var bme=Object.defineProperty;var IB=t=>{throw TypeError(t)};var wme=(t,e,r)=>e in t?bme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Le=(t,e,r)=>wme(t,typeof e!="symbol"?e+"":e,r),aP=(t,e,r)=>e.has(t)||IB("Cannot "+r);var _=(t,e,r)=>(aP(t,e,"read from private field"),r?r.call(t):e.get(t)),se=(t,e,r)=>e.has(t)?IB("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Q=(t,e,r,n)=>(aP(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ce=(t,e,r)=>(aP(t,e,"access private method"),r);var Jn=(t,e,r,n)=>({set _(s){Q(t,e,s,r)},get _(){return _(t,e,n)}});function _me(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function jme(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}),r}var $X={exports:{}},Dk={},BX={exports:{}},Ht={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Nj=Symbol.for("react.element"),Sme=Symbol.for("react.portal"),Nme=Symbol.for("react.fragment"),Ame=Symbol.for("react.strict_mode"),Eme=Symbol.for("react.profiler"),Cme=Symbol.for("react.provider"),kme=Symbol.for("react.context"),Tme=Symbol.for("react.forward_ref"),Pme=Symbol.for("react.suspense"),Ome=Symbol.for("react.memo"),Ime=Symbol.for("react.lazy"),RB=Symbol.iterator;function Rme(t){return t===null||typeof t!="object"?null:(t=RB&&t[RB]||t["@@iterator"],typeof t=="function"?t:null)}var UX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zX=Object.assign,HX={};function e0(t,e,r){this.props=t,this.context=e,this.refs=HX,this.updater=r||UX}e0.prototype.isReactComponent={};e0.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};e0.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function WX(){}WX.prototype=e0.prototype;function L3(t,e,r){this.props=t,this.context=e,this.refs=HX,this.updater=r||UX}var F3=L3.prototype=new WX;F3.constructor=L3;zX(F3,e0.prototype);F3.isPureReactComponent=!0;var MB=Array.isArray,VX=Object.prototype.hasOwnProperty,$3={current:null},qX={key:!0,ref:!0,__self:!0,__source:!0};function GX(t,e,r){var n,s={},i=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)VX.call(e,n)&&!qX.hasOwnProperty(n)&&(s[n]=e[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(n in l=t.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:Nj,type:t,key:i,ref:o,props:s,_owner:$3.current}}function Mme(t,e){return{$$typeof:Nj,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function B3(t){return typeof t=="object"&&t!==null&&t.$$typeof===Nj}function Dme(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var DB=/\/+/g;function oP(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Dme(""+t.key):e.toString(36)}function tA(t,e,r,n,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Nj:case Sme:o=!0}}if(o)return o=t,s=s(o),t=n===""?"."+oP(o,0):n,MB(s)?(r="",t!=null&&(r=t.replace(DB,"$&/")+"/"),tA(s,e,r,"",function(u){return u})):s!=null&&(B3(s)&&(s=Mme(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(DB,"$&/")+"/")+t)),e.push(s)),1;if(o=0,n=n===""?".":n+":",MB(t))for(var l=0;l<t.length;l++){i=t[l];var c=n+oP(i,l);o+=tA(i,e,r,c,s)}else if(c=Rme(t),typeof c=="function")for(t=c.call(t),l=0;!(i=t.next()).done;)i=i.value,c=n+oP(i,l++),o+=tA(i,e,r,c,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function MS(t,e,r){if(t==null)return t;var n=[],s=0;return tA(t,n,"","",function(i){return e.call(r,i,s++)}),n}function Lme(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var _i={current:null},rA={transition:null},Fme={ReactCurrentDispatcher:_i,ReactCurrentBatchConfig:rA,ReactCurrentOwner:$3};function KX(){throw Error("act(...) is not supported in production builds of React.")}Ht.Children={map:MS,forEach:function(t,e,r){MS(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return MS(t,function(){e++}),e},toArray:function(t){return MS(t,function(e){return e})||[]},only:function(t){if(!B3(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Ht.Component=e0;Ht.Fragment=Nme;Ht.Profiler=Eme;Ht.PureComponent=L3;Ht.StrictMode=Ame;Ht.Suspense=Pme;Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fme;Ht.act=KX;Ht.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=zX({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=$3.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)VX.call(e,c)&&!qX.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=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:Nj,type:t.type,key:s,ref:i,props:n,_owner:o}};Ht.createContext=function(t){return t={$$typeof:kme,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Cme,_context:t},t.Consumer=t};Ht.createElement=GX;Ht.createFactory=function(t){var e=GX.bind(null,t);return e.type=t,e};Ht.createRef=function(){return{current:null}};Ht.forwardRef=function(t){return{$$typeof:Tme,render:t}};Ht.isValidElement=B3;Ht.lazy=function(t){return{$$typeof:Ime,_payload:{_status:-1,_result:t},_init:Lme}};Ht.memo=function(t,e){return{$$typeof:Ome,type:t,compare:e===void 0?null:e}};Ht.startTransition=function(t){var e=rA.transition;rA.transition={};try{t()}finally{rA.transition=e}};Ht.unstable_act=KX;Ht.useCallback=function(t,e){return _i.current.useCallback(t,e)};Ht.useContext=function(t){return _i.current.useContext(t)};Ht.useDebugValue=function(){};Ht.useDeferredValue=function(t){return _i.current.useDeferredValue(t)};Ht.useEffect=function(t,e){return _i.current.useEffect(t,e)};Ht.useId=function(){return _i.current.useId()};Ht.useImperativeHandle=function(t,e,r){return _i.current.useImperativeHandle(t,e,r)};Ht.useInsertionEffect=function(t,e){return _i.current.useInsertionEffect(t,e)};Ht.useLayoutEffect=function(t,e){return _i.current.useLayoutEffect(t,e)};Ht.useMemo=function(t,e){return _i.current.useMemo(t,e)};Ht.useReducer=function(t,e,r){return _i.current.useReducer(t,e,r)};Ht.useRef=function(t){return _i.current.useRef(t)};Ht.useState=function(t){return _i.current.useState(t)};Ht.useSyncExternalStore=function(t,e,r){return _i.current.useSyncExternalStore(t,e,r)};Ht.useTransition=function(){return _i.current.useTransition()};Ht.version="18.3.1";BX.exports=Ht;var S=BX.exports;const me=qt(S),U3=_me({__proto__:null,default:me},[S]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $me=S,Bme=Symbol.for("react.element"),Ume=Symbol.for("react.fragment"),zme=Object.prototype.hasOwnProperty,Hme=$me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Wme={key:!0,ref:!0,__self:!0,__source:!0};function YX(t,e,r){var n,s={},i=null,o=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)zme.call(e,n)&&!Wme.hasOwnProperty(n)&&(s[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)s[n]===void 0&&(s[n]=e[n]);return{$$typeof:Bme,type:t,key:i,ref:o,props:s,_owner:Hme.current}}Dk.Fragment=Ume;Dk.jsx=YX;Dk.jsxs=YX;$X.exports=Dk;var a=$X.exports,XX={exports:{}},Ma={},QX={exports:{}},ZX={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(t){function e(Y,H){var $=Y.length;Y.push(H);e:for(;0<$;){var L=$-1>>>1,F=Y[L];if(0<s(F,H))Y[L]=H,Y[$]=F,$=L;else break e}}function r(Y){return Y.length===0?null:Y[0]}function n(Y){if(Y.length===0)return null;var H=Y[0],$=Y.pop();if($!==H){Y[0]=$;e:for(var L=0,F=Y.length,W=F>>>1;L<W;){var X=2*(L+1)-1,oe=Y[X],le=X+1,B=Y[le];if(0>s(oe,$))le<F&&0>s(B,oe)?(Y[L]=B,Y[le]=$,L=le):(Y[L]=oe,Y[X]=$,L=X);else if(le<F&&0>s(B,$))Y[L]=B,Y[le]=$,L=le;else break e}}return H}function s(Y,H){var $=Y.sortIndex-H.sortIndex;return $!==0?$:Y.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,g=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(Y){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=Y)n(u),H.sortIndex=H.expirationTime,e(c,H);else break;H=r(u)}}function w(Y){if(m=!1,b(Y),!g)if(r(c)!==null)g=!0,K(j);else{var H=r(u);H!==null&&G(w,H.startTime-Y)}}function j(Y,H){g=!1,m&&(m=!1,y(k),k=-1),p=!0;var $=f;try{for(b(H),h=r(c);h!==null&&(!(h.expirationTime>H)||Y&&!z());){var L=h.callback;if(typeof L=="function"){h.callback=null,f=h.priorityLevel;var F=L(h.expirationTime<=H);H=t.unstable_now(),typeof F=="function"?h.callback=F:h===r(c)&&n(c),b(H)}else n(c);h=r(c)}if(h!==null)var W=!0;else{var X=r(u);X!==null&&G(w,X.startTime-H),W=!1}return W}finally{h=null,f=$,p=!1}}var N=!1,C=null,k=-1,E=5,M=-1;function z(){return!(t.unstable_now()-M<E)}function I(){if(C!==null){var Y=t.unstable_now();M=Y;var H=!0;try{H=C(!0,Y)}finally{H?q():(N=!1,C=null)}}else N=!1}var q;if(typeof x=="function")q=function(){x(I)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,U=A.port2;A.port1.onmessage=I,q=function(){U.postMessage(null)}}else q=function(){v(I,0)};function K(Y){C=Y,N||(N=!0,q())}function G(Y,H){k=v(function(){Y(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(Y){Y.callback=null},t.unstable_continueExecution=function(){g||p||(g=!0,K(j))},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(Y){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var $=f;f=H;try{return Y()}finally{f=$}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(Y,H){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var $=f;f=Y;try{return H()}finally{f=$}},t.unstable_scheduleCallback=function(Y,H,$){var L=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?L+$:L):$=L,Y){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=$+F,Y={id:d++,callback:H,priorityLevel:Y,startTime:$,expirationTime:F,sortIndex:-1},$>L?(Y.sortIndex=$,e(u,Y),r(c)===null&&Y===r(u)&&(m?(y(k),k=-1):m=!0,G(w,$-L))):(Y.sortIndex=F,e(c,Y),g||p||(g=!0,K(j))),Y},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(Y){var H=f;return function(){var $=f;f=H;try{return Y.apply(this,arguments)}finally{f=$}}}})(ZX);QX.exports=ZX;var Vme=QX.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var qme=S,Ra=Vme;function He(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var JX=new Set,Ew={};function sg(t,e){dx(t,e),dx(t+"Capture",e)}function dx(t,e){for(Ew[t]=e,t=0;t<e.length;t++)JX.add(e[t])}var Hu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pM=Object.prototype.hasOwnProperty,Gme=/^[: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]*$/,LB={},FB={};function Kme(t){return pM.call(FB,t)?!0:pM.call(LB,t)?!1:Gme.test(t)?FB[t]=!0:(LB[t]=!0,!1)}function Yme(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Xme(t,e,r,n){if(e===null||typeof e>"u"||Yme(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 ji(t,e,r,n,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Ts={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ts[t]=new ji(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ts[e]=new ji(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ts[t]=new ji(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ts[t]=new ji(t,2,!1,t,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(t){Ts[t]=new ji(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ts[t]=new ji(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ts[t]=new ji(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ts[t]=new ji(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ts[t]=new ji(t,5,!1,t.toLowerCase(),null,!1,!1)});var z3=/[\-:]([a-z])/g;function H3(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(z3,H3);Ts[e]=new ji(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(z3,H3);Ts[e]=new ji(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(z3,H3);Ts[e]=new ji(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ts[t]=new ji(t,1,!1,t.toLowerCase(),null,!1,!1)});Ts.xlinkHref=new ji("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ts[t]=new ji(t,1,!1,t.toLowerCase(),null,!0,!0)});function W3(t,e,r,n){var s=Ts.hasOwnProperty(e)?Ts[e]:null;(s!==null?s.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Xme(e,r,s,n)&&(r=null),n||s===null?Kme(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):s.mustUseProperty?t[s.propertyName]=r===null?s.type===3?!1:"":r:(e=s.attributeName,n=s.attributeNamespace,r===null?t.removeAttribute(e):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var sd=qme.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,DS=Symbol.for("react.element"),Xg=Symbol.for("react.portal"),Qg=Symbol.for("react.fragment"),V3=Symbol.for("react.strict_mode"),mM=Symbol.for("react.profiler"),eQ=Symbol.for("react.provider"),tQ=Symbol.for("react.context"),q3=Symbol.for("react.forward_ref"),gM=Symbol.for("react.suspense"),yM=Symbol.for("react.suspense_list"),G3=Symbol.for("react.memo"),Ad=Symbol.for("react.lazy"),rQ=Symbol.for("react.offscreen"),$B=Symbol.iterator;function D0(t){return t===null||typeof t!="object"?null:(t=$B&&t[$B]||t["@@iterator"],typeof t=="function"?t:null)}var sn=Object.assign,lP;function xb(t){if(lP===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);lP=e&&e[1]||""}return`
`+lP+t}var cP=!1;function uP(t,e){if(!t||cP)return"";cP=!0;var r=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(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=n.stack.split(`
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{cP=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?xb(t):""}function Qme(t){switch(t.tag){case 5:return xb(t.type);case 16:return xb("Lazy");case 13:return xb("Suspense");case 19:return xb("SuspenseList");case 0:case 2:case 15:return t=uP(t.type,!1),t;case 11:return t=uP(t.type.render,!1),t;case 1:return t=uP(t.type,!0),t;default:return""}}function vM(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Qg:return"Fragment";case Xg:return"Portal";case mM:return"Profiler";case V3:return"StrictMode";case gM:return"Suspense";case yM:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case tQ:return(t.displayName||"Context")+".Consumer";case eQ:return(t._context.displayName||"Context")+".Provider";case q3:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case G3:return e=t.displayName||null,e!==null?e:vM(t.type)||"Memo";case Ad:e=t._payload,t=t._init;try{return vM(t(e))}catch{}}return null}function Zme(t){var e=t.type;switch(t.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 t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vM(e);case 8:return e===V3?"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 Kh(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function nQ(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Jme(t){var e=nQ(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function LS(t){t._valueTracker||(t._valueTracker=Jme(t))}function sQ(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=nQ(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function lE(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xM(t,e){var r=e.checked;return sn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function BB(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Kh(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function iQ(t,e){e=e.checked,e!=null&&W3(t,"checked",e,!1)}function bM(t,e){iQ(t,e);var r=Kh(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?wM(t,e.type,r):e.hasOwnProperty("defaultValue")&&wM(t,e.type,Kh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function UB(t,e,r){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=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function wM(t,e,r){(e!=="number"||lE(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var bb=Array.isArray;function wy(t,e,r,n){if(t=t.options,e){e={};for(var s=0;s<r.length;s++)e["$"+r[s]]=!0;for(r=0;r<t.length;r++)s=e.hasOwnProperty("$"+t[r].value),t[r].selected!==s&&(t[r].selected=s),s&&n&&(t[r].defaultSelected=!0)}else{for(r=""+Kh(r),e=null,s=0;s<t.length;s++){if(t[s].value===r){t[s].selected=!0,n&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function _M(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(He(91));return sn({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function zB(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(He(92));if(bb(r)){if(1<r.length)throw Error(He(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:Kh(r)}}function aQ(t,e){var r=Kh(e.value),n=Kh(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function HB(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function oQ(t){switch(t){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 jM(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?oQ(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var FS,lQ=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,s){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(FS=FS||document.createElement("div"),FS.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=FS.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Cw(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var tw={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},ege=["Webkit","ms","Moz","O"];Object.keys(tw).forEach(function(t){ege.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),tw[e]=tw[t]})});function cQ(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||tw.hasOwnProperty(t)&&tw[t]?(""+e).trim():e+"px"}function uQ(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=cQ(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,s):t[r]=s}}var tge=sn({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 SM(t,e){if(e){if(tge[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(He(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(He(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(He(61))}if(e.style!=null&&typeof e.style!="object")throw Error(He(62))}}function NM(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 AM=null;function K3(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var EM=null,_y=null,jy=null;function WB(t){if(t=Cj(t)){if(typeof EM!="function")throw Error(He(280));var e=t.stateNode;e&&(e=Uk(e),EM(t.stateNode,t.type,e))}}function dQ(t){_y?jy?jy.push(t):jy=[t]:_y=t}function hQ(){if(_y){var t=_y,e=jy;if(jy=_y=null,WB(t),e)for(t=0;t<e.length;t++)WB(e[t])}}function fQ(t,e){return t(e)}function pQ(){}var dP=!1;function mQ(t,e,r){if(dP)return t(e,r);dP=!0;try{return fQ(t,e,r)}finally{dP=!1,(_y!==null||jy!==null)&&(pQ(),hQ())}}function kw(t,e){var r=t.stateNode;if(r===null)return null;var n=Uk(r);if(n===null)return null;r=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)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(He(231,e,typeof r));return r}var CM=!1;if(Hu)try{var L0={};Object.defineProperty(L0,"passive",{get:function(){CM=!0}}),window.addEventListener("test",L0,L0),window.removeEventListener("test",L0,L0)}catch{CM=!1}function rge(t,e,r,n,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(r,u)}catch(d){this.onError(d)}}var rw=!1,cE=null,uE=!1,kM=null,nge={onError:function(t){rw=!0,cE=t}};function sge(t,e,r,n,s,i,o,l,c){rw=!1,cE=null,rge.apply(nge,arguments)}function ige(t,e,r,n,s,i,o,l,c){if(sge.apply(this,arguments),rw){if(rw){var u=cE;rw=!1,cE=null}else throw Error(He(198));uE||(uE=!0,kM=u)}}function ig(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function gQ(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function VB(t){if(ig(t)!==t)throw Error(He(188))}function age(t){var e=t.alternate;if(!e){if(e=ig(t),e===null)throw Error(He(188));return e!==t?null:t}for(var r=t,n=e;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return VB(s),t;if(i===n)return VB(s),e;i=i.sibling}throw Error(He(188))}if(r.return!==n.return)r=s,n=i;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o)throw Error(He(189))}}if(r.alternate!==n)throw Error(He(190))}if(r.tag!==3)throw Error(He(188));return r.stateNode.current===r?t:e}function yQ(t){return t=age(t),t!==null?vQ(t):null}function vQ(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=vQ(t);if(e!==null)return e;t=t.sibling}return null}var xQ=Ra.unstable_scheduleCallback,qB=Ra.unstable_cancelCallback,oge=Ra.unstable_shouldYield,lge=Ra.unstable_requestPaint,jn=Ra.unstable_now,cge=Ra.unstable_getCurrentPriorityLevel,Y3=Ra.unstable_ImmediatePriority,bQ=Ra.unstable_UserBlockingPriority,dE=Ra.unstable_NormalPriority,uge=Ra.unstable_LowPriority,wQ=Ra.unstable_IdlePriority,Lk=null,lc=null;function dge(t){if(lc&&typeof lc.onCommitFiberRoot=="function")try{lc.onCommitFiberRoot(Lk,t,void 0,(t.current.flags&128)===128)}catch{}}var sl=Math.clz32?Math.clz32:pge,hge=Math.log,fge=Math.LN2;function pge(t){return t>>>=0,t===0?32:31-(hge(t)/fge|0)|0}var $S=64,BS=4194304;function wb(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function hE(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,s=t.suspendedLanes,i=t.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?n=wb(l):(i&=o,i!==0&&(n=wb(i)))}else o=r&~s,o!==0?n=wb(o):i!==0&&(n=wb(i));if(n===0)return 0;if(e!==0&&e!==n&&!(e&s)&&(s=n&-n,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-sl(e),s=1<<r,n|=t[r],e&=~s;return n}function mge(t,e){switch(t){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 gge(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-sl(i),l=1<<o,c=s[o];c===-1?(!(l&r)||l&n)&&(s[o]=mge(l,e)):c<=e&&(t.expiredLanes|=l),i&=~l}}function TM(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function _Q(){var t=$S;return $S<<=1,!($S&4194240)&&($S=64),t}function hP(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Aj(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-sl(e),t[e]=r}function yge(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var s=31-sl(r),i=1<<s;e[s]=0,n[s]=-1,t[s]=-1,r&=~i}}function X3(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-sl(r),s=1<<n;s&e|t[n]&e&&(t[n]|=e),r&=~s}}var pr=0;function jQ(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var SQ,Q3,NQ,AQ,EQ,PM=!1,US=[],Dh=null,Lh=null,Fh=null,Tw=new Map,Pw=new Map,kd=[],vge="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 GB(t,e){switch(t){case"focusin":case"focusout":Dh=null;break;case"dragenter":case"dragleave":Lh=null;break;case"mouseover":case"mouseout":Fh=null;break;case"pointerover":case"pointerout":Tw.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pw.delete(e.pointerId)}}function F0(t,e,r,n,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},e!==null&&(e=Cj(e),e!==null&&Q3(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function xge(t,e,r,n,s){switch(e){case"focusin":return Dh=F0(Dh,t,e,r,n,s),!0;case"dragenter":return Lh=F0(Lh,t,e,r,n,s),!0;case"mouseover":return Fh=F0(Fh,t,e,r,n,s),!0;case"pointerover":var i=s.pointerId;return Tw.set(i,F0(Tw.get(i)||null,t,e,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,Pw.set(i,F0(Pw.get(i)||null,t,e,r,n,s)),!0}return!1}function CQ(t){var e=np(t.target);if(e!==null){var r=ig(e);if(r!==null){if(e=r.tag,e===13){if(e=gQ(r),e!==null){t.blockedOn=e,EQ(t.priority,function(){NQ(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function nA(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=OM(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);AM=n,r.target.dispatchEvent(n),AM=null}else return e=Cj(r),e!==null&&Q3(e),t.blockedOn=r,!1;e.shift()}return!0}function KB(t,e,r){nA(t)&&r.delete(e)}function bge(){PM=!1,Dh!==null&&nA(Dh)&&(Dh=null),Lh!==null&&nA(Lh)&&(Lh=null),Fh!==null&&nA(Fh)&&(Fh=null),Tw.forEach(KB),Pw.forEach(KB)}function $0(t,e){t.blockedOn===e&&(t.blockedOn=null,PM||(PM=!0,Ra.unstable_scheduleCallback(Ra.unstable_NormalPriority,bge)))}function Ow(t){function e(s){return $0(s,t)}if(0<US.length){$0(US[0],t);for(var r=1;r<US.length;r++){var n=US[r];n.blockedOn===t&&(n.blockedOn=null)}}for(Dh!==null&&$0(Dh,t),Lh!==null&&$0(Lh,t),Fh!==null&&$0(Fh,t),Tw.forEach(e),Pw.forEach(e),r=0;r<kd.length;r++)n=kd[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<kd.length&&(r=kd[0],r.blockedOn===null);)CQ(r),r.blockedOn===null&&kd.shift()}var Sy=sd.ReactCurrentBatchConfig,fE=!0;function wge(t,e,r,n){var s=pr,i=Sy.transition;Sy.transition=null;try{pr=1,Z3(t,e,r,n)}finally{pr=s,Sy.transition=i}}function _ge(t,e,r,n){var s=pr,i=Sy.transition;Sy.transition=null;try{pr=4,Z3(t,e,r,n)}finally{pr=s,Sy.transition=i}}function Z3(t,e,r,n){if(fE){var s=OM(t,e,r,n);if(s===null)_P(t,e,n,pE,r),GB(t,n);else if(xge(s,t,e,r,n))n.stopPropagation();else if(GB(t,n),e&4&&-1<vge.indexOf(t)){for(;s!==null;){var i=Cj(s);if(i!==null&&SQ(i),i=OM(t,e,r,n),i===null&&_P(t,e,n,pE,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else _P(t,e,n,null,r)}}var pE=null;function OM(t,e,r,n){if(pE=null,t=K3(n),t=np(t),t!==null)if(e=ig(t),e===null)t=null;else if(r=e.tag,r===13){if(t=gQ(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return pE=t,null}function kQ(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cge()){case Y3:return 1;case bQ:return 4;case dE:case uge:return 16;case wQ:return 536870912;default:return 16}default:return 16}}var Ih=null,J3=null,sA=null;function TQ(){if(sA)return sA;var t,e=J3,r=e.length,n,s="value"in Ih?Ih.value:Ih.textContent,i=s.length;for(t=0;t<r&&e[t]===s[t];t++);var o=r-t;for(n=1;n<=o&&e[r-n]===s[i-n];n++);return sA=s.slice(t,1<n?1-n:void 0)}function iA(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function zS(){return!0}function YB(){return!1}function Da(t){function e(r,n,s,i,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(r=t[l],this[l]=r?r(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?zS:YB,this.isPropagationStopped=YB,this}return sn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=zS)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=zS)},persist:function(){},isPersistent:zS}),e}var t0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eF=Da(t0),Ej=sn({},t0,{view:0,detail:0}),jge=Da(Ej),fP,pP,B0,Fk=sn({},Ej,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tF,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==B0&&(B0&&t.type==="mousemove"?(fP=t.screenX-B0.screenX,pP=t.screenY-B0.screenY):pP=fP=0,B0=t),fP)},movementY:function(t){return"movementY"in t?t.movementY:pP}}),XB=Da(Fk),Sge=sn({},Fk,{dataTransfer:0}),Nge=Da(Sge),Age=sn({},Ej,{relatedTarget:0}),mP=Da(Age),Ege=sn({},t0,{animationName:0,elapsedTime:0,pseudoElement:0}),Cge=Da(Ege),kge=sn({},t0,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Tge=Da(kge),Pge=sn({},t0,{data:0}),QB=Da(Pge),Oge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ige={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"},Rge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mge(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Rge[t])?!!e[t]:!1}function tF(){return Mge}var Dge=sn({},Ej,{key:function(t){if(t.key){var e=Oge[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=iA(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ige[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tF,charCode:function(t){return t.type==="keypress"?iA(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?iA(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Lge=Da(Dge),Fge=sn({},Fk,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ZB=Da(Fge),$ge=sn({},Ej,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tF}),Bge=Da($ge),Uge=sn({},t0,{propertyName:0,elapsedTime:0,pseudoElement:0}),zge=Da(Uge),Hge=sn({},Fk,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Wge=Da(Hge),Vge=[9,13,27,32],rF=Hu&&"CompositionEvent"in window,nw=null;Hu&&"documentMode"in document&&(nw=document.documentMode);var qge=Hu&&"TextEvent"in window&&!nw,PQ=Hu&&(!rF||nw&&8<nw&&11>=nw),JB=" ",eU=!1;function OQ(t,e){switch(t){case"keyup":return Vge.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function IQ(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zg=!1;function Gge(t,e){switch(t){case"compositionend":return IQ(e);case"keypress":return e.which!==32?null:(eU=!0,JB);case"textInput":return t=e.data,t===JB&&eU?null:t;default:return null}}function Kge(t,e){if(Zg)return t==="compositionend"||!rF&&OQ(t,e)?(t=TQ(),sA=J3=Ih=null,Zg=!1,t):null;switch(t){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 PQ&&e.locale!=="ko"?null:e.data;default:return null}}var Yge={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 tU(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Yge[t.type]:e==="textarea"}function RQ(t,e,r,n){dQ(n),e=mE(e,"onChange"),0<e.length&&(r=new eF("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var sw=null,Iw=null;function Xge(t){VQ(t,0)}function $k(t){var e=ty(t);if(sQ(e))return t}function Qge(t,e){if(t==="change")return e}var MQ=!1;if(Hu){var gP;if(Hu){var yP="oninput"in document;if(!yP){var rU=document.createElement("div");rU.setAttribute("oninput","return;"),yP=typeof rU.oninput=="function"}gP=yP}else gP=!1;MQ=gP&&(!document.documentMode||9<document.documentMode)}function nU(){sw&&(sw.detachEvent("onpropertychange",DQ),Iw=sw=null)}function DQ(t){if(t.propertyName==="value"&&$k(Iw)){var e=[];RQ(e,Iw,t,K3(t)),mQ(Xge,e)}}function Zge(t,e,r){t==="focusin"?(nU(),sw=e,Iw=r,sw.attachEvent("onpropertychange",DQ)):t==="focusout"&&nU()}function Jge(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return $k(Iw)}function eye(t,e){if(t==="click")return $k(e)}function tye(t,e){if(t==="input"||t==="change")return $k(e)}function rye(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ll=typeof Object.is=="function"?Object.is:rye;function Rw(t,e){if(ll(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!pM.call(e,s)||!ll(t[s],e[s]))return!1}return!0}function sU(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function iU(t,e){var r=sU(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=sU(r)}}function LQ(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?LQ(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function FQ(){for(var t=window,e=lE();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=lE(t.document)}return e}function nF(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function nye(t){var e=FQ(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&LQ(r.ownerDocument.documentElement,r)){if(n!==null&&nF(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!t.extend&&i>n&&(s=n,n=i,i=s),s=iU(r,i);var o=iU(r,n);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var sye=Hu&&"documentMode"in document&&11>=document.documentMode,Jg=null,IM=null,iw=null,RM=!1;function aU(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;RM||Jg==null||Jg!==lE(n)||(n=Jg,"selectionStart"in n&&nF(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}),iw&&Rw(iw,n)||(iw=n,n=mE(IM,"onSelect"),0<n.length&&(e=new eF("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=Jg)))}function HS(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var ey={animationend:HS("Animation","AnimationEnd"),animationiteration:HS("Animation","AnimationIteration"),animationstart:HS("Animation","AnimationStart"),transitionend:HS("Transition","TransitionEnd")},vP={},$Q={};Hu&&($Q=document.createElement("div").style,"AnimationEvent"in window||(delete ey.animationend.animation,delete ey.animationiteration.animation,delete ey.animationstart.animation),"TransitionEvent"in window||delete ey.transitionend.transition);function Bk(t){if(vP[t])return vP[t];if(!ey[t])return t;var e=ey[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in $Q)return vP[t]=e[r];return t}var BQ=Bk("animationend"),UQ=Bk("animationiteration"),zQ=Bk("animationstart"),HQ=Bk("transitionend"),WQ=new Map,oU="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 cf(t,e){WQ.set(t,e),sg(e,[t])}for(var xP=0;xP<oU.length;xP++){var bP=oU[xP],iye=bP.toLowerCase(),aye=bP[0].toUpperCase()+bP.slice(1);cf(iye,"on"+aye)}cf(BQ,"onAnimationEnd");cf(UQ,"onAnimationIteration");cf(zQ,"onAnimationStart");cf("dblclick","onDoubleClick");cf("focusin","onFocus");cf("focusout","onBlur");cf(HQ,"onTransitionEnd");dx("onMouseEnter",["mouseout","mouseover"]);dx("onMouseLeave",["mouseout","mouseover"]);dx("onPointerEnter",["pointerout","pointerover"]);dx("onPointerLeave",["pointerout","pointerover"]);sg("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));sg("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));sg("onBeforeInput",["compositionend","keypress","textInput","paste"]);sg("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));sg("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));sg("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _b="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(" "),oye=new Set("cancel close invalid load scroll toggle".split(" ").concat(_b));function lU(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,ige(n,e,void 0,t),t.currentTarget=null}function VQ(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],s=n.event;n=n.listeners;e:{var i=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!==i&&s.isPropagationStopped())break e;lU(s,l,u),i=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;lU(s,l,u),i=c}}}if(uE)throw t=kM,uE=!1,kM=null,t}function Fr(t,e){var r=e[$M];r===void 0&&(r=e[$M]=new Set);var n=t+"__bubble";r.has(n)||(qQ(e,t,2,!1),r.add(n))}function wP(t,e,r){var n=0;e&&(n|=4),qQ(r,t,n,e)}var WS="_reactListening"+Math.random().toString(36).slice(2);function Mw(t){if(!t[WS]){t[WS]=!0,JX.forEach(function(r){r!=="selectionchange"&&(oye.has(r)||wP(r,!1,t),wP(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[WS]||(e[WS]=!0,wP("selectionchange",!1,e))}}function qQ(t,e,r,n){switch(kQ(e)){case 1:var s=wge;break;case 4:s=_ge;break;default:s=Z3}r=s.bind(null,e,r,t),s=void 0,!CM||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),n?s!==void 0?t.addEventListener(e,r,{capture:!0,passive:s}):t.addEventListener(e,r,!0):s!==void 0?t.addEventListener(e,r,{passive:s}):t.addEventListener(e,r,!1)}function _P(t,e,r,n,s){var i=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;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=np(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}mQ(function(){var u=i,d=K3(r),h=[];e:{var f=WQ.get(t);if(f!==void 0){var p=eF,g=t;switch(t){case"keypress":if(iA(r)===0)break e;case"keydown":case"keyup":p=Lge;break;case"focusin":g="focus",p=mP;break;case"focusout":g="blur",p=mP;break;case"beforeblur":case"afterblur":p=mP;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=XB;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Nge;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Bge;break;case BQ:case UQ:case zQ:p=Cge;break;case HQ:p=zge;break;case"scroll":p=jge;break;case"wheel":p=Wge;break;case"copy":case"cut":case"paste":p=Tge;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=ZB}var m=(e&4)!==0,v=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var x=u,b;x!==null;){b=x;var w=b.stateNode;if(b.tag===5&&w!==null&&(b=w,y!==null&&(w=kw(x,y),w!=null&&m.push(Dw(x,w,b)))),v)break;x=x.return}0<m.length&&(f=new p(f,g,null,r,d),h.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==AM&&(g=r.relatedTarget||r.fromElement)&&(np(g)||g[Wu]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(g=r.relatedTarget||r.toElement,p=u,g=g?np(g):null,g!==null&&(v=ig(g),g!==v||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(m=XB,w="onMouseLeave",y="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(m=ZB,w="onPointerLeave",y="onPointerEnter",x="pointer"),v=p==null?f:ty(p),b=g==null?f:ty(g),f=new m(w,x+"leave",p,r,d),f.target=v,f.relatedTarget=b,w=null,np(d)===u&&(m=new m(y,x+"enter",g,r,d),m.target=b,m.relatedTarget=v,w=m),v=w,p&&g)t:{for(m=p,y=g,x=0,b=m;b;b=bg(b))x++;for(b=0,w=y;w;w=bg(w))b++;for(;0<x-b;)m=bg(m),x--;for(;0<b-x;)y=bg(y),b--;for(;x--;){if(m===y||y!==null&&m===y.alternate)break t;m=bg(m),y=bg(y)}m=null}else m=null;p!==null&&cU(h,f,p,m,!1),g!==null&&v!==null&&cU(h,v,g,m,!0)}}e:{if(f=u?ty(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var j=Qge;else if(tU(f))if(MQ)j=tye;else{j=Jge;var N=Zge}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(j=eye);if(j&&(j=j(t,u))){RQ(h,j,r,d);break e}N&&N(t,f,u),t==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&wM(f,"number",f.value)}switch(N=u?ty(u):window,t){case"focusin":(tU(N)||N.contentEditable==="true")&&(Jg=N,IM=u,iw=null);break;case"focusout":iw=IM=Jg=null;break;case"mousedown":RM=!0;break;case"contextmenu":case"mouseup":case"dragend":RM=!1,aU(h,r,d);break;case"selectionchange":if(sye)break;case"keydown":case"keyup":aU(h,r,d)}var C;if(rF)e:{switch(t){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Zg?OQ(t,r)&&(k="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(k="onCompositionStart");k&&(PQ&&r.locale!=="ko"&&(Zg||k!=="onCompositionStart"?k==="onCompositionEnd"&&Zg&&(C=TQ()):(Ih=d,J3="value"in Ih?Ih.value:Ih.textContent,Zg=!0)),N=mE(u,k),0<N.length&&(k=new QB(k,t,null,r,d),h.push({event:k,listeners:N}),C?k.data=C:(C=IQ(r),C!==null&&(k.data=C)))),(C=qge?Gge(t,r):Kge(t,r))&&(u=mE(u,"onBeforeInput"),0<u.length&&(d=new QB("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=C))}VQ(h,e)})}function Dw(t,e,r){return{instance:t,listener:e,currentTarget:r}}function mE(t,e){for(var r=e+"Capture",n=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=kw(t,r),i!=null&&n.unshift(Dw(t,i,s)),i=kw(t,e),i!=null&&n.push(Dw(t,i,s))),t=t.return}return n}function bg(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function cU(t,e,r,n,s){for(var i=e._reactName,o=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=kw(r,i),c!=null&&o.unshift(Dw(r,c,l))):s||(c=kw(r,i),c!=null&&o.push(Dw(r,c,l)))),r=r.return}o.length!==0&&t.push({event:e,listeners:o})}var lye=/\r\n?/g,cye=/\u0000|\uFFFD/g;function uU(t){return(typeof t=="string"?t:""+t).replace(lye,`
`).replace(cye,"")}function VS(t,e,r){if(e=uU(e),uU(t)!==e&&r)throw Error(He(425))}function gE(){}var MM=null,DM=null;function LM(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var FM=typeof setTimeout=="function"?setTimeout:void 0,uye=typeof clearTimeout=="function"?clearTimeout:void 0,dU=typeof Promise=="function"?Promise:void 0,dye=typeof queueMicrotask=="function"?queueMicrotask:typeof dU<"u"?function(t){return dU.resolve(null).then(t).catch(hye)}:FM;function hye(t){setTimeout(function(){throw t})}function jP(t,e){var r=e,n=0;do{var s=r.nextSibling;if(t.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){t.removeChild(s),Ow(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Ow(e)}function $h(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function hU(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var r0=Math.random().toString(36).slice(2),ec="__reactFiber$"+r0,Lw="__reactProps$"+r0,Wu="__reactContainer$"+r0,$M="__reactEvents$"+r0,fye="__reactListeners$"+r0,pye="__reactHandles$"+r0;function np(t){var e=t[ec];if(e)return e;for(var r=t.parentNode;r;){if(e=r[Wu]||r[ec]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=hU(t);t!==null;){if(r=t[ec])return r;t=hU(t)}return e}t=r,r=t.parentNode}return null}function Cj(t){return t=t[ec]||t[Wu],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ty(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(He(33))}function Uk(t){return t[Lw]||null}var BM=[],ry=-1;function uf(t){return{current:t}}function Hr(t){0>ry||(t.current=BM[ry],BM[ry]=null,ry--)}function kr(t,e){ry++,BM[ry]=t.current,t.current=e}var Yh={},Xs=uf(Yh),Wi=uf(!1),Fm=Yh;function hx(t,e){var r=t.type.contextTypes;if(!r)return Yh;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Vi(t){return t=t.childContextTypes,t!=null}function yE(){Hr(Wi),Hr(Xs)}function fU(t,e,r){if(Xs.current!==Yh)throw Error(He(168));kr(Xs,e),kr(Wi,r)}function GQ(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in e))throw Error(He(108,Zme(t)||"Unknown",s));return sn({},r,n)}function vE(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Yh,Fm=Xs.current,kr(Xs,t),kr(Wi,Wi.current),!0}function pU(t,e,r){var n=t.stateNode;if(!n)throw Error(He(169));r?(t=GQ(t,e,Fm),n.__reactInternalMemoizedMergedChildContext=t,Hr(Wi),Hr(Xs),kr(Xs,t)):Hr(Wi),kr(Wi,r)}var Yc=null,zk=!1,SP=!1;function KQ(t){Yc===null?Yc=[t]:Yc.push(t)}function mye(t){zk=!0,KQ(t)}function df(){if(!SP&&Yc!==null){SP=!0;var t=0,e=pr;try{var r=Yc;for(pr=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}Yc=null,zk=!1}catch(s){throw Yc!==null&&(Yc=Yc.slice(t+1)),xQ(Y3,df),s}finally{pr=e,SP=!1}}return null}var ny=[],sy=0,xE=null,bE=0,ro=[],no=0,$m=null,Pu=1,Ou="";function Bf(t,e){ny[sy++]=bE,ny[sy++]=xE,xE=t,bE=e}function YQ(t,e,r){ro[no++]=Pu,ro[no++]=Ou,ro[no++]=$m,$m=t;var n=Pu;t=Ou;var s=32-sl(n)-1;n&=~(1<<s),r+=1;var i=32-sl(e)+s;if(30<i){var o=s-s%5;i=(n&(1<<o)-1).toString(32),n>>=o,s-=o,Pu=1<<32-sl(e)+s|r<<s|n,Ou=i+t}else Pu=1<<i|r<<s|n,Ou=t}function sF(t){t.return!==null&&(Bf(t,1),YQ(t,1,0))}function iF(t){for(;t===xE;)xE=ny[--sy],ny[sy]=null,bE=ny[--sy],ny[sy]=null;for(;t===$m;)$m=ro[--no],ro[no]=null,Ou=ro[--no],ro[no]=null,Pu=ro[--no],ro[no]=null}var Ta=null,Ca=null,Xr=!1,Zo=null;function XQ(t,e){var r=oo(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function mU(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ta=t,Ca=$h(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ta=t,Ca=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=$m!==null?{id:Pu,overflow:Ou}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=oo(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Ta=t,Ca=null,!0):!1;default:return!1}}function UM(t){return(t.mode&1)!==0&&(t.flags&128)===0}function zM(t){if(Xr){var e=Ca;if(e){var r=e;if(!mU(t,e)){if(UM(t))throw Error(He(418));e=$h(r.nextSibling);var n=Ta;e&&mU(t,e)?XQ(n,r):(t.flags=t.flags&-4097|2,Xr=!1,Ta=t)}}else{if(UM(t))throw Error(He(418));t.flags=t.flags&-4097|2,Xr=!1,Ta=t}}}function gU(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ta=t}function qS(t){if(t!==Ta)return!1;if(!Xr)return gU(t),Xr=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!LM(t.type,t.memoizedProps)),e&&(e=Ca)){if(UM(t))throw QQ(),Error(He(418));for(;e;)XQ(t,e),e=$h(e.nextSibling)}if(gU(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(He(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Ca=$h(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Ca=null}}else Ca=Ta?$h(t.stateNode.nextSibling):null;return!0}function QQ(){for(var t=Ca;t;)t=$h(t.nextSibling)}function fx(){Ca=Ta=null,Xr=!1}function aF(t){Zo===null?Zo=[t]:Zo.push(t)}var gye=sd.ReactCurrentBatchConfig;function U0(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(He(309));var n=r.stateNode}if(!n)throw Error(He(147,t));var s=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(He(284));if(!r._owner)throw Error(He(290,t))}return t}function GS(t,e){throw t=Object.prototype.toString.call(e),Error(He(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function yU(t){var e=t._init;return e(t._payload)}function ZQ(t){function e(y,x){if(t){var b=y.deletions;b===null?(y.deletions=[x],y.flags|=16):b.push(x)}}function r(y,x){if(!t)return null;for(;x!==null;)e(y,x),x=x.sibling;return null}function n(y,x){for(y=new Map;x!==null;)x.key!==null?y.set(x.key,x):y.set(x.index,x),x=x.sibling;return y}function s(y,x){return y=Hh(y,x),y.index=0,y.sibling=null,y}function i(y,x,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<x?(y.flags|=2,x):b):(y.flags|=2,x)):(y.flags|=1048576,x)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function l(y,x,b,w){return x===null||x.tag!==6?(x=PP(b,y.mode,w),x.return=y,x):(x=s(x,b),x.return=y,x)}function c(y,x,b,w){var j=b.type;return j===Qg?d(y,x,b.props.children,w,b.key):x!==null&&(x.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ad&&yU(j)===x.type)?(w=s(x,b.props),w.ref=U0(y,x,b),w.return=y,w):(w=hA(b.type,b.key,b.props,null,y.mode,w),w.ref=U0(y,x,b),w.return=y,w)}function u(y,x,b,w){return x===null||x.tag!==4||x.stateNode.containerInfo!==b.containerInfo||x.stateNode.implementation!==b.implementation?(x=OP(b,y.mode,w),x.return=y,x):(x=s(x,b.children||[]),x.return=y,x)}function d(y,x,b,w,j){return x===null||x.tag!==7?(x=Tm(b,y.mode,w,j),x.return=y,x):(x=s(x,b),x.return=y,x)}function h(y,x,b){if(typeof x=="string"&&x!==""||typeof x=="number")return x=PP(""+x,y.mode,b),x.return=y,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case DS:return b=hA(x.type,x.key,x.props,null,y.mode,b),b.ref=U0(y,null,x),b.return=y,b;case Xg:return x=OP(x,y.mode,b),x.return=y,x;case Ad:var w=x._init;return h(y,w(x._payload),b)}if(bb(x)||D0(x))return x=Tm(x,y.mode,b,null),x.return=y,x;GS(y,x)}return null}function f(y,x,b,w){var j=x!==null?x.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return j!==null?null:l(y,x,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case DS:return b.key===j?c(y,x,b,w):null;case Xg:return b.key===j?u(y,x,b,w):null;case Ad:return j=b._init,f(y,x,j(b._payload),w)}if(bb(b)||D0(b))return j!==null?null:d(y,x,b,w,null);GS(y,b)}return null}function p(y,x,b,w,j){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(b)||null,l(x,y,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case DS:return y=y.get(w.key===null?b:w.key)||null,c(x,y,w,j);case Xg:return y=y.get(w.key===null?b:w.key)||null,u(x,y,w,j);case Ad:var N=w._init;return p(y,x,b,N(w._payload),j)}if(bb(w)||D0(w))return y=y.get(b)||null,d(x,y,w,j,null);GS(x,w)}return null}function g(y,x,b,w){for(var j=null,N=null,C=x,k=x=0,E=null;C!==null&&k<b.length;k++){C.index>k?(E=C,C=null):E=C.sibling;var M=f(y,C,b[k],w);if(M===null){C===null&&(C=E);break}t&&C&&M.alternate===null&&e(y,C),x=i(M,x,k),N===null?j=M:N.sibling=M,N=M,C=E}if(k===b.length)return r(y,C),Xr&&Bf(y,k),j;if(C===null){for(;k<b.length;k++)C=h(y,b[k],w),C!==null&&(x=i(C,x,k),N===null?j=C:N.sibling=C,N=C);return Xr&&Bf(y,k),j}for(C=n(y,C);k<b.length;k++)E=p(C,y,k,b[k],w),E!==null&&(t&&E.alternate!==null&&C.delete(E.key===null?k:E.key),x=i(E,x,k),N===null?j=E:N.sibling=E,N=E);return t&&C.forEach(function(z){return e(y,z)}),Xr&&Bf(y,k),j}function m(y,x,b,w){var j=D0(b);if(typeof j!="function")throw Error(He(150));if(b=j.call(b),b==null)throw Error(He(151));for(var N=j=null,C=x,k=x=0,E=null,M=b.next();C!==null&&!M.done;k++,M=b.next()){C.index>k?(E=C,C=null):E=C.sibling;var z=f(y,C,M.value,w);if(z===null){C===null&&(C=E);break}t&&C&&z.alternate===null&&e(y,C),x=i(z,x,k),N===null?j=z:N.sibling=z,N=z,C=E}if(M.done)return r(y,C),Xr&&Bf(y,k),j;if(C===null){for(;!M.done;k++,M=b.next())M=h(y,M.value,w),M!==null&&(x=i(M,x,k),N===null?j=M:N.sibling=M,N=M);return Xr&&Bf(y,k),j}for(C=n(y,C);!M.done;k++,M=b.next())M=p(C,y,k,M.value,w),M!==null&&(t&&M.alternate!==null&&C.delete(M.key===null?k:M.key),x=i(M,x,k),N===null?j=M:N.sibling=M,N=M);return t&&C.forEach(function(I){return e(y,I)}),Xr&&Bf(y,k),j}function v(y,x,b,w){if(typeof b=="object"&&b!==null&&b.type===Qg&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case DS:e:{for(var j=b.key,N=x;N!==null;){if(N.key===j){if(j=b.type,j===Qg){if(N.tag===7){r(y,N.sibling),x=s(N,b.props.children),x.return=y,y=x;break e}}else if(N.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ad&&yU(j)===N.type){r(y,N.sibling),x=s(N,b.props),x.ref=U0(y,N,b),x.return=y,y=x;break e}r(y,N);break}else e(y,N);N=N.sibling}b.type===Qg?(x=Tm(b.props.children,y.mode,w,b.key),x.return=y,y=x):(w=hA(b.type,b.key,b.props,null,y.mode,w),w.ref=U0(y,x,b),w.return=y,y=w)}return o(y);case Xg:e:{for(N=b.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===b.containerInfo&&x.stateNode.implementation===b.implementation){r(y,x.sibling),x=s(x,b.children||[]),x.return=y,y=x;break e}else{r(y,x);break}else e(y,x);x=x.sibling}x=OP(b,y.mode,w),x.return=y,y=x}return o(y);case Ad:return N=b._init,v(y,x,N(b._payload),w)}if(bb(b))return g(y,x,b,w);if(D0(b))return m(y,x,b,w);GS(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,x!==null&&x.tag===6?(r(y,x.sibling),x=s(x,b),x.return=y,y=x):(r(y,x),x=PP(b,y.mode,w),x.return=y,y=x),o(y)):r(y,x)}return v}var px=ZQ(!0),JQ=ZQ(!1),wE=uf(null),_E=null,iy=null,oF=null;function lF(){oF=iy=_E=null}function cF(t){var e=wE.current;Hr(wE),t._currentValue=e}function HM(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Ny(t,e){_E=t,oF=iy=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&($i=!0),t.firstContext=null)}function vo(t){var e=t._currentValue;if(oF!==t)if(t={context:t,memoizedValue:e,next:null},iy===null){if(_E===null)throw Error(He(308));iy=t,_E.dependencies={lanes:0,firstContext:t}}else iy=iy.next=t;return e}var sp=null;function uF(t){sp===null?sp=[t]:sp.push(t)}function eZ(t,e,r,n){var s=e.interleaved;return s===null?(r.next=r,uF(e)):(r.next=s.next,s.next=r),e.interleaved=r,Vu(t,n)}function Vu(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var Ed=!1;function dF(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tZ(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Du(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Bh(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,er&2){var s=n.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),n.pending=e,Vu(t,r)}return s=n.interleaved,s===null?(e.next=e,uF(n)):(e.next=s.next,s.next=e),n.interleaved=e,Vu(t,r)}function aA(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,X3(t,r)}}function vU(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?s=i=e:i=i.next=e}else s=i=e;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function jE(t,e,r,n){var s=t.updateQueue;Ed=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;o=0,d=u=c=null,l=i;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=t,m=l;switch(f=e,p=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(p,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(p,h,f):g,f==null)break e;h=sn({},h,f);break e;case 2:Ed=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Um|=o,t.lanes=o,t.memoizedState=h}}function xU(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(He(191,s));s.call(n)}}}var kj={},cc=uf(kj),Fw=uf(kj),$w=uf(kj);function ip(t){if(t===kj)throw Error(He(174));return t}function hF(t,e){switch(kr($w,e),kr(Fw,t),kr(cc,kj),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:jM(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=jM(e,t)}Hr(cc),kr(cc,e)}function mx(){Hr(cc),Hr(Fw),Hr($w)}function rZ(t){ip($w.current);var e=ip(cc.current),r=jM(e,t.type);e!==r&&(kr(Fw,t),kr(cc,r))}function fF(t){Fw.current===t&&(Hr(cc),Hr(Fw))}var tn=uf(0);function SE(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.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===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var NP=[];function pF(){for(var t=0;t<NP.length;t++)NP[t]._workInProgressVersionPrimary=null;NP.length=0}var oA=sd.ReactCurrentDispatcher,AP=sd.ReactCurrentBatchConfig,Bm=0,nn=null,Vn=null,cs=null,NE=!1,aw=!1,Bw=0,yye=0;function Ls(){throw Error(He(321))}function mF(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!ll(t[r],e[r]))return!1;return!0}function gF(t,e,r,n,s,i){if(Bm=i,nn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,oA.current=t===null||t.memoizedState===null?wye:_ye,t=r(n,s),aw){i=0;do{if(aw=!1,Bw=0,25<=i)throw Error(He(301));i+=1,cs=Vn=null,e.updateQueue=null,oA.current=jye,t=r(n,s)}while(aw)}if(oA.current=AE,e=Vn!==null&&Vn.next!==null,Bm=0,cs=Vn=nn=null,NE=!1,e)throw Error(He(300));return t}function yF(){var t=Bw!==0;return Bw=0,t}function El(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cs===null?nn.memoizedState=cs=t:cs=cs.next=t,cs}function xo(){if(Vn===null){var t=nn.alternate;t=t!==null?t.memoizedState:null}else t=Vn.next;var e=cs===null?nn.memoizedState:cs.next;if(e!==null)cs=e,Vn=t;else{if(t===null)throw Error(He(310));Vn=t,t={memoizedState:Vn.memoizedState,baseState:Vn.baseState,baseQueue:Vn.baseQueue,queue:Vn.queue,next:null},cs===null?nn.memoizedState=cs=t:cs=cs.next=t}return cs}function Uw(t,e){return typeof e=="function"?e(t):e}function EP(t){var e=xo(),r=e.queue;if(r===null)throw Error(He(311));r.lastRenderedReducer=t;var n=Vn,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((Bm&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:t(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=n):c=c.next=h,nn.lanes|=d,Um|=d}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,ll(n,e.memoizedState)||($i=!0),e.memoizedState=n,e.baseState=o,e.baseQueue=c,r.lastRenderedState=n}if(t=r.interleaved,t!==null){s=t;do i=s.lane,nn.lanes|=i,Um|=i,s=s.next;while(s!==t)}else s===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function CP(t){var e=xo(),r=e.queue;if(r===null)throw Error(He(311));r.lastRenderedReducer=t;var n=r.dispatch,s=r.pending,i=e.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);ll(i,e.memoizedState)||($i=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function nZ(){}function sZ(t,e){var r=nn,n=xo(),s=e(),i=!ll(n.memoizedState,s);if(i&&(n.memoizedState=s,$i=!0),n=n.queue,vF(oZ.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||cs!==null&&cs.memoizedState.tag&1){if(r.flags|=2048,zw(9,aZ.bind(null,r,n,s,e),void 0,null),us===null)throw Error(He(349));Bm&30||iZ(r,e,s)}return s}function iZ(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=nn.updateQueue,e===null?(e={lastEffect:null,stores:null},nn.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function aZ(t,e,r,n){e.value=r,e.getSnapshot=n,lZ(e)&&cZ(t)}function oZ(t,e,r){return r(function(){lZ(e)&&cZ(t)})}function lZ(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!ll(t,r)}catch{return!0}}function cZ(t){var e=Vu(t,1);e!==null&&il(e,t,1,-1)}function bU(t){var e=El();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uw,lastRenderedState:t},e.queue=t,t=t.dispatch=bye.bind(null,nn,t),[e.memoizedState,t]}function zw(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=nn.updateQueue,e===null?(e={lastEffect:null,stores:null},nn.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function uZ(){return xo().memoizedState}function lA(t,e,r,n){var s=El();nn.flags|=t,s.memoizedState=zw(1|e,r,void 0,n===void 0?null:n)}function Hk(t,e,r,n){var s=xo();n=n===void 0?null:n;var i=void 0;if(Vn!==null){var o=Vn.memoizedState;if(i=o.destroy,n!==null&&mF(n,o.deps)){s.memoizedState=zw(e,r,i,n);return}}nn.flags|=t,s.memoizedState=zw(1|e,r,i,n)}function wU(t,e){return lA(8390656,8,t,e)}function vF(t,e){return Hk(2048,8,t,e)}function dZ(t,e){return Hk(4,2,t,e)}function hZ(t,e){return Hk(4,4,t,e)}function fZ(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function pZ(t,e,r){return r=r!=null?r.concat([t]):null,Hk(4,4,fZ.bind(null,e,t),r)}function xF(){}function mZ(t,e){var r=xo();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&mF(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function gZ(t,e){var r=xo();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&mF(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function yZ(t,e,r){return Bm&21?(ll(r,e)||(r=_Q(),nn.lanes|=r,Um|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,$i=!0),t.memoizedState=r)}function vye(t,e){var r=pr;pr=r!==0&&4>r?r:4,t(!0);var n=AP.transition;AP.transition={};try{t(!1),e()}finally{pr=r,AP.transition=n}}function vZ(){return xo().memoizedState}function xye(t,e,r){var n=zh(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},xZ(t))bZ(e,r);else if(r=eZ(t,e,r,n),r!==null){var s=yi();il(r,t,n,s),wZ(r,e,n)}}function bye(t,e,r){var n=zh(t),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(xZ(t))bZ(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,r);if(s.hasEagerState=!0,s.eagerState=l,ll(l,o)){var c=e.interleaved;c===null?(s.next=s,uF(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}r=eZ(t,e,s,n),r!==null&&(s=yi(),il(r,t,n,s),wZ(r,e,n))}}function xZ(t){var e=t.alternate;return t===nn||e!==null&&e===nn}function bZ(t,e){aw=NE=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function wZ(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,X3(t,r)}}var AE={readContext:vo,useCallback:Ls,useContext:Ls,useEffect:Ls,useImperativeHandle:Ls,useInsertionEffect:Ls,useLayoutEffect:Ls,useMemo:Ls,useReducer:Ls,useRef:Ls,useState:Ls,useDebugValue:Ls,useDeferredValue:Ls,useTransition:Ls,useMutableSource:Ls,useSyncExternalStore:Ls,useId:Ls,unstable_isNewReconciler:!1},wye={readContext:vo,useCallback:function(t,e){return El().memoizedState=[t,e===void 0?null:e],t},useContext:vo,useEffect:wU,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,lA(4194308,4,fZ.bind(null,e,t),r)},useLayoutEffect:function(t,e){return lA(4194308,4,t,e)},useInsertionEffect:function(t,e){return lA(4,2,t,e)},useMemo:function(t,e){var r=El();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=El();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=xye.bind(null,nn,t),[n.memoizedState,t]},useRef:function(t){var e=El();return t={current:t},e.memoizedState=t},useState:bU,useDebugValue:xF,useDeferredValue:function(t){return El().memoizedState=t},useTransition:function(){var t=bU(!1),e=t[0];return t=vye.bind(null,t[1]),El().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=nn,s=El();if(Xr){if(r===void 0)throw Error(He(407));r=r()}else{if(r=e(),us===null)throw Error(He(349));Bm&30||iZ(n,e,r)}s.memoizedState=r;var i={value:r,getSnapshot:e};return s.queue=i,wU(oZ.bind(null,n,i,t),[t]),n.flags|=2048,zw(9,aZ.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=El(),e=us.identifierPrefix;if(Xr){var r=Ou,n=Pu;r=(n&~(1<<32-sl(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Bw++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=yye++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},_ye={readContext:vo,useCallback:mZ,useContext:vo,useEffect:vF,useImperativeHandle:pZ,useInsertionEffect:dZ,useLayoutEffect:hZ,useMemo:gZ,useReducer:EP,useRef:uZ,useState:function(){return EP(Uw)},useDebugValue:xF,useDeferredValue:function(t){var e=xo();return yZ(e,Vn.memoizedState,t)},useTransition:function(){var t=EP(Uw)[0],e=xo().memoizedState;return[t,e]},useMutableSource:nZ,useSyncExternalStore:sZ,useId:vZ,unstable_isNewReconciler:!1},jye={readContext:vo,useCallback:mZ,useContext:vo,useEffect:vF,useImperativeHandle:pZ,useInsertionEffect:dZ,useLayoutEffect:hZ,useMemo:gZ,useReducer:CP,useRef:uZ,useState:function(){return CP(Uw)},useDebugValue:xF,useDeferredValue:function(t){var e=xo();return Vn===null?e.memoizedState=t:yZ(e,Vn.memoizedState,t)},useTransition:function(){var t=CP(Uw)[0],e=xo().memoizedState;return[t,e]},useMutableSource:nZ,useSyncExternalStore:sZ,useId:vZ,unstable_isNewReconciler:!1};function Do(t,e){if(t&&t.defaultProps){e=sn({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function WM(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:sn({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Wk={isMounted:function(t){return(t=t._reactInternals)?ig(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=yi(),s=zh(t),i=Du(n,s);i.payload=e,r!=null&&(i.callback=r),e=Bh(t,i,s),e!==null&&(il(e,t,s,n),aA(e,t,s))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=yi(),s=zh(t),i=Du(n,s);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=Bh(t,i,s),e!==null&&(il(e,t,s,n),aA(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=yi(),n=zh(t),s=Du(r,n);s.tag=2,e!=null&&(s.callback=e),e=Bh(t,s,n),e!==null&&(il(e,t,n,r),aA(e,t,n))}};function _U(t,e,r,n,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,o):e.prototype&&e.prototype.isPureReactComponent?!Rw(r,n)||!Rw(s,i):!0}function _Z(t,e,r){var n=!1,s=Yh,i=e.contextType;return typeof i=="object"&&i!==null?i=vo(i):(s=Vi(e)?Fm:Xs.current,n=e.contextTypes,i=(n=n!=null)?hx(t,s):Yh),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Wk,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function jU(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&Wk.enqueueReplaceState(e,e.state,null)}function VM(t,e,r,n){var s=t.stateNode;s.props=r,s.state=t.memoizedState,s.refs={},dF(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=vo(i):(i=Vi(e)?Fm:Xs.current,s.context=hx(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(WM(t,e,i,r),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&Wk.enqueueReplaceState(s,s.state,null),jE(t,r,s,n),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function gx(t,e){try{var r="",n=e;do r+=Qme(n),n=n.return;while(n);var s=r}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function kP(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function qM(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var Sye=typeof WeakMap=="function"?WeakMap:Map;function jZ(t,e,r){r=Du(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){CE||(CE=!0,rD=n),qM(t,e)},r}function SZ(t,e,r){r=Du(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var s=e.value;r.payload=function(){return n(s)},r.callback=function(){qM(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){qM(t,e),typeof n!="function"&&(Uh===null?Uh=new Set([this]):Uh.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function SU(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new Sye;var s=new Set;n.set(e,s)}else s=n.get(e),s===void 0&&(s=new Set,n.set(e,s));s.has(r)||(s.add(r),t=Fye.bind(null,t,e,r),e.then(t,t))}function NU(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function AU(t,e,r,n,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Du(-1,1),e.tag=2,Bh(r,e,1))),r.lanes|=1),t)}var Nye=sd.ReactCurrentOwner,$i=!1;function hi(t,e,r,n){e.child=t===null?JQ(e,null,r,n):px(e,t.child,r,n)}function EU(t,e,r,n,s){r=r.render;var i=e.ref;return Ny(e,s),n=gF(t,e,r,n,i,s),r=yF(),t!==null&&!$i?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,qu(t,e,s)):(Xr&&r&&sF(e),e.flags|=1,hi(t,e,n,s),e.child)}function CU(t,e,r,n,s){if(t===null){var i=r.type;return typeof i=="function"&&!EF(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,NZ(t,e,i,n,s)):(t=hA(r.type,null,n,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(r=r.compare,r=r!==null?r:Rw,r(o,n)&&t.ref===e.ref)return qu(t,e,s)}return e.flags|=1,t=Hh(i,n),t.ref=e.ref,t.return=e,e.child=t}function NZ(t,e,r,n,s){if(t!==null){var i=t.memoizedProps;if(Rw(i,n)&&t.ref===e.ref)if($i=!1,e.pendingProps=n=i,(t.lanes&s)!==0)t.flags&131072&&($i=!0);else return e.lanes=t.lanes,qu(t,e,s)}return GM(t,e,r,n,s)}function AZ(t,e,r){var n=e.pendingProps,s=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},kr(oy,_a),_a|=r;else{if(!(r&1073741824))return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,kr(oy,_a),_a|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,kr(oy,_a),_a|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,kr(oy,_a),_a|=n;return hi(t,e,s,r),e.child}function EZ(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function GM(t,e,r,n,s){var i=Vi(r)?Fm:Xs.current;return i=hx(e,i),Ny(e,s),r=gF(t,e,r,n,i,s),n=yF(),t!==null&&!$i?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,qu(t,e,s)):(Xr&&n&&sF(e),e.flags|=1,hi(t,e,r,s),e.child)}function kU(t,e,r,n,s){if(Vi(r)){var i=!0;vE(e)}else i=!1;if(Ny(e,s),e.stateNode===null)cA(t,e),_Z(e,r,n),VM(e,r,n,s),n=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=vo(u):(u=Vi(r)?Fm:Xs.current,u=hx(e,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&jU(e,o,n,u),Ed=!1;var f=e.memoizedState;o.state=f,jE(e,n,o,s),c=e.memoizedState,l!==n||f!==c||Wi.current||Ed?(typeof d=="function"&&(WM(e,r,d,n),c=e.memoizedState),(l=Ed||_U(e,r,l,n,f,c,u))?(h||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,tZ(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Do(e.type,l),o.props=u,h=e.pendingProps,f=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=vo(c):(c=Vi(r)?Fm:Xs.current,c=hx(e,c));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&jU(e,o,n,c),Ed=!1,f=e.memoizedState,o.state=f,jE(e,n,o,s);var g=e.memoizedState;l!==h||f!==g||Wi.current||Ed?(typeof p=="function"&&(WM(e,r,p,n),g=e.memoizedState),(u=Ed||_U(e,r,u,n,f,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=g),o.props=n,o.state=g,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return KM(t,e,r,n,i,s)}function KM(t,e,r,n,s,i){EZ(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return s&&pU(e,r,!1),qu(t,e,i);n=e.stateNode,Nye.current=e;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=px(e,t.child,null,i),e.child=px(e,null,l,i)):hi(t,e,l,i),e.memoizedState=n.state,s&&pU(e,r,!0),e.child}function CZ(t){var e=t.stateNode;e.pendingContext?fU(t,e.pendingContext,e.pendingContext!==e.context):e.context&&fU(t,e.context,!1),hF(t,e.containerInfo)}function TU(t,e,r,n,s){return fx(),aF(s),e.flags|=256,hi(t,e,r,n),e.child}var YM={dehydrated:null,treeContext:null,retryLane:0};function XM(t){return{baseLanes:t,cachePool:null,transitions:null}}function kZ(t,e,r){var n=e.pendingProps,s=tn.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),kr(tn,s&1),t===null)return zM(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,i?(n=e.mode,i=e.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Gk(o,n,0,null),t=Tm(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=XM(r),e.memoizedState=YM,t):bF(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Aye(t,e,o,n,l,s,r);if(i){i=n.fallback,o=e.mode,s=t.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=Hh(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Hh(l,i):(i=Tm(i,o,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,o=t.child.memoizedState,o=o===null?XM(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~r,e.memoizedState=YM,n}return i=t.child,t=i.sibling,n=Hh(i,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function bF(t,e){return e=Gk({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function KS(t,e,r,n){return n!==null&&aF(n),px(e,t.child,null,r),t=bF(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Aye(t,e,r,n,s,i,o){if(r)return e.flags&256?(e.flags&=-257,n=kP(Error(He(422))),KS(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,s=e.mode,n=Gk({mode:"visible",children:n.children},s,0,null),i=Tm(i,s,o,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,e.mode&1&&px(e,t.child,null,o),e.child.memoizedState=XM(o),e.memoizedState=YM,i);if(!(e.mode&1))return KS(t,e,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(He(419)),n=kP(i,n,void 0),KS(t,e,o,n)}if(l=(o&t.childLanes)!==0,$i||l){if(n=us,n!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Vu(t,s),il(n,t,s,-1))}return AF(),n=kP(Error(He(421))),KS(t,e,o,n)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=$ye.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Ca=$h(s.nextSibling),Ta=e,Xr=!0,Zo=null,t!==null&&(ro[no++]=Pu,ro[no++]=Ou,ro[no++]=$m,Pu=t.id,Ou=t.overflow,$m=e),e=bF(e,n.children),e.flags|=4096,e)}function PU(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),HM(t.return,e,r)}function TP(t,e,r,n,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function TZ(t,e,r){var n=e.pendingProps,s=n.revealOrder,i=n.tail;if(hi(t,e,n.children,r),n=tn.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&PU(t,r,e);else if(t.tag===19)PU(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(kr(tn,n),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(r=e.child,s=null;r!==null;)t=r.alternate,t!==null&&SE(t)===null&&(s=r),r=r.sibling;r=s,r===null?(s=e.child,e.child=null):(s=r.sibling,r.sibling=null),TP(e,!1,s,r,i);break;case"backwards":for(r=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&SE(t)===null){e.child=s;break}t=s.sibling,s.sibling=r,r=s,s=t}TP(e,!0,r,null,i);break;case"together":TP(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function cA(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function qu(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Um|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(He(153));if(e.child!==null){for(t=e.child,r=Hh(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Hh(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Eye(t,e,r){switch(e.tag){case 3:CZ(e),fx();break;case 5:rZ(e);break;case 1:Vi(e.type)&&vE(e);break;case 4:hF(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,s=e.memoizedProps.value;kr(wE,n._currentValue),n._currentValue=s;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(kr(tn,tn.current&1),e.flags|=128,null):r&e.child.childLanes?kZ(t,e,r):(kr(tn,tn.current&1),t=qu(t,e,r),t!==null?t.sibling:null);kr(tn,tn.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return TZ(t,e,r);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),kr(tn,tn.current),n)break;return null;case 22:case 23:return e.lanes=0,AZ(t,e,r)}return qu(t,e,r)}var PZ,QM,OZ,IZ;PZ=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};QM=function(){};OZ=function(t,e,r,n){var s=t.memoizedProps;if(s!==n){t=e.stateNode,ip(cc.current);var i=null;switch(r){case"input":s=xM(t,s),n=xM(t,n),i=[];break;case"select":s=sn({},s,{value:void 0}),n=sn({},n,{value:void 0}),i=[];break;case"textarea":s=_M(t,s),n=_M(t,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=gE)}SM(r,n);var o;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ew.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[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)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ew.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Fr("scroll",t),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};IZ=function(t,e,r,n){r!==n&&(e.flags|=4)};function z0(t,e){if(!Xr)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Fs(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function Cye(t,e,r){var n=e.pendingProps;switch(iF(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fs(e),null;case 1:return Vi(e.type)&&yE(),Fs(e),null;case 3:return n=e.stateNode,mx(),Hr(Wi),Hr(Xs),pF(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(qS(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Zo!==null&&(iD(Zo),Zo=null))),QM(t,e),Fs(e),null;case 5:fF(e);var s=ip($w.current);if(r=e.type,t!==null&&e.stateNode!=null)OZ(t,e,r,n,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(He(166));return Fs(e),null}if(t=ip(cc.current),qS(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[ec]=e,n[Lw]=i,t=(e.mode&1)!==0,r){case"dialog":Fr("cancel",n),Fr("close",n);break;case"iframe":case"object":case"embed":Fr("load",n);break;case"video":case"audio":for(s=0;s<_b.length;s++)Fr(_b[s],n);break;case"source":Fr("error",n);break;case"img":case"image":case"link":Fr("error",n),Fr("load",n);break;case"details":Fr("toggle",n);break;case"input":BB(n,i),Fr("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Fr("invalid",n);break;case"textarea":zB(n,i),Fr("invalid",n)}SM(r,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&VS(n.textContent,l,t),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&VS(n.textContent,l,t),s=["children",""+l]):Ew.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Fr("scroll",n)}switch(r){case"input":LS(n),UB(n,i,!0);break;case"textarea":LS(n),HB(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=gE)}n=s,e.updateQueue=n,n!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=oQ(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[ec]=e,t[Lw]=n,PZ(t,e,!1,!1),e.stateNode=t;e:{switch(o=NM(r,n),r){case"dialog":Fr("cancel",t),Fr("close",t),s=n;break;case"iframe":case"object":case"embed":Fr("load",t),s=n;break;case"video":case"audio":for(s=0;s<_b.length;s++)Fr(_b[s],t);s=n;break;case"source":Fr("error",t),s=n;break;case"img":case"image":case"link":Fr("error",t),Fr("load",t),s=n;break;case"details":Fr("toggle",t),s=n;break;case"input":BB(t,n),s=xM(t,n),Fr("invalid",t);break;case"option":s=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},s=sn({},n,{value:void 0}),Fr("invalid",t);break;case"textarea":zB(t,n),s=_M(t,n),Fr("invalid",t);break;default:s=n}SM(r,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?uQ(t,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&lQ(t,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Cw(t,c):typeof c=="number"&&Cw(t,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ew.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Fr("scroll",t):c!=null&&W3(t,i,c,o))}switch(r){case"input":LS(t),UB(t,n,!1);break;case"textarea":LS(t),HB(t);break;case"option":n.value!=null&&t.setAttribute("value",""+Kh(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?wy(t,!!n.multiple,i,!1):n.defaultValue!=null&&wy(t,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=gE)}switch(r){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 Fs(e),null;case 6:if(t&&e.stateNode!=null)IZ(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(He(166));if(r=ip($w.current),ip(cc.current),qS(e)){if(n=e.stateNode,r=e.memoizedProps,n[ec]=e,(i=n.nodeValue!==r)&&(t=Ta,t!==null))switch(t.tag){case 3:VS(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&VS(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[ec]=e,e.stateNode=n}return Fs(e),null;case 13:if(Hr(tn),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Xr&&Ca!==null&&e.mode&1&&!(e.flags&128))QQ(),fx(),e.flags|=98560,i=!1;else if(i=qS(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(He(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(He(317));i[ec]=e}else fx(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Fs(e),i=!1}else Zo!==null&&(iD(Zo),Zo=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||tn.current&1?Gn===0&&(Gn=3):AF())),e.updateQueue!==null&&(e.flags|=4),Fs(e),null);case 4:return mx(),QM(t,e),t===null&&Mw(e.stateNode.containerInfo),Fs(e),null;case 10:return cF(e.type._context),Fs(e),null;case 17:return Vi(e.type)&&yE(),Fs(e),null;case 19:if(Hr(tn),i=e.memoizedState,i===null)return Fs(e),null;if(n=(e.flags&128)!==0,o=i.rendering,o===null)if(n)z0(i,!1);else{if(Gn!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=SE(t),o!==null){for(e.flags|=128,z0(i,!1),n=o.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return kr(tn,tn.current&1|2),e.child}t=t.sibling}i.tail!==null&&jn()>yx&&(e.flags|=128,n=!0,z0(i,!1),e.lanes=4194304)}else{if(!n)if(t=SE(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),z0(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Xr)return Fs(e),null}else 2*jn()-i.renderingStartTime>yx&&r!==1073741824&&(e.flags|=128,n=!0,z0(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(r=i.last,r!==null?r.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=jn(),e.sibling=null,r=tn.current,kr(tn,n?r&1|2:r&1),e):(Fs(e),null);case 22:case 23:return NF(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?_a&1073741824&&(Fs(e),e.subtreeFlags&6&&(e.flags|=8192)):Fs(e),null;case 24:return null;case 25:return null}throw Error(He(156,e.tag))}function kye(t,e){switch(iF(e),e.tag){case 1:return Vi(e.type)&&yE(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return mx(),Hr(Wi),Hr(Xs),pF(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return fF(e),null;case 13:if(Hr(tn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(He(340));fx()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Hr(tn),null;case 4:return mx(),null;case 10:return cF(e.type._context),null;case 22:case 23:return NF(),null;case 24:return null;default:return null}}var YS=!1,qs=!1,Tye=typeof WeakSet=="function"?WeakSet:Set,lt=null;function ay(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){dn(t,e,n)}else r.current=null}function ZM(t,e,r){try{r()}catch(n){dn(t,e,n)}}var OU=!1;function Pye(t,e){if(MM=fE,t=FQ(),nF(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=t,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(l=o+s),h!==i||n!==0&&h.nodeType!==3||(c=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===t)break t;if(f===r&&++u===s&&(l=o),f===i&&++d===n&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(DM={focusedElem:t,selectionRange:r},fE=!1,lt=e;lt!==null;)if(e=lt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,lt=t;else for(;lt!==null;){e=lt;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,v=g.memoizedState,y=e.stateNode,x=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Do(e.type,m),v);y.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(He(163))}}catch(w){dn(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,lt=t;break}lt=e.return}return g=OU,OU=!1,g}function ow(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&ZM(e,r,i)}s=s.next}while(s!==n)}}function Vk(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function JM(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function RZ(t){var e=t.alternate;e!==null&&(t.alternate=null,RZ(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ec],delete e[Lw],delete e[$M],delete e[fye],delete e[pye])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function MZ(t){return t.tag===5||t.tag===3||t.tag===4}function IU(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||MZ(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function eD(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=gE));else if(n!==4&&(t=t.child,t!==null))for(eD(t,e,r),t=t.sibling;t!==null;)eD(t,e,r),t=t.sibling}function tD(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(tD(t,e,r),t=t.sibling;t!==null;)tD(t,e,r),t=t.sibling}var xs=null,Xo=!1;function fd(t,e,r){for(r=r.child;r!==null;)DZ(t,e,r),r=r.sibling}function DZ(t,e,r){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(Lk,r)}catch{}switch(r.tag){case 5:qs||ay(r,e);case 6:var n=xs,s=Xo;xs=null,fd(t,e,r),xs=n,Xo=s,xs!==null&&(Xo?(t=xs,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):xs.removeChild(r.stateNode));break;case 18:xs!==null&&(Xo?(t=xs,r=r.stateNode,t.nodeType===8?jP(t.parentNode,r):t.nodeType===1&&jP(t,r),Ow(t)):jP(xs,r.stateNode));break;case 4:n=xs,s=Xo,xs=r.stateNode.containerInfo,Xo=!0,fd(t,e,r),xs=n,Xo=s;break;case 0:case 11:case 14:case 15:if(!qs&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&ZM(r,e,o),s=s.next}while(s!==n)}fd(t,e,r);break;case 1:if(!qs&&(ay(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){dn(r,e,l)}fd(t,e,r);break;case 21:fd(t,e,r);break;case 22:r.mode&1?(qs=(n=qs)||r.memoizedState!==null,fd(t,e,r),qs=n):fd(t,e,r);break;default:fd(t,e,r)}}function RU(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Tye),e.forEach(function(n){var s=Bye.bind(null,t,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Eo(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:xs=l.stateNode,Xo=!1;break e;case 3:xs=l.stateNode.containerInfo,Xo=!0;break e;case 4:xs=l.stateNode.containerInfo,Xo=!0;break e}l=l.return}if(xs===null)throw Error(He(160));DZ(i,o,s),xs=null,Xo=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){dn(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)LZ(e,t),e=e.sibling}function LZ(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Eo(e,t),_l(t),n&4){try{ow(3,t,t.return),Vk(3,t)}catch(m){dn(t,t.return,m)}try{ow(5,t,t.return)}catch(m){dn(t,t.return,m)}}break;case 1:Eo(e,t),_l(t),n&512&&r!==null&&ay(r,r.return);break;case 5:if(Eo(e,t),_l(t),n&512&&r!==null&&ay(r,r.return),t.flags&32){var s=t.stateNode;try{Cw(s,"")}catch(m){dn(t,t.return,m)}}if(n&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=r!==null?r.memoizedProps:i,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&iQ(s,i),NM(l,o);var u=NM(l,i);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?uQ(s,h):d==="dangerouslySetInnerHTML"?lQ(s,h):d==="children"?Cw(s,h):W3(s,d,h,u)}switch(l){case"input":bM(s,i);break;case"textarea":aQ(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?wy(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?wy(s,!!i.multiple,i.defaultValue,!0):wy(s,!!i.multiple,i.multiple?[]:"",!1))}s[Lw]=i}catch(m){dn(t,t.return,m)}}break;case 6:if(Eo(e,t),_l(t),n&4){if(t.stateNode===null)throw Error(He(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(m){dn(t,t.return,m)}}break;case 3:if(Eo(e,t),_l(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Ow(e.containerInfo)}catch(m){dn(t,t.return,m)}break;case 4:Eo(e,t),_l(t);break;case 13:Eo(e,t),_l(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(jF=jn())),n&4&&RU(t);break;case 22:if(d=r!==null&&r.memoizedState!==null,t.mode&1?(qs=(u=qs)||d,Eo(e,t),qs=u):Eo(e,t),_l(t),n&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(lt=t,d=t.child;d!==null;){for(h=lt=d;lt!==null;){switch(f=lt,p=f.child,f.tag){case 0:case 11:case 14:case 15:ow(4,f,f.return);break;case 1:ay(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(m){dn(n,r,m)}}break;case 5:ay(f,f.return);break;case 22:if(f.memoizedState!==null){DU(h);continue}}p!==null?(p.return=f,lt=p):DU(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=cQ("display",o))}catch(m){dn(t,t.return,m)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(m){dn(t,t.return,m)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Eo(e,t),_l(t),n&4&&RU(t);break;case 21:break;default:Eo(e,t),_l(t)}}function _l(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(MZ(r)){var n=r;break e}r=r.return}throw Error(He(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Cw(s,""),n.flags&=-33);var i=IU(t);tD(t,i,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=IU(t);eD(t,l,o);break;default:throw Error(He(161))}}catch(c){dn(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Oye(t,e,r){lt=t,FZ(t)}function FZ(t,e,r){for(var n=(t.mode&1)!==0;lt!==null;){var s=lt,i=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||YS;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||qs;l=YS;var u=qs;if(YS=o,(qs=c)&&!u)for(lt=s;lt!==null;)o=lt,c=o.child,o.tag===22&&o.memoizedState!==null?LU(s):c!==null?(c.return=o,lt=c):LU(s);for(;i!==null;)lt=i,FZ(i),i=i.sibling;lt=s,YS=l,qs=u}MU(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,lt=i):MU(t)}}function MU(t){for(;lt!==null;){var e=lt;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:qs||Vk(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!qs)if(r===null)n.componentDidMount();else{var s=e.elementType===e.type?r.memoizedProps:Do(e.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&xU(e,i,n);break;case 3:var o=e.updateQueue;if(o!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}xU(e,o,r)}break;case 5:var l=e.stateNode;if(r===null&&e.flags&4){r=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.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 d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Ow(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(He(163))}qs||e.flags&512&&JM(e)}catch(f){dn(e,e.return,f)}}if(e===t){lt=null;break}if(r=e.sibling,r!==null){r.return=e.return,lt=r;break}lt=e.return}}function DU(t){for(;lt!==null;){var e=lt;if(e===t){lt=null;break}var r=e.sibling;if(r!==null){r.return=e.return,lt=r;break}lt=e.return}}function LU(t){for(;lt!==null;){var e=lt;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Vk(4,e)}catch(c){dn(e,r,c)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var s=e.return;try{n.componentDidMount()}catch(c){dn(e,s,c)}}var i=e.return;try{JM(e)}catch(c){dn(e,i,c)}break;case 5:var o=e.return;try{JM(e)}catch(c){dn(e,o,c)}}}catch(c){dn(e,e.return,c)}if(e===t){lt=null;break}var l=e.sibling;if(l!==null){l.return=e.return,lt=l;break}lt=e.return}}var Iye=Math.ceil,EE=sd.ReactCurrentDispatcher,wF=sd.ReactCurrentOwner,ho=sd.ReactCurrentBatchConfig,er=0,us=null,In=null,Ns=0,_a=0,oy=uf(0),Gn=0,Hw=null,Um=0,qk=0,_F=0,lw=null,Li=null,jF=0,yx=1/0,zc=null,CE=!1,rD=null,Uh=null,XS=!1,Rh=null,kE=0,cw=0,nD=null,uA=-1,dA=0;function yi(){return er&6?jn():uA!==-1?uA:uA=jn()}function zh(t){return t.mode&1?er&2&&Ns!==0?Ns&-Ns:gye.transition!==null?(dA===0&&(dA=_Q()),dA):(t=pr,t!==0||(t=window.event,t=t===void 0?16:kQ(t.type)),t):1}function il(t,e,r,n){if(50<cw)throw cw=0,nD=null,Error(He(185));Aj(t,r,n),(!(er&2)||t!==us)&&(t===us&&(!(er&2)&&(qk|=r),Gn===4&&Td(t,Ns)),qi(t,n),r===1&&er===0&&!(e.mode&1)&&(yx=jn()+500,zk&&df()))}function qi(t,e){var r=t.callbackNode;gge(t,e);var n=hE(t,t===us?Ns:0);if(n===0)r!==null&&qB(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&qB(r),e===1)t.tag===0?mye(FU.bind(null,t)):KQ(FU.bind(null,t)),dye(function(){!(er&6)&&df()}),r=null;else{switch(jQ(n)){case 1:r=Y3;break;case 4:r=bQ;break;case 16:r=dE;break;case 536870912:r=wQ;break;default:r=dE}r=qZ(r,$Z.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function $Z(t,e){if(uA=-1,dA=0,er&6)throw Error(He(327));var r=t.callbackNode;if(Ay()&&t.callbackNode!==r)return null;var n=hE(t,t===us?Ns:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=TE(t,n);else{e=n;var s=er;er|=2;var i=UZ();(us!==t||Ns!==e)&&(zc=null,yx=jn()+500,km(t,e));do try{Dye();break}catch(l){BZ(t,l)}while(!0);lF(),EE.current=i,er=s,In!==null?e=0:(us=null,Ns=0,e=Gn)}if(e!==0){if(e===2&&(s=TM(t),s!==0&&(n=s,e=sD(t,s))),e===1)throw r=Hw,km(t,0),Td(t,n),qi(t,jn()),r;if(e===6)Td(t,n);else{if(s=t.current.alternate,!(n&30)&&!Rye(s)&&(e=TE(t,n),e===2&&(i=TM(t),i!==0&&(n=i,e=sD(t,i))),e===1))throw r=Hw,km(t,0),Td(t,n),qi(t,jn()),r;switch(t.finishedWork=s,t.finishedLanes=n,e){case 0:case 1:throw Error(He(345));case 2:Uf(t,Li,zc);break;case 3:if(Td(t,n),(n&130023424)===n&&(e=jF+500-jn(),10<e)){if(hE(t,0)!==0)break;if(s=t.suspendedLanes,(s&n)!==n){yi(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=FM(Uf.bind(null,t,Li,zc),e);break}Uf(t,Li,zc);break;case 4:if(Td(t,n),(n&4194240)===n)break;for(e=t.eventTimes,s=-1;0<n;){var o=31-sl(n);i=1<<o,o=e[o],o>s&&(s=o),n&=~i}if(n=s,n=jn()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Iye(n/1960))-n,10<n){t.timeoutHandle=FM(Uf.bind(null,t,Li,zc),n);break}Uf(t,Li,zc);break;case 5:Uf(t,Li,zc);break;default:throw Error(He(329))}}}return qi(t,jn()),t.callbackNode===r?$Z.bind(null,t):null}function sD(t,e){var r=lw;return t.current.memoizedState.isDehydrated&&(km(t,e).flags|=256),t=TE(t,e),t!==2&&(e=Li,Li=r,e!==null&&iD(e)),t}function iD(t){Li===null?Li=t:Li.push.apply(Li,t)}function Rye(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!ll(i(),s))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Td(t,e){for(e&=~_F,e&=~qk,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-sl(e),n=1<<r;t[r]=-1,e&=~n}}function FU(t){if(er&6)throw Error(He(327));Ay();var e=hE(t,0);if(!(e&1))return qi(t,jn()),null;var r=TE(t,e);if(t.tag!==0&&r===2){var n=TM(t);n!==0&&(e=n,r=sD(t,n))}if(r===1)throw r=Hw,km(t,0),Td(t,e),qi(t,jn()),r;if(r===6)throw Error(He(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Uf(t,Li,zc),qi(t,jn()),null}function SF(t,e){var r=er;er|=1;try{return t(e)}finally{er=r,er===0&&(yx=jn()+500,zk&&df())}}function zm(t){Rh!==null&&Rh.tag===0&&!(er&6)&&Ay();var e=er;er|=1;var r=ho.transition,n=pr;try{if(ho.transition=null,pr=1,t)return t()}finally{pr=n,ho.transition=r,er=e,!(er&6)&&df()}}function NF(){_a=oy.current,Hr(oy)}function km(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,uye(r)),In!==null)for(r=In.return;r!==null;){var n=r;switch(iF(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&yE();break;case 3:mx(),Hr(Wi),Hr(Xs),pF();break;case 5:fF(n);break;case 4:mx();break;case 13:Hr(tn);break;case 19:Hr(tn);break;case 10:cF(n.type._context);break;case 22:case 23:NF()}r=r.return}if(us=t,In=t=Hh(t.current,null),Ns=_a=e,Gn=0,Hw=null,_F=qk=Um=0,Li=lw=null,sp!==null){for(e=0;e<sp.length;e++)if(r=sp[e],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var o=i.next;i.next=s,n.next=o}r.pending=n}sp=null}return t}function BZ(t,e){do{var r=In;try{if(lF(),oA.current=AE,NE){for(var n=nn.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}NE=!1}if(Bm=0,cs=Vn=nn=null,aw=!1,Bw=0,wF.current=null,r===null||r.return===null){Gn=1,Hw=e,In=null;break}e:{var i=t,o=r.return,l=r,c=e;if(e=Ns,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=NU(o);if(p!==null){p.flags&=-257,AU(p,o,l,i,e),p.mode&1&&SU(i,u,e),e=p,c=u;var g=e.updateQueue;if(g===null){var m=new Set;m.add(c),e.updateQueue=m}else g.add(c);break e}else{if(!(e&1)){SU(i,u,e),AF();break e}c=Error(He(426))}}else if(Xr&&l.mode&1){var v=NU(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),AU(v,o,l,i,e),aF(gx(c,l));break e}}i=c=gx(c,l),Gn!==4&&(Gn=2),lw===null?lw=[i]:lw.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=jZ(i,c,e);vU(i,y);break e;case 1:l=c;var x=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Uh===null||!Uh.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=SZ(i,l,e);vU(i,w);break e}}i=i.return}while(i!==null)}HZ(r)}catch(j){e=j,In===r&&r!==null&&(In=r=r.return);continue}break}while(!0)}function UZ(){var t=EE.current;return EE.current=AE,t===null?AE:t}function AF(){(Gn===0||Gn===3||Gn===2)&&(Gn=4),us===null||!(Um&268435455)&&!(qk&268435455)||Td(us,Ns)}function TE(t,e){var r=er;er|=2;var n=UZ();(us!==t||Ns!==e)&&(zc=null,km(t,e));do try{Mye();break}catch(s){BZ(t,s)}while(!0);if(lF(),er=r,EE.current=n,In!==null)throw Error(He(261));return us=null,Ns=0,Gn}function Mye(){for(;In!==null;)zZ(In)}function Dye(){for(;In!==null&&!oge();)zZ(In)}function zZ(t){var e=VZ(t.alternate,t,_a);t.memoizedProps=t.pendingProps,e===null?HZ(t):In=e,wF.current=null}function HZ(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=kye(r,e),r!==null){r.flags&=32767,In=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Gn=6,In=null;return}}else if(r=Cye(r,e,_a),r!==null){In=r;return}if(e=e.sibling,e!==null){In=e;return}In=e=t}while(e!==null);Gn===0&&(Gn=5)}function Uf(t,e,r){var n=pr,s=ho.transition;try{ho.transition=null,pr=1,Lye(t,e,r,n)}finally{ho.transition=s,pr=n}return null}function Lye(t,e,r,n){do Ay();while(Rh!==null);if(er&6)throw Error(He(327));r=t.finishedWork;var s=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(He(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(yge(t,i),t===us&&(In=us=null,Ns=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||XS||(XS=!0,qZ(dE,function(){return Ay(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=ho.transition,ho.transition=null;var o=pr;pr=1;var l=er;er|=4,wF.current=null,Pye(t,r),LZ(r,t),nye(DM),fE=!!MM,DM=MM=null,t.current=r,Oye(r),lge(),er=l,pr=o,ho.transition=i}else t.current=r;if(XS&&(XS=!1,Rh=t,kE=s),i=t.pendingLanes,i===0&&(Uh=null),dge(r.stateNode),qi(t,jn()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)s=e[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(CE)throw CE=!1,t=rD,rD=null,t;return kE&1&&t.tag!==0&&Ay(),i=t.pendingLanes,i&1?t===nD?cw++:(cw=0,nD=t):cw=0,df(),null}function Ay(){if(Rh!==null){var t=jQ(kE),e=ho.transition,r=pr;try{if(ho.transition=null,pr=16>t?16:t,Rh===null)var n=!1;else{if(t=Rh,Rh=null,kE=0,er&6)throw Error(He(331));var s=er;for(er|=4,lt=t.current;lt!==null;){var i=lt,o=i.child;if(lt.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(lt=u;lt!==null;){var d=lt;switch(d.tag){case 0:case 11:case 15:ow(8,d,i)}var h=d.child;if(h!==null)h.return=d,lt=h;else for(;lt!==null;){d=lt;var f=d.sibling,p=d.return;if(RZ(d),d===u){lt=null;break}if(f!==null){f.return=p,lt=f;break}lt=p}}}var g=i.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==null)}}lt=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,lt=o;else e:for(;lt!==null;){if(i=lt,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ow(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,lt=y;break e}lt=i.return}}var x=t.current;for(lt=x;lt!==null;){o=lt;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,lt=b;else e:for(o=x;lt!==null;){if(l=lt,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Vk(9,l)}}catch(j){dn(l,l.return,j)}if(l===o){lt=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,lt=w;break e}lt=l.return}}if(er=s,df(),lc&&typeof lc.onPostCommitFiberRoot=="function")try{lc.onPostCommitFiberRoot(Lk,t)}catch{}n=!0}return n}finally{pr=r,ho.transition=e}}return!1}function $U(t,e,r){e=gx(r,e),e=jZ(t,e,1),t=Bh(t,e,1),e=yi(),t!==null&&(Aj(t,1,e),qi(t,e))}function dn(t,e,r){if(t.tag===3)$U(t,t,r);else for(;e!==null;){if(e.tag===3){$U(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Uh===null||!Uh.has(n))){t=gx(r,t),t=SZ(e,t,1),e=Bh(e,t,1),t=yi(),e!==null&&(Aj(e,1,t),qi(e,t));break}}e=e.return}}function Fye(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=yi(),t.pingedLanes|=t.suspendedLanes&r,us===t&&(Ns&r)===r&&(Gn===4||Gn===3&&(Ns&130023424)===Ns&&500>jn()-jF?km(t,0):_F|=r),qi(t,e)}function WZ(t,e){e===0&&(t.mode&1?(e=BS,BS<<=1,!(BS&130023424)&&(BS=4194304)):e=1);var r=yi();t=Vu(t,e),t!==null&&(Aj(t,e,r),qi(t,r))}function $ye(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),WZ(t,r)}function Bye(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,s=t.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(He(314))}n!==null&&n.delete(e),WZ(t,r)}var VZ;VZ=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Wi.current)$i=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return $i=!1,Eye(t,e,r);$i=!!(t.flags&131072)}else $i=!1,Xr&&e.flags&1048576&&YQ(e,bE,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;cA(t,e),t=e.pendingProps;var s=hx(e,Xs.current);Ny(e,r),s=gF(null,e,n,t,s,r);var i=yF();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Vi(n)?(i=!0,vE(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,dF(e),s.updater=Wk,e.stateNode=s,s._reactInternals=e,VM(e,n,t,r),e=KM(null,e,n,!0,i,r)):(e.tag=0,Xr&&i&&sF(e),hi(null,e,s,r),e=e.child),e;case 16:n=e.elementType;e:{switch(cA(t,e),t=e.pendingProps,s=n._init,n=s(n._payload),e.type=n,s=e.tag=zye(n),t=Do(n,t),s){case 0:e=GM(null,e,n,t,r);break e;case 1:e=kU(null,e,n,t,r);break e;case 11:e=EU(null,e,n,t,r);break e;case 14:e=CU(null,e,n,Do(n.type,t),r);break e}throw Error(He(306,n,""))}return e;case 0:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Do(n,s),GM(t,e,n,s,r);case 1:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Do(n,s),kU(t,e,n,s,r);case 3:e:{if(CZ(e),t===null)throw Error(He(387));n=e.pendingProps,i=e.memoizedState,s=i.element,tZ(t,e),jE(e,n,null,r);var o=e.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=gx(Error(He(423)),e),e=TU(t,e,n,r,s);break e}else if(n!==s){s=gx(Error(He(424)),e),e=TU(t,e,n,r,s);break e}else for(Ca=$h(e.stateNode.containerInfo.firstChild),Ta=e,Xr=!0,Zo=null,r=JQ(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(fx(),n===s){e=qu(t,e,r);break e}hi(t,e,n,r)}e=e.child}return e;case 5:return rZ(e),t===null&&zM(e),n=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,LM(n,s)?o=null:i!==null&&LM(n,i)&&(e.flags|=32),EZ(t,e),hi(t,e,o,r),e.child;case 6:return t===null&&zM(e),null;case 13:return kZ(t,e,r);case 4:return hF(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=px(e,null,n,r):hi(t,e,n,r),e.child;case 11:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Do(n,s),EU(t,e,n,s,r);case 7:return hi(t,e,e.pendingProps,r),e.child;case 8:return hi(t,e,e.pendingProps.children,r),e.child;case 12:return hi(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,kr(wE,n._currentValue),n._currentValue=o,i!==null)if(ll(i.value,o)){if(i.children===s.children&&!Wi.current){e=qu(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=Du(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),HM(i.return,r,e),l.lanes|=r;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(He(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),HM(o,r,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}hi(t,e,s.children,r),e=e.child}return e;case 9:return s=e.type,n=e.pendingProps.children,Ny(e,r),s=vo(s),n=n(s),e.flags|=1,hi(t,e,n,r),e.child;case 14:return n=e.type,s=Do(n,e.pendingProps),s=Do(n.type,s),CU(t,e,n,s,r);case 15:return NZ(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,s=e.pendingProps,s=e.elementType===n?s:Do(n,s),cA(t,e),e.tag=1,Vi(n)?(t=!0,vE(e)):t=!1,Ny(e,r),_Z(e,n,s),VM(e,n,s,r),KM(null,e,n,!0,t,r);case 19:return TZ(t,e,r);case 22:return AZ(t,e,r)}throw Error(He(156,e.tag))};function qZ(t,e){return xQ(t,e)}function Uye(t,e,r,n){this.tag=t,this.key=r,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 oo(t,e,r,n){return new Uye(t,e,r,n)}function EF(t){return t=t.prototype,!(!t||!t.isReactComponent)}function zye(t){if(typeof t=="function")return EF(t)?1:0;if(t!=null){if(t=t.$$typeof,t===q3)return 11;if(t===G3)return 14}return 2}function Hh(t,e){var r=t.alternate;return r===null?(r=oo(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function hA(t,e,r,n,s,i){var o=2;if(n=t,typeof t=="function")EF(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Qg:return Tm(r.children,s,i,e);case V3:o=8,s|=8;break;case mM:return t=oo(12,r,e,s|2),t.elementType=mM,t.lanes=i,t;case gM:return t=oo(13,r,e,s),t.elementType=gM,t.lanes=i,t;case yM:return t=oo(19,r,e,s),t.elementType=yM,t.lanes=i,t;case rQ:return Gk(r,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case eQ:o=10;break e;case tQ:o=9;break e;case q3:o=11;break e;case G3:o=14;break e;case Ad:o=16,n=null;break e}throw Error(He(130,t==null?t:typeof t,""))}return e=oo(o,r,e,s),e.elementType=t,e.type=n,e.lanes=i,e}function Tm(t,e,r,n){return t=oo(7,t,n,e),t.lanes=r,t}function Gk(t,e,r,n){return t=oo(22,t,n,e),t.elementType=rQ,t.lanes=r,t.stateNode={isHidden:!1},t}function PP(t,e,r){return t=oo(6,t,null,e),t.lanes=r,t}function OP(t,e,r){return e=oo(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Hye(t,e,r,n,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hP(0),this.expirationTimes=hP(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hP(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function CF(t,e,r,n,s,i,o,l,c){return t=new Hye(t,e,r,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=oo(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},dF(i),t}function Wye(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xg,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function GZ(t){if(!t)return Yh;t=t._reactInternals;e:{if(ig(t)!==t||t.tag!==1)throw Error(He(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Vi(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(He(171))}if(t.tag===1){var r=t.type;if(Vi(r))return GQ(t,r,e)}return e}function KZ(t,e,r,n,s,i,o,l,c){return t=CF(r,n,!0,t,s,i,o,l,c),t.context=GZ(null),r=t.current,n=yi(),s=zh(r),i=Du(n,s),i.callback=e??null,Bh(r,i,s),t.current.lanes=s,Aj(t,s,n),qi(t,n),t}function Kk(t,e,r,n){var s=e.current,i=yi(),o=zh(s);return r=GZ(r),e.context===null?e.context=r:e.pendingContext=r,e=Du(i,o),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=Bh(s,e,o),t!==null&&(il(t,s,o,i),aA(t,s,o)),o}function PE(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function BU(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function kF(t,e){BU(t,e),(t=t.alternate)&&BU(t,e)}function Vye(){return null}var YZ=typeof reportError=="function"?reportError:function(t){console.error(t)};function TF(t){this._internalRoot=t}Yk.prototype.render=TF.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(He(409));Kk(t,e,null,null)};Yk.prototype.unmount=TF.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;zm(function(){Kk(null,t,null,null)}),e[Wu]=null}};function Yk(t){this._internalRoot=t}Yk.prototype.unstable_scheduleHydration=function(t){if(t){var e=AQ();t={blockedOn:null,target:t,priority:e};for(var r=0;r<kd.length&&e!==0&&e<kd[r].priority;r++);kd.splice(r,0,t),r===0&&CQ(t)}};function PF(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Xk(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function UU(){}function qye(t,e,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=PE(o);i.call(u)}}var o=KZ(e,n,t,0,null,!1,!1,"",UU);return t._reactRootContainer=o,t[Wu]=o.current,Mw(t.nodeType===8?t.parentNode:t),zm(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=PE(c);l.call(u)}}var c=CF(t,0,!1,null,null,!1,!1,"",UU);return t._reactRootContainer=c,t[Wu]=c.current,Mw(t.nodeType===8?t.parentNode:t),zm(function(){Kk(e,c,r,n)}),c}function Qk(t,e,r,n,s){var i=r._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=PE(o);l.call(c)}}Kk(e,o,t,s)}else o=qye(r,e,t,s,n);return PE(o)}SQ=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=wb(e.pendingLanes);r!==0&&(X3(e,r|1),qi(e,jn()),!(er&6)&&(yx=jn()+500,df()))}break;case 13:zm(function(){var n=Vu(t,1);if(n!==null){var s=yi();il(n,t,1,s)}}),kF(t,1)}};Q3=function(t){if(t.tag===13){var e=Vu(t,134217728);if(e!==null){var r=yi();il(e,t,134217728,r)}kF(t,134217728)}};NQ=function(t){if(t.tag===13){var e=zh(t),r=Vu(t,e);if(r!==null){var n=yi();il(r,t,e,n)}kF(t,e)}};AQ=function(){return pr};EQ=function(t,e){var r=pr;try{return pr=t,e()}finally{pr=r}};EM=function(t,e,r){switch(e){case"input":if(bM(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var s=Uk(n);if(!s)throw Error(He(90));sQ(n),bM(n,s)}}}break;case"textarea":aQ(t,r);break;case"select":e=r.value,e!=null&&wy(t,!!r.multiple,e,!1)}};fQ=SF;pQ=zm;var Gye={usingClientEntryPoint:!1,Events:[Cj,ty,Uk,dQ,hQ,SF]},H0={findFiberByHostInstance:np,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Kye={bundleType:H0.bundleType,version:H0.version,rendererPackageName:H0.rendererPackageName,rendererConfig:H0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:sd.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=yQ(t),t===null?null:t.stateNode},findFiberByHostInstance:H0.findFiberByHostInstance||Vye,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 QS=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!QS.isDisabled&&QS.supportsFiber)try{Lk=QS.inject(Kye),lc=QS}catch{}}Ma.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gye;Ma.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!PF(e))throw Error(He(200));return Wye(t,e,null,r)};Ma.createRoot=function(t,e){if(!PF(t))throw Error(He(299));var r=!1,n="",s=YZ;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=CF(t,1,!1,null,null,r,!1,n,s),t[Wu]=e.current,Mw(t.nodeType===8?t.parentNode:t),new TF(e)};Ma.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(He(188)):(t=Object.keys(t).join(","),Error(He(268,t)));return t=yQ(e),t=t===null?null:t.stateNode,t};Ma.flushSync=function(t){return zm(t)};Ma.hydrate=function(t,e,r){if(!Xk(e))throw Error(He(200));return Qk(null,t,e,!0,r)};Ma.hydrateRoot=function(t,e,r){if(!PF(t))throw Error(He(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",o=YZ;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),e=KZ(e,null,t,1,r??null,s,!1,i,o),t[Wu]=e.current,Mw(t),n)for(t=0;t<n.length;t++)r=n[t],s=r._getVersion,s=s(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,s]:e.mutableSourceEagerHydrationData.push(r,s);return new Yk(e)};Ma.render=function(t,e,r){if(!Xk(e))throw Error(He(200));return Qk(null,t,e,!1,r)};Ma.unmountComponentAtNode=function(t){if(!Xk(t))throw Error(He(40));return t._reactRootContainer?(zm(function(){Qk(null,null,t,!1,function(){t._reactRootContainer=null,t[Wu]=null})}),!0):!1};Ma.unstable_batchedUpdates=SF;Ma.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!Xk(r))throw Error(He(200));if(t==null||t._reactInternals===void 0)throw Error(He(38));return Qk(t,e,r,!1,n)};Ma.version="18.3.1-next-f1338f8080-20240426";function XZ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(XZ)}catch(t){console.error(t)}}XZ(),XX.exports=Ma;var Nc=XX.exports;const QZ=qt(Nc);var ZZ,zU=Nc;ZZ=zU.createRoot,zU.hydrateRoot;var Yye=typeof Element<"u",Xye=typeof Map=="function",Qye=typeof Set=="function",Zye=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function fA(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var r,n,s;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!fA(t[n],e[n]))return!1;return!0}var i;if(Xye&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(i=t.entries();!(n=i.next()).done;)if(!e.has(n.value[0]))return!1;for(i=t.entries();!(n=i.next()).done;)if(!fA(n.value[1],e.get(n.value[0])))return!1;return!0}if(Qye&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(i=t.entries();!(n=i.next()).done;)if(!e.has(n.value[0]))return!1;return!0}if(Zye&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(t[n]!==e[n])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[n]))return!1;if(Yye&&t instanceof Element)return!1;for(n=r;n--!==0;)if(!((s[n]==="_owner"||s[n]==="__v"||s[n]==="__o")&&t.$$typeof)&&!fA(t[s[n]],e[s[n]]))return!1;return!0}return t!==t&&e!==e}var Jye=function(e,r){try{return fA(e,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const eve=qt(Jye);var tve=function(t,e,r,n,s,i,o,l){if(!t){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,n,s,i,o,l],d=0;c=new Error(e.replace(/%s/g,function(){return u[d++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},rve=tve;const HU=qt(rve);var nve=function(e,r,n,s){var i=n?n.call(s,e,r):void 0;if(i!==void 0)return!!i;if(e===r)return!0;if(typeof e!="object"||!e||typeof r!="object"||!r)return!1;var o=Object.keys(e),l=Object.keys(r);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(r),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var h=e[d],f=r[d];if(i=n?n.call(s,h,f,d):void 0,i===!1||i===void 0&&h!==f)return!1}return!0};const sve=qt(nve);var JZ=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(JZ||{}),IP={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},WU=Object.values(JZ),OF={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ive=Object.entries(OF).reduce((t,[e,r])=>(t[r]=e,t),{}),rl="data-rh",Ey={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Cy=(t,e)=>{for(let r=t.length-1;r>=0;r-=1){const n=t[r];if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}return null},ave=t=>{let e=Cy(t,"title");const r=Cy(t,Ey.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),r&&e)return r.replace(/%s/g,()=>e);const n=Cy(t,Ey.DEFAULT_TITLE);return e||n||void 0},ove=t=>Cy(t,Ey.ON_CHANGE_CLIENT_STATE)||(()=>{}),RP=(t,e)=>e.filter(r=>typeof r[t]<"u").map(r=>r[t]).reduce((r,n)=>({...r,...n}),{}),lve=(t,e)=>e.filter(r=>typeof r.base<"u").map(r=>r.base).reverse().reduce((r,n)=>{if(!r.length){const s=Object.keys(n);for(let i=0;i<s.length;i+=1){const l=s[i].toLowerCase();if(t.indexOf(l)!==-1&&n[l])return r.concat(n)}}return r},[]),cve=t=>console&&typeof console.warn=="function"&&console.warn(t),W0=(t,e,r)=>{const n={};return r.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&cve(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,i)=>{const o={};i.filter(c=>{let u;const d=Object.keys(c);for(let f=0;f<d.length;f+=1){const p=d[f],g=p.toLowerCase();e.indexOf(g)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(g==="rel"&&c[g].toLowerCase()==="stylesheet")&&(u=g),e.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(u=p)}if(!u||!c[u])return!1;const h=c[u].toLowerCase();return n[u]||(n[u]={}),o[u]||(o[u]={}),n[u][h]?!1:(o[u][h]=!0,!0)}).reverse().forEach(c=>s.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const u=l[c],d={...n[u],...o[u]};n[u]=d}return s},[]).reverse()},uve=(t,e)=>{if(Array.isArray(t)&&t.length){for(let r=0;r<t.length;r+=1)if(t[r][e])return!0}return!1},dve=t=>({baseTag:lve(["href"],t),bodyAttributes:RP("bodyAttributes",t),defer:Cy(t,Ey.DEFER),encode:Cy(t,Ey.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:RP("htmlAttributes",t),linkTags:W0("link",["rel","href"],t),metaTags:W0("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:W0("noscript",["innerHTML"],t),onChangeClientState:ove(t),scriptTags:W0("script",["src","innerHTML"],t),styleTags:W0("style",["cssText"],t),title:ave(t),titleAttributes:RP("titleAttributes",t),prioritizeSeoTags:uve(t,Ey.PRIORITIZE_SEO_TAGS)}),eJ=t=>Array.isArray(t)?t.join(""):t,hve=(t,e)=>{const r=Object.keys(t);for(let n=0;n<r.length;n+=1)if(e[r[n]]&&e[r[n]].includes(t[r[n]]))return!0;return!1},MP=(t,e)=>Array.isArray(t)?t.reduce((r,n)=>(hve(n,e)?r.priority.push(n):r.default.push(n),r),{priority:[],default:[]}):{default:t,priority:[]},VU=(t,e)=>({...t,[e]:void 0}),fve=["noscript","script","style"],aD=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),tJ=t=>Object.keys(t).reduce((e,r)=>{const n=typeof t[r]<"u"?`${r}="${t[r]}"`:`${r}`;return e?`${e} ${n}`:n},""),pve=(t,e,r,n)=>{const s=tJ(r),i=eJ(e);return s?`<${t} ${rl}="true" ${s}>${aD(i,n)}</${t}>`:`<${t} ${rl}="true">${aD(i,n)}</${t}>`},mve=(t,e,r=!0)=>e.reduce((n,s)=>{const i=s,o=Object.keys(i).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const h=typeof i[d]>"u"?d:`${d}="${aD(i[d],r)}"`;return u?`${u} ${h}`:h},""),l=i.innerHTML||i.cssText||"",c=fve.indexOf(t)===-1;return`${n}<${t} ${rl}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),rJ=(t,e={})=>Object.keys(t).reduce((r,n)=>{const s=OF[n];return r[s||n]=t[n],r},e),gve=(t,e,r)=>{const n={key:e,[rl]:!0},s=rJ(r,n);return[me.createElement("title",s,e)]},pA=(t,e)=>e.map((r,n)=>{const s={key:n,[rl]:!0};return Object.keys(r).forEach(i=>{const l=OF[i]||i;if(l==="innerHTML"||l==="cssText"){const c=r.innerHTML||r.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=r[i]}),me.createElement(t,s)}),Wa=(t,e,r=!0)=>{switch(t){case"title":return{toComponent:()=>gve(t,e.title,e.titleAttributes),toString:()=>pve(t,e.title,e.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>rJ(e),toString:()=>tJ(e)};default:return{toComponent:()=>pA(t,e),toString:()=>mve(t,e,r)}}},yve=({metaTags:t,linkTags:e,scriptTags:r,encode:n})=>{const s=MP(t,IP.meta),i=MP(e,IP.link),o=MP(r,IP.script);return{priorityMethods:{toComponent:()=>[...pA("meta",s.priority),...pA("link",i.priority),...pA("script",o.priority)],toString:()=>`${Wa("meta",s.priority,n)} ${Wa("link",i.priority,n)} ${Wa("script",o.priority,n)}`},metaTags:s.default,linkTags:i.default,scriptTags:o.default}},vve=t=>{const{baseTag:e,bodyAttributes:r,encode:n=!0,htmlAttributes:s,noscriptTags:i,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:u}=t;let{linkTags:d,metaTags:h,scriptTags:f}=t,p={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:p,linkTags:d,metaTags:h,scriptTags:f}=yve(t)),{priority:p,base:Wa("base",e,n),bodyAttributes:Wa("bodyAttributes",r,n),htmlAttributes:Wa("htmlAttributes",s,n),link:Wa("link",d,n),meta:Wa("meta",h,n),noscript:Wa("noscript",i,n),script:Wa("script",f,n),style:Wa("style",o,n),title:Wa("title",{title:l,titleAttributes:c},n)}},oD=vve,ZS=[],nJ=!!(typeof window<"u"&&window.document&&window.document.createElement),lD=class{constructor(t,e){Le(this,"instances",[]);Le(this,"canUseDOM",nJ);Le(this,"context");Le(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?ZS:this.instances,add:t=>{(this.canUseDOM?ZS:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?ZS:this.instances).indexOf(t);(this.canUseDOM?ZS:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=oD({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},xve={},sJ=me.createContext(xve),pp,iJ=(pp=class extends S.Component{constructor(r){super(r);Le(this,"helmetData");this.helmetData=new lD(this.props.context||{},pp.canUseDOM)}render(){return me.createElement(sJ.Provider,{value:this.helmetData.value},this.props.children)}},Le(pp,"canUseDOM",nJ),pp),wg=(t,e)=>{const r=document.head||document.querySelector("head"),n=r.querySelectorAll(`${t}[${rl}]`),s=[].slice.call(n),i=[];let o;return e&&e.length&&e.forEach(l=>{const c=document.createElement(t);for(const u in l)if(Object.prototype.hasOwnProperty.call(l,u))if(u==="innerHTML")c.innerHTML=l.innerHTML;else if(u==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const d=u,h=typeof l[d]>"u"?"":l[d];c.setAttribute(u,h)}c.setAttribute(rl,"true"),s.some((u,d)=>(o=d,c.isEqualNode(u)))?s.splice(o,1):i.push(c)}),s.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),i.forEach(l=>r.appendChild(l)),{oldTags:s,newTags:i}},cD=(t,e)=>{const r=document.getElementsByTagName(t)[0];if(!r)return;const n=r.getAttribute(rl),s=n?n.split(","):[],i=[...s],o=Object.keys(e);for(const l of o){const c=e[l]||"";r.getAttribute(l)!==c&&r.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=i.indexOf(l);u!==-1&&i.splice(u,1)}for(let l=i.length-1;l>=0;l-=1)r.removeAttribute(i[l]);s.length===i.length?r.removeAttribute(rl):r.getAttribute(rl)!==o.join(",")&&r.setAttribute(rl,o.join(","))},bve=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=eJ(t)),cD("title",e)},qU=(t,e)=>{const{baseTag:r,bodyAttributes:n,htmlAttributes:s,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:d,title:h,titleAttributes:f}=t;cD("body",n),cD("html",s),bve(h,f);const p={baseTag:wg("base",r),linkTags:wg("link",i),metaTags:wg("meta",o),noscriptTags:wg("noscript",l),scriptTags:wg("script",u),styleTags:wg("style",d)},g={},m={};Object.keys(p).forEach(v=>{const{newTags:y,oldTags:x}=p[v];y.length&&(g[v]=y),x.length&&(m[v]=p[v].oldTags)}),e&&e(),c(t,g,m)},V0=null,wve=t=>{V0&&cancelAnimationFrame(V0),t.defer?V0=requestAnimationFrame(()=>{qU(t,()=>{V0=null})}):(qU(t),V0=null)},_ve=wve,GU=class extends S.Component{constructor(){super(...arguments);Le(this,"rendered",!1)}shouldComponentUpdate(e){return!sve(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:r}=this.props.context;let n=null;const s=dve(e.get().map(i=>{const o={...i.props};return delete o.context,o}));iJ.canUseDOM?_ve(s):oD&&(n=oD(s)),r(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},fM,jve=(fM=class extends S.Component{shouldComponentUpdate(t){return!eve(VU(this.props,"helmetData"),VU(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,r,n){return{...e,[t.type]:[...e[t.type]||[],{...r,...this.mapNestedChildrenToProps(t,n)}]}}mapObjectTypeChildren(t,e,r,n){switch(t.type){case"title":return{...e,[t.type]:n,titleAttributes:{...r}};case"body":return{...e,bodyAttributes:{...r}};case"html":return{...e,htmlAttributes:{...r}};default:return{...e,[t.type]:{...r}}}}mapArrayTypeChildrenToProps(t,e){let r={...e};return Object.keys(t).forEach(n=>{r={...r,[n]:t[n]}}),r}warnOnInvalidChildren(t,e){return HU(WU.some(r=>t.type===r),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${WU.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),HU(!e||typeof e=="string"||Array.isArray(e)&&!e.some(r=>typeof r!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let r={};return me.Children.forEach(t,n=>{if(!n||!n.props)return;const{children:s,...i}=n.props,o=Object.keys(i).reduce((c,u)=>(c[ive[u]||u]=i[u],c),{});let{type:l}=n;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(n,s),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(n,r,o,s);break;default:e=this.mapObjectTypeChildren(n,e,o,s);break}}),this.mapArrayTypeChildrenToProps(r,e)}render(){const{children:t,...e}=this.props;let r={...e},{helmetData:n}=e;if(t&&(r=this.mapChildrenToProps(t,r)),n&&!(n instanceof lD)){const s=n;n=new lD(s.context,!0),delete r.helmetData}return n?me.createElement(GU,{...r,context:n.value}):me.createElement(sJ.Consumer,null,s=>me.createElement(GU,{...r,context:s}))}},Le(fM,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),fM);const Sve=1,Nve=1e6;let DP=0;function Ave(){return DP=(DP+1)%Number.MAX_SAFE_INTEGER,DP.toString()}const LP=new Map,KU=t=>{if(LP.has(t))return;const e=setTimeout(()=>{LP.delete(t),uw({type:"REMOVE_TOAST",toastId:t})},Nve);LP.set(t,e)},Eve=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Sve)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?KU(r):t.toasts.forEach(n=>{KU(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},mA=[];let gA={toasts:[]};function uw(t){gA=Eve(gA,t),mA.forEach(e=>{e(gA)})}function jb({...t}){const e=Ave(),r=s=>uw({type:"UPDATE_TOAST",toast:{...s,id:e}}),n=()=>uw({type:"DISMISS_TOAST",toastId:e});return uw({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||n()}}}),{id:e,dismiss:n,update:r}}function vn(){const[t,e]=S.useState(gA);return S.useEffect(()=>(mA.push(e),()=>{const r=mA.indexOf(e);r>-1&&mA.splice(r,1)}),[t]),{...t,toast:jb,dismiss:r=>uw({type:"DISMISS_TOAST",toastId:r})}}function ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function YU(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Zk(...t){return e=>{let r=!1;const n=t.map(s=>{const i=YU(s,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():YU(t[s],null)}}}}function jt(...t){return S.useCallback(Zk(...t),t)}function Cve(t,e){const r=S.createContext(e),n=i=>{const{children:o,...l}=i,c=S.useMemo(()=>l,Object.values(l));return a.jsx(r.Provider,{value:c,children:o})};n.displayName=t+"Provider";function s(i){const o=S.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,s]}function Ln(t,e=[]){let r=[];function n(i,o){const l=S.createContext(o),c=r.length;r=[...r,o];const u=h=>{var y;const{scope:f,children:p,...g}=h,m=((y=f==null?void 0:f[t])==null?void 0:y[c])||l,v=S.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})};u.displayName=i+"Provider";function d(h,f){var m;const p=((m=f==null?void 0:f[t])==null?void 0:m[c])||l,g=S.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=r.map(o=>S.createContext(o));return function(l){const c=(l==null?void 0:l[t])||i;return S.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[n,kve(s,...e)]}function kve(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...l,...h}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Xh(t){const e=Pve(t),r=S.forwardRef((n,s)=>{const{children:i,...o}=n,l=S.Children.toArray(i),c=l.find(Ove);if(c){const u=c.props.children,d=l.map(h=>h===c?S.Children.count(u)>1?S.Children.only(null):S.isValidElement(u)?u.props.children:null:h);return a.jsx(e,{...o,ref:s,children:S.isValidElement(u)?S.cloneElement(u,void 0,d):null})}return a.jsx(e,{...o,ref:s,children:i})});return r.displayName=`${t}.Slot`,r}var Tve=Xh("Slot");function Pve(t){const e=S.forwardRef((r,n)=>{const{children:s,...i}=r;if(S.isValidElement(s)){const o=Rve(s),l=Ive(i,s.props);return s.type!==S.Fragment&&(l.ref=n?Zk(n,o):o),S.cloneElement(s,l)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var aJ=Symbol("radix.slottable");function oJ(t){const e=({children:r})=>a.jsx(a.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=aJ,e}function Ove(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aJ}function Ive(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function Rve(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function Tj(t){const e=t+"CollectionProvider",[r,n]=Ln(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:v,children:y}=m,x=me.useRef(null),b=me.useRef(new Map).current;return a.jsx(s,{scope:v,itemMap:b,collectionRef:x,children:y})};o.displayName=e;const l=t+"CollectionSlot",c=Xh(l),u=me.forwardRef((m,v)=>{const{scope:y,children:x}=m,b=i(l,y),w=jt(v,b.collectionRef);return a.jsx(c,{ref:w,children:x})});u.displayName=l;const d=t+"CollectionItemSlot",h="data-radix-collection-item",f=Xh(d),p=me.forwardRef((m,v)=>{const{scope:y,children:x,...b}=m,w=me.useRef(null),j=jt(v,w),N=i(d,y);return me.useEffect(()=>(N.itemMap.set(w,{ref:w,...b}),()=>void N.itemMap.delete(w))),a.jsx(f,{[h]:"",ref:j,children:x})});p.displayName=d;function g(m){const v=i(t+"CollectionConsumer",m);return me.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((N,C)=>b.indexOf(N.ref.current)-b.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,n]}var Mve=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],et=Mve.reduce((t,e)=>{const r=Xh(`Primitive.${e}`),n=S.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function IF(t,e){t&&Nc.flushSync(()=>t.dispatchEvent(e))}function pn(t){const e=S.useRef(t);return S.useEffect(()=>{e.current=t}),S.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function Dve(t,e=globalThis==null?void 0:globalThis.document){const r=pn(t);S.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var Lve="DismissableLayer",uD="dismissableLayer.update",Fve="dismissableLayer.pointerDownOutside",$ve="dismissableLayer.focusOutside",XU,lJ=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ag=S.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=t,u=S.useContext(lJ),[d,h]=S.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=S.useState({}),g=jt(e,C=>h(C)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(v),x=d?m.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=y,j=Uve(C=>{const k=C.target,E=[...u.branches].some(M=>M.contains(k));!w||E||(s==null||s(C),o==null||o(C),C.defaultPrevented||l==null||l())},f),N=zve(C=>{const k=C.target;[...u.branches].some(M=>M.contains(k))||(i==null||i(C),o==null||o(C),C.defaultPrevented||l==null||l())},f);return Dve(C=>{x===u.layers.size-1&&(n==null||n(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},f),S.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(XU=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),QU(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=XU)}},[d,f,r,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),QU())},[d,u]),S.useEffect(()=>{const C=()=>p({});return document.addEventListener(uD,C),()=>document.removeEventListener(uD,C)},[]),a.jsx(et.div,{...c,ref:g,style:{pointerEvents:b?w?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,j.onPointerDownCapture)})});ag.displayName=Lve;var Bve="DismissableLayerBranch",cJ=S.forwardRef((t,e)=>{const r=S.useContext(lJ),n=S.useRef(null),s=jt(e,n);return S.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),a.jsx(et.div,{...t,ref:s})});cJ.displayName=Bve;function Uve(t,e=globalThis==null?void 0:globalThis.document){const r=pn(t),n=S.useRef(!1),s=S.useRef(()=>{});return S.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){uJ(Fve,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function zve(t,e=globalThis==null?void 0:globalThis.document){const r=pn(t),n=S.useRef(!1);return S.useEffect(()=>{const s=i=>{i.target&&!n.current&&uJ($ve,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function QU(){const t=new CustomEvent(uD);document.dispatchEvent(t)}function uJ(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?IF(s,i):s.dispatchEvent(i)}var Hve=ag,Wve=cJ,gn=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},Vve="Portal",n0=S.forwardRef((t,e)=>{var l;const{container:r,...n}=t,[s,i]=S.useState(!1);gn(()=>i(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?QZ.createPortal(a.jsx(et.div,{...n,ref:e}),o):null});n0.displayName=Vve;function qve(t,e){return S.useReducer((r,n)=>e[r][n]??r,t)}var Xn=t=>{const{present:e,children:r}=t,n=Gve(e),s=typeof r=="function"?r({present:n.isPresent}):S.Children.only(r),i=jt(n.ref,Kve(s));return typeof r=="function"||n.isPresent?S.cloneElement(s,{ref:i}):null};Xn.displayName="Presence";function Gve(t){const[e,r]=S.useState(),n=S.useRef(null),s=S.useRef(t),i=S.useRef("none"),o=t?"mounted":"unmounted",[l,c]=qve(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const u=JS(n.current);i.current=l==="mounted"?u:"none"},[l]),gn(()=>{const u=n.current,d=s.current;if(d!==t){const f=i.current,p=JS(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),gn(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=p=>{const m=JS(n.current).includes(p.animationName);if(p.target===e&&m&&(c("ANIMATION_END"),!s.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=p=>{p.target===e&&(i.current=JS(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:S.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function JS(t){return(t==null?void 0:t.animationName)||"none"}function Kve(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Yve=U3[" useInsertionEffect ".trim().toString()]||gn;function Ps({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[s,i,o]=Xve({defaultProp:e,onChange:r}),l=t!==void 0,c=l?t:s;{const d=S.useRef(t!==void 0);S.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=S.useCallback(d=>{var h;if(l){const f=Qve(d)?d(t):d;f!==t&&((h=o.current)==null||h.call(o,f))}else i(d)},[l,t,i,o]);return[c,u]}function Xve({defaultProp:t,onChange:e}){const[r,n]=S.useState(t),s=S.useRef(r),i=S.useRef(e);return Yve(()=>{i.current=e},[e]),S.useEffect(()=>{var o;s.current!==r&&((o=i.current)==null||o.call(i,r),s.current=r)},[r,s]),[r,n,i]}function Qve(t){return typeof t=="function"}var dJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Zve="VisuallyHidden",Jk=S.forwardRef((t,e)=>a.jsx(et.span,{...t,ref:e,style:{...dJ,...t.style}}));Jk.displayName=Zve;var Jve=Jk,RF="ToastProvider",[MF,exe,txe]=Tj("Toast"),[hJ,Qgt]=Ln("Toast",[txe]),[rxe,eT]=hJ(RF),fJ=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[l,c]=S.useState(null),[u,d]=S.useState(0),h=S.useRef(!1),f=S.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${RF}\`. Expected non-empty \`string\`.`),a.jsx(MF.Provider,{scope:e,children:a.jsx(rxe,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:S.useCallback(()=>d(p=>p+1),[]),onToastRemove:S.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};fJ.displayName=RF;var pJ="ToastViewport",nxe=["F8"],dD="toast.viewportPause",hD="toast.viewportResume",mJ=S.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=nxe,label:s="Notifications ({hotkey})",...i}=t,o=eT(pJ,r),l=exe(r),c=S.useRef(null),u=S.useRef(null),d=S.useRef(null),h=S.useRef(null),f=jt(e,h,o.onViewportChange),p=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;S.useEffect(()=>{const v=y=>{var b;n.length!==0&&n.every(w=>y[w]||y.code===w)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]),S.useEffect(()=>{const v=c.current,y=h.current;if(g&&v&&y){const x=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(dD);y.dispatchEvent(N),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(hD);y.dispatchEvent(N),o.isClosePausedRef.current=!1}},w=N=>{!v.contains(N.relatedTarget)&&b()},j=()=>{v.contains(document.activeElement)||b()};return v.addEventListener("focusin",x),v.addEventListener("focusout",w),v.addEventListener("pointermove",x),v.addEventListener("pointerleave",j),window.addEventListener("blur",x),window.addEventListener("focus",b),()=>{v.removeEventListener("focusin",x),v.removeEventListener("focusout",w),v.removeEventListener("pointermove",x),v.removeEventListener("pointerleave",j),window.removeEventListener("blur",x),window.removeEventListener("focus",b)}}},[g,o.isClosePausedRef]);const m=S.useCallback(({tabbingDirection:v})=>{const x=l().map(b=>{const w=b.ref.current,j=[w,...gxe(w)];return v==="forwards"?j:j.reverse()});return(v==="forwards"?x.reverse():x).flat()},[l]);return S.useEffect(()=>{const v=h.current;if(v){const y=x=>{var j,N,C;const b=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!b){const k=document.activeElement,E=x.shiftKey;if(x.target===v&&E){(j=u.current)==null||j.focus();return}const I=m({tabbingDirection:E?"backwards":"forwards"}),q=I.findIndex(A=>A===k);FP(I.slice(q+1))?x.preventDefault():E?(N=u.current)==null||N.focus():(C=d.current)==null||C.focus()}};return v.addEventListener("keydown",y),()=>v.removeEventListener("keydown",y)}},[l,m]),a.jsxs(Wve,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&a.jsx(fD,{ref:u,onFocusFromOutsideViewport:()=>{const v=m({tabbingDirection:"forwards"});FP(v)}}),a.jsx(MF.Slot,{scope:r,children:a.jsx(et.ol,{tabIndex:-1,...i,ref:f})}),g&&a.jsx(fD,{ref:d,onFocusFromOutsideViewport:()=>{const v=m({tabbingDirection:"backwards"});FP(v)}})]})});mJ.displayName=pJ;var gJ="ToastFocusProxy",fD=S.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,i=eT(gJ,r);return a.jsx(Jk,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&n()}})});fD.displayName=gJ;var Pj="Toast",sxe="toast.swipeStart",ixe="toast.swipeMove",axe="toast.swipeCancel",oxe="toast.swipeEnd",yJ=S.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...o}=t,[l,c]=Ps({prop:n,defaultProp:s??!0,onChange:i,caller:Pj});return a.jsx(Xn,{present:r||l,children:a.jsx(uxe,{open:l,...o,ref:e,onClose:()=>c(!1),onPause:pn(t.onPause),onResume:pn(t.onResume),onSwipeStart:ze(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ze(t.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ze(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ze(t.onSwipeEnd,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});yJ.displayName=Pj;var[lxe,cxe]=hJ(Pj,{onClose(){}}),uxe=S.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...g}=t,m=eT(Pj,r),[v,y]=S.useState(null),x=jt(e,A=>y(A)),b=S.useRef(null),w=S.useRef(null),j=s||m.duration,N=S.useRef(0),C=S.useRef(j),k=S.useRef(0),{onToastAdd:E,onToastRemove:M}=m,z=pn(()=>{var U;(v==null?void 0:v.contains(document.activeElement))&&((U=m.viewport)==null||U.focus()),o()}),I=S.useCallback(A=>{!A||A===1/0||(window.clearTimeout(k.current),N.current=new Date().getTime(),k.current=window.setTimeout(z,A))},[z]);S.useEffect(()=>{const A=m.viewport;if(A){const U=()=>{I(C.current),u==null||u()},K=()=>{const G=new Date().getTime()-N.current;C.current=C.current-G,window.clearTimeout(k.current),c==null||c()};return A.addEventListener(dD,K),A.addEventListener(hD,U),()=>{A.removeEventListener(dD,K),A.removeEventListener(hD,U)}}},[m.viewport,j,c,u,I]),S.useEffect(()=>{i&&!m.isClosePausedRef.current&&I(j)},[i,j,m.isClosePausedRef,I]),S.useEffect(()=>(E(),()=>M()),[E,M]);const q=S.useMemo(()=>v?SJ(v):null,[v]);return m.viewport?a.jsxs(a.Fragment,{children:[q&&a.jsx(dxe,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:q}),a.jsx(lxe,{scope:r,onClose:z,children:Nc.createPortal(a.jsx(MF.ItemSlot,{scope:r,children:a.jsx(Hve,{asChild:!0,onEscapeKeyDown:ze(l,()=>{m.isFocusedToastEscapeKeyDownRef.current||z(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(et.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...g,ref:x,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ze(t.onKeyDown,A=>{A.key==="Escape"&&(l==null||l(A.nativeEvent),A.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,z()))}),onPointerDown:ze(t.onPointerDown,A=>{A.button===0&&(b.current={x:A.clientX,y:A.clientY})}),onPointerMove:ze(t.onPointerMove,A=>{if(!b.current)return;const U=A.clientX-b.current.x,K=A.clientY-b.current.y,G=!!w.current,Y=["left","right"].includes(m.swipeDirection),H=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,$=Y?H(0,U):0,L=Y?0:H(0,K),F=A.pointerType==="touch"?10:2,W={x:$,y:L},X={originalEvent:A,delta:W};G?(w.current=W,eN(ixe,h,X,{discrete:!1})):ZU(W,m.swipeDirection,F)?(w.current=W,eN(sxe,d,X,{discrete:!1}),A.target.setPointerCapture(A.pointerId)):(Math.abs(U)>F||Math.abs(K)>F)&&(b.current=null)}),onPointerUp:ze(t.onPointerUp,A=>{const U=w.current,K=A.target;if(K.hasPointerCapture(A.pointerId)&&K.releasePointerCapture(A.pointerId),w.current=null,b.current=null,U){const G=A.currentTarget,Y={originalEvent:A,delta:U};ZU(U,m.swipeDirection,m.swipeThreshold)?eN(oxe,p,Y,{discrete:!0}):eN(axe,f,Y,{discrete:!0}),G.addEventListener("click",H=>H.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),dxe=t=>{const{__scopeToast:e,children:r,...n}=t,s=eT(Pj,e),[i,o]=S.useState(!1),[l,c]=S.useState(!1);return pxe(()=>o(!0)),S.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(n0,{asChild:!0,children:a.jsx(Jk,{...n,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",r]})})})},hxe="ToastTitle",vJ=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});vJ.displayName=hxe;var fxe="ToastDescription",xJ=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});xJ.displayName=fxe;var bJ="ToastAction",wJ=S.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?a.jsx(jJ,{altText:r,asChild:!0,children:a.jsx(DF,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${bJ}\`. Expected non-empty \`string\`.`),null)});wJ.displayName=bJ;var _J="ToastClose",DF=S.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=cxe(_J,r);return a.jsx(jJ,{asChild:!0,children:a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,s.onClose)})})});DF.displayName=_J;var jJ=S.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return a.jsx(et.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function SJ(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),mxe(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...SJ(n))}}),e}function eN(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?IF(s,i):s.dispatchEvent(i)}var ZU=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),i=n>s;return e==="left"||e==="right"?i&&n>r:!i&&s>r};function pxe(t=()=>{}){const e=pn(t);gn(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function mxe(t){return t.nodeType===t.ELEMENT_NODE}function gxe(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function FP(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var yxe=fJ,NJ=mJ,AJ=yJ,EJ=vJ,CJ=xJ,kJ=wJ,TJ=DF;function PJ(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=PJ(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Jt(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=PJ(t))&&(n&&(n+=" "),n+=e);return n}const JU=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ez=Jt,id=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ez(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],h=i==null?void 0:i[u];if(d===null)return null;const f=JU(d)||JU(h);return s[u][f]}),l=r&&Object.entries(r).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(g=>{let[m,v]=g;return Array.isArray(v)?v.includes({...i,...l}[m]):{...i,...l}[m]===v})?[...u,h,f]:u},[]);return ez(t,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vxe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OJ=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var xxe={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"};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bxe=S.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...l},c)=>S.createElement("svg",{ref:c,...xxe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:OJ("lucide",s),...l},[...o.map(([u,d])=>S.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Re=(t,e)=>{const r=S.forwardRef(({className:n,...s},i)=>S.createElement(bxe,{ref:i,iconNode:e,className:OJ(`lucide-${vxe(t)}`,n),...s}));return r.displayName=`${t}`,r};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tz=Re("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wxe=Re("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _xe=Re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uc=Re("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xi=Re("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rz=Re("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nz=Re("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jxe=Re("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sxe=Re("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sz=Re("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iz=Re("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vx=Re("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gs=Re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ad=Re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nxe=Re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IJ=Re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RJ=Re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ww=Re("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pl=Re("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dc=Re("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Axe=Re("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Exe=Re("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cxe=Re("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pD=Re("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kxe=Re("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $P=Re("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s0=Re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Txe=Re("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MJ=Re("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yn=Re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pxe=Re("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oxe=Re("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fo=Re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i0=Re("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OE=Re("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yi=Re("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const az=Re("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ixe=Re("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ir=Re("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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rxe=Re("FileType",[["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:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mxe=Re("FileX",[["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:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dxe=Re("File",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lxe=Re("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IE=Re("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DJ=Re("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fxe=Re("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $xe=Re("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bxe=Re("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oj=Re("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hm=Re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uxe=Re("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zxe=Re("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hf=Re("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Et=Re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ks=Re("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LJ=Re("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hxe=Re("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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FJ=Re("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wxe=Re("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vxe=Re("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LF=Re("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qxe=Re("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gxe=Re("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kxe=Re("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wm=Re("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yxe=Re("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $J=Re("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xxe=Re("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qxe=Re("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zxe=Re("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jxe=Re("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e0e=Re("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BJ=Re("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RE=Re("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UJ=Re("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zJ=Re("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sc=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t0e=Re("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a0=Re("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const r0e=Re("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HJ=Re("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const n0e=Re("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mD=Re("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WJ=Re("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const al=Re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VJ=Re("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FF=Re("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s0e=Re("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jo=Re("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i0e=Re("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gD=Re("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a0e=Re("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o0e=Re("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const As=Re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l0e=Re("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c0e=Re("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pa=Re("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qh=Re("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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ij=Re("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qJ=Re("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const u0e=Re("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d0e=Re("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rs=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const h0e=Re("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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const f0e=Re("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"}]]),$F="-",p0e=t=>{const e=g0e(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{const l=o.split($F);return l[0]===""&&l.length!==1&&l.shift(),GJ(l,e)||m0e(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},GJ=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),s=n?GJ(t.slice(1),n):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join($F);return(o=e.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},oz=/^\[(.+)\]$/,m0e=t=>{if(oz.test(t)){const e=oz.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},g0e=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return v0e(Object.entries(t.classGroups),r).forEach(([i,o])=>{yD(o,n,i,e)}),n},yD=(t,e,r,n)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:lz(e,s);i.classGroupId=r;return}if(typeof s=="function"){if(y0e(s)){yD(s(n),e,r,n);return}e.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{yD(o,lz(e,i),r,n)})})},lz=(t,e)=>{let r=t;return e.split($F).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},y0e=t=>t.isThemeGetter,v0e=(t,e)=>e?t.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[e+o,l])):i);return[r,s]}):t,x0e=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},KJ="!",b0e=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,s=e[0],i=e.length,o=l=>{const c=[];let u=0,d=0,h;for(let v=0;v<l.length;v++){let y=l[v];if(u===0){if(y===s&&(n||l.slice(v,v+i)===e)){c.push(l.slice(d,v)),d=v+i;continue}if(y==="/"){h=v;continue}}y==="["?u++:y==="]"&&u--}const f=c.length===0?l:l.substring(d),p=f.startsWith(KJ),g=p?f.substring(1):f,m=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return r?l=>r({className:l,parseClassName:o}):o},w0e=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},_0e=t=>({cache:x0e(t.cacheSize),parseClassName:b0e(t),...p0e(t)}),j0e=/\s+/,S0e=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(j0e);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=r(u);let g=!!p,m=n(g?f.substring(0,p):f);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=n(f),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const v=w0e(d).join(":"),y=h?v+KJ:v,x=y+m;if(i.includes(x))continue;i.push(x);const b=s(m,g);for(let w=0;w<b.length;++w){const j=b[w];i.push(y+j)}l=u+(l.length>0?" "+l:l)}return l};function N0e(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=YJ(e))&&(n&&(n+=" "),n+=r);return n}const YJ=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=YJ(t[n]))&&(r&&(r+=" "),r+=e);return r};function A0e(t,...e){let r,n,s,i=o;function o(c){const u=e.reduce((d,h)=>h(d),t());return r=_0e(u),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=S0e(c,r);return s(c,d),d}return function(){return i(N0e.apply(null,arguments))}}const Lr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},XJ=/^\[(?:([a-z-]+):)?(.+)\]$/i,E0e=/^\d+\/\d+$/,C0e=new Set(["px","full","screen"]),k0e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,T0e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,P0e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,O0e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I0e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oc=t=>ky(t)||C0e.has(t)||E0e.test(t),pd=t=>o0(t,"length",U0e),ky=t=>!!t&&!Number.isNaN(Number(t)),BP=t=>o0(t,"number",ky),q0=t=>!!t&&Number.isInteger(Number(t)),R0e=t=>t.endsWith("%")&&ky(t.slice(0,-1)),Rt=t=>XJ.test(t),md=t=>k0e.test(t),M0e=new Set(["length","size","percentage"]),D0e=t=>o0(t,M0e,QJ),L0e=t=>o0(t,"position",QJ),F0e=new Set(["image","url"]),$0e=t=>o0(t,F0e,H0e),B0e=t=>o0(t,"",z0e),G0=()=>!0,o0=(t,e,r)=>{const n=XJ.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},U0e=t=>T0e.test(t)&&!P0e.test(t),QJ=()=>!1,z0e=t=>O0e.test(t),H0e=t=>I0e.test(t),W0e=()=>{const t=Lr("colors"),e=Lr("spacing"),r=Lr("blur"),n=Lr("brightness"),s=Lr("borderColor"),i=Lr("borderRadius"),o=Lr("borderSpacing"),l=Lr("borderWidth"),c=Lr("contrast"),u=Lr("grayscale"),d=Lr("hueRotate"),h=Lr("invert"),f=Lr("gap"),p=Lr("gradientColorStops"),g=Lr("gradientColorStopPositions"),m=Lr("inset"),v=Lr("margin"),y=Lr("opacity"),x=Lr("padding"),b=Lr("saturate"),w=Lr("scale"),j=Lr("sepia"),N=Lr("skew"),C=Lr("space"),k=Lr("translate"),E=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",Rt,e],I=()=>[Rt,e],q=()=>["",Oc,pd],A=()=>["auto",ky,Rt],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",Rt],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[ky,Rt];return{cacheSize:500,separator:":",theme:{colors:[G0],spacing:[Oc,pd],blur:["none","",md,Rt],brightness:L(),borderColor:[t],borderRadius:["none","","full",md,Rt],borderSpacing:I(),borderWidth:q(),contrast:L(),grayscale:H(),hueRotate:L(),invert:H(),gap:I(),gradientColorStops:[t],gradientColorStopPositions:[R0e,pd],inset:z(),margin:z(),opacity:L(),padding:I(),saturate:L(),scale:L(),sepia:H(),skew:L(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",Rt]}],container:["container"],columns:[{columns:[md]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),Rt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",q0,Rt]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Rt]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",q0,Rt]}],"grid-cols":[{"grid-cols":[G0]}],"col-start-end":[{col:["auto",{span:["full",q0,Rt]},Rt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[G0]}],"row-start-end":[{row:["auto",{span:[q0,Rt]},Rt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Rt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Rt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Rt,e]}],"min-w":[{"min-w":[Rt,e,"min","max","fit"]}],"max-w":[{"max-w":[Rt,e,"none","full","min","max","fit","prose",{screen:[md]},md]}],h:[{h:[Rt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Rt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Rt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Rt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",md,pd]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",BP]}],"font-family":[{font:[G0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Rt]}],"line-clamp":[{"line-clamp":["none",ky,BP]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Oc,Rt]}],"list-image":[{"list-image":["none",Rt]}],"list-style-type":[{list:["none","disc","decimal",Rt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Oc,pd]}],"underline-offset":[{"underline-offset":["auto",Oc,Rt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Rt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),L0e]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",D0e]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$0e]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:K()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[Oc,Rt]}],"outline-w":[{outline:[Oc,pd]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Oc,pd]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",md,B0e]}],"shadow-color":[{shadow:[G0]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",md,Rt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Rt]}],duration:[{duration:L()}],ease:[{ease:["linear","in","out","in-out",Rt]}],delay:[{delay:L()}],animate:[{animate:["none","spin","ping","pulse","bounce",Rt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[q0,Rt]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Rt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Rt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Rt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Oc,pd,BP]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},V0e=A0e(W0e);function Oe(...t){return V0e(Jt(t))}const q0e=yxe,ZJ=S.forwardRef(({className:t,...e},r)=>a.jsx(NJ,{ref:r,className:Oe("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));ZJ.displayName=NJ.displayName;const G0e=id("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),JJ=S.forwardRef(({className:t,variant:e,...r},n)=>a.jsx(AJ,{ref:n,className:Oe(G0e({variant:e}),t),...r}));JJ.displayName=AJ.displayName;const K0e=S.forwardRef(({className:t,...e},r)=>a.jsx(kJ,{ref:r,className:Oe("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));K0e.displayName=kJ.displayName;const eee=S.forwardRef(({className:t,...e},r)=>a.jsx(TJ,{ref:r,className:Oe("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Rs,{className:"h-4 w-4"})}));eee.displayName=TJ.displayName;const tee=S.forwardRef(({className:t,...e},r)=>a.jsx(EJ,{ref:r,className:Oe("text-sm font-semibold",t),...e}));tee.displayName=EJ.displayName;const ree=S.forwardRef(({className:t,...e},r)=>a.jsx(CJ,{ref:r,className:Oe("text-sm opacity-90",t),...e}));ree.displayName=CJ.displayName;function Y0e(){const{toasts:t}=vn();return a.jsxs(q0e,{children:[t.map(function({id:e,title:r,description:n,action:s,...i}){return a.jsxs(JJ,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[r&&a.jsx(tee,{children:r}),n&&a.jsx(ree,{children:n})]}),s,a.jsx(eee,{})]},e)}),a.jsx(ZJ,{})]})}var cz=["light","dark"],X0e="(prefers-color-scheme: dark)",Q0e=S.createContext(void 0),Z0e={setTheme:t=>{},themes:[]},J0e=()=>{var t;return(t=S.useContext(Q0e))!=null?t:Z0e};S.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=s?cz.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(g,m=!1,v=!0)=>{let y=o?o[g]:g,x=m?g+"|| ''":`'${y}'`,b="";return s&&v&&!m&&cz.includes(g)&&(b+=`d.style.colorScheme = '${g}';`),r==="class"?m||y?b+=`c.add(${x})`:b+="null":y&&(b+=`d[s](n,${x})`),b},p=t?`!function(){${d}${f(t)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${X0e}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${h}}catch(t){}}();`;return S.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var ebe=t=>{switch(t){case"success":return nbe;case"info":return ibe;case"warning":return sbe;case"error":return abe;default:return null}},tbe=Array(12).fill(0),rbe=({visible:t,className:e})=>me.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},me.createElement("div",{className:"sonner-spinner"},tbe.map((r,n)=>me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),nbe=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),sbe=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ibe=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),abe=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),obe=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),lbe=()=>{let[t,e]=me.useState(document.hidden);return me.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},vD=1,cbe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...n}=t,s=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:vD++,i=this.toasts.find(l=>l.id===s),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:r}),{...l,...t,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let n=t instanceof Promise?t:t(),s=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],me.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(dbe(c)&&!c.ok){s=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${c.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${c.status}`):e.description;this.create({id:r,type:"error",message:u,description:d})}else if(e.success!==void 0){s=!1;let u=typeof e.success=="function"?await e.success(c):e.success,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:r,type:"success",message:u,description:d})}}).catch(async c=>{if(i=["reject",c],e.error!==void 0){s=!1;let u=typeof e.error=="function"?await e.error(c):e.error,d=typeof e.description=="function"?await e.description(c):e.description;this.create({id:r,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=e.finally)==null||c.call(e)}),l=()=>new Promise((c,u)=>o.then(()=>i[0]==="reject"?u(i[1]):c(i[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||vD++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Mi=new cbe,ube=(t,e)=>{let r=(e==null?void 0:e.id)||vD++;return Mi.addToast({title:t,...e,id:r}),r},dbe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",hbe=ube,fbe=()=>Mi.toasts,pbe=()=>Mi.getActiveToasts(),Fe=Object.assign(hbe,{success:Mi.success,info:Mi.info,warning:Mi.warning,error:Mi.error,custom:Mi.custom,message:Mi.message,promise:Mi.promise,dismiss:Mi.dismiss,loading:Mi.loading},{getHistory:fbe,getToasts:pbe});function mbe(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}mbe(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function tN(t){return t.label!==void 0}var gbe=3,ybe="32px",vbe="16px",uz=4e3,xbe=356,bbe=14,wbe=20,_be=200;function Co(...t){return t.filter(Boolean).join(" ")}function jbe(t){let[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}var Sbe=t=>{var e,r,n,s,i,o,l,c,u,d,h;let{invert:f,toast:p,unstyled:g,interacting:m,setHeights:v,visibleToasts:y,heights:x,index:b,toasts:w,expanded:j,removeToast:N,defaultRichColors:C,closeButton:k,style:E,cancelButtonStyle:M,actionButtonStyle:z,className:I="",descriptionClassName:q="",duration:A,position:U,gap:K,loadingIcon:G,expandByDefault:Y,classNames:H,icons:$,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:F}=t,[W,X]=me.useState(null),[oe,le]=me.useState(null),[B,R]=me.useState(!1),[ee,te]=me.useState(!1),[Z,J]=me.useState(!1),[he,P]=me.useState(!1),[ie,V]=me.useState(!1),[O,T]=me.useState(0),[D,ne]=me.useState(0),ue=me.useRef(p.duration||A||uz),re=me.useRef(null),pe=me.useRef(null),xe=b===0,ye=b+1<=y,ae=p.type,de=p.dismissible!==!1,ge=p.className||"",we=p.descriptionClassName||"",je=me.useMemo(()=>x.findIndex(Ve=>Ve.toastId===p.id)||0,[x,p.id]),Se=me.useMemo(()=>{var Ve;return(Ve=p.closeButton)!=null?Ve:k},[p.closeButton,k]),Ue=me.useMemo(()=>p.duration||A||uz,[p.duration,A]),Ae=me.useRef(0),fe=me.useRef(0),Ee=me.useRef(0),Ce=me.useRef(null),[Ge,dt]=U.split("-"),Ne=me.useMemo(()=>x.reduce((Ve,pt,Nt)=>Nt>=je?Ve:Ve+pt.height,0),[x,je]),Ze=lbe(),Ke=p.invert||f,Xe=ae==="loading";fe.current=me.useMemo(()=>je*K+Ne,[je,Ne]),me.useEffect(()=>{ue.current=Ue},[Ue]),me.useEffect(()=>{R(!0)},[]),me.useEffect(()=>{let Ve=pe.current;if(Ve){let pt=Ve.getBoundingClientRect().height;return ne(pt),v(Nt=>[{toastId:p.id,height:pt,position:p.position},...Nt]),()=>v(Nt=>Nt.filter(Ms=>Ms.toastId!==p.id))}},[v,p.id]),me.useLayoutEffect(()=>{if(!B)return;let Ve=pe.current,pt=Ve.style.height;Ve.style.height="auto";let Nt=Ve.getBoundingClientRect().height;Ve.style.height=pt,ne(Nt),v(Ms=>Ms.find(Zn=>Zn.toastId===p.id)?Ms.map(Zn=>Zn.toastId===p.id?{...Zn,height:Nt}:Zn):[{toastId:p.id,height:Nt,position:p.position},...Ms])},[B,p.title,p.description,v,p.id]);let Ye=me.useCallback(()=>{te(!0),T(fe.current),v(Ve=>Ve.filter(pt=>pt.toastId!==p.id)),setTimeout(()=>{N(p)},_be)},[p,N,v,fe]);me.useEffect(()=>{if(p.promise&&ae==="loading"||p.duration===1/0||p.type==="loading")return;let Ve;return j||m||F&&Ze?(()=>{if(Ee.current<Ae.current){let pt=new Date().getTime()-Ae.current;ue.current=ue.current-pt}Ee.current=new Date().getTime()})():ue.current!==1/0&&(Ae.current=new Date().getTime(),Ve=setTimeout(()=>{var pt;(pt=p.onAutoClose)==null||pt.call(p,p),Ye()},ue.current)),()=>clearTimeout(Ve)},[j,m,p,ae,F,Ze,Ye]),me.useEffect(()=>{p.delete&&Ye()},[Ye,p.delete]);function At(){var Ve,pt,Nt;return $!=null&&$.loading?me.createElement("div",{className:Co(H==null?void 0:H.loader,(Ve=p==null?void 0:p.classNames)==null?void 0:Ve.loader,"sonner-loader"),"data-visible":ae==="loading"},$.loading):G?me.createElement("div",{className:Co(H==null?void 0:H.loader,(pt=p==null?void 0:p.classNames)==null?void 0:pt.loader,"sonner-loader"),"data-visible":ae==="loading"},G):me.createElement(rbe,{className:Co(H==null?void 0:H.loader,(Nt=p==null?void 0:p.classNames)==null?void 0:Nt.loader),visible:ae==="loading"})}return me.createElement("li",{tabIndex:0,ref:pe,className:Co(I,ge,H==null?void 0:H.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,H==null?void 0:H.default,H==null?void 0:H[ae],(r=p==null?void 0:p.classNames)==null?void 0:r[ae]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||g),"data-mounted":B,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":ee,"data-visible":ye,"data-y-position":Ge,"data-x-position":dt,"data-index":b,"data-front":xe,"data-swiping":Z,"data-dismissible":de,"data-type":ae,"data-invert":Ke,"data-swipe-out":he,"data-swipe-direction":oe,"data-expanded":!!(j||Y&&B),style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${ee?O:fe.current}px`,"--initial-height":Y?"auto":`${D}px`,...E,...p.style},onDragEnd:()=>{J(!1),X(null),Ce.current=null},onPointerDown:Ve=>{Xe||!de||(re.current=new Date,T(fe.current),Ve.target.setPointerCapture(Ve.pointerId),Ve.target.tagName!=="BUTTON"&&(J(!0),Ce.current={x:Ve.clientX,y:Ve.clientY}))},onPointerUp:()=>{var Ve,pt,Nt,Ms;if(he||!de)return;Ce.current=null;let Zn=Number(((Ve=pe.current)==null?void 0:Ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ta=Number(((pt=pe.current)==null?void 0:pt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),La=new Date().getTime()-((Nt=re.current)==null?void 0:Nt.getTime()),Ds=W==="x"?Zn:ta,ra=Math.abs(Ds)/La;if(Math.abs(Ds)>=wbe||ra>.11){T(fe.current),(Ms=p.onDismiss)==null||Ms.call(p,p),le(W==="x"?Zn>0?"right":"left":ta>0?"down":"up"),Ye(),P(!0),V(!1);return}J(!1),X(null)},onPointerMove:Ve=>{var pt,Nt,Ms,Zn;if(!Ce.current||!de||((pt=window.getSelection())==null?void 0:pt.toString().length)>0)return;let ta=Ve.clientY-Ce.current.y,La=Ve.clientX-Ce.current.x,Ds=(Nt=t.swipeDirections)!=null?Nt:jbe(U);!W&&(Math.abs(La)>1||Math.abs(ta)>1)&&X(Math.abs(La)>Math.abs(ta)?"x":"y");let ra={x:0,y:0};W==="y"?(Ds.includes("top")||Ds.includes("bottom"))&&(Ds.includes("top")&&ta<0||Ds.includes("bottom")&&ta>0)&&(ra.y=ta):W==="x"&&(Ds.includes("left")||Ds.includes("right"))&&(Ds.includes("left")&&La<0||Ds.includes("right")&&La>0)&&(ra.x=La),(Math.abs(ra.x)>0||Math.abs(ra.y)>0)&&V(!0),(Ms=pe.current)==null||Ms.style.setProperty("--swipe-amount-x",`${ra.x}px`),(Zn=pe.current)==null||Zn.style.setProperty("--swipe-amount-y",`${ra.y}px`)}},Se&&!p.jsx?me.createElement("button",{"aria-label":L,"data-disabled":Xe,"data-close-button":!0,onClick:Xe||!de?()=>{}:()=>{var Ve;Ye(),(Ve=p.onDismiss)==null||Ve.call(p,p)},className:Co(H==null?void 0:H.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=$==null?void 0:$.close)!=null?i:obe):null,p.jsx||S.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:me.createElement(me.Fragment,null,ae||p.icon||p.promise?me.createElement("div",{"data-icon":"",className:Co(H==null?void 0:H.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||At():null,p.type!=="loading"?p.icon||($==null?void 0:$[ae])||ebe(ae):null):null,me.createElement("div",{"data-content":"",className:Co(H==null?void 0:H.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},me.createElement("div",{"data-title":"",className:Co(H==null?void 0:H.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?me.createElement("div",{"data-description":"",className:Co(q,we,H==null?void 0:H.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),S.isValidElement(p.cancel)?p.cancel:p.cancel&&tN(p.cancel)?me.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||M,onClick:Ve=>{var pt,Nt;tN(p.cancel)&&de&&((Nt=(pt=p.cancel).onClick)==null||Nt.call(pt,Ve),Ye())},className:Co(H==null?void 0:H.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,S.isValidElement(p.action)?p.action:p.action&&tN(p.action)?me.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||z,onClick:Ve=>{var pt,Nt;tN(p.action)&&((Nt=(pt=p.action).onClick)==null||Nt.call(pt,Ve),!Ve.defaultPrevented&&Ye())},className:Co(H==null?void 0:H.actionButton,(h=p==null?void 0:p.classNames)==null?void 0:h.actionButton)},p.action.label):null))};function dz(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Nbe(t,e){let r={};return[t,e].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?vbe:ybe;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=l:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var Abe=S.forwardRef(function(t,e){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:f,style:p,visibleToasts:g=gbe,toastOptions:m,dir:v=dz(),gap:y=bbe,loadingIcon:x,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:j}=t,[N,C]=me.useState([]),k=me.useMemo(()=>Array.from(new Set([n].concat(N.filter(F=>F.position).map(F=>F.position)))),[N,n]),[E,M]=me.useState([]),[z,I]=me.useState(!1),[q,A]=me.useState(!1),[U,K]=me.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=me.useRef(null),Y=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=me.useRef(null),$=me.useRef(!1),L=me.useCallback(F=>{C(W=>{var X;return(X=W.find(oe=>oe.id===F.id))!=null&&X.delete||Mi.dismiss(F.id),W.filter(({id:oe})=>oe!==F.id)})},[]);return me.useEffect(()=>Mi.subscribe(F=>{if(F.dismiss){C(W=>W.map(X=>X.id===F.id?{...X,delete:!0}:X));return}setTimeout(()=>{QZ.flushSync(()=>{C(W=>{let X=W.findIndex(oe=>oe.id===F.id);return X!==-1?[...W.slice(0,X),{...W[X],...F},...W.slice(X+1)]:[F,...W]})})})}),[]),me.useEffect(()=>{if(d!=="system"){K(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:W})=>{K(W?"dark":"light")})}catch{F.addListener(({matches:X})=>{try{K(X?"dark":"light")}catch(oe){console.error(oe)}})}},[d]),me.useEffect(()=>{N.length<=1&&I(!1)},[N]),me.useEffect(()=>{let F=W=>{var X,oe;s.every(le=>W[le]||W.code===le)&&(I(!0),(X=G.current)==null||X.focus()),W.code==="Escape"&&(document.activeElement===G.current||(oe=G.current)!=null&&oe.contains(document.activeElement))&&I(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[s]),me.useEffect(()=>{if(G.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,$.current=!1)}},[G.current]),me.createElement("section",{ref:e,"aria-label":`${w} ${Y}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},k.map((F,W)=>{var X;let[oe,le]=F.split("-");return N.length?me.createElement("ol",{key:F,dir:v==="auto"?dz():v,tabIndex:-1,ref:G,className:l,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":oe,"data-lifted":z&&N.length>1&&!i,"data-x-position":le,style:{"--front-toast-height":`${((X=E[0])==null?void 0:X.height)||0}px`,"--width":`${xbe}px`,"--gap":`${y}px`,...p,...Nbe(c,u)},onBlur:B=>{$.current&&!B.currentTarget.contains(B.relatedTarget)&&($.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||$.current||($.current=!0,H.current=B.relatedTarget)},onMouseEnter:()=>I(!0),onMouseMove:()=>I(!0),onMouseLeave:()=>{q||I(!1)},onDragEnd:()=>I(!1),onPointerDown:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},N.filter(B=>!B.position&&W===0||B.position===F).map((B,R)=>{var ee,te;return me.createElement(Sbe,{key:B.id,icons:b,index:R,toast:B,defaultRichColors:h,duration:(ee=m==null?void 0:m.duration)!=null?ee:f,className:m==null?void 0:m.className,descriptionClassName:m==null?void 0:m.descriptionClassName,invert:r,visibleToasts:g,closeButton:(te=m==null?void 0:m.closeButton)!=null?te:o,interacting:q,position:F,style:m==null?void 0:m.style,unstyled:m==null?void 0:m.unstyled,classNames:m==null?void 0:m.classNames,cancelButtonStyle:m==null?void 0:m.cancelButtonStyle,actionButtonStyle:m==null?void 0:m.actionButtonStyle,removeToast:L,toasts:N.filter(Z=>Z.position==B.position),heights:E.filter(Z=>Z.position==B.position),setHeights:M,expandByDefault:i,gap:y,loadingIcon:x,expanded:z,pauseWhenPageIsHidden:j,swipeDirections:t.swipeDirections})})):null}))});const Ebe=({...t})=>{const{theme:e="system"}=J0e();return a.jsx(Abe,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var Cbe=U3[" useId ".trim().toString()]||(()=>{}),kbe=0;function Gi(t){const[e,r]=S.useState(Cbe());return gn(()=>{r(n=>n??String(kbe++))},[t]),e?`radix-${e}`:""}const Tbe=["top","right","bottom","left"],Zh=Math.min,Sa=Math.max,ME=Math.round,rN=Math.floor,hc=t=>({x:t,y:t}),Pbe={left:"right",right:"left",bottom:"top",top:"bottom"},Obe={start:"end",end:"start"};function xD(t,e,r){return Sa(t,Zh(e,r))}function Gu(t,e){return typeof t=="function"?t(e):t}function Ku(t){return t.split("-")[0]}function l0(t){return t.split("-")[1]}function BF(t){return t==="x"?"y":"x"}function UF(t){return t==="y"?"height":"width"}const Ibe=new Set(["top","bottom"]);function ic(t){return Ibe.has(Ku(t))?"y":"x"}function zF(t){return BF(ic(t))}function Rbe(t,e,r){r===void 0&&(r=!1);const n=l0(t),s=zF(t),i=UF(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=DE(o)),[o,DE(o)]}function Mbe(t){const e=DE(t);return[bD(t),e,bD(e)]}function bD(t){return t.replace(/start|end/g,e=>Obe[e])}const hz=["left","right"],fz=["right","left"],Dbe=["top","bottom"],Lbe=["bottom","top"];function Fbe(t,e,r){switch(t){case"top":case"bottom":return r?e?fz:hz:e?hz:fz;case"left":case"right":return e?Dbe:Lbe;default:return[]}}function $be(t,e,r,n){const s=l0(t);let i=Fbe(Ku(t),r==="start",n);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(bD)))),i}function DE(t){return t.replace(/left|right|bottom|top/g,e=>Pbe[e])}function Bbe(t){return{top:0,right:0,bottom:0,left:0,...t}}function nee(t){return typeof t!="number"?Bbe(t):{top:t,right:t,bottom:t,left:t}}function LE(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function pz(t,e,r){let{reference:n,floating:s}=t;const i=ic(e),o=zF(e),l=UF(o),c=Ku(e),u=i==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:n.y-s.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:h};break;case"left":p={x:n.x-s.width,y:h};break;default:p={x:n.x,y:n.y}}switch(l0(e)){case"start":p[o]-=f*(r&&u?-1:1);break;case"end":p[o]+=f*(r&&u?-1:1);break}return p}const Ube=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:o}=r,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=pz(u,n,c),f=n,p={},g=0;for(let m=0;m<l.length;m++){const{name:v,fn:y}=l[m],{x,y:b,data:w,reset:j}=await y({x:d,y:h,initialPlacement:n,placement:f,strategy:s,middlewareData:p,rects:u,platform:o,elements:{reference:t,floating:e}});d=x??d,h=b??h,p={...p,[v]:{...p[v],...w}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):j.rects),{x:d,y:h}=pz(u,f,c)),m=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function Vw(t,e){var r;e===void 0&&(e={});const{x:n,y:s,platform:i,rects:o,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=Gu(e,t),g=nee(p),v=l[f?h==="floating"?"reference":"floating":h],y=LE(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=h==="floating"?{x:n,y:s,width:o.floating.width,height:o.floating.height}:o.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},j=LE(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:b,strategy:c}):x);return{top:(y.top-j.top+g.top)/w.y,bottom:(j.bottom-y.bottom+g.bottom)/w.y,left:(y.left-j.left+g.left)/w.x,right:(j.right-y.right+g.right)/w.x}}const zbe=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Gu(t,e)||{};if(u==null)return{};const h=nee(d),f={x:r,y:n},p=zF(s),g=UF(p),m=await o.getDimensions(u),v=p==="y",y=v?"top":"left",x=v?"bottom":"right",b=v?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[p]-f[p]-i.floating[g],j=f[p]-i.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=N?N[b]:0;(!C||!await(o.isElement==null?void 0:o.isElement(N)))&&(C=l.floating[b]||i.floating[g]);const k=w/2-j/2,E=C/2-m[g]/2-1,M=Zh(h[y],E),z=Zh(h[x],E),I=M,q=C-m[g]-z,A=C/2-m[g]/2+k,U=xD(I,A,q),K=!c.arrow&&l0(s)!=null&&A!==U&&i.reference[g]/2-(A<I?M:z)-m[g]/2<0,G=K?A<I?A-I:A-q:0;return{[p]:f[p]+G,data:{[p]:U,centerOffset:A-U-G,...K&&{alignmentOffset:G}},reset:K}}}),Hbe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=Gu(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const y=Ku(s),x=ic(l),b=Ku(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=f||(b||!m?[DE(l)]:Mbe(l)),N=g!=="none";!f&&N&&j.push(...$be(l,m,g,w));const C=[l,...j],k=await Vw(e,v),E=[];let M=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&E.push(k[y]),h){const A=Rbe(s,o,w);E.push(k[A[0]],k[A[1]])}if(M=[...M,{placement:s,overflows:E}],!E.every(A=>A<=0)){var z,I;const A=(((z=i.flip)==null?void 0:z.index)||0)+1,U=C[A];if(U&&(!(h==="alignment"?x!==ic(U):!1)||M.every(Y=>ic(Y.placement)===x?Y.overflows[0]>0:!0)))return{data:{index:A,overflows:M},reset:{placement:U}};let K=(I=M.filter(G=>G.overflows[0]<=0).sort((G,Y)=>G.overflows[1]-Y.overflows[1])[0])==null?void 0:I.placement;if(!K)switch(p){case"bestFit":{var q;const G=(q=M.filter(Y=>{if(N){const H=ic(Y.placement);return H===x||H==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(H=>H>0).reduce((H,$)=>H+$,0)]).sort((Y,H)=>Y[1]-H[1])[0])==null?void 0:q[0];G&&(K=G);break}case"initialPlacement":K=l;break}if(s!==K)return{reset:{placement:K}}}return{}}}};function mz(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function gz(t){return Tbe.some(e=>t[e]>=0)}const Wbe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=Gu(t,e);switch(n){case"referenceHidden":{const i=await Vw(e,{...s,elementContext:"reference"}),o=mz(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:gz(o)}}}case"escaped":{const i=await Vw(e,{...s,altBoundary:!0}),o=mz(i,r.floating);return{data:{escapedOffsets:o,escaped:gz(o)}}}default:return{}}}}},see=new Set(["left","top"]);async function Vbe(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=Ku(r),l=l0(r),c=ic(r)==="y",u=see.has(o)?-1:1,d=i&&c?-1:1,h=Gu(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const qbe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:o,middlewareData:l}=e,c=await Vbe(e,t);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},Gbe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:y,y:x}=v;return{x:y,y:x}}},...c}=Gu(t,e),u={x:r,y:n},d=await Vw(e,c),h=ic(Ku(s)),f=BF(h);let p=u[f],g=u[h];if(i){const v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",x=p+d[v],b=p-d[y];p=xD(x,p,b)}if(o){const v=h==="y"?"top":"left",y=h==="y"?"bottom":"right",x=g+d[v],b=g-d[y];g=xD(x,g,b)}const m=l.fn({...e,[f]:p,[h]:g});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[h]:o}}}}}},Kbe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Gu(t,e),d={x:r,y:n},h=ic(s),f=BF(h);let p=d[f],g=d[h];const m=Gu(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const b=f==="y"?"height":"width",w=i.reference[f]-i.floating[b]+v.mainAxis,j=i.reference[f]+i.reference[b]-v.mainAxis;p<w?p=w:p>j&&(p=j)}if(u){var y,x;const b=f==="y"?"width":"height",w=see.has(Ku(s)),j=i.reference[h]-i.floating[b]+(w&&((y=o.offset)==null?void 0:y[h])||0)+(w?0:v.crossAxis),N=i.reference[h]+i.reference[b]+(w?0:((x=o.offset)==null?void 0:x[h])||0)-(w?v.crossAxis:0);g<j?g=j:g>N&&(g=N)}return{[f]:p,[h]:g}}}},Ybe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:c=()=>{},...u}=Gu(t,e),d=await Vw(e,u),h=Ku(s),f=l0(s),p=ic(s)==="y",{width:g,height:m}=i.floating;let v,y;h==="top"||h==="bottom"?(v=h,y=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,v=f==="end"?"top":"bottom");const x=m-d.top-d.bottom,b=g-d.left-d.right,w=Zh(m-d[v],x),j=Zh(g-d[y],b),N=!e.middlewareData.shift;let C=w,k=j;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(k=b),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(C=x),N&&!f){const M=Sa(d.left,0),z=Sa(d.right,0),I=Sa(d.top,0),q=Sa(d.bottom,0);p?k=g-2*(M!==0||z!==0?M+z:Sa(d.left,d.right)):C=m-2*(I!==0||q!==0?I+q:Sa(d.top,d.bottom))}await c({...e,availableWidth:k,availableHeight:C});const E=await o.getDimensions(l.floating);return g!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function tT(){return typeof window<"u"}function c0(t){return iee(t)?(t.nodeName||"").toLowerCase():"#document"}function Oa(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ac(t){var e;return(e=(iee(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function iee(t){return tT()?t instanceof Node||t instanceof Oa(t).Node:!1}function cl(t){return tT()?t instanceof Element||t instanceof Oa(t).Element:!1}function xc(t){return tT()?t instanceof HTMLElement||t instanceof Oa(t).HTMLElement:!1}function yz(t){return!tT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Oa(t).ShadowRoot}const Xbe=new Set(["inline","contents"]);function Rj(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=ul(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!Xbe.has(s)}const Qbe=new Set(["table","td","th"]);function Zbe(t){return Qbe.has(c0(t))}const Jbe=[":popover-open",":modal"];function rT(t){return Jbe.some(e=>{try{return t.matches(e)}catch{return!1}})}const ewe=["transform","translate","scale","rotate","perspective"],twe=["transform","translate","scale","rotate","perspective","filter"],rwe=["paint","layout","strict","content"];function HF(t){const e=WF(),r=cl(t)?ul(t):t;return ewe.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||twe.some(n=>(r.willChange||"").includes(n))||rwe.some(n=>(r.contain||"").includes(n))}function nwe(t){let e=Jh(t);for(;xc(e)&&!xx(e);){if(HF(e))return e;if(rT(e))return null;e=Jh(e)}return null}function WF(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const swe=new Set(["html","body","#document"]);function xx(t){return swe.has(c0(t))}function ul(t){return Oa(t).getComputedStyle(t)}function nT(t){return cl(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Jh(t){if(c0(t)==="html")return t;const e=t.assignedSlot||t.parentNode||yz(t)&&t.host||Ac(t);return yz(e)?e.host:e}function aee(t){const e=Jh(t);return xx(e)?t.ownerDocument?t.ownerDocument.body:t.body:xc(e)&&Rj(e)?e:aee(e)}function qw(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=aee(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),o=Oa(s);if(i){const l=wD(o);return e.concat(o,o.visualViewport||[],Rj(s)?s:[],l&&r?qw(l):[])}return e.concat(s,qw(s,[],r))}function wD(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function oee(t){const e=ul(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=xc(t),i=s?t.offsetWidth:r,o=s?t.offsetHeight:n,l=ME(r)!==i||ME(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function VF(t){return cl(t)?t:t.contextElement}function Ty(t){const e=VF(t);if(!xc(e))return hc(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=oee(e);let o=(i?ME(r.width):r.width)/n,l=(i?ME(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const iwe=hc(0);function lee(t){const e=Oa(t);return!WF()||!e.visualViewport?iwe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function awe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Oa(t)?!1:e}function Vm(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=VF(t);let o=hc(1);e&&(n?cl(n)&&(o=Ty(n)):o=Ty(t));const l=awe(i,r,n)?lee(i):hc(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(i){const f=Oa(i),p=n&&cl(n)?Oa(n):n;let g=f,m=wD(g);for(;m&&n&&p!==g;){const v=Ty(m),y=m.getBoundingClientRect(),x=ul(m),b=y.left+(m.clientLeft+parseFloat(x.paddingLeft))*v.x,w=y.top+(m.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,h*=v.y,c+=b,u+=w,g=Oa(m),m=wD(g)}}return LE({width:d,height:h,x:c,y:u})}function sT(t,e){const r=nT(t).scrollLeft;return e?e.left+r:Vm(Ac(t)).left+r}function cee(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-sT(t,r),s=r.top+e.scrollTop;return{x:n,y:s}}function owe(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",o=Ac(n),l=e?rT(e.floating):!1;if(n===o||l&&i)return r;let c={scrollLeft:0,scrollTop:0},u=hc(1);const d=hc(0),h=xc(n);if((h||!h&&!i)&&((c0(n)!=="body"||Rj(o))&&(c=nT(n)),xc(n))){const p=Vm(n);u=Ty(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const f=o&&!h&&!i?cee(o,c):hc(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:r.y*u.y-c.scrollTop*u.y+d.y+f.y}}function lwe(t){return Array.from(t.getClientRects())}function cwe(t){const e=Ac(t),r=nT(t),n=t.ownerDocument.body,s=Sa(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Sa(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+sT(t);const l=-r.scrollTop;return ul(n).direction==="rtl"&&(o+=Sa(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:o,y:l}}const vz=25;function uwe(t,e){const r=Oa(t),n=Ac(t),s=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const d=WF();(!d||d&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=sT(n);if(u<=0){const d=n.ownerDocument,h=d.body,f=getComputedStyle(h),p=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(n.clientWidth-h.clientWidth-p);g<=vz&&(i-=g)}else u<=vz&&(i+=u);return{width:i,height:o,x:l,y:c}}const dwe=new Set(["absolute","fixed"]);function hwe(t,e){const r=Vm(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=xc(t)?Ty(t):hc(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,u=n*i.y;return{width:o,height:l,x:c,y:u}}function xz(t,e,r){let n;if(e==="viewport")n=uwe(t,r);else if(e==="document")n=cwe(Ac(t));else if(cl(e))n=hwe(e,r);else{const s=lee(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return LE(n)}function uee(t,e){const r=Jh(t);return r===e||!cl(r)||xx(r)?!1:ul(r).position==="fixed"||uee(r,e)}function fwe(t,e){const r=e.get(t);if(r)return r;let n=qw(t,[],!1).filter(l=>cl(l)&&c0(l)!=="body"),s=null;const i=ul(t).position==="fixed";let o=i?Jh(t):t;for(;cl(o)&&!xx(o);){const l=ul(o),c=HF(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&dwe.has(s.position)||Rj(o)&&!c&&uee(t,o))?n=n.filter(d=>d!==o):s=l,o=Jh(o)}return e.set(t,n),n}function pwe(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const o=[...r==="clippingAncestors"?rT(e)?[]:fwe(e,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const h=xz(e,d,s);return u.top=Sa(h.top,u.top),u.right=Zh(h.right,u.right),u.bottom=Zh(h.bottom,u.bottom),u.left=Sa(h.left,u.left),u},xz(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function mwe(t){const{width:e,height:r}=oee(t);return{width:e,height:r}}function gwe(t,e,r){const n=xc(e),s=Ac(e),i=r==="fixed",o=Vm(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=hc(0);function u(){c.x=sT(s)}if(n||!n&&!i)if((c0(e)!=="body"||Rj(s))&&(l=nT(e)),n){const p=Vm(e,!0,i,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else s&&u();i&&!n&&s&&u();const d=s&&!n&&!i?cee(s,l):hc(0),h=o.left+l.scrollLeft-c.x-d.x,f=o.top+l.scrollTop-c.y-d.y;return{x:h,y:f,width:o.width,height:o.height}}function UP(t){return ul(t).position==="static"}function bz(t,e){if(!xc(t)||ul(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ac(t)===r&&(r=r.ownerDocument.body),r}function dee(t,e){const r=Oa(t);if(rT(t))return r;if(!xc(t)){let s=Jh(t);for(;s&&!xx(s);){if(cl(s)&&!UP(s))return s;s=Jh(s)}return r}let n=bz(t,e);for(;n&&Zbe(n)&&UP(n);)n=bz(n,e);return n&&xx(n)&&UP(n)&&!HF(n)?r:n||nwe(t)||r}const ywe=async function(t){const e=this.getOffsetParent||dee,r=this.getDimensions,n=await r(t.floating);return{reference:gwe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function vwe(t){return ul(t).direction==="rtl"}const xwe={convertOffsetParentRelativeRectToViewportRelativeRect:owe,getDocumentElement:Ac,getClippingRect:pwe,getOffsetParent:dee,getElementRects:ywe,getClientRects:lwe,getDimensions:mwe,getScale:Ty,isElement:cl,isRTL:vwe};function hee(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bwe(t,e){let r=null,n;const s=Ac(t);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=t.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(l||e(),!f||!p)return;const g=rN(h),m=rN(s.clientWidth-(d+f)),v=rN(s.clientHeight-(h+p)),y=rN(d),b={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:Sa(0,Zh(1,c))||1};let w=!0;function j(N){const C=N[0].intersectionRatio;if(C!==c){if(!w)return o();C?o(!1,C):n=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!hee(u,t.getBoundingClientRect())&&o(),w=!1}try{r=new IntersectionObserver(j,{...b,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,b)}r.observe(t)}return o(!0),i}function wwe(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=VF(t),d=s||i?[...u?qw(u):[],...qw(e)]:[];d.forEach(y=>{s&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});const h=u&&l?bwe(u,r):null;let f=-1,p=null;o&&(p=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(e)})),r()}),u&&!c&&p.observe(u),p.observe(e));let g,m=c?Vm(t):null;c&&v();function v(){const y=Vm(t);m&&!hee(m,y)&&r(),m=y,g=requestAnimationFrame(v)}return r(),()=>{var y;d.forEach(x=>{s&&x.removeEventListener("scroll",r),i&&x.removeEventListener("resize",r)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const _we=qbe,jwe=Gbe,Swe=Hbe,Nwe=Ybe,Awe=Wbe,wz=zbe,Ewe=Kbe,Cwe=(t,e,r)=>{const n=new Map,s={platform:xwe,...r},i={...s.platform,_c:n};return Ube(t,e,{...s,platform:i})};var kwe=typeof document<"u",Twe=function(){},yA=kwe?S.useLayoutEffect:Twe;function FE(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!FE(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!FE(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function fee(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _z(t,e){const r=fee(t);return Math.round(e*r)/r}function zP(t){const e=S.useRef(t);return yA(()=>{e.current=t}),e}function Pwe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,h]=S.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=S.useState(n);FE(f,n)||p(n);const[g,m]=S.useState(null),[v,y]=S.useState(null),x=S.useCallback(Y=>{Y!==N.current&&(N.current=Y,m(Y))},[]),b=S.useCallback(Y=>{Y!==C.current&&(C.current=Y,y(Y))},[]),w=i||g,j=o||v,N=S.useRef(null),C=S.useRef(null),k=S.useRef(d),E=c!=null,M=zP(c),z=zP(s),I=zP(u),q=S.useCallback(()=>{if(!N.current||!C.current)return;const Y={placement:e,strategy:r,middleware:f};z.current&&(Y.platform=z.current),Cwe(N.current,C.current,Y).then(H=>{const $={...H,isPositioned:I.current!==!1};A.current&&!FE(k.current,$)&&(k.current=$,Nc.flushSync(()=>{h($)}))})},[f,e,r,z,I]);yA(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(Y=>({...Y,isPositioned:!1})))},[u]);const A=S.useRef(!1);yA(()=>(A.current=!0,()=>{A.current=!1}),[]),yA(()=>{if(w&&(N.current=w),j&&(C.current=j),w&&j){if(M.current)return M.current(w,j,q);q()}},[w,j,q,M,E]);const U=S.useMemo(()=>({reference:N,floating:C,setReference:x,setFloating:b}),[x,b]),K=S.useMemo(()=>({reference:w,floating:j}),[w,j]),G=S.useMemo(()=>{const Y={position:r,left:0,top:0};if(!K.floating)return Y;const H=_z(K.floating,d.x),$=_z(K.floating,d.y);return l?{...Y,transform:"translate("+H+"px, "+$+"px)",...fee(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:H,top:$}},[r,l,K.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:q,refs:U,elements:K,floatingStyles:G}),[d,q,U,K,G])}const Owe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?wz({element:n.current,padding:s}).fn(r):{}:n?wz({element:n,padding:s}).fn(r):{}}}},Iwe=(t,e)=>({..._we(t),options:[t,e]}),Rwe=(t,e)=>({...jwe(t),options:[t,e]}),Mwe=(t,e)=>({...Ewe(t),options:[t,e]}),Dwe=(t,e)=>({...Swe(t),options:[t,e]}),Lwe=(t,e)=>({...Nwe(t),options:[t,e]}),Fwe=(t,e)=>({...Awe(t),options:[t,e]}),$we=(t,e)=>({...Owe(t),options:[t,e]});var Bwe="Arrow",pee=S.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...i}=t;return a.jsx(et.svg,{...i,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});pee.displayName=Bwe;var Uwe=pee;function qF(t){const[e,r]=S.useState(void 0);return gn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=t.offsetWidth,l=t.offsetHeight;r({width:o,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var GF="Popper",[mee,ff]=Ln(GF),[zwe,gee]=mee(GF),yee=t=>{const{__scopePopper:e,children:r}=t,[n,s]=S.useState(null);return a.jsx(zwe,{scope:e,anchor:n,onAnchorChange:s,children:r})};yee.displayName=GF;var vee="PopperAnchor",xee=S.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,i=gee(vee,r),o=S.useRef(null),l=jt(e,o);return S.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:a.jsx(et.div,{...s,ref:l})});xee.displayName=vee;var KF="PopperContent",[Hwe,Wwe]=mee(KF),bee=S.forwardRef((t,e)=>{var B,R,ee,te,Z,J;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,v=gee(KF,r),[y,x]=S.useState(null),b=jt(e,he=>x(he)),[w,j]=S.useState(null),N=qF(w),C=(N==null?void 0:N.width)??0,k=(N==null?void 0:N.height)??0,E=n+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(u)?u:[u],I=z.length>0,q={padding:M,boundary:z.filter(qwe),altBoundary:I},{refs:A,floatingStyles:U,placement:K,isPositioned:G,middlewareData:Y}=Pwe({strategy:"fixed",placement:E,whileElementsMounted:(...he)=>wwe(...he,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[Iwe({mainAxis:s+k,alignmentAxis:o}),c&&Rwe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Mwe():void 0,...q}),c&&Dwe({...q}),Lwe({...q,apply:({elements:he,rects:P,availableWidth:ie,availableHeight:V})=>{const{width:O,height:T}=P.reference,D=he.floating.style;D.setProperty("--radix-popper-available-width",`${ie}px`),D.setProperty("--radix-popper-available-height",`${V}px`),D.setProperty("--radix-popper-anchor-width",`${O}px`),D.setProperty("--radix-popper-anchor-height",`${T}px`)}}),w&&$we({element:w,padding:l}),Gwe({arrowWidth:C,arrowHeight:k}),f&&Fwe({strategy:"referenceHidden",...q})]}),[H,$]=jee(K),L=pn(g);gn(()=>{G&&(L==null||L())},[G,L]);const F=(B=Y.arrow)==null?void 0:B.x,W=(R=Y.arrow)==null?void 0:R.y,X=((ee=Y.arrow)==null?void 0:ee.centerOffset)!==0,[oe,le]=S.useState();return gn(()=>{y&&le(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:G?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(te=Y.transformOrigin)==null?void 0:te.x,(Z=Y.transformOrigin)==null?void 0:Z.y].join(" "),...((J=Y.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(Hwe,{scope:r,placedSide:H,onArrowChange:j,arrowX:F,arrowY:W,shouldHideArrow:X,children:a.jsx(et.div,{"data-side":H,"data-align":$,...m,ref:b,style:{...m.style,animation:G?void 0:"none"}})})})});bee.displayName=KF;var wee="PopperArrow",Vwe={top:"bottom",right:"left",bottom:"top",left:"right"},_ee=S.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,i=Wwe(wee,n),o=Vwe[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(Uwe,{...s,ref:r,style:{...s.style,display:"block"}})})});_ee.displayName=wee;function qwe(t){return t!==null}var Gwe=t=>({name:"transformOrigin",options:t,fn(e){var v,y,x;const{placement:r,rects:n,middlewareData:s}=e,o=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=jee(r),h={start:"0%",center:"50%",end:"100%"}[d],f=(((y=s.arrow)==null?void 0:y.x)??0)+l/2,p=(((x=s.arrow)==null?void 0:x.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?h:`${f}px`,m=`${-c}px`):u==="top"?(g=o?h:`${f}px`,m=`${n.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?h:`${p}px`):u==="left"&&(g=`${n.floating.width+c}px`,m=o?h:`${p}px`),{data:{x:g,y:m}}}});function jee(t){const[e,r="center"]=t.split("-");return[e,r]}var iT=yee,Mj=xee,aT=bee,oT=_ee,[lT,Zgt]=Ln("Tooltip",[ff]),cT=ff(),See="TooltipProvider",Kwe=700,_D="tooltip.open",[Ywe,YF]=lT(See),Nee=t=>{const{__scopeTooltip:e,delayDuration:r=Kwe,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=t,o=S.useRef(!0),l=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(Ywe,{scope:e,isOpenDelayedRef:o,delayDuration:r,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:S.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};Nee.displayName=See;var Gw="Tooltip",[Xwe,uT]=lT(Gw),Aee=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=t,c=YF(Gw,t.__scopeTooltip),u=cT(e),[d,h]=S.useState(null),f=Gi(),p=S.useRef(0),g=o??c.disableHoverableContent,m=l??c.delayDuration,v=S.useRef(!1),[y,x]=Ps({prop:n,defaultProp:s??!1,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(_D))):c.onClose(),i==null||i(C)},caller:Gw}),b=S.useMemo(()=>y?v.current?"delayed-open":"instant-open":"closed",[y]),w=S.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,x(!0)},[x]),j=S.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),N=S.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,x(!0),p.current=0},m)},[m,x]);return S.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(iT,{...u,children:a.jsx(Xwe,{scope:e,contentId:f,open:y,stateAttribute:b,trigger:d,onTriggerChange:h,onTriggerEnter:S.useCallback(()=>{c.isOpenDelayedRef.current?N():w()},[c.isOpenDelayedRef,N,w]),onTriggerLeave:S.useCallback(()=>{g?j():(window.clearTimeout(p.current),p.current=0)},[j,g]),onOpen:w,onClose:j,disableHoverableContent:g,children:r})})};Aee.displayName=Gw;var jD="TooltipTrigger",Eee=S.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=uT(jD,r),i=YF(jD,r),o=cT(r),l=S.useRef(null),c=jt(e,l,s.onTriggerChange),u=S.useRef(!1),d=S.useRef(!1),h=S.useCallback(()=>u.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(Mj,{asChild:!0,...o,children:a.jsx(et.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ze(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ze(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:ze(t.onBlur,s.onClose),onClick:ze(t.onClick,s.onClose)})})});Eee.displayName=jD;var Qwe="TooltipPortal",[Jgt,Zwe]=lT(Qwe,{forceMount:void 0}),bx="TooltipContent",Cee=S.forwardRef((t,e)=>{const r=Zwe(bx,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=t,o=uT(bx,t.__scopeTooltip);return a.jsx(Xn,{present:n||o.open,children:o.disableHoverableContent?a.jsx(kee,{side:s,...i,ref:e}):a.jsx(Jwe,{side:s,...i,ref:e})})}),Jwe=S.forwardRef((t,e)=>{const r=uT(bx,t.__scopeTooltip),n=YF(bx,t.__scopeTooltip),s=S.useRef(null),i=jt(e,s),[o,l]=S.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:h}=n,f=S.useCallback(()=>{l(null),h(!1)},[h]),p=S.useCallback((g,m)=>{const v=g.currentTarget,y={x:g.clientX,y:g.clientY},x=s1e(y,v.getBoundingClientRect()),b=i1e(y,x),w=a1e(m.getBoundingClientRect()),j=l1e([...b,...w]);l(j),h(!0)},[h]);return S.useEffect(()=>()=>f(),[f]),S.useEffect(()=>{if(c&&d){const g=v=>p(v,d),m=v=>p(v,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,f]),S.useEffect(()=>{if(o){const g=m=>{const v=m.target,y={x:m.clientX,y:m.clientY},x=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),b=!o1e(y,o);x?f():b&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,f]),a.jsx(kee,{...t,ref:i})}),[e1e,t1e]=lT(Gw,{isInside:!1}),r1e=oJ("TooltipContent"),kee=S.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=t,c=uT(bx,r),u=cT(r),{onClose:d}=c;return S.useEffect(()=>(document.addEventListener(_D,d),()=>document.removeEventListener(_D,d)),[d]),S.useEffect(()=>{if(c.trigger){const h=f=>{const p=f.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),a.jsx(ag,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:a.jsxs(aT,{"data-state":c.stateAttribute,...u,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(r1e,{children:n}),a.jsx(e1e,{scope:r,isInside:!0,children:a.jsx(Jve,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Cee.displayName=bx;var Tee="TooltipArrow",n1e=S.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=cT(r);return t1e(Tee,r).isInside?null:a.jsx(oT,{...s,...n,ref:e})});n1e.displayName=Tee;function s1e(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function i1e(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function a1e(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function o1e(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function l1e(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),c1e(e)}function c1e(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const s=t[n];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var u1e=Nee,d1e=Aee,h1e=Eee,Pee=Cee;const Si=u1e,Yt=d1e,Xt=h1e,Vt=S.forwardRef(({className:t,sideOffset:e=4,...r},n)=>a.jsx(Pee,{ref:n,sideOffset:e,className:Oe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));Vt.displayName=Pee.displayName;var u0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},qm=typeof window>"u"||"Deno"in globalThis;function fi(){}function f1e(t,e){return typeof t=="function"?t(e):t}function SD(t){return typeof t=="number"&&t>=0&&t!==1/0}function Oee(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Wh(t,e){return typeof t=="function"?t(e):t}function to(t,e){return typeof t=="function"?t(e):t}function jz(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:l}=t;if(o){if(n){if(e.queryHash!==XF(o,e.options))return!1}else if(!Kw(e.queryKey,o))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function Sz(t,e){const{exact:r,status:n,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(Gm(e.options.mutationKey)!==Gm(i))return!1}else if(!Kw(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function XF(t,e){return((e==null?void 0:e.queryKeyHashFn)||Gm)(t)}function Gm(t){return JSON.stringify(t,(e,r)=>ND(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Kw(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Kw(t[r],e[r])):!1}function Iee(t,e){if(t===e)return t;const r=Nz(t)&&Nz(e);if(r||ND(t)&&ND(e)){const n=r?t:Object.keys(t),s=n.length,i=r?e:Object.keys(e),o=i.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<o;d++){const h=r?d:i[d];(!r&&c.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,u++):(l[h]=Iee(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&u++)}return s===o&&u===s?t:l}return e}function $E(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Nz(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ND(t){if(!Az(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Az(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Az(t){return Object.prototype.toString.call(t)==="[object Object]"}function p1e(t){return new Promise(e=>{setTimeout(e,t)})}function AD(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Iee(t,e):e}function m1e(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function g1e(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var QF=Symbol();function Ree(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===QF?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Mee(t,e){return typeof t=="function"?t(...e):!!t}var mp,Md,Wy,EX,y1e=(EX=class extends u0{constructor(){super();se(this,mp);se(this,Md);se(this,Wy);Q(this,Wy,e=>{if(!qm&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,Md)||this.setEventListener(_(this,Wy))}onUnsubscribe(){var e;this.hasListeners()||((e=_(this,Md))==null||e.call(this),Q(this,Md,void 0))}setEventListener(e){var r;Q(this,Wy,e),(r=_(this,Md))==null||r.call(this),Q(this,Md,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){_(this,mp)!==e&&(Q(this,mp,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof _(this,mp)=="boolean"?_(this,mp):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},mp=new WeakMap,Md=new WeakMap,Wy=new WeakMap,EX),ZF=new y1e,Vy,Dd,qy,CX,v1e=(CX=class extends u0{constructor(){super();se(this,Vy,!0);se(this,Dd);se(this,qy);Q(this,qy,e=>{if(!qm&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){_(this,Dd)||this.setEventListener(_(this,qy))}onUnsubscribe(){var e;this.hasListeners()||((e=_(this,Dd))==null||e.call(this),Q(this,Dd,void 0))}setEventListener(e){var r;Q(this,qy,e),(r=_(this,Dd))==null||r.call(this),Q(this,Dd,e(this.setOnline.bind(this)))}setOnline(e){_(this,Vy)!==e&&(Q(this,Vy,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return _(this,Vy)}},Vy=new WeakMap,Dd=new WeakMap,qy=new WeakMap,CX),BE=new v1e;function ED(){let t,e;const r=new Promise((s,i)=>{t=s,e=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function x1e(t){return Math.min(1e3*2**t,3e4)}function Dee(t){return(t??"online")==="online"?BE.isOnline():!0}var Lee=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function HP(t){return t instanceof Lee}function Fee(t){let e=!1,r=0,n=!1,s;const i=ED(),o=m=>{var v;n||(f(new Lee(m)),(v=t.abort)==null||v.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>ZF.isFocused()&&(t.networkMode==="always"||BE.isOnline())&&t.canRun(),d=()=>Dee(t.networkMode)&&t.canRun(),h=m=>{var v;n||(n=!0,(v=t.onSuccess)==null||v.call(t,m),s==null||s(),i.resolve(m))},f=m=>{var v;n||(n=!0,(v=t.onError)==null||v.call(t,m),s==null||s(),i.reject(m))},p=()=>new Promise(m=>{var v;s=y=>{(n||u())&&m(y)},(v=t.onPause)==null||v.call(t)}).then(()=>{var m;s=void 0,n||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(n)return;let m;const v=r===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(h).catch(y=>{var N;if(n)return;const x=t.retry??(qm?0:3),b=t.retryDelay??x1e,w=typeof b=="function"?b(r,y):b,j=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,y);if(e||!j){f(y);return}r++,(N=t.onFail)==null||N.call(t,r,y),p1e(w).then(()=>u()?void 0:p()).then(()=>{e?f(y):g()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}var b1e=t=>setTimeout(t,0);function w1e(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=b1e;const i=l=>{e?t.push(l):s(()=>{r(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var qn=w1e(),gp,kX,$ee=(kX=class{constructor(){se(this,gp)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),SD(this.gcTime)&&Q(this,gp,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(qm?1/0:5*60*1e3))}clearGcTimeout(){_(this,gp)&&(clearTimeout(_(this,gp)),Q(this,gp,void 0))}},gp=new WeakMap,kX),Gy,yp,Va,vp,zs,q1,xp,Lo,Lc,TX,_1e=(TX=class extends $ee{constructor(e){super();se(this,Lo);se(this,Gy);se(this,yp);se(this,Va);se(this,vp);se(this,zs);se(this,q1);se(this,xp);Q(this,xp,!1),Q(this,q1,e.defaultOptions),this.setOptions(e.options),this.observers=[],Q(this,vp,e.client),Q(this,Va,_(this,vp).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Q(this,Gy,j1e(this.options)),this.state=e.state??_(this,Gy),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=_(this,zs))==null?void 0:e.promise}setOptions(e){this.options={..._(this,q1),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Va).remove(this)}setData(e,r){const n=AD(this.state.data,e,this.options);return ce(this,Lo,Lc).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){ce(this,Lo,Lc).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=_(this,zs))==null?void 0:n.promise;return(s=_(this,zs))==null||s.cancel(e),r?r.then(fi).catch(fi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Gy))}isActive(){return this.observers.some(e=>to(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===QF||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Wh(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Oee(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=_(this,zs))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=_(this,zs))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),_(this,Va).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(_(this,zs)&&(_(this,xp)?_(this,zs).cancel({revert:!0}):_(this,zs).cancelRetry()),this.scheduleGc()),_(this,Va).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ce(this,Lo,Lc).call(this,{type:"invalidate"})}fetch(e,r){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(_(this,zs))return _(this,zs).continueRetry(),_(this,zs).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Q(this,xp,!0),n.signal)})},i=()=>{const f=Ree(this.options,r),g=(()=>{const m={client:_(this,vp),queryKey:this.queryKey,meta:this.meta};return s(m),m})();return Q(this,xp,!1),this.options.persister?this.options.persister(f,g,this):f(g)},l=(()=>{const f={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,vp),state:this.state,fetchFn:i};return s(f),f})();(u=this.options.behavior)==null||u.onFetch(l,this),Q(this,yp,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&ce(this,Lo,Lc).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=f=>{var p,g,m,v;HP(f)&&f.silent||ce(this,Lo,Lc).call(this,{type:"error",error:f}),HP(f)||((g=(p=_(this,Va).config).onError)==null||g.call(p,f,this),(v=(m=_(this,Va).config).onSettled)==null||v.call(m,this.state.data,f,this)),this.scheduleGc()};return Q(this,zs,Fee({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,g,m,v;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(g=(p=_(this,Va).config).onSuccess)==null||g.call(p,f,this),(v=(m=_(this,Va).config).onSettled)==null||v.call(m,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,p)=>{ce(this,Lo,Lc).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{ce(this,Lo,Lc).call(this,{type:"pause"})},onContinue:()=>{ce(this,Lo,Lc).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),_(this,zs).start()}},Gy=new WeakMap,yp=new WeakMap,Va=new WeakMap,vp=new WeakMap,zs=new WeakMap,q1=new WeakMap,xp=new WeakMap,Lo=new WeakSet,Lc=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Bee(n.data,this.options),fetchMeta:e.meta??null};case"success":return Q(this,yp,void 0),{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return HP(s)&&s.revert&&_(this,yp)?{..._(this,yp),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),qn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),_(this,Va).notify({query:this,type:"updated",action:e})})},TX);function Bee(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Dee(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function j1e(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Pl,PX,S1e=(PX=class extends u0{constructor(e={}){super();se(this,Pl);this.config=e,Q(this,Pl,new Map)}build(e,r,n){const s=r.queryKey,i=r.queryHash??XF(s,r);let o=this.get(i);return o||(o=new _1e({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){_(this,Pl).has(e.queryHash)||(_(this,Pl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=_(this,Pl).get(e.queryHash);r&&(e.destroy(),r===e&&_(this,Pl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){qn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return _(this,Pl).get(e)}getAll(){return[..._(this,Pl).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>jz(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>jz(e,n)):r}notify(e){qn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){qn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){qn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Pl=new WeakMap,PX),Ol,ii,bp,Il,wd,OX,N1e=(OX=class extends $ee{constructor(e){super();se(this,Il);se(this,Ol);se(this,ii);se(this,bp);this.mutationId=e.mutationId,Q(this,ii,e.mutationCache),Q(this,Ol,[]),this.state=e.state||Uee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){_(this,Ol).includes(e)||(_(this,Ol).push(e),this.clearGcTimeout(),_(this,ii).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Q(this,Ol,_(this,Ol).filter(r=>r!==e)),this.scheduleGc(),_(this,ii).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){_(this,Ol).length||(this.state.status==="pending"?this.scheduleGc():_(this,ii).remove(this))}continue(){var e;return((e=_(this,bp))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,l,c,u,d,h,f,p,g,m,v,y,x,b,w,j,N,C,k;const r=()=>{ce(this,Il,wd).call(this,{type:"continue"})};Q(this,bp,Fee({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(E,M)=>{ce(this,Il,wd).call(this,{type:"failed",failureCount:E,error:M})},onPause:()=>{ce(this,Il,wd).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ii).canRun(this)}));const n=this.state.status==="pending",s=!_(this,bp).canStart();try{if(n)r();else{ce(this,Il,wd).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(i=_(this,ii).config).onMutate)==null?void 0:o.call(i,e,this));const M=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));M!==this.state.context&&ce(this,Il,wd).call(this,{type:"pending",context:M,variables:e,isPaused:s})}const E=await _(this,bp).start();return await((d=(u=_(this,ii).config).onSuccess)==null?void 0:d.call(u,E,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,E,e,this.state.context)),await((g=(p=_(this,ii).config).onSettled)==null?void 0:g.call(p,E,null,this.state.variables,this.state.context,this)),await((v=(m=this.options).onSettled)==null?void 0:v.call(m,E,null,e,this.state.context)),ce(this,Il,wd).call(this,{type:"success",data:E}),E}catch(E){try{throw await((x=(y=_(this,ii).config).onError)==null?void 0:x.call(y,E,e,this.state.context,this)),await((w=(b=this.options).onError)==null?void 0:w.call(b,E,e,this.state.context)),await((N=(j=_(this,ii).config).onSettled)==null?void 0:N.call(j,void 0,E,this.state.variables,this.state.context,this)),await((k=(C=this.options).onSettled)==null?void 0:k.call(C,void 0,E,e,this.state.context)),E}finally{ce(this,Il,wd).call(this,{type:"error",error:E})}}finally{_(this,ii).runNext(this)}}},Ol=new WeakMap,ii=new WeakMap,bp=new WeakMap,Il=new WeakSet,wd=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),qn.batch(()=>{_(this,Ol).forEach(n=>{n.onMutationUpdate(e)}),_(this,ii).notify({mutation:this,type:"updated",action:e})})},OX);function Uee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xc,Fo,G1,IX,A1e=(IX=class extends u0{constructor(e={}){super();se(this,Xc);se(this,Fo);se(this,G1);this.config=e,Q(this,Xc,new Set),Q(this,Fo,new Map),Q(this,G1,0)}build(e,r,n){const s=new N1e({mutationCache:this,mutationId:++Jn(this,G1)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){_(this,Xc).add(e);const r=nN(e);if(typeof r=="string"){const n=_(this,Fo).get(r);n?n.push(e):_(this,Fo).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(_(this,Xc).delete(e)){const r=nN(e);if(typeof r=="string"){const n=_(this,Fo).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&_(this,Fo).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=nN(e);if(typeof r=="string"){const n=_(this,Fo).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=nN(e);if(typeof r=="string"){const s=(n=_(this,Fo).get(r))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){qn.batch(()=>{_(this,Xc).forEach(e=>{this.notify({type:"removed",mutation:e})}),_(this,Xc).clear(),_(this,Fo).clear()})}getAll(){return Array.from(_(this,Xc))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Sz(r,n))}findAll(e={}){return this.getAll().filter(r=>Sz(e,r))}notify(e){qn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return qn.batch(()=>Promise.all(e.map(r=>r.continue().catch(fi))))}},Xc=new WeakMap,Fo=new WeakMap,G1=new WeakMap,IX);function nN(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Ez(t){return{onFetch:(e,r)=>{var d,h,f,p,g;const n=e.options,s=(f=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((g=e.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const v=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},y=Ree(e.options,e.fetchOptions),x=async(b,w,j)=>{if(m)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);const C=(()=>{const z={client:e.client,queryKey:e.queryKey,pageParam:w,direction:j?"backward":"forward",meta:e.options.meta};return v(z),z})(),k=await y(C),{maxPages:E}=e.options,M=j?g1e:m1e;return{pages:M(b.pages,k,E),pageParams:M(b.pageParams,w,E)}};if(s&&i.length){const b=s==="backward",w=b?E1e:Cz,j={pages:i,pageParams:o},N=w(n,j);l=await x(j,N,b)}else{const b=t??i.length;do{const w=c===0?o[0]??n.initialPageParam:Cz(n,l);if(c>0&&w==null)break;l=await x(l,w),c++}while(c<b)}return l};e.options.persister?e.fetchFn=()=>{var m,v;return(v=(m=e.options).persister)==null?void 0:v.call(m,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=u}}}function Cz(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function E1e(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var on,Ld,Fd,Ky,Yy,$d,Xy,Qy,RX,C1e=(RX=class{constructor(t={}){se(this,on);se(this,Ld);se(this,Fd);se(this,Ky);se(this,Yy);se(this,$d);se(this,Xy);se(this,Qy);Q(this,on,t.queryCache||new S1e),Q(this,Ld,t.mutationCache||new A1e),Q(this,Fd,t.defaultOptions||{}),Q(this,Ky,new Map),Q(this,Yy,new Map),Q(this,$d,0)}mount(){Jn(this,$d)._++,_(this,$d)===1&&(Q(this,Xy,ZF.subscribe(async t=>{t&&(await this.resumePausedMutations(),_(this,on).onFocus())})),Q(this,Qy,BE.subscribe(async t=>{t&&(await this.resumePausedMutations(),_(this,on).onOnline())})))}unmount(){var t,e;Jn(this,$d)._--,_(this,$d)===0&&((t=_(this,Xy))==null||t.call(this),Q(this,Xy,void 0),(e=_(this,Qy))==null||e.call(this),Q(this,Qy,void 0))}isFetching(t){return _(this,on).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return _(this,Ld).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=_(this,on).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=_(this,on).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Wh(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return _(this,on).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=_(this,on).get(n.queryHash),i=s==null?void 0:s.state.data,o=f1e(e,i);if(o!==void 0)return _(this,on).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return qn.batch(()=>_(this,on).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=_(this,on).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=_(this,on);qn.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=_(this,on);return qn.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=qn.batch(()=>_(this,on).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(fi).catch(fi)}invalidateQueries(t,e={}){return qn.batch(()=>(_(this,on).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=qn.batch(()=>_(this,on).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(fi)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(fi)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=_(this,on).build(this,e);return r.isStaleByTime(Wh(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(fi).catch(fi)}fetchInfiniteQuery(t){return t.behavior=Ez(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(fi).catch(fi)}ensureInfiniteQueryData(t){return t.behavior=Ez(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return BE.isOnline()?_(this,Ld).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,on)}getMutationCache(){return _(this,Ld)}getDefaultOptions(){return _(this,Fd)}setDefaultOptions(t){Q(this,Fd,t)}setQueryDefaults(t,e){_(this,Ky).set(Gm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[..._(this,Ky).values()],r={};return e.forEach(n=>{Kw(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){_(this,Yy).set(Gm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[..._(this,Yy).values()],r={};return e.forEach(n=>{Kw(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={..._(this,Fd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=XF(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===QF&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{..._(this,Fd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){_(this,on).clear(),_(this,Ld).clear()}},on=new WeakMap,Ld=new WeakMap,Fd=new WeakMap,Ky=new WeakMap,Yy=new WeakMap,$d=new WeakMap,Xy=new WeakMap,Qy=new WeakMap,RX),Ti,Gt,K1,ai,wp,Zy,Bd,Ud,Y1,Jy,ev,_p,jp,zd,tv,ur,Sb,CD,kD,TD,PD,OD,ID,RD,zee,MX,k1e=(MX=class extends u0{constructor(e,r){super();se(this,ur);se(this,Ti);se(this,Gt);se(this,K1);se(this,ai);se(this,wp);se(this,Zy);se(this,Bd);se(this,Ud);se(this,Y1);se(this,Jy);se(this,ev);se(this,_p);se(this,jp);se(this,zd);se(this,tv,new Set);this.options=r,Q(this,Ti,e),Q(this,Ud,null),Q(this,Bd,ED()),this.options.experimental_prefetchInRender||_(this,Bd).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Gt).addObserver(this),kz(_(this,Gt),this.options)?ce(this,ur,Sb).call(this):this.updateResult(),ce(this,ur,PD).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return MD(_(this,Gt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return MD(_(this,Gt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ce(this,ur,OD).call(this),ce(this,ur,ID).call(this),_(this,Gt).removeObserver(this)}setOptions(e){const r=this.options,n=_(this,Gt);if(this.options=_(this,Ti).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof to(this.options.enabled,_(this,Gt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ce(this,ur,RD).call(this),_(this,Gt).setOptions(this.options),r._defaulted&&!$E(this.options,r)&&_(this,Ti).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Gt),observer:this});const s=this.hasListeners();s&&Tz(_(this,Gt),n,this.options,r)&&ce(this,ur,Sb).call(this),this.updateResult(),s&&(_(this,Gt)!==n||to(this.options.enabled,_(this,Gt))!==to(r.enabled,_(this,Gt))||Wh(this.options.staleTime,_(this,Gt))!==Wh(r.staleTime,_(this,Gt)))&&ce(this,ur,CD).call(this);const i=ce(this,ur,kD).call(this);s&&(_(this,Gt)!==n||to(this.options.enabled,_(this,Gt))!==to(r.enabled,_(this,Gt))||i!==_(this,zd))&&ce(this,ur,TD).call(this,i)}getOptimisticResult(e){const r=_(this,Ti).getQueryCache().build(_(this,Ti),e),n=this.createResult(r,e);return P1e(this,n)&&(Q(this,ai,n),Q(this,Zy,this.options),Q(this,wp,_(this,Gt).state)),n}getCurrentResult(){return _(this,ai)}trackResult(e,r){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),r==null||r(s),Reflect.get(n,s))})}trackProp(e){_(this,tv).add(e)}getCurrentQuery(){return _(this,Gt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=_(this,Ti).defaultQueryOptions(e),n=_(this,Ti).getQueryCache().build(_(this,Ti),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return ce(this,ur,Sb).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,ai)))}createResult(e,r){var E;const n=_(this,Gt),s=this.options,i=_(this,ai),o=_(this,wp),l=_(this,Zy),u=e!==n?e.state:_(this,K1),{state:d}=e;let h={...d},f=!1,p;if(r._optimisticResults){const M=this.hasListeners(),z=!M&&kz(e,r),I=M&&Tz(e,n,r,s);(z||I)&&(h={...h,...Bee(d.data,e.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:v}=h;p=h.data;let y=!1;if(r.placeholderData!==void 0&&p===void 0&&v==="pending"){let M;i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(M=i.data,y=!0):M=typeof r.placeholderData=="function"?r.placeholderData((E=_(this,ev))==null?void 0:E.state.data,_(this,ev)):r.placeholderData,M!==void 0&&(v="success",p=AD(i==null?void 0:i.data,M,r),f=!0)}if(r.select&&p!==void 0&&!y)if(i&&p===(o==null?void 0:o.data)&&r.select===_(this,Y1))p=_(this,Jy);else try{Q(this,Y1,r.select),p=r.select(p),p=AD(i==null?void 0:i.data,p,r),Q(this,Jy,p),Q(this,Ud,null)}catch(M){Q(this,Ud,M)}_(this,Ud)&&(g=_(this,Ud),p=_(this,Jy),m=Date.now(),v="error");const x=h.fetchStatus==="fetching",b=v==="pending",w=v==="error",j=b&&x,N=p!==void 0,k={status:v,fetchStatus:h.fetchStatus,isPending:b,isSuccess:v==="success",isError:w,isInitialLoading:j,isLoading:j,data:p,dataUpdatedAt:h.dataUpdatedAt,error:g,errorUpdatedAt:m,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!b,isLoadingError:w&&!N,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&N,isStale:JF(e,r),refetch:this.refetch,promise:_(this,Bd),isEnabled:to(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=q=>{k.status==="error"?q.reject(k.error):k.data!==void 0&&q.resolve(k.data)},z=()=>{const q=Q(this,Bd,k.promise=ED());M(q)},I=_(this,Bd);switch(I.status){case"pending":e.queryHash===n.queryHash&&M(I);break;case"fulfilled":(k.status==="error"||k.data!==I.value)&&z();break;case"rejected":(k.status!=="error"||k.error!==I.reason)&&z();break}}return k}updateResult(){const e=_(this,ai),r=this.createResult(_(this,Gt),this.options);if(Q(this,wp,_(this,Gt).state),Q(this,Zy,this.options),_(this,wp).data!==void 0&&Q(this,ev,_(this,Gt)),$E(r,e))return;Q(this,ai,r);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!_(this,tv).size)return!0;const o=new Set(i??_(this,tv));return this.options.throwOnError&&o.add("error"),Object.keys(_(this,ai)).some(l=>{const c=l;return _(this,ai)[c]!==e[c]&&o.has(c)})};ce(this,ur,zee).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ce(this,ur,PD).call(this)}},Ti=new WeakMap,Gt=new WeakMap,K1=new WeakMap,ai=new WeakMap,wp=new WeakMap,Zy=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,Y1=new WeakMap,Jy=new WeakMap,ev=new WeakMap,_p=new WeakMap,jp=new WeakMap,zd=new WeakMap,tv=new WeakMap,ur=new WeakSet,Sb=function(e){ce(this,ur,RD).call(this);let r=_(this,Gt).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(fi)),r},CD=function(){ce(this,ur,OD).call(this);const e=Wh(this.options.staleTime,_(this,Gt));if(qm||_(this,ai).isStale||!SD(e))return;const n=Oee(_(this,ai).dataUpdatedAt,e)+1;Q(this,_p,setTimeout(()=>{_(this,ai).isStale||this.updateResult()},n))},kD=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Gt)):this.options.refetchInterval)??!1},TD=function(e){ce(this,ur,ID).call(this),Q(this,zd,e),!(qm||to(this.options.enabled,_(this,Gt))===!1||!SD(_(this,zd))||_(this,zd)===0)&&Q(this,jp,setInterval(()=>{(this.options.refetchIntervalInBackground||ZF.isFocused())&&ce(this,ur,Sb).call(this)},_(this,zd)))},PD=function(){ce(this,ur,CD).call(this),ce(this,ur,TD).call(this,ce(this,ur,kD).call(this))},OD=function(){_(this,_p)&&(clearTimeout(_(this,_p)),Q(this,_p,void 0))},ID=function(){_(this,jp)&&(clearInterval(_(this,jp)),Q(this,jp,void 0))},RD=function(){const e=_(this,Ti).getQueryCache().build(_(this,Ti),this.options);if(e===_(this,Gt))return;const r=_(this,Gt);Q(this,Gt,e),Q(this,K1,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},zee=function(e){qn.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(_(this,ai))}),_(this,Ti).getQueryCache().notify({query:_(this,Gt),type:"observerResultsUpdated"})})},MX);function T1e(t,e){return to(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function kz(t,e){return T1e(t,e)||t.state.data!==void 0&&MD(t,e,e.refetchOnMount)}function MD(t,e,r){if(to(e.enabled,t)!==!1&&Wh(e.staleTime,t)!=="static"){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&JF(t,e)}return!1}function Tz(t,e,r,n){return(t!==e||to(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&JF(t,r)}function JF(t,e){return to(e.enabled,t)!==!1&&t.isStaleByTime(Wh(e.staleTime,t))}function P1e(t,e){return!$E(t.getCurrentResult(),e)}var Hd,Wd,Pi,Qc,Bu,vA,DD,DX,O1e=(DX=class extends u0{constructor(r,n){super();se(this,Bu);se(this,Hd);se(this,Wd);se(this,Pi);se(this,Qc);Q(this,Hd,r),this.setOptions(n),this.bindMethods(),ce(this,Bu,vA).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var s;const n=this.options;this.options=_(this,Hd).defaultMutationOptions(r),$E(this.options,n)||_(this,Hd).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Pi),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Gm(n.mutationKey)!==Gm(this.options.mutationKey)?this.reset():((s=_(this,Pi))==null?void 0:s.state.status)==="pending"&&_(this,Pi).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,Pi))==null||r.removeObserver(this)}onMutationUpdate(r){ce(this,Bu,vA).call(this),ce(this,Bu,DD).call(this,r)}getCurrentResult(){return _(this,Wd)}reset(){var r;(r=_(this,Pi))==null||r.removeObserver(this),Q(this,Pi,void 0),ce(this,Bu,vA).call(this),ce(this,Bu,DD).call(this)}mutate(r,n){var s;return Q(this,Qc,n),(s=_(this,Pi))==null||s.removeObserver(this),Q(this,Pi,_(this,Hd).getMutationCache().build(_(this,Hd),this.options)),_(this,Pi).addObserver(this),_(this,Pi).execute(r)}},Hd=new WeakMap,Wd=new WeakMap,Pi=new WeakMap,Qc=new WeakMap,Bu=new WeakSet,vA=function(){var n;const r=((n=_(this,Pi))==null?void 0:n.state)??Uee();Q(this,Wd,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},DD=function(r){qn.batch(()=>{var n,s,i,o,l,c,u,d;if(_(this,Qc)&&this.hasListeners()){const h=_(this,Wd).variables,f=_(this,Wd).context;(r==null?void 0:r.type)==="success"?((s=(n=_(this,Qc)).onSuccess)==null||s.call(n,r.data,h,f),(o=(i=_(this,Qc)).onSettled)==null||o.call(i,r.data,null,h,f)):(r==null?void 0:r.type)==="error"&&((c=(l=_(this,Qc)).onError)==null||c.call(l,r.error,h,f),(d=(u=_(this,Qc)).onSettled)==null||d.call(u,void 0,r.error,h,f))}this.listeners.forEach(h=>{h(_(this,Wd))})})},DX),Hee=S.createContext(void 0),e6=t=>{const e=S.useContext(Hee);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},I1e=({client:t,children:e})=>(S.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(Hee.Provider,{value:t,children:e})),Wee=S.createContext(!1),R1e=()=>S.useContext(Wee);Wee.Provider;function M1e(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var D1e=S.createContext(M1e()),L1e=()=>S.useContext(D1e),F1e=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},$1e=t=>{S.useEffect(()=>{t.clearReset()},[t])},B1e=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Mee(r,[t.error,n])),U1e=t=>{if(t.suspense){const e=n=>n==="static"?n:Math.max(n??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...n)=>e(r(...n)):e(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},z1e=(t,e)=>t.isLoading&&t.isFetching&&!e,H1e=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Pz=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function W1e(t,e,r){var h,f,p,g,m;const n=R1e(),s=L1e(),i=e6(),o=i.defaultQueryOptions(t);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o),o._optimisticResults=n?"isRestoring":"optimistic",U1e(o),F1e(o,s),$1e(s);const l=!i.getQueryCache().get(o.queryHash),[c]=S.useState(()=>new e(i,o)),u=c.getOptimisticResult(o),d=!n&&t.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(v=>{const y=d?c.subscribe(qn.batchCalls(v)):fi;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),S.useEffect(()=>{c.setOptions(o)},[o,c]),H1e(o,u))throw Pz(o,c,s);if(B1e({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,o,u),o.experimental_prefetchInRender&&!qm&&z1e(u,n)){const v=l?Pz(o,c,s):(m=i.getQueryCache().get(o.queryHash))==null?void 0:m.promise;v==null||v.catch(fi).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function V1e(t,e){return W1e(t,k1e)}function WP(t,e){const r=e6(),[n]=S.useState(()=>new O1e(r,t));S.useEffect(()=>{n.setOptions(t)},[n,t]);const s=S.useSyncExternalStore(S.useCallback(o=>n.subscribe(qn.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=S.useCallback((o,l)=>{n.mutate(o,l).catch(fi)},[n]);if(s.error&&Mee(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/**
 * @remix-run/router v1.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Yw(){return Yw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Yw.apply(this,arguments)}var Mh;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Mh||(Mh={}));const Oz="popstate";function q1e(t){t===void 0&&(t={});function e(n,s){let{pathname:i,search:o,hash:l}=n.location;return LD("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:UE(s)}return K1e(e,r,null,t)}function Sn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vee(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function G1e(){return Math.random().toString(36).substr(2,8)}function Iz(t,e){return{usr:t.state,key:t.key,idx:e}}function LD(t,e,r,n){return r===void 0&&(r=null),Yw({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?d0(e):e,{state:r,key:e&&e.key||n||G1e()})}function UE(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function d0(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function K1e(t,e,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:i=!1}=n,o=s.history,l=Mh.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Yw({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=Mh.Pop;let v=d(),y=v==null?null:v-u;u=v,c&&c({action:l,location:m.location,delta:y})}function f(v,y){l=Mh.Push;let x=LD(m.location,v,y);u=d()+1;let b=Iz(x,u),w=m.createHref(x);try{o.pushState(b,"",w)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(w)}i&&c&&c({action:l,location:m.location,delta:1})}function p(v,y){l=Mh.Replace;let x=LD(m.location,v,y);u=d();let b=Iz(x,u),w=m.createHref(x);o.replaceState(b,"",w),i&&c&&c({action:l,location:m.location,delta:0})}function g(v){let y=s.location.origin!=="null"?s.location.origin:s.location.href,x=typeof v=="string"?v:UE(v);return x=x.replace(/ $/,"%20"),Sn(y,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,y)}let m={get action(){return l},get location(){return t(s,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Oz,h),c=v,()=>{s.removeEventListener(Oz,h),c=null}},createHref(v){return e(s,v)},createURL:g,encodeLocation(v){let y=g(v);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(v){return o.go(v)}};return m}var Rz;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Rz||(Rz={}));function Y1e(t,e,r){return r===void 0&&(r="/"),X1e(t,e,r,!1)}function X1e(t,e,r,n){let s=typeof e=="string"?d0(e):e,i=t6(s.pathname||"/",r);if(i==null)return null;let o=qee(t);Q1e(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=l_e(i);l=a_e(o[c],u,n)}return l}function qee(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Sn(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Vh([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(Sn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),qee(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:s_e(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of Gee(i.path))s(i,o,c)}),e}function Gee(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let o=Gee(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function Q1e(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:i_e(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Z1e=/^:[\w-]+$/,J1e=3,e_e=2,t_e=1,r_e=10,n_e=-2,Mz=t=>t==="*";function s_e(t,e){let r=t.split("/"),n=r.length;return r.some(Mz)&&(n+=n_e),e&&(n+=e_e),r.filter(s=>!Mz(s)).reduce((s,i)=>s+(Z1e.test(i)?J1e:i===""?t_e:r_e),n)}function i_e(t,e){return t.length===e.length&&t.slice(0,-1).every((n,s)=>n===e[s])?t[t.length-1]-e[e.length-1]:0}function a_e(t,e,r){let{routesMeta:n}=t,s={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=Dz({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),f=c.route;if(!h&&u&&r&&!n[n.length-1].route.index&&(h=Dz({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:Vh([i,h.pathname]),pathnameBase:h_e(Vh([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=Vh([i,h.pathnameBase]))}return o}function Dz(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=o_e(t.path,t.caseSensitive,t.end),s=e.match(r);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let m=l[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[h];return p&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function o_e(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Vee(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),n]}function l_e(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vee(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function t6(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function c_e(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:s=""}=typeof t=="string"?d0(t):t;return{pathname:r?r.startsWith("/")?r:u_e(r,e):e,search:f_e(n),hash:p_e(s)}}function u_e(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function VP(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"].  Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function d_e(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function r6(t,e){let r=d_e(t);return e?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function n6(t,e,r,n){n===void 0&&(n=!1);let s;typeof t=="string"?s=d0(t):(s=Yw({},t),Sn(!s.pathname||!s.pathname.includes("?"),VP("?","pathname","search",s)),Sn(!s.pathname||!s.pathname.includes("#"),VP("#","pathname","hash",s)),Sn(!s.search||!s.search.includes("#"),VP("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?e[h]:"/"}let c=c_e(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Vh=t=>t.join("/").replace(/\/\/+/g,"/"),h_e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),f_e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,p_e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function m_e(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Kee=["post","put","patch","delete"];new Set(Kee);const g_e=["get",...Kee];new Set(g_e);/**
 * React Router v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Xw(){return Xw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Xw.apply(this,arguments)}const s6=S.createContext(null),y_e=S.createContext(null),pf=S.createContext(null),dT=S.createContext(null),od=S.createContext({outlet:null,matches:[],isDataRoute:!1}),Yee=S.createContext(null);function v_e(t,e){let{relative:r}=e===void 0?{}:e;h0()||Sn(!1);let{basename:n,navigator:s}=S.useContext(pf),{hash:i,pathname:o,search:l}=Qee(t,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:Vh([n,o])),s.createHref({pathname:c,search:l,hash:i})}function h0(){return S.useContext(dT)!=null}function mf(){return h0()||Sn(!1),S.useContext(dT).location}function Xee(t){S.useContext(pf).static||S.useLayoutEffect(t)}function wr(){let{isDataRoute:t}=S.useContext(od);return t?I_e():x_e()}function x_e(){h0()||Sn(!1);let t=S.useContext(s6),{basename:e,future:r,navigator:n}=S.useContext(pf),{matches:s}=S.useContext(od),{pathname:i}=mf(),o=JSON.stringify(r6(s,r.v7_relativeSplatPath)),l=S.useRef(!1);return Xee(()=>{l.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let h=n6(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Vh([e,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[e,n,o,i,t])}const b_e=S.createContext(null);function w_e(t){let e=S.useContext(od).outlet;return e&&S.createElement(b_e.Provider,{value:t},e)}function Qee(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=S.useContext(pf),{matches:s}=S.useContext(od),{pathname:i}=mf(),o=JSON.stringify(r6(s,n.v7_relativeSplatPath));return S.useMemo(()=>n6(t,JSON.parse(o),i,r==="path"),[t,o,i,r])}function __e(t,e){return j_e(t,e)}function j_e(t,e,r,n){h0()||Sn(!1);let{navigator:s}=S.useContext(pf),{matches:i}=S.useContext(od),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=mf(),d;if(e){var h;let v=typeof e=="string"?d0(e):e;c==="/"||(h=v.pathname)!=null&&h.startsWith(c)||Sn(!1),d=v}else d=u;let f=d.pathname||"/",p=f;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=Y1e(t,{pathname:p}),m=C_e(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Vh([c,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:Vh([c,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,r,n);return e&&m?S.createElement(dT.Provider,{value:{location:Xw({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Mh.Pop}},m):m}function S_e(){let t=O_e(),e=m_e(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},e),r?S.createElement("pre",{style:s},r):null,null)}const N_e=S.createElement(S_e,null);class A_e extends S.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?S.createElement(od.Provider,{value:this.props.routeContext},S.createElement(Yee.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function E_e(t){let{routeContext:e,match:r,children:n}=t,s=S.useContext(s6);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(od.Provider,{value:e},n)}function C_e(t,e,r,n){var s;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var i;if(!r)return null;if(r.errors)t=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,l=(s=r)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||Sn(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=r,g=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||g){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,g=!1,m=null,v=null;r&&(p=l&&h.route.id?l[h.route.id]:void 0,m=h.route.errorElement||N_e,c&&(u<0&&f===0?(g=!0,v=null):u===f&&(g=!0,v=h.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,f+1)),x=()=>{let b;return p?b=m:g?b=v:h.route.Component?b=S.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,S.createElement(E_e,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:r!=null},children:b})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?S.createElement(A_e,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):x()},null)}var Zee=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Zee||{}),zE=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(zE||{});function k_e(t){let e=S.useContext(s6);return e||Sn(!1),e}function T_e(t){let e=S.useContext(y_e);return e||Sn(!1),e}function P_e(t){let e=S.useContext(od);return e||Sn(!1),e}function Jee(t){let e=P_e(),r=e.matches[e.matches.length-1];return r.route.id||Sn(!1),r.route.id}function O_e(){var t;let e=S.useContext(Yee),r=T_e(zE.UseRouteError),n=Jee(zE.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function I_e(){let{router:t}=k_e(Zee.UseNavigateStable),e=Jee(zE.UseNavigateStable),r=S.useRef(!1);return Xee(()=>{r.current=!0}),S.useCallback(function(s,i){i===void 0&&(i={}),r.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Xw({fromRouteId:e},i)))},[t,e])}function R_e(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function FD(t){let{to:e,replace:r,state:n,relative:s}=t;h0()||Sn(!1);let{future:i,static:o}=S.useContext(pf),{matches:l}=S.useContext(od),{pathname:c}=mf(),u=wr(),d=n6(e,r6(l,i.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:s}),[u,h,s,r,n]),null}function M_e(t){return w_e(t.context)}function Ct(t){Sn(!1)}function D_e(t){let{basename:e="/",children:r=null,location:n,navigationType:s=Mh.Pop,navigator:i,static:o=!1,future:l}=t;h0()&&Sn(!1);let c=e.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:c,navigator:i,static:o,future:Xw({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=d0(n));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:g="default"}=n,m=S.useMemo(()=>{let v=t6(d,c);return v==null?null:{location:{pathname:v,search:h,hash:f,state:p,key:g},navigationType:s}},[c,d,h,f,p,g,s]);return m==null?null:S.createElement(pf.Provider,{value:u},S.createElement(dT.Provider,{children:r,value:m}))}function L_e(t){let{children:e,location:r}=t;return __e($D(e),r)}new Promise(()=>{});function $D(t,e){e===void 0&&(e=[]);let r=[];return S.Children.forEach(t,(n,s)=>{if(!S.isValidElement(n))return;let i=[...e,s];if(n.type===S.Fragment){r.push.apply(r,$D(n.props.children,i));return}n.type!==Ct&&Sn(!1),!n.props.index||!n.props.children||Sn(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=$D(n.props.children,i)),r.push(o)}),r}/**
 * React Router DOM v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function BD(){return BD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},BD.apply(this,arguments)}function F_e(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function $_e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function B_e(t,e){return t.button===0&&(!e||e==="_self")&&!$_e(t)}function UD(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function U_e(t,e){let r=UD(t);return e&&e.forEach((n,s)=>{r.has(s)||e.getAll(s).forEach(i=>{r.append(s,i)})}),r}const z_e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],H_e="6";try{window.__reactRouterVersion=H_e}catch{}const W_e="startTransition",Lz=U3[W_e];function V_e(t){let{basename:e,children:r,future:n,window:s}=t,i=S.useRef();i.current==null&&(i.current=q1e({window:s,v5Compat:!0}));let o=i.current,[l,c]=S.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},d=S.useCallback(h=>{u&&Lz?Lz(()=>c(h)):c(h)},[c,u]);return S.useLayoutEffect(()=>o.listen(d),[o,d]),S.useEffect(()=>R_e(n),[n]),S.createElement(D_e,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const q_e=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",G_e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mt=S.forwardRef(function(e,r){let{onClick:n,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=e,f=F_e(e,z_e),{basename:p}=S.useContext(pf),g,m=!1;if(typeof u=="string"&&G_e.test(u)&&(g=u,q_e))try{let b=new URL(window.location.href),w=u.startsWith("//")?new URL(b.protocol+u):new URL(u),j=t6(w.pathname,p);w.origin===b.origin&&j!=null?u=j+w.search+w.hash:m=!0}catch{}let v=v_e(u,{relative:s}),y=K_e(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function x(b){n&&n(b),b.defaultPrevented||y(b)}return S.createElement("a",BD({},f,{href:g||v,onClick:m||i?n:x,ref:r,target:c}))});var Fz;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Fz||(Fz={}));var $z;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})($z||($z={}));function K_e(t,e){let{target:r,replace:n,state:s,preventScrollReset:i,relative:o,viewTransition:l}=e===void 0?{}:e,c=wr(),u=mf(),d=Qee(t,{relative:o});return S.useCallback(h=>{if(B_e(h,r)){h.preventDefault();let f=n!==void 0?n:UE(u)===UE(d);c(t,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,n,s,r,t,i,o,l])}function Dj(t){let e=S.useRef(UD(t)),r=S.useRef(!1),n=mf(),s=S.useMemo(()=>U_e(n.search,r.current?null:e.current),[n.search]),i=wr(),o=S.useCallback((l,c)=>{const u=UD(typeof l=="function"?l(s):l);r.current=!0,i("?"+u,c)},[i,s]);return[s,o]}const Y_e="modulepreload",X_e=function(t){return"/"+t},Bz={},Lj=function(e,r,n){let s=Promise.resolve();if(r&&r.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"));s=Promise.allSettled(r.map(c=>{if(c=X_e(c),c in Bz)return;Bz[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Y_e,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},Q_e=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>f0);return{default:n}},[]).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)};class i6 extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}}class Z_e extends i6{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Uz extends i6{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class zz extends i6{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var zD;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(zD||(zD={}));var J_e=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class eje{constructor(e,{headers:r={},customFetch:n,region:s=zD.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=Q_e(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,r={}){var n;return J_e(this,void 0,void 0,function*(){try{const{headers:s,method:i,body:o}=r;let l={},{region:c}=r;c||(c=this.region);const u=new URL(`${this.url}/${e}`);c&&c!=="any"&&(l["x-region"]=c,u.searchParams.set("forceFunctionRegion",c));let d;o&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",d=o):typeof o=="string"?(l["Content-Type"]="text/plain",d=o):typeof FormData<"u"&&o instanceof FormData?d=o:(l["Content-Type"]="application/json",d=JSON.stringify(o)));const h=yield this.fetch(u.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),s),body:d}).catch(m=>{throw new Z_e(m)}),f=h.headers.get("x-relay-error");if(f&&f==="true")throw new Uz(h);if(!h.ok)throw new zz(h);let p=((n=h.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),g;return p==="application/json"?g=yield h.json():p==="application/octet-stream"?g=yield h.blob():p==="text/event-stream"?g=h:p==="multipart/form-data"?g=yield h.formData():g=yield h.text(),{data:g,error:null,response:h}}catch(s){return{data:null,error:s,response:s instanceof zz||s instanceof Uz?s.context:void 0}}})}}var Fi={},a6={},hT={},Fj={},fT={},pT={},tje=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")},wx=tje();const rje=wx.fetch,ete=wx.fetch.bind(wx),tte=wx.Headers,nje=wx.Request,sje=wx.Response,f0=Object.freeze(Object.defineProperty({__proto__:null,Headers:tte,Request:nje,Response:sje,default:ete,fetch:rje},Symbol.toStringTag,{value:"Module"})),ije=jme(f0);var mT={};Object.defineProperty(mT,"__esModule",{value:!0});let aje=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};mT.default=aje;var rte=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pT,"__esModule",{value:!0});const oje=rte(ije),lje=rte(mT);let cje=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=oje.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=Object.assign({},this.headers),this.headers[e]=r,this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const n=this.fetch;let s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,c;let u=null,d=null,h=null,f=i.status,p=i.statusText;if(i.ok){if(this.method!=="HEAD"){const y=await i.text();y===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?d=y:d=JSON.parse(y))}const m=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),v=(l=i.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");m&&v&&v.length>1&&(h=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={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,h=null,f=406,p="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{const m=await i.text();try{u=JSON.parse(m),Array.isArray(u)&&i.status===404&&(d=[],u=null,f=200,p="OK")}catch{i.status===404&&m===""?(f=204,p="No Content"):u={message:m}}if(u&&this.isMaybeSingle&&(!((c=u==null?void 0:u.details)===null||c===void 0)&&c.includes("0 rows"))&&(u=null,f=200,p="OK"),u&&this.shouldThrowOnError)throw new lje.default(u)}return{error:u,data:d,count:h,status:f,statusText:p}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,l,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,r)}returns(){return this}overrideTypes(){return this}};pT.default=cje;var uje=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fT,"__esModule",{value:!0});const dje=uje(pT);let hje=class extends dje.default{select(e){let r=!1;const n=(e??"*").split("").map(s=>/\s/.test(s)&&!r?"":(s==='"'&&(r=!r),s)).join("");return this.url.searchParams.set("select",n),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:s,referencedTable:i=s}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:s=n}={}){const i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,r?"verbose":null,n?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(l=this.headers.Accept)!==null&&l!==void 0?l:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};fT.default=hje;var fje=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fj,"__esModule",{value:!0});const pje=fje(fT);let mje=class extends pje.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){const n=Array.from(new Set(r)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${o}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){const s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};Fj.default=mje;var gje=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hT,"__esModule",{value:!0});const K0=gje(Fj);let yje=class{constructor(e,{headers:r={},schema:n,fetch:s}){this.url=e,this.headers=r,this.schema=n,this.fetch=s}select(e,{head:r=!1,count:n}={}){const s=r?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),n&&(this.headers.Prefer=`count=${n}`),new K0.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:r,defaultToNull:n=!0}={}){const s="POST",i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),r&&i.push(`count=${r}`),n||i.push("missing=default"),this.headers.Prefer=i.join(","),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 K0.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:s,defaultToNull:i=!0}={}){const o="POST",l=[`resolution=${n?"ignore":"merge"}-duplicates`];if(r!==void 0&&this.url.searchParams.set("on_conflict",r),this.headers.Prefer&&l.push(this.headers.Prefer),s&&l.push(`count=${s}`),i||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new K0.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:r}={}){const n="PATCH",s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),r&&s.push(`count=${r}`),this.headers.Prefer=s.join(","),new K0.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const r="DELETE",n=[];return e&&n.push(`count=${e}`),this.headers.Prefer&&n.unshift(this.headers.Prefer),this.headers.Prefer=n.join(","),new K0.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};hT.default=yje;var gT={},yT={};Object.defineProperty(yT,"__esModule",{value:!0});yT.version=void 0;yT.version="0.0.0-automated";Object.defineProperty(gT,"__esModule",{value:!0});gT.DEFAULT_HEADERS=void 0;const vje=yT;gT.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${vje.version}`};var nte=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(a6,"__esModule",{value:!0});const xje=nte(hT),bje=nte(Fj),wje=gT;let _je=class ste{constructor(e,{headers:r={},schema:n,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},wje.DEFAULT_HEADERS),r),this.schemaName=n,this.fetch=s}from(e){const r=new URL(`${this.url}/${e}`);return new xje.default(r,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new ste(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){let o;const l=new URL(`${this.url}/rpc/${e}`);let c;n||s?(o=n?"HEAD":"GET",Object.entries(r).filter(([d,h])=>h!==void 0).map(([d,h])=>[d,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([d,h])=>{l.searchParams.append(d,h)})):(o="POST",c=r);const u=Object.assign({},this.headers);return i&&(u.Prefer=`count=${i}`),new bje.default({method:o,url:l,headers:u,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}};a6.default=_je;var p0=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.PostgrestError=Fi.PostgrestBuilder=Fi.PostgrestTransformBuilder=Fi.PostgrestFilterBuilder=Fi.PostgrestQueryBuilder=Fi.PostgrestClient=void 0;const ite=p0(a6);Fi.PostgrestClient=ite.default;const ate=p0(hT);Fi.PostgrestQueryBuilder=ate.default;const ote=p0(Fj);Fi.PostgrestFilterBuilder=ote.default;const lte=p0(fT);Fi.PostgrestTransformBuilder=lte.default;const cte=p0(pT);Fi.PostgrestBuilder=cte.default;const ute=p0(mT);Fi.PostgrestError=ute.default;var jje=Fi.default={PostgrestClient:ite.default,PostgrestQueryBuilder:ate.default,PostgrestFilterBuilder:ote.default,PostgrestTransformBuilder:lte.default,PostgrestBuilder:cte.default,PostgrestError:ute.default};const{PostgrestClient:Sje,PostgrestQueryBuilder:ayt,PostgrestFilterBuilder:oyt,PostgrestTransformBuilder:lyt,PostgrestBuilder:cyt,PostgrestError:uyt}=jje;class Nje{static dynamicRequire(e){try{return typeof process<"u"&&process.versions&&process.versions.node&&typeof require<"u"?require(e):null}catch{return null}}static detectEnvironment(){var e,r;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"&&process.versions&&process.versions.node){const n=parseInt(process.versions.node.split(".")[0]);if(n>=22)try{if(typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};const s=this.dynamicRequire("undici");if(s&&s.WebSocket)return{type:"native",constructor:s.WebSocket};throw new Error("undici not available")}catch{return{type:"unsupported",error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Install the "ws" package or check your Node.js installation.'}}try{const s=this.dynamicRequire("ws");if(s)return{type:"ws",constructor:(r=s.WebSocket)!==null&&r!==void 0?r:s};throw new Error("ws package not available")}catch{return{type:"unsupported",error:`Node.js ${n} detected without WebSocket support.`,workaround:'Install the "ws" package: npm install 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 r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`

Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){const n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Aje="2.15.0",Eje=`realtime-js/${Aje}`,Cje="1.0.0",HD=1e4,kje=1e3,Tje=100;var dw;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(dw||(dw={}));var $n;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})($n||($n={}));var Qo;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Qo||(Qo={}));var WD;(function(t){t.websocket="websocket"})(WD||(WD={}));var Qf;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Qf||(Qf={}));class Pje{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2);let o=this.HEADER_LENGTH+2;const l=n.decode(e.slice(o,o+s));o=o+s;const c=n.decode(e.slice(o,o+i));o=o+i;const u=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:u}}}let dte=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}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 jr;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(jr||(jr={}));const Hz=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((i,o)=>(i[o]=Oje(o,t,e,s),i),{})},Oje=(t,e,r,n)=>{const s=e.find(l=>l.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?hte(i,o):VD(o)},hte=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Dje(e,r)}switch(t){case jr.bool:return Ije(e);case jr.float4:case jr.float8:case jr.int2:case jr.int4:case jr.int8:case jr.numeric:case jr.oid:return Rje(e);case jr.json:case jr.jsonb:return Mje(e);case jr.timestamp:return Lje(e);case jr.abstime:case jr.date:case jr.daterange:case jr.int4range:case jr.int8range:case jr.money:case jr.reltime:case jr.text:case jr.time:case jr.timestamptz:case jr.timetz:case jr.tsrange:case jr.tstzrange:return VD(e);default:return VD(e)}},VD=t=>t,Ije=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Rje=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Mje=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Dje=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>hte(e,l))}return t},Lje=t=>typeof t=="string"?t.replace(" ","T"):t,fte=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class qP{constructor(e,r,n={},s=HD){this.channel=e,this.event=r,this.payload=n,this.timeout=s,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,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}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:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Wz;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Wz||(Wz={}));class hw{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=hw.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=hw.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=hw.syncDiff(this.state,s,i,o),l())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,s){const i=this.cloneDeep(e),o=this.transformState(r),l={},c={};return this.map(i,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const h=i[u];if(h){const f=d.map(v=>v.presence_ref),p=h.map(v=>v.presence_ref),g=d.filter(v=>p.indexOf(v.presence_ref)<0),m=h.filter(v=>f.indexOf(v.presence_ref)<0);g.length>0&&(l[u]=g),m.length>0&&(c[u]=m)}else l[u]=d}),this.syncDiff(i,{joins:l,leaves:c},n,s)}static syncDiff(e,r,n,s){const{joins:i,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(i,(l,c)=>{var u;const d=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),d.length>0){const h=e[l].map(p=>p.presence_ref),f=d.filter(p=>h.indexOf(p.presence_ref)<0);e[l].unshift(...f)}n(l,d,c)}),this.map(o,(l,c)=>{let u=e[l];if(!u)return;const d=c.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),e[l]=u,s(l,u,c),u.length===0&&delete e[l]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return"metas"in s?r[n]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):r[n]=s,r},{})}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 Vz;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Vz||(Vz={}));var fw;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(fw||(fw={}));var Hc;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Hc||(Hc={}));class o6{constructor(e,r={config:{}},n){this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=$n.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},r.config),this.timeout=this.socket.timeout,this.joinPush=new qP(this,Qo.join,this.params,this.timeout),this.rejoinTimer=new dte(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=$n.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=$n.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=$n.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=$n.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=$n.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Qo.reply,{},(s,i)=>{this._trigger(this._replyEventName(i),s)}),this.presence=new hw(this),this.broadcastEndpointURL=fte(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,r=this.timeout){var n,s;if(this.socket.isConnected()||this.socket.connect(),this.state==$n.closed){const{config:{broadcast:i,presence:o,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[fw.PRESENCE]&&this.bindings[fw.PRESENCE].length>0,d={},h={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>e==null?void 0:e(Hc.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(Hc.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket.setAuth(),f===void 0){e==null||e(Hc.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,m=(p=g==null?void 0:g.length)!==null&&p!==void 0?p:0,v=[];for(let y=0;y<m;y++){const x=g[y],{filter:{event:b,schema:w,table:j,filter:N}}=x,C=f&&f[y];if(C&&C.event===b&&C.schema===w&&C.table===j&&C.filter===N)v.push(Object.assign(Object.assign({},x),{id:C.id}));else{this.unsubscribe(),this.state=$n.errored,e==null||e(Hc.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,e&&e(Hc.SUBSCRIBED);return}}).receive("error",f=>{this.state=$n.errored,e==null||e(Hc.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Hc.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===$n.joined&&e===fw.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,r,n)}async send(e,r={}){var n,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,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:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this._push(e.type,e,r.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)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=$n.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Qo.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new qP(this,Qo.leave,{},e),n.receive("ok",()=>{r(),s("ok")}).receive("timeout",()=>{r(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=$n.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new qP(this,e,r,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Tje){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var s,i;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=Qo;if(n&&[l,c,u,d].indexOf(o)>=0&&n!==this._joinRef())return;let f=this._onMessage(o,r,n);if(r&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(p=>{var g,m,v;return((g=p.filter)===null||g===void 0?void 0:g.event)==="*"||((v=(m=p.filter)===null||m===void 0?void 0:m.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(p=>p.callback(f,n)):(i=this.bindings[o])===null||i===void 0||i.filter(p=>{var g,m,v,y,x,b;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const w=p.id,j=(g=p.filter)===null||g===void 0?void 0:g.event;return w&&((m=r.ids)===null||m===void 0?void 0:m.includes(w))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const w=(x=(y=p==null?void 0:p.filter)===null||y===void 0?void 0:y.event)===null||x===void 0?void 0:x.toLocaleLowerCase();return w==="*"||w===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof f=="object"&&"ids"in f){const g=f.data,{schema:m,table:v,commit_timestamp:y,type:x,errors:b}=g;f=Object.assign(Object.assign({},{schema:m,table:v,commit_timestamp:y,eventType:x,new:{},old:{},errors:b}),this._getPayloadRecords(g))}p.callback(f,n)})}_isClosed(){return this.state===$n.closed}_isJoined(){return this.state===$n.joined}_isJoining(){return this.state===$n.joining}_isLeaving(){return this.state===$n.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){const s=e.toLocaleLowerCase(),i={type:s,filter:r,callback:n};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,r){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&o6.isEqual(s.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Qo.close,{},e)}_onError(e){this._on(Qo.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=$n.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=Hz(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Hz(e.columns,e.old_record)),r}}const qz=()=>{},sN={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Fje=[1e3,2e3,5e3,1e4],$je=1e4,Bje=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class Uje{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=HD,this.transport=null,this.heartbeatIntervalMs=sN.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=qz,this.ref=0,this.reconnectTimer=null,this.logger=qz,this.conn=null,this.sendBuffer=[],this.serializer=new Pje,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let i;return s?i=s:typeof fetch>"u"?i=(...o)=>Lj(async()=>{const{default:l}=await Promise.resolve().then(()=>f0);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.`)}):i=fetch,(...o)=>i(...o)},!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${WD.websocket}`,this.httpEndpoint=fte(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.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=Nje.createWebSocket(this.endpointURL())}catch(e){throw this._setConnectionState("disconnected"),new Error(`WebSocket not available: ${e.message}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Cje}))}disconnect(e,r){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,r??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case dw.connecting:return Qf.Connecting;case dw.open:return Qf.Open;case dw.closing:return Qf.Closing;default:return Qf.Closed}}isConnected(){return this.connectionState()===Qf.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new o6(`realtime:${e}`,r,this);return this.channels.push(i),i}}push(e){const{topic:r,event:n,payload:s,ref:i}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${r} ${n} (${i})`,s),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()){this.heartbeatCallback("disconnected");return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.heartbeatCallback("timeout"),this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(kje,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},sN.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatCallback("sent"),this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(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 r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{r.topic==="phoenix"&&r.event==="phx_reply"&&this.heartbeatCallback(r.payload.status==="ok"?"ok":"error"),r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:s,payload:i,ref:o}=r,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${n} ${s} ${l}`.trim(),i),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,i,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.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=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.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(Qo.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;const n=e.match(/\?/)?"&":"?",s=new URLSearchParams(r);return`${e}${n}${s}`}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Bje],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{const s={access_token:r,version:Eje};r&&n.updateJoinPayload(s),n.joinedOnce&&n._isJoined()&&n._push(Qo.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new dte(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},sN.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,s,i,o,l,c,u;if(this.transport=(r=e==null?void 0:e.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:HD,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:sN.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,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=(l=e==null?void 0:e.reconnectAfterMs)!==null&&l!==void 0?l:d=>Fje[d-1]||$je,this.encode=(c=e==null?void 0:e.encode)!==null&&c!==void 0?c:(d,h)=>h(JSON.stringify(d)),this.decode=(u=e==null?void 0:e.decode)!==null&&u!==void 0?u: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}}}class l6 extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function os(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class zje extends l6{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class qD extends l6{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}}var Hje=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const pte=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>f0);return{default:n}},void 0).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)},Wje=()=>Hje(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Lj(()=>Promise.resolve().then(()=>f0),void 0)).Response:Response}),GD=t=>{if(Array.isArray(t))return t.map(r=>GD(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=GD(n)}),e},Vje=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var og=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const GP=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),qje=(t,e,r)=>og(void 0,void 0,void 0,function*(){const n=yield Wje();t instanceof n&&!(r!=null&&r.noResolveJson)?t.json().then(s=>{const i=t.status||500,o=(s==null?void 0:s.statusCode)||i+"";e(new zje(GP(s),i,o))}).catch(s=>{e(new qD(GP(s),s))}):e(new qD(GP(t),t))}),Gje=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!n?s:(Vje(n)?(s.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(n)):s.body=n,Object.assign(Object.assign({},s),r))};function $j(t,e,r,n,s,i){return og(this,void 0,void 0,function*(){return new Promise((o,l)=>{t(r,Gje(e,n,s,i)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>qje(c,l,n))})})}function HE(t,e,r,n){return og(this,void 0,void 0,function*(){return $j(t,"GET",e,r,n)})}function Wc(t,e,r,n,s){return og(this,void 0,void 0,function*(){return $j(t,"POST",e,n,s,r)})}function KD(t,e,r,n,s){return og(this,void 0,void 0,function*(){return $j(t,"PUT",e,n,s,r)})}function Kje(t,e,r,n){return og(this,void 0,void 0,function*(){return $j(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function mte(t,e,r,n,s){return og(this,void 0,void 0,function*(){return $j(t,"DELETE",e,n,s,r)})}var Ai=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const Yje={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Gz={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Xje{constructor(e,r={},n,s){this.url=e,this.headers=r,this.bucketId=n,this.fetch=pte(s)}uploadOrUpdate(e,r,n,s){return Ai(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Gz),s);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?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),s!=null&&s.headers&&(l=Object.assign(Object.assign({},l),s.headers));const u=this._removeEmptyFolders(r),d=this._getFinalPath(u),h=yield(e=="PUT"?KD:Wc)(this.fetch,`${this.url}/object/${d}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(os(i))return{data:null,error:i};throw i}})}upload(e,r,n){return Ai(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,s){return Ai(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",r);try{let c;const u=Object.assign({upsert:Gz.upsert},s),d=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,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const h=yield KD(this.fetch,l.toString(),c,{headers:d});return{data:{path:i,fullPath:h.Key},error:null}}catch(c){if(os(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,r){return Ai(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const s=Object.assign({},this.headers);r!=null&&r.upsert&&(s["x-upsert"]="true");const i=yield Wc(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new l6("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(n){if(os(n))return{data:null,error:n};throw n}})}update(e,r,n){return Ai(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return Ai(this,void 0,void 0,function*(){try{return{data:yield Wc(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(os(s))return{data:null,error:s};throw s}})}copy(e,r,n){return Ai(this,void 0,void 0,function*(){try{return{data:{path:(yield Wc(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(os(s))return{data:null,error:s};throw s}})}createSignedUrl(e,r,n){return Ai(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield Wc(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:r},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(os(s))return{data:null,error:s};throw s}})}createSignedUrls(e,r,n){return Ai(this,void 0,void 0,function*(){try{const s=yield Wc(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(os(s))return{data:null,error:s};throw s}})}download(e,r){return Ai(this,void 0,void 0,function*(){const s=typeof(r==null?void 0:r.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((r==null?void 0:r.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield HE(this.fetch,`${this.url}/${s}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(os(l))return{data:null,error:l};throw l}})}info(e){return Ai(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{const n=yield HE(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:GD(n),error:null}}catch(n){if(os(n))return{data:null,error:n};throw n}})}exists(e){return Ai(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{return yield Kje(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(os(n)&&n instanceof qD){const s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){const n=this._getFinalPath(e),s=[],i=r!=null&&r.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&s.push(i);const l=typeof(r==null?void 0:r.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((r==null?void 0:r.transform)||{});c!==""&&s.push(c);let u=s.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${u}`)}}}remove(e){return Ai(this,void 0,void 0,function*(){try{return{data:yield mte(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(os(r))return{data:null,error:r};throw r}})}list(e,r,n){return Ai(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},Yje),r),{prefix:e||""});return{data:yield Wc(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(os(s))return{data:null,error:s};throw s}})}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 r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}}const Qje="2.10.4",Zje={"X-Client-Info":`storage-js/${Qje}`};var _g=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class Jje{constructor(e,r={},n,s){const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},Zje),r),this.fetch=pte(n)}listBuckets(){return _g(this,void 0,void 0,function*(){try{return{data:yield HE(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(os(e))return{data:null,error:e};throw e}})}getBucket(e){return _g(this,void 0,void 0,function*(){try{return{data:yield HE(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(os(r))return{data:null,error:r};throw r}})}createBucket(e,r={public:!1}){return _g(this,void 0,void 0,function*(){try{return{data:yield Wc(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(os(n))return{data:null,error:n};throw n}})}updateBucket(e,r){return _g(this,void 0,void 0,function*(){try{return{data:yield KD(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(os(n))return{data:null,error:n};throw n}})}emptyBucket(e){return _g(this,void 0,void 0,function*(){try{return{data:yield Wc(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(os(r))return{data:null,error:r};throw r}})}deleteBucket(e){return _g(this,void 0,void 0,function*(){try{return{data:yield mte(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(os(r))return{data:null,error:r};throw r}})}}class eSe extends Jje{constructor(e,r={},n,s){super(e,r,n,s)}from(e){return new Xje(this.url,this.headers,e,this.fetch)}}const tSe="2.54.0";let Nb="";typeof Deno<"u"?Nb="deno":typeof document<"u"?Nb="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Nb="react-native":Nb="node";const rSe={"X-Client-Info":`supabase-js-${Nb}/${tSe}`},nSe={headers:rSe},sSe={schema:"public"},iSe={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},aSe={};var oSe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};const lSe=t=>{let e;return t?e=t:typeof fetch>"u"?e=ete:e=fetch,(...r)=>e(...r)},cSe=()=>typeof Headers>"u"?tte:Headers,uSe=(t,e,r)=>{const n=lSe(r),s=cSe();return(i,o)=>oSe(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:t;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",t),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(i,Object.assign(Object.assign({},o),{headers:u}))})};var dSe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};function hSe(t){return t.endsWith("/")?t:t+"/"}function fSe(t,e){var r,n;const{db:s,auth:i,realtime:o,global:l}=t,{db:c,auth:u,realtime:d,global:h}=e,f={db:Object.assign(Object.assign({},c),s),auth:Object.assign(Object.assign({},u),i),realtime:Object.assign(Object.assign({},d),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:()=>dSe(this,void 0,void 0,function*(){return""})};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}const gte="2.71.1",Lg=30*1e3,YD=3,KP=YD*Lg,pSe="http://localhost:9999",mSe="supabase.auth.token",gSe={"X-Client-Info":`gotrue-js/${gte}`},XD="X-Supabase-Api-Version",yte={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ySe=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,vSe=10*60*1e3;class c6 extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function Ot(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class xSe extends c6{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function bSe(t){return Ot(t)&&t.name==="AuthApiError"}class vte extends c6{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class gf extends c6{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class _d extends gf{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function wSe(t){return Ot(t)&&t.name==="AuthSessionMissingError"}class iN extends gf{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class aN extends gf{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class oN extends gf{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function _Se(t){return Ot(t)&&t.name==="AuthImplicitGrantRedirectError"}class Kz extends gf{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class QD extends gf{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function YP(t){return Ot(t)&&t.name==="AuthRetryableFetchError"}class Yz extends gf{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class ZD extends gf{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const WE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Xz=` 	
\r=`.split(""),jSe=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Xz.length;e+=1)t[Xz[e].charCodeAt(0)]=-2;for(let e=0;e<WE.length;e+=1)t[WE[e].charCodeAt(0)]=e;return t})();function Qz(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(WE[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;r(WE[n]),e.queuedBits-=6}}function xte(t,e,r){const n=jSe[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Zz(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{ASe(o,n,r)};for(let o=0;o<t.length;o+=1)xte(t.charCodeAt(o),s,i);return e.join("")}function SSe(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function NSe(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}SSe(n,e)}}function ASe(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function ESe(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)xte(t.charCodeAt(s),r,n);return new Uint8Array(e)}function CSe(t){const e=[];return NSe(t,r=>e.push(r)),new Uint8Array(e)}function kSe(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>Qz(s,r,n)),Qz(null,r,n),e.join("")}function TSe(t){return Math.round(Date.now()/1e3)+t}function PSe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Oo=()=>typeof window<"u"&&typeof document<"u",Pf={tested:!1,writable:!1},bte=()=>{if(!Oo())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Pf.tested)return Pf.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Pf.tested=!0,Pf.writable=!0}catch{Pf.tested=!0,Pf.writable=!1}return Pf.writable};function OSe(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const wte=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...r)=>Lj(async()=>{const{default:n}=await Promise.resolve().then(()=>f0);return{default:n}},void 0).then(({default:n})=>n(...r)):e=fetch,(...r)=>e(...r)},ISe=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Fg=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Of=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},gd=async(t,e)=>{await t.removeItem(e)};class vT{constructor(){this.promise=new vT.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}vT.promiseConstructor=Promise;function XP(t){const e=t.split(".");if(e.length!==3)throw new ZD("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!ySe.test(e[n]))throw new ZD("JWT not in base64url format");return{header:JSON.parse(Zz(e[0])),payload:JSON.parse(Zz(e[1])),signature:ESe(e[2]),raw:{header:e[0],payload:e[1]}}}async function RSe(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function MSe(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function DSe(t){return("0"+t.toString(16)).substr(-2)}function LSe(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,DSe).join("")}async function FSe(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function $Se(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await FSe(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jg(t,e,r=!1){const n=LSe();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await Fg(t,`${e}-code-verifier`,s);const i=await $Se(n);return[i,n===i?"plain":"s256"]}const BSe=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function USe(t){const e=t.headers.get(XD);if(!e||!e.match(BSe))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function zSe(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function HSe(t){switch(t){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 WSe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Sg(t){if(!WSe.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function QP(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.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 "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Jz(t){return JSON.parse(JSON.stringify(t))}var VSe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r};const zf=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),qSe=[502,503,504];async function e9(t){var e;if(!ISe(t))throw new QD(zf(t),0);if(qSe.includes(t.status))throw new QD(zf(t),t.status);let r;try{r=await t.json()}catch(i){throw new vte(zf(i),i)}let n;const s=USe(t);if(s&&s.getTime()>=yte["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new Yz(zf(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new _d}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new Yz(zf(r),t.status,r.weak_password.reasons);throw new xSe(zf(r),t.status||500,n)}const GSe=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function zt(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[XD]||(i[XD]=yte["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await KSe(t,e,r+l,{headers:i,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 KSe(t,e,r,n,s,i){const o=GSe(e,n,s,i);let l;try{l=await t(r,Object.assign({},o))}catch(c){throw console.error(c),new QD(zf(c),0)}if(l.ok||await e9(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await e9(c)}}function Fc(t){var e;let r=null;ZSe(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=TSe(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function t9(t){const e=Fc(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Pd(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function YSe(t){return{data:t,error:null}}function XSe(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=VSe(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function QSe(t){return t}function ZSe(t){return t.access_token&&t.refresh_token&&t.expires_in}const ZP=["global","local","others"];var JSe=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r};class eNe{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=wte(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,r=ZP[0]){if(ZP.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${ZP.join(", ")}`);try{return await zt(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ot(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await zt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Pd})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=JSe(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await zt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:XSe,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(Ot(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await zt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Pd})}catch(r){if(Ot(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await zt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:QSe});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(g=>{const m=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(g.split(";")[1].split("=")[1]);u[`${v}Page`]=m}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(Ot(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Sg(e);try{return await zt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Pd})}catch(r){if(Ot(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Sg(e);try{return await zt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Pd})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Sg(e);try{return await zt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Pd})}catch(n){if(Ot(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Sg(e.userId);try{const{data:r,error:n}=await zt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Sg(e.userId),Sg(e.id);try{return{data:await zt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}}function r9(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}function tNe(){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 Ng={debug:!!(globalThis&&bte()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class _te extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class rNe extends _te{}async function nNe(t,e,r){Ng.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Ng.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Ng.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await r()}finally{Ng.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Ng.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new rNe(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ng.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}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 r()}}))}tNe();const sNe={url:pSe,storageKey:mSe,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:gSe,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function n9(t,e,r){return await r()}const Ag={};class Qw{constructor(e){var r,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=Qw.nextInstanceID,Qw.nextInstanceID+=1,this.instanceID>0&&Oo()&&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 s=Object.assign(Object.assign({},sNe),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new eNe({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=wte(s.fetch),this.lock=s.lock||n9,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Oo()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=nNe:this.lock=n9,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?(s.storage?this.storage=s.storage:bte()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=r9(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=r9(this.memoryStorage)),Oo()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,r;return(r=(e=Ag[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ag[this.storageKey]=Object.assign(Object.assign({},Ag[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ag[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ag[this.storageKey]=Object.assign(Object.assign({},Ag[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${gte}) ${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 r=OSe(window.location.href);let n="none";if(this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce"),Oo()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),_Se(i)){const c=(e=i.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:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=s;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(r){return Ot(r)?{error:r}:{error:new vte("Unexpected error during initialization",r)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:Fc}),{data:o,error:l}=i;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(i){if(Ot(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:d,password:h,options:f}=e;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await jg(this.storage,this.storageKey)),i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:g},xform:Fc})}else if("phone"in e){const{phone:d,password:h,options:f}=e;i=await zt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Fc})}else throw new aN("You must provide either an email or phone number and a password");const{data:o,error:l}=i;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(i){if(Ot(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:l}=e;r=await zt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:t9})}else if("phone"in e){const{phone:i,password:o,options:l}=e;r=await zt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:t9})}else throw new aN("You must provide either an email or phone number and a password");const{data:n,error:s}=r;return s?{data:{user:null,session:null},error:s}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new iN}:(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:s})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;if(r==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}async signInWithSolana(e){var r,n,s,i,o,l,c,u,d,h,f,p;let g,m;if("message"in e)g=e.message,m=e.signature;else{const{chain:v,wallet:y,statement:x,options:b}=e;let w;if(Oo())if(typeof y=="object")w=y;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))w=N.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 y!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=y}const j=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in w&&w.signIn){const N=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),x?{statement:x}:null));let C;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")C=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)C=N;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)g=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),m=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${j.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(s=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((u=b==null?void 0:b.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(d=b==null?void 0:b.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
`);const N=await w.signMessage(new TextEncoder().encode(g),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=N}}try{const{data:v,error:y}=await zt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:kSe(m)},!((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:Fc});if(y)throw y;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new iN}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:y})}catch(v){if(Ot(v))return{data:{user:null,session:null},error:v};throw v}}async _exchangeCodeForSession(e){const r=await Of(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{const{data:i,error:o}=await zt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Fc});if(await gd(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new iN}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(Ot(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,l=await zt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Fc}),{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 iN}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:u})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await jg(this.storage,this.storageKey));const{error:h}=await zt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},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:d},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:d}=await zt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!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:d}}throw new aN("You must provide either an email or phone number.")}catch(l){if(Ot(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await zt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Fc});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(s){if(Ot(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var r,n,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await jg(this.storage,this.storageKey)),await zt(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=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:YSe})}catch(i){if(Ot(i))return{data:null,error:i};throw i}}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:r},error:n}=e;if(n)throw n;if(!r)throw new _d;const{error:s}=await zt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(Ot(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await zt(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:l}=await zt(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new aN("You must provide either an email or phone number and a type")}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}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=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.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 r=await this.__loadSession();return await e(r)}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 r=await Of(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<KP:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Of(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=QP()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,u,d)=>(!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,d))})}return{data:{session:e},error:null}}const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},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 zt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Pd}):await this._useSession(async r=>{var n,s,i;const{data:o,error:l}=r;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new _d}:await zt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Pd})})}catch(r){if(Ot(r))return wSe(r)&&(await this._removeSession(),await gd(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:r};throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new _d;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await jg(this.storage,this.storageKey));const{data:u,error:d}=await zt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Pd});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(n){if(Ot(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 _d;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=XP(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){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};i=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(r){if(Ot(r))return{data:{session:null,user:null},error:r};throw r}}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 r=>{var n;if(!e){const{data:o,error:l}=r;if(l)throw l;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new _d;const{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if(Ot(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(e,r){try{if(!Oo())throw new oN("No browser detected.");if(e.error||e.error_description||e.error_code)throw new oN(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Kz("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new oN("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Kz("No code detected.");const{data:x,error:b}=await this._exchangeCodeForSession(e.code);if(b)throw b;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:x.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!i||!l||!o||!u)throw new oN("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const p=f-d;p*1e3<=Lg&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${h}s`);const g=f-h;d-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,d):d-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,f,d);const{data:m,error:v}=await this._getUser(i);if(v)throw v;const y={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:f,refresh_token:o,token_type:u,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:e.type},error:null}}catch(n){if(Ot(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Of(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}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 r=>{var n;const{data:s,error:i}=r;if(i)return{error:i};const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(bSe(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await gd(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const r=PSe(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await jg(this.storage,this.storageKey,!0));try{return await zt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(Ot(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async linkIdentity(e){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,l,c,u,d;const{data:h,error:f}=i;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 zt(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Oo()&&!(!((r=e.options)===null||r===void 0)&&r.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(Ot(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await zt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await MSe(async s=>(s>0&&await RSe(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await zt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Fc})),(s,i)=>{const o=200*Math.pow(2,s);return i&&YP(i)&&Date.now()+o-n<Lg})}catch(n){if(this._debug(r,"error",n),Ot(n))return{data:{session:null,user:null},error:n};throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Oo()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Of(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Of(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Fg(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:QP()}else if(s&&!s.user&&!s.user){const o=await Of(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await gd(this.storage,this.storageKey+"-user"),await Fg(this.storage,this.storageKey,s)):s.user=QP()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<KP;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${KP}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),YP(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):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",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new _d;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new vT;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new _d;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(s,"error",i),Ot(i)){const o={session:null,error:i};return YP(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,r)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Fg(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=Jz(s);await Fg(this.storage,this.storageKey,i)}else{const s=Jz(r);await Fg(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await gd(this.storage,this.storageKey),await gd(this.storage,this.storageKey+"-code-verifier"),await gd(this.storage,this.storageKey+"-user"),this.userStorage&&await gd(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Oo()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Lg);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 r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Lg);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Lg}ms, refresh threshold is ${YD} ticks`),s<=YD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof _te)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Oo()||!(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 r=`#_onVisibilityChanged(${e})`;this._debug(r,"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(r,"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,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await jg(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?{data:null,error:i}:await zt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;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 zt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?{data:null,error:u}:(e.factorType==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return{data:null,error:i};const{data:o,error:l}=await zt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=s==null?void 0:s.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(r){if(Ot(r))return{data:null,error:r};throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?{data:null,error:i}:await zt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Ot(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){const{data:{user:e},error:r}=await this.getUser();if(r)return{data:null,error:r};const n=(e==null?void 0:e.factors)||[],s=n.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=n.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:n,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var r,n;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=XP(s.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((n=(r=s.user.factors)===null||r===void 0?void 0:r.filter(h=>h.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");const d=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:d},error:null}}))}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(l=>l.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+vSe>s)return n;const{data:i,error:o}=await zt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:p,error:g}=await this.getSession();if(g||!p.session)return{data:null,error:g};n=p.session.access_token}const{header:s,payload:i,signature:o,raw:{header:l,payload:c}}=XP(n);r!=null&&r.allowExpired||zSe(i.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:o},error:null}}const d=HSe(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,CSe(`${l}.${c}`)))throw new ZD("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(Ot(n))return{data:null,error:n};throw n}}}Qw.nextInstanceID=0;const iNe=Qw;class aNe extends iNe{constructor(e){super(e)}}var oNe=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?i(d.value):s(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})};class lNe{constructor(e,r,n){var s,i,o;if(this.supabaseUrl=e,this.supabaseKey=r,!e)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");const l=hSe(e),c=new URL(l);this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,d={db:sSe,realtime:aSe,auth:Object.assign(Object.assign({},iSe),{storageKey:u}),global:nSe},h=fSe(n??{},d);this.storageKey=(s=h.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},h.accessToken?(this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(f,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=h.auth)!==null&&o!==void 0?o:{},this.headers,h.global.fetch),this.fetch=uSe(r,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 Sje(new URL("rest/v1",c).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new eSe(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new eje(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,r={},n={}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,r;return oNe(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:n}=yield this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:s,storageKey:i,flowType:o,lock:l,debug:c},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new aNe({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),u),storageKey:i,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:s,flowType:o,lock:l,debug:c,fetch:d,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new Uje(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((r,n)=>{this._handleTokenChanged(r,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const jte=(t,e,r)=>new lNe(t,e,r);function cNe(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}cNe()&&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 uNe="https://nqibmbtqcjucktqcreob.supabase.co",dNe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg",Ar=jte(uNe,dNe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),Ste=S.createContext(void 0);function hNe({children:t}){const[e,r]=S.useState(null),[n,s]=S.useState(null),[i,o]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!0),h=async A=>{try{await Promise.all([f(A),p(A),g(A)])}catch(U){console.error("Error loading user data:",U)}finally{d(!1)}};S.useEffect(()=>{let A=!0;Ar.auth.getSession().then(async({data:{session:K}})=>{A&&(r((K==null?void 0:K.user)??null),K!=null&&K.user?await h(K.user.id):d(!1))});const{data:{subscription:U}}=Ar.auth.onAuthStateChange((K,G)=>{A&&(K==="SIGNED_IN"&&d(!0),r((G==null?void 0:G.user)??null),G!=null&&G.user?setTimeout(async()=>{A&&await h(G.user.id)},0):(s(null),o(null),c(null),d(!1)))});return()=>{A=!1,U.unsubscribe()}},[]);const f=async A=>{try{const{data:U,error:K}=await Ar.from("users").select("*").eq("id",A).maybeSingle();if(K){if(console.error("Error fetching user profile:",K),K.code==="PGRST116"){await x(A);return}}else U?s(U):await x(A)}catch(U){console.error("Error in fetchUserProfile:",U)}},p=async A=>{try{const{data:U,error:K}=await Ar.from("user_profiles").select("*").eq("user_id",A).maybeSingle();if(K&&K.code!=="PGRST116"){console.error("Error fetching research profile:",K);return}o(U)}catch(U){console.error("Error in fetchResearchProfile:",U)}},g=async A=>{try{const{data:U,error:K}=await Ar.from("user_student_points").select("total_purchased, used_points, remaining_points").eq("user_id",A).maybeSingle();if(K)throw K;c({total:(U==null?void 0:U.total_purchased)||60,used:(U==null?void 0:U.used_points)||0,remaining:(U==null?void 0:U.remaining_points)||60})}catch(U){console.error("Error fetching student points:",U),c({total:60,used:0,remaining:60})}},m=async A=>{await g(A)},v=async()=>{e&&(await f(e.id),await g(e.id))},y=async A=>{await p(A)},x=async(A,U)=>{var K;try{const{data:G}=await Ar.auth.getUser();if(!((K=G.user)!=null&&K.email))return;const Y={id:A,email:G.user.email,plan:"starter",current_token_balance:30};if(U)Y.terms_accepted_at=U.terms_accepted_at,Y.privacy_accepted_at=U.privacy_accepted_at,Y.terms_version=U.terms_version,Y.privacy_version=U.privacy_version,Y.marketing_consent=!0,Y.marketing_consent_at=U.terms_accepted_at;else if(G.user.user_metadata){const L=G.user.user_metadata;L.terms_accepted_at&&(Y.terms_accepted_at=L.terms_accepted_at,Y.privacy_accepted_at=L.privacy_accepted_at,Y.terms_version=L.terms_version,Y.privacy_version=L.privacy_version,Y.marketing_consent=!0,Y.marketing_consent_at=L.terms_accepted_at)}const{data:H,error:$}=await Ar.from("users").insert(Y).select().single();if($)if($.code==="23505"){console.log("User profile already exists, fetching...");const{data:L}=await Ar.from("users").select("*").eq("id",A).single();L&&s(L)}else console.error("Error creating user profile:",$);else s(H)}catch(G){console.error("Error in createUserProfile:",G)}},b=async(A,U)=>{if(!A||!A.includes("@"))return{error:{message:"Please enter a valid email address"}};if(!U||U.length<6)return{error:{message:"Password must be at least 6 characters"}};const{error:K}=await Ar.auth.signInWithPassword({email:A.trim().toLowerCase(),password:U});return K||typeof window<"u"&&window.umami&&window.umami.track("user-login"),{error:K}},w=async(A,U,K)=>{if(!A||!A.includes("@"))return{error:{message:"Please enter a valid email address"}};if(!U||U.length<6)return{error:{message:"Password must be at least 6 characters"}};const{data:G,error:Y}=await Ar.auth.signUp({email:A.trim().toLowerCase(),password:U,options:{emailRedirectTo:`${window.location.origin}/dashboard`,data:K?{terms_accepted_at:K.terms_accepted_at,privacy_accepted_at:K.privacy_accepted_at,terms_version:K.terms_version,privacy_version:K.privacy_version}:void 0}});return!Y&&G.user&&K&&await x(G.user.id,K),{error:Y}},j=async()=>{const{error:A}=await Ar.auth.signOut();return A||(r(null),s(null),o(null),c(null)),{error:A}},N=A=>{switch(A){case"starter":return 30;case"pro":return 100;case"author":return 200;default:return 30}},C=async A=>{try{const{data:U,error:K}=await Ar.rpc("consume_tokens",{pages_to_consume:A});return K?(console.error("Token consumption error:",K),{success:!1,error:K.message}):(e&&await f(e.id),U)}catch(U){return console.error("Token consumption error:",U),{success:!1,error:U.message||"Failed to consume tokens"}}},k=-20,E=()=>l?l.remaining>k:!1,M=async A=>{if(e)try{const{error:U}=await Ar.from("user_profiles").upsert({user_id:e.id,...A,updated_at:new Date().toISOString()},{onConflict:"user_id"});if(U)throw U;await y(e.id)}catch(U){throw console.error("Error updating research profile:",U),U}},q={user:e,userProfile:n,researchProfile:i,studentPoints:l,loading:u,signIn:b,signUp:w,signOut:j,getPlanLimit:N,consumeTokens:C,fetchStudentPoints:m,refreshProfile:v,checkStudentPoints:E,updateResearchProfile:M,uploadAvatar:async A=>{if(!e)throw new Error("No user logged in");try{const U=A.name.split(".").pop(),K=`${e.id}/avatar.${U}`,{error:G}=await Ar.storage.from("avatars").upload(K,A,{upsert:!0});if(G)throw G;return await M({avatar_url:K}),K}catch(U){throw console.error("Error uploading avatar:",U),U}},selectPublicAvatar:async A=>{if(!e)throw new Error("No user logged in");await M({avatar_url:A})}};return a.jsx(Ste.Provider,{value:q,children:t})}function Pt(){const t=S.useContext(Ste);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}const u6=id("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 rounded-xl shadow-md shadow-primary/20 hover:shadow-lg hover:shadow-primary/30",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 rounded-xl shadow-md",outline:"border border-border/50 bg-card/50 backdrop-blur-sm hover:bg-muted/50 hover:text-foreground rounded-xl dark:border-border/30",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-xl",ghost:"hover:bg-muted/50 hover:text-foreground rounded-xl",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-5 py-2",sm:"h-9 rounded-xl px-4",lg:"h-12 rounded-xl px-8",icon:"h-10 w-10 rounded-xl"}},defaultVariants:{variant:"default",size:"default"}}),ve=S.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...s},i)=>{const o=n?Tve:"button";return a.jsx(o,{className:Oe(u6({variant:e,size:r,className:t})),ref:i,...s})});ve.displayName="Button";var fNe=S.createContext(void 0);function lg(t){const e=S.useContext(fNe);return t||e||"ltr"}var JP=0;function xT(){S.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??s9()),document.body.insertAdjacentElement("beforeend",t[1]??s9()),JP++,()=>{JP===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),JP--}},[])}function s9(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var eO="focusScope.autoFocusOnMount",tO="focusScope.autoFocusOnUnmount",i9={bubbles:!1,cancelable:!0},pNe="FocusScope",Bj=S.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[l,c]=S.useState(null),u=pn(s),d=pn(i),h=S.useRef(null),f=jt(e,m=>c(m)),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(n){let m=function(b){if(p.paused||!l)return;const w=b.target;l.contains(w)?h.current=w:jd(h.current,{select:!0})},v=function(b){if(p.paused||!l)return;const w=b.relatedTarget;w!==null&&(l.contains(w)||jd(h.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&jd(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const x=new MutationObserver(y);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),x.disconnect()}}},[n,l,p.paused]),S.useEffect(()=>{if(l){o9.add(p);const m=document.activeElement;if(!l.contains(m)){const y=new CustomEvent(eO,i9);l.addEventListener(eO,u),l.dispatchEvent(y),y.defaultPrevented||(mNe(bNe(Nte(l)),{select:!0}),document.activeElement===m&&jd(l))}return()=>{l.removeEventListener(eO,u),setTimeout(()=>{const y=new CustomEvent(tO,i9);l.addEventListener(tO,d),l.dispatchEvent(y),y.defaultPrevented||jd(m??document.body,{select:!0}),l.removeEventListener(tO,d),o9.remove(p)},0)}}},[l,u,d,p]);const g=S.useCallback(m=>{if(!r&&!n||p.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(v&&y){const x=m.currentTarget,[b,w]=gNe(x);b&&w?!m.shiftKey&&y===w?(m.preventDefault(),r&&jd(b,{select:!0})):m.shiftKey&&y===b&&(m.preventDefault(),r&&jd(w,{select:!0})):y===x&&m.preventDefault()}},[r,n,p.paused]);return a.jsx(et.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});Bj.displayName=pNe;function mNe(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(jd(n,{select:e}),document.activeElement!==r)return}function gNe(t){const e=Nte(t),r=a9(e,t),n=a9(e.reverse(),t);return[r,n]}function Nte(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function a9(t,e){for(const r of t)if(!yNe(r,{upTo:e}))return r}function yNe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function vNe(t){return t instanceof HTMLInputElement&&"select"in t}function jd(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&vNe(t)&&e&&t.select()}}var o9=xNe();function xNe(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=l9(t,e),t.unshift(e)},remove(e){var r;t=l9(t,e),(r=t[0])==null||r.resume()}}}function l9(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function bNe(t){return t.filter(e=>e.tagName!=="A")}var rO="rovingFocusGroup.onEntryFocus",wNe={bubbles:!1,cancelable:!0},Uj="RovingFocusGroup",[JD,Ate,_Ne]=Tj(Uj),[jNe,m0]=Ln(Uj,[_Ne]),[SNe,NNe]=jNe(Uj),Ete=S.forwardRef((t,e)=>a.jsx(JD.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(JD.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(ANe,{...t,ref:e})})}));Ete.displayName=Uj;var ANe=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,f=S.useRef(null),p=jt(e,f),g=lg(i),[m,v]=Ps({prop:o,defaultProp:l??null,onChange:c,caller:Uj}),[y,x]=S.useState(!1),b=pn(u),w=Ate(r),j=S.useRef(!1),[N,C]=S.useState(0);return S.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(rO,b),()=>k.removeEventListener(rO,b)},[b]),a.jsx(SNe,{scope:r,orientation:n,dir:g,loop:s,currentTabStopId:m,onItemFocus:S.useCallback(k=>v(k),[v]),onItemShiftTab:S.useCallback(()=>x(!0),[]),onFocusableItemAdd:S.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:S.useCallback(()=>C(k=>k-1),[]),children:a.jsx(et.div,{tabIndex:y||N===0?-1:0,"data-orientation":n,...h,ref:p,style:{outline:"none",...t.style},onMouseDown:ze(t.onMouseDown,()=>{j.current=!0}),onFocus:ze(t.onFocus,k=>{const E=!j.current;if(k.target===k.currentTarget&&E&&!y){const M=new CustomEvent(rO,wNe);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const z=w().filter(K=>K.focusable),I=z.find(K=>K.active),q=z.find(K=>K.id===m),U=[I,q,...z].filter(Boolean).map(K=>K.ref.current);Tte(U,d)}}j.current=!1}),onBlur:ze(t.onBlur,()=>x(!1))})})}),Cte="RovingFocusGroupItem",kte=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,children:o,...l}=t,c=Gi(),u=i||c,d=NNe(Cte,r),h=d.currentTabStopId===u,f=Ate(r),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=d;return S.useEffect(()=>{if(n)return p(),()=>g()},[n,p,g]),a.jsx(JD.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:a.jsx(et.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:ze(t.onMouseDown,v=>{n?d.onItemFocus(u):v.preventDefault()}),onFocus:ze(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:ze(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=kNe(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=f().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const w=b.indexOf(v.currentTarget);b=d.loop?TNe(b,w+1):b.slice(w+1)}setTimeout(()=>Tte(b))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:m!=null}):o})})});kte.displayName=Cte;var ENe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function CNe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function kNe(t,e,r){const n=CNe(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return ENe[n]}function Tte(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function TNe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var d6=Ete,h6=kte,PNe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Eg=new WeakMap,lN=new WeakMap,cN={},nO=0,Pte=function(t){return t&&(t.host||Pte(t.parentNode))},ONe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=Pte(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},INe=function(t,e,r,n){var s=ONe(e,Array.isArray(t)?t:[t]);cN[r]||(cN[r]=new WeakMap);var i=cN[r],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))d(f);else try{var p=f.getAttribute(n),g=p!==null&&p!=="false",m=(Eg.get(f)||0)+1,v=(i.get(f)||0)+1;Eg.set(f,m),i.set(f,v),o.push(f),m===1&&g&&lN.set(f,!0),v===1&&f.setAttribute(r,"true"),g||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return d(e),l.clear(),nO++,function(){o.forEach(function(h){var f=Eg.get(h)-1,p=i.get(h)-1;Eg.set(h,f),i.set(h,p),f||(lN.has(h)||h.removeAttribute(n),lN.delete(h)),p||h.removeAttribute(r)}),nO--,nO||(Eg=new WeakMap,Eg=new WeakMap,lN=new WeakMap,cN={})}},bT=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=PNe(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),INe(n,s,r,"aria-hidden")):function(){return null}},tc=function(){return tc=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},tc.apply(this,arguments)};function Ote(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function RNe(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var xA="right-scroll-bar-position",bA="width-before-scroll-bar",MNe="with-scroll-bars-hidden",DNe="--removed-body-scroll-bar-size";function sO(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function LNe(t,e){var r=S.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=e,r.facade}var FNe=typeof window<"u"?S.useLayoutEffect:S.useEffect,c9=new WeakMap;function $Ne(t,e){var r=LNe(null,function(n){return t.forEach(function(s){return sO(s,n)})});return FNe(function(){var n=c9.get(r);if(n){var s=new Set(n),i=new Set(t),o=r.current;s.forEach(function(l){i.has(l)||sO(l,null)}),i.forEach(function(l){s.has(l)||sO(l,o)})}c9.set(r,t)},[t]),r}function BNe(t){return t}function UNe(t,e){e===void 0&&(e=BNe);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var o=e(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return s}function zNe(t){t===void 0&&(t={});var e=UNe(null);return e.options=tc({async:!0,ssr:!1},t),e}var Ite=function(t){var e=t.sideCar,r=Ote(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return S.createElement(n,tc({},r))};Ite.isSideCarExport=!0;function HNe(t,e){return t.useMedium(e),Ite}var Rte=zNe(),iO=function(){},wT=S.forwardRef(function(t,e){var r=S.useRef(null),n=S.useState({onScrollCapture:iO,onWheelCapture:iO,onTouchMoveCapture:iO}),s=n[0],i=n[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,h=t.shards,f=t.sideCar,p=t.noRelative,g=t.noIsolation,m=t.inert,v=t.allowPinchZoom,y=t.as,x=y===void 0?"div":y,b=t.gapMode,w=Ote(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=f,N=$Ne([r,e]),C=tc(tc({},w),s);return S.createElement(S.Fragment,null,d&&S.createElement(j,{sideCar:Rte,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),o?S.cloneElement(S.Children.only(l),tc(tc({},C),{ref:N})):S.createElement(x,tc({},C,{className:c,ref:N}),l))});wT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wT.classNames={fullWidth:bA,zeroRight:xA};var WNe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function VNe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=WNe();return e&&t.setAttribute("nonce",e),t}function qNe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function GNe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var KNe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=VNe())&&(qNe(e,r),GNe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},YNe=function(){var t=KNe();return function(e,r){S.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},Mte=function(){var t=YNe(),e=function(r){var n=r.styles,s=r.dynamic;return t(n,s),null};return e},XNe={left:0,top:0,right:0,gap:0},aO=function(t){return parseInt(t||"",10)||0},QNe=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[aO(r),aO(n),aO(s)]},ZNe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return XNe;var e=QNe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},JNe=Mte(),Py="data-scroll-locked",eAe=function(t,e,r,n){var s=t.left,i=t.top,o=t.right,l=t.gap;return r===void 0&&(r="margin"),`
  .`.concat(MNe,` {
   overflow: hidden `).concat(n,`;
   padding-right: `).concat(l,"px ").concat(n,`;
  }
  body[`).concat(Py,`] {
    overflow: hidden `).concat(n,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(n,`;
    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(xA,` {
    right: `).concat(l,"px ").concat(n,`;
  }
  
  .`).concat(bA,` {
    margin-right: `).concat(l,"px ").concat(n,`;
  }
  
  .`).concat(xA," .").concat(xA,` {
    right: 0 `).concat(n,`;
  }
  
  .`).concat(bA," .").concat(bA,` {
    margin-right: 0 `).concat(n,`;
  }
  
  body[`).concat(Py,`] {
    `).concat(DNe,": ").concat(l,`px;
  }
`)},u9=function(){var t=parseInt(document.body.getAttribute(Py)||"0",10);return isFinite(t)?t:0},tAe=function(){S.useEffect(function(){return document.body.setAttribute(Py,(u9()+1).toString()),function(){var t=u9()-1;t<=0?document.body.removeAttribute(Py):document.body.setAttribute(Py,t.toString())}},[])},rAe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;tAe();var i=S.useMemo(function(){return ZNe(s)},[s]);return S.createElement(JNe,{styles:eAe(i,!e,s,r?"":"!important")})},e4=!1;if(typeof window<"u")try{var uN=Object.defineProperty({},"passive",{get:function(){return e4=!0,!0}});window.addEventListener("test",uN,uN),window.removeEventListener("test",uN,uN)}catch{e4=!1}var Cg=e4?{passive:!1}:!1,nAe=function(t){return t.tagName==="TEXTAREA"},Dte=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!nAe(t)&&r[e]==="visible")},sAe=function(t){return Dte(t,"overflowY")},iAe=function(t){return Dte(t,"overflowX")},d9=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Lte(t,n);if(s){var i=Fte(t,n),o=i[1],l=i[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},aAe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},oAe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Lte=function(t,e){return t==="v"?sAe(e):iAe(e)},Fte=function(t,e){return t==="v"?aAe(e):oAe(e)},lAe=function(t,e){return t==="h"&&e==="rtl"?-1:1},cAe=function(t,e,r,n,s){var i=lAe(t,window.getComputedStyle(e).direction),o=i*n,l=r.target,c=e.contains(l),u=!1,d=o>0,h=0,f=0;do{if(!l)break;var p=Fte(t,l),g=p[0],m=p[1],v=p[2],y=m-v-i*g;(g||y)&&Lte(t,l)&&(h+=y,f+=g);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},dN=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},h9=function(t){return[t.deltaX,t.deltaY]},f9=function(t){return t&&"current"in t?t.current:t},uAe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},dAe=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},hAe=0,kg=[];function fAe(t){var e=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),s=S.useState(hAe++)[0],i=S.useState(Mte)[0],o=S.useRef(t);S.useEffect(function(){o.current=t},[t]),S.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var m=RNe([t.lockRef.current],(t.shards||[]).map(f9),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=S.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var y=dN(m),x=r.current,b="deltaX"in m?m.deltaX:x[0]-y[0],w="deltaY"in m?m.deltaY:x[1]-y[1],j,N=m.target,C=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in m&&C==="h"&&N.type==="range")return!1;var k=d9(C,N);if(!k)return!0;if(k?j=C:(j=C==="v"?"h":"v",k=d9(C,N)),!k)return!1;if(!n.current&&"changedTouches"in m&&(b||w)&&(n.current=j),!j)return!0;var E=n.current||j;return cAe(E,v,m,E==="h"?b:w,!0)},[]),c=S.useCallback(function(m){var v=m;if(!(!kg.length||kg[kg.length-1]!==i)){var y="deltaY"in v?h9(v):dN(v),x=e.current.filter(function(j){return j.name===v.type&&(j.target===v.target||v.target===j.shadowParent)&&uAe(j.delta,y)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var b=(o.current.shards||[]).map(f9).filter(Boolean).filter(function(j){return j.contains(v.target)}),w=b.length>0?l(v,b[0]):!o.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),u=S.useCallback(function(m,v,y,x){var b={name:m,delta:v,target:y,should:x,shadowParent:pAe(y)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),d=S.useCallback(function(m){r.current=dN(m),n.current=void 0},[]),h=S.useCallback(function(m){u(m.type,h9(m),m.target,l(m,t.lockRef.current))},[]),f=S.useCallback(function(m){u(m.type,dN(m),m.target,l(m,t.lockRef.current))},[]);S.useEffect(function(){return kg.push(i),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Cg),document.addEventListener("touchmove",c,Cg),document.addEventListener("touchstart",d,Cg),function(){kg=kg.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,Cg),document.removeEventListener("touchmove",c,Cg),document.removeEventListener("touchstart",d,Cg)}},[]);var p=t.removeScrollBar,g=t.inert;return S.createElement(S.Fragment,null,g?S.createElement(i,{styles:dAe(s)}):null,p?S.createElement(rAe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function pAe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const mAe=HNe(Rte,fAe);var zj=S.forwardRef(function(t,e){return S.createElement(wT,tc({},t,{ref:e,sideCar:mAe}))});zj.classNames=wT.classNames;var t4=["Enter"," "],gAe=["ArrowDown","PageUp","Home"],$te=["ArrowUp","PageDown","End"],yAe=[...gAe,...$te],vAe={ltr:[...t4,"ArrowRight"],rtl:[...t4,"ArrowLeft"]},xAe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Hj="Menu",[Zw,bAe,wAe]=Tj(Hj),[cg,Bte]=Ln(Hj,[wAe,ff,m0]),_T=ff(),Ute=m0(),[_Ae,ug]=cg(Hj),[jAe,Wj]=cg(Hj),zte=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:o=!0}=t,l=_T(e),[c,u]=S.useState(null),d=S.useRef(!1),h=pn(i),f=lg(s);return S.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(iT,{...l,children:a.jsx(_Ae,{scope:e,open:r,onOpenChange:h,content:c,onContentChange:u,children:a.jsx(jAe,{scope:e,onClose:S.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:n})})})};zte.displayName=Hj;var SAe="MenuAnchor",f6=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=_T(r);return a.jsx(Mj,{...s,...n,ref:e})});f6.displayName=SAe;var p6="MenuPortal",[NAe,Hte]=cg(p6,{forceMount:void 0}),Wte=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=ug(p6,e);return a.jsx(NAe,{scope:e,forceMount:r,children:a.jsx(Xn,{present:r||i.open,children:a.jsx(n0,{asChild:!0,container:s,children:n})})})};Wte.displayName=p6;var po="MenuContent",[AAe,m6]=cg(po),Vte=S.forwardRef((t,e)=>{const r=Hte(po,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=ug(po,t.__scopeMenu),o=Wj(po,t.__scopeMenu);return a.jsx(Zw.Provider,{scope:t.__scopeMenu,children:a.jsx(Xn,{present:n||i.open,children:a.jsx(Zw.Slot,{scope:t.__scopeMenu,children:o.modal?a.jsx(EAe,{...s,ref:e}):a.jsx(CAe,{...s,ref:e})})})})}),EAe=S.forwardRef((t,e)=>{const r=ug(po,t.__scopeMenu),n=S.useRef(null),s=jt(e,n);return S.useEffect(()=>{const i=n.current;if(i)return bT(i)},[]),a.jsx(g6,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),CAe=S.forwardRef((t,e)=>{const r=ug(po,t.__scopeMenu);return a.jsx(g6,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),kAe=Xh("MenuContent.ScrollLock"),g6=S.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,...m}=t,v=ug(po,r),y=Wj(po,r),x=_T(r),b=Ute(r),w=bAe(r),[j,N]=S.useState(null),C=S.useRef(null),k=jt(e,C,v.onContentChange),E=S.useRef(0),M=S.useRef(""),z=S.useRef(0),I=S.useRef(null),q=S.useRef("right"),A=S.useRef(0),U=g?zj:S.Fragment,K=g?{as:kAe,allowPinchZoom:!0}:void 0,G=H=>{var B,R;const $=M.current+H,L=w().filter(ee=>!ee.disabled),F=document.activeElement,W=(B=L.find(ee=>ee.ref.current===F))==null?void 0:B.textValue,X=L.map(ee=>ee.textValue),oe=UAe(X,$,W),le=(R=L.find(ee=>ee.textValue===oe))==null?void 0:R.ref.current;(function ee(te){M.current=te,window.clearTimeout(E.current),te!==""&&(E.current=window.setTimeout(()=>ee(""),1e3))})($),le&&setTimeout(()=>le.focus())};S.useEffect(()=>()=>window.clearTimeout(E.current),[]),xT();const Y=S.useCallback(H=>{var L,F;return q.current===((L=I.current)==null?void 0:L.side)&&HAe(H,(F=I.current)==null?void 0:F.area)},[]);return a.jsx(AAe,{scope:r,searchRef:M,onItemEnter:S.useCallback(H=>{Y(H)&&H.preventDefault()},[Y]),onItemLeave:S.useCallback(H=>{var $;Y(H)||(($=C.current)==null||$.focus(),N(null))},[Y]),onTriggerLeave:S.useCallback(H=>{Y(H)&&H.preventDefault()},[Y]),pointerGraceTimerRef:z,onPointerGraceIntentChange:S.useCallback(H=>{I.current=H},[]),children:a.jsx(U,{...K,children:a.jsx(Bj,{asChild:!0,trapped:s,onMountAutoFocus:ze(i,H=>{var $;H.preventDefault(),($=C.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(ag,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:a.jsx(d6,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:ze(c,H=>{y.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(aT,{role:"menu","aria-orientation":"vertical","data-state":ore(v.open),"data-radix-menu-content":"",dir:y.dir,...x,...m,ref:k,style:{outline:"none",...m.style},onKeyDown:ze(m.onKeyDown,H=>{const L=H.target.closest("[data-radix-menu-content]")===H.currentTarget,F=H.ctrlKey||H.altKey||H.metaKey,W=H.key.length===1;L&&(H.key==="Tab"&&H.preventDefault(),!F&&W&&G(H.key));const X=C.current;if(H.target!==X||!yAe.includes(H.key))return;H.preventDefault();const le=w().filter(B=>!B.disabled).map(B=>B.ref.current);$te.includes(H.key)&&le.reverse(),$Ae(le)}),onBlur:ze(t.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(E.current),M.current="")}),onPointerMove:ze(t.onPointerMove,Jw(H=>{const $=H.target,L=A.current!==H.clientX;if(H.currentTarget.contains($)&&L){const F=H.clientX>A.current?"right":"left";q.current=F,A.current=H.clientX}}))})})})})})})});Vte.displayName=po;var TAe="MenuGroup",y6=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{role:"group",...n,ref:e})});y6.displayName=TAe;var PAe="MenuLabel",qte=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{...n,ref:e})});qte.displayName=PAe;var VE="MenuItem",p9="menu.itemSelect",jT=S.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,i=S.useRef(null),o=Wj(VE,t.__scopeMenu),l=m6(VE,t.__scopeMenu),c=jt(e,i),u=S.useRef(!1),d=()=>{const h=i.current;if(!r&&h){const f=new CustomEvent(p9,{bubbles:!0,cancelable:!0});h.addEventListener(p9,p=>n==null?void 0:n(p),{once:!0}),IF(h,f),f.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(Gte,{...s,ref:c,disabled:r,onClick:ze(t.onClick,d),onPointerDown:h=>{var f;(f=t.onPointerDown)==null||f.call(t,h),u.current=!0},onPointerUp:ze(t.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:ze(t.onKeyDown,h=>{const f=l.searchRef.current!=="";r||f&&h.key===" "||t4.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});jT.displayName=VE;var Gte=S.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=t,o=m6(VE,r),l=Ute(r),c=S.useRef(null),u=jt(e,c),[d,h]=S.useState(!1),[f,p]=S.useState("");return S.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(Zw.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:a.jsx(h6,{asChild:!0,...l,focusable:!n,children:a.jsx(et.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:ze(t.onPointerMove,Jw(g=>{n?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ze(t.onPointerLeave,Jw(g=>o.onItemLeave(g))),onFocus:ze(t.onFocus,()=>h(!0)),onBlur:ze(t.onBlur,()=>h(!1))})})})}),OAe="MenuCheckboxItem",Kte=S.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return a.jsx(Jte,{scope:t.__scopeMenu,checked:r,children:a.jsx(jT,{role:"menuitemcheckbox","aria-checked":qE(r)?"mixed":r,...s,ref:e,"data-state":x6(r),onSelect:ze(s.onSelect,()=>n==null?void 0:n(qE(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Kte.displayName=OAe;var Yte="MenuRadioGroup",[IAe,RAe]=cg(Yte,{value:void 0,onValueChange:()=>{}}),Xte=S.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,i=pn(n);return a.jsx(IAe,{scope:t.__scopeMenu,value:r,onValueChange:i,children:a.jsx(y6,{...s,ref:e})})});Xte.displayName=Yte;var Qte="MenuRadioItem",Zte=S.forwardRef((t,e)=>{const{value:r,...n}=t,s=RAe(Qte,t.__scopeMenu),i=r===s.value;return a.jsx(Jte,{scope:t.__scopeMenu,checked:i,children:a.jsx(jT,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":x6(i),onSelect:ze(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});Zte.displayName=Qte;var v6="MenuItemIndicator",[Jte,MAe]=cg(v6,{checked:!1}),ere=S.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,i=MAe(v6,r);return a.jsx(Xn,{present:n||qE(i.checked)||i.checked===!0,children:a.jsx(et.span,{...s,ref:e,"data-state":x6(i.checked)})})});ere.displayName=v6;var DAe="MenuSeparator",tre=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return a.jsx(et.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});tre.displayName=DAe;var LAe="MenuArrow",rre=S.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=_T(r);return a.jsx(oT,{...s,...n,ref:e})});rre.displayName=LAe;var FAe="MenuSub",[hyt,nre]=cg(FAe),Ab="MenuSubTrigger",sre=S.forwardRef((t,e)=>{const r=ug(Ab,t.__scopeMenu),n=Wj(Ab,t.__scopeMenu),s=nre(Ab,t.__scopeMenu),i=m6(Ab,t.__scopeMenu),o=S.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:t.__scopeMenu},d=S.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return S.useEffect(()=>d,[d]),S.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),a.jsx(f6,{asChild:!0,...u,children:a.jsx(Gte,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":ore(r.open),...t,ref:Zk(e,s.onTriggerChange),onClick:h=>{var f;(f=t.onClick)==null||f.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ze(t.onPointerMove,Jw(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ze(t.onPointerLeave,Jw(h=>{var p,g;d();const f=(p=r.content)==null?void 0:p.getBoundingClientRect();if(f){const m=(g=r.content)==null?void 0:g.dataset.side,v=m==="right",y=v?-5:5,x=f[v?"left":"right"],b=f[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x,y:f.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ze(t.onKeyDown,h=>{var p;const f=i.searchRef.current!=="";t.disabled||f&&h.key===" "||vAe[n.dir].includes(h.key)&&(r.onOpenChange(!0),(p=r.content)==null||p.focus(),h.preventDefault())})})})});sre.displayName=Ab;var ire="MenuSubContent",are=S.forwardRef((t,e)=>{const r=Hte(po,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=ug(po,t.__scopeMenu),o=Wj(po,t.__scopeMenu),l=nre(ire,t.__scopeMenu),c=S.useRef(null),u=jt(e,c);return a.jsx(Zw.Provider,{scope:t.__scopeMenu,children:a.jsx(Xn,{present:n||i.open,children:a.jsx(Zw.Slot,{scope:t.__scopeMenu,children:a.jsx(g6,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ze(t.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ze(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:ze(t.onKeyDown,d=>{var p;const h=d.currentTarget.contains(d.target),f=xAe[o.dir].includes(d.key);h&&f&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});are.displayName=ire;function ore(t){return t?"open":"closed"}function qE(t){return t==="indeterminate"}function x6(t){return qE(t)?"indeterminate":t?"checked":"unchecked"}function $Ae(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function BAe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function UAe(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=BAe(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function zAe(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function HAe(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return zAe(r,e)}function Jw(t){return e=>e.pointerType==="mouse"?t(e):void 0}var WAe=zte,VAe=f6,qAe=Wte,GAe=Vte,KAe=y6,YAe=qte,XAe=jT,QAe=Kte,ZAe=Xte,JAe=Zte,eEe=ere,tEe=tre,rEe=rre,nEe=sre,sEe=are,ST="DropdownMenu",[iEe,fyt]=Ln(ST,[Bte]),Ni=Bte(),[aEe,lre]=iEe(ST),cre=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=t,c=Ni(e),u=S.useRef(null),[d,h]=Ps({prop:s,defaultProp:i??!1,onChange:o,caller:ST});return a.jsx(aEe,{scope:e,triggerId:Gi(),triggerRef:u,contentId:Gi(),open:d,onOpenChange:h,onOpenToggle:S.useCallback(()=>h(f=>!f),[h]),modal:l,children:a.jsx(WAe,{...c,open:d,onOpenChange:h,dir:n,modal:l,children:r})})};cre.displayName=ST;var ure="DropdownMenuTrigger",dre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,i=lre(ure,r),o=Ni(r);return a.jsx(VAe,{asChild:!0,...o,children:a.jsx(et.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:Zk(e,i.triggerRef),onPointerDown:ze(t.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ze(t.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});dre.displayName=ure;var oEe="DropdownMenuPortal",hre=t=>{const{__scopeDropdownMenu:e,...r}=t,n=Ni(e);return a.jsx(qAe,{...n,...r})};hre.displayName=oEe;var fre="DropdownMenuContent",pre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=lre(fre,r),i=Ni(r),o=S.useRef(!1);return a.jsx(GAe,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:e,onCloseAutoFocus:ze(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:ze(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pre.displayName=fre;var lEe="DropdownMenuGroup",cEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(KAe,{...s,...n,ref:e})});cEe.displayName=lEe;var uEe="DropdownMenuLabel",mre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(YAe,{...s,...n,ref:e})});mre.displayName=uEe;var dEe="DropdownMenuItem",gre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(XAe,{...s,...n,ref:e})});gre.displayName=dEe;var hEe="DropdownMenuCheckboxItem",yre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(QAe,{...s,...n,ref:e})});yre.displayName=hEe;var fEe="DropdownMenuRadioGroup",pEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(ZAe,{...s,...n,ref:e})});pEe.displayName=fEe;var mEe="DropdownMenuRadioItem",vre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(JAe,{...s,...n,ref:e})});vre.displayName=mEe;var gEe="DropdownMenuItemIndicator",xre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(eEe,{...s,...n,ref:e})});xre.displayName=gEe;var yEe="DropdownMenuSeparator",bre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(tEe,{...s,...n,ref:e})});bre.displayName=yEe;var vEe="DropdownMenuArrow",xEe=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(rEe,{...s,...n,ref:e})});xEe.displayName=vEe;var bEe="DropdownMenuSubTrigger",wre=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(nEe,{...s,...n,ref:e})});wre.displayName=bEe;var wEe="DropdownMenuSubContent",_re=S.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=Ni(r);return a.jsx(sEe,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_re.displayName=wEe;var _Ee=cre,jEe=dre,SEe=hre,jre=pre,Sre=mre,Nre=gre,Are=yre,Ere=vre,Cre=xre,kre=bre,Tre=wre,Pre=_re;const Ore=_Ee,Ire=jEe,NEe=S.forwardRef(({className:t,inset:e,children:r,...n},s)=>a.jsxs(Tre,{ref:s,className:Oe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...n,children:[r,a.jsx(IJ,{className:"ml-auto h-4 w-4"})]}));NEe.displayName=Tre.displayName;const AEe=S.forwardRef(({className:t,...e},r)=>a.jsx(Pre,{ref:r,className:Oe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));AEe.displayName=Pre.displayName;const b6=S.forwardRef(({className:t,sideOffset:e=4,...r},n)=>a.jsx(SEe,{children:a.jsx(jre,{ref:n,sideOffset:e,className:Oe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));b6.displayName=jre.displayName;const Oy=S.forwardRef(({className:t,inset:e,...r},n)=>a.jsx(Nre,{ref:n,className:Oe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...r}));Oy.displayName=Nre.displayName;const EEe=S.forwardRef(({className:t,children:e,checked:r,...n},s)=>a.jsxs(Are,{ref:s,className:Oe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Cre,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),e]}));EEe.displayName=Are.displayName;const CEe=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(Ere,{ref:n,className:Oe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Cre,{children:a.jsx(pD,{className:"h-2 w-2 fill-current"})})}),e]}));CEe.displayName=Ere.displayName;const kEe=S.forwardRef(({className:t,inset:e,...r},n)=>a.jsx(Sre,{ref:n,className:Oe("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));kEe.displayName=Sre.displayName;const w6=S.forwardRef(({className:t,...e},r)=>a.jsx(kre,{ref:r,className:Oe("-mx-1 my-1 h-px bg-muted",t),...e}));w6.displayName=kre.displayName;var Rre={exports:{}},Mre={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var _x=S;function TEe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var PEe=typeof Object.is=="function"?Object.is:TEe,OEe=_x.useState,IEe=_x.useEffect,REe=_x.useLayoutEffect,MEe=_x.useDebugValue;function DEe(t,e){var r=e(),n=OEe({inst:{value:r,getSnapshot:e}}),s=n[0].inst,i=n[1];return REe(function(){s.value=r,s.getSnapshot=e,oO(s)&&i({inst:s})},[t,r,e]),IEe(function(){return oO(s)&&i({inst:s}),t(function(){oO(s)&&i({inst:s})})},[t]),MEe(r),r}function oO(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!PEe(t,r)}catch{return!0}}function LEe(t,e){return e()}var FEe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?LEe:DEe;Mre.useSyncExternalStore=_x.useSyncExternalStore!==void 0?_x.useSyncExternalStore:FEe;Rre.exports=Mre;var $Ee=Rre.exports;function BEe(){return $Ee.useSyncExternalStore(UEe,()=>!0,()=>!1)}function UEe(){return()=>{}}var _6="Avatar",[zEe,pyt]=Ln(_6),[HEe,Dre]=zEe(_6),Lre=S.forwardRef((t,e)=>{const{__scopeAvatar:r,...n}=t,[s,i]=S.useState("idle");return a.jsx(HEe,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(et.span,{...n,ref:e})})});Lre.displayName=_6;var Fre="AvatarImage",$re=S.forwardRef((t,e)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:s=()=>{},...i}=t,o=Dre(Fre,r),l=WEe(n,i),c=pn(u=>{s(u),o.onImageLoadingStatusChange(u)});return gn(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(et.img,{...i,ref:e,src:n}):null});$re.displayName=Fre;var Bre="AvatarFallback",Ure=S.forwardRef((t,e)=>{const{__scopeAvatar:r,delayMs:n,...s}=t,i=Dre(Bre,r),[o,l]=S.useState(n===void 0);return S.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(c)}},[n]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(et.span,{...s,ref:e}):null});Ure.displayName=Bre;function m9(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function WEe(t,{referrerPolicy:e,crossOrigin:r}){const n=BEe(),s=S.useRef(null),i=n?(s.current||(s.current=new window.Image),s.current):null,[o,l]=S.useState(()=>m9(i,t));return gn(()=>{l(m9(i,t))},[i,t]),gn(()=>{const c=h=>()=>{l(h)};if(!i)return;const u=c("loaded"),d=c("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,r,e]),o}var zre=Lre,Hre=$re,Wre=Ure;const NT=S.forwardRef(({className:t,...e},r)=>a.jsx(zre,{ref:r,className:Oe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));NT.displayName=zre.displayName;const AT=S.forwardRef(({className:t,...e},r)=>a.jsx(Hre,{ref:r,className:Oe("aspect-square h-full w-full",t),...e}));AT.displayName=Hre.displayName;const ET=S.forwardRef(({className:t,...e},r)=>a.jsx(Wre,{ref:r,className:Oe("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));ET.displayName=Wre.displayName;const Vre=S.createContext(void 0),VEe=({children:t})=>{const[e,r]=S.useState(()=>localStorage.getItem("theme")||"light");S.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",e)},[e]);const n=()=>{r(s=>s==="light"?"dark":"light")};return a.jsx(Vre.Provider,{value:{theme:e,toggleTheme:n},children:t})},j6=()=>{const t=S.useContext(Vre);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};function qEe(){const{toggleTheme:t}=j6();return a.jsxs("button",{onClick:t,className:"relative flex items-center justify-center text-gray-500 transition-colors bg-white border border-gray-200 rounded-full hover:text-gray-900 h-11 w-11 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white","aria-label":"Toggle theme",children:[a.jsx(a0e,{className:"hidden h-5 w-5 dark:block"}),a.jsx(Qxe,{className:"h-5 w-5 dark:hidden"})]})}var CT="Dialog",[qre,Gre]=Ln(CT),[GEe,ml]=qre(CT),Kre=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,l=S.useRef(null),c=S.useRef(null),[u,d]=Ps({prop:n,defaultProp:s??!1,onChange:i,caller:CT});return a.jsx(GEe,{scope:e,triggerRef:l,contentRef:c,contentId:Gi(),titleId:Gi(),descriptionId:Gi(),open:u,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(h=>!h),[d]),modal:o,children:r})};Kre.displayName=CT;var Yre="DialogTrigger",Xre=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ml(Yre,r),i=jt(e,s.triggerRef);return a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":A6(s.open),...n,ref:i,onClick:ze(t.onClick,s.onOpenToggle)})});Xre.displayName=Yre;var S6="DialogPortal",[KEe,Qre]=qre(S6,{forceMount:void 0}),Zre=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=ml(S6,e);return a.jsx(KEe,{scope:e,forceMount:r,children:S.Children.map(n,o=>a.jsx(Xn,{present:r||i.open,children:a.jsx(n0,{asChild:!0,container:s,children:o})}))})};Zre.displayName=S6;var GE="DialogOverlay",Jre=S.forwardRef((t,e)=>{const r=Qre(GE,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=ml(GE,t.__scopeDialog);return i.modal?a.jsx(Xn,{present:n||i.open,children:a.jsx(XEe,{...s,ref:e})}):null});Jre.displayName=GE;var YEe=Xh("DialogOverlay.RemoveScroll"),XEe=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ml(GE,r);return a.jsx(zj,{as:YEe,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(et.div,{"data-state":A6(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Km="DialogContent",ene=S.forwardRef((t,e)=>{const r=Qre(Km,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=ml(Km,t.__scopeDialog);return a.jsx(Xn,{present:n||i.open,children:i.modal?a.jsx(QEe,{...s,ref:e}):a.jsx(ZEe,{...s,ref:e})})});ene.displayName=Km;var QEe=S.forwardRef((t,e)=>{const r=ml(Km,t.__scopeDialog),n=S.useRef(null),s=jt(e,r.contentRef,n);return S.useEffect(()=>{const i=n.current;if(i)return bT(i)},[]),a.jsx(tne,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ze(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:ze(t.onFocusOutside,i=>i.preventDefault())})}),ZEe=S.forwardRef((t,e)=>{const r=ml(Km,t.__scopeDialog),n=S.useRef(!1),s=S.useRef(!1);return a.jsx(tne,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),tne=S.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,l=ml(Km,r),c=S.useRef(null),u=jt(e,c);return xT(),a.jsxs(a.Fragment,{children:[a.jsx(Bj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(ag,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":A6(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(eCe,{titleId:l.titleId}),a.jsx(rCe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),N6="DialogTitle",rne=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ml(N6,r);return a.jsx(et.h2,{id:s.titleId,...n,ref:e})});rne.displayName=N6;var nne="DialogDescription",sne=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ml(nne,r);return a.jsx(et.p,{id:s.descriptionId,...n,ref:e})});sne.displayName=nne;var ine="DialogClose",ane=S.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=ml(ine,r);return a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});ane.displayName=ine;function A6(t){return t?"open":"closed"}var one="DialogTitleWarning",[JEe,lne]=Cve(one,{contentName:Km,titleName:N6,docsSlug:"dialog"}),eCe=({titleId:t})=>{const e=lne(one),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return S.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},tCe="DialogDescriptionWarning",rCe=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lne(tCe).contentName}}.`;return S.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},E6=Kre,C6=Xre,k6=Zre,Vj=Jre,qj=ene,Gj=rne,Kj=sne,kT=ane;const Vr=E6,dl=C6,nCe=k6,cne=S.forwardRef(({className:t,...e},r)=>a.jsx(Vj,{ref:r,className:Oe("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));cne.displayName=Vj.displayName;const Rr=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(nCe,{children:[a.jsx(cne,{}),a.jsxs(qj,{ref:n,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[e,a.jsxs(kT,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Rs,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rr.displayName=qj.displayName;const Mr=({className:t,...e})=>a.jsx("div",{className:Oe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Mr.displayName="DialogHeader";const yf=({className:t,...e})=>a.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});yf.displayName="DialogFooter";const Dr=S.forwardRef(({className:t,...e},r)=>a.jsx(Gj,{ref:r,className:Oe("text-lg font-semibold leading-none tracking-tight",t),...e}));Dr.displayName=Gj.displayName;const g0=S.forwardRef(({className:t,...e},r)=>a.jsx(Kj,{ref:r,className:Oe("text-sm text-muted-foreground",t),...e}));g0.displayName=Kj.displayName;const Wt=S.forwardRef(({className:t,...e},r)=>a.jsx("textarea",{className:Oe("flex min-h-[120px] w-full rounded-lg border border-input bg-background","px-4 py-3 text-sm text-foreground","shadow-theme-xs","placeholder:text-muted-foreground","focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10","disabled:cursor-not-allowed disabled:opacity-50","dark:border-gray-800 dark:bg-gray-900 dark:text-white",t),ref:r,...e}));Wt.displayName="Textarea";function r4(t,[e,r]){return Math.min(r,Math.max(e,t))}function sCe(t,e){return S.useReducer((r,n)=>e[r][n]??r,t)}var T6="ScrollArea",[une,myt]=Ln(T6),[iCe,So]=une(T6),dne=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:i=600,...o}=t,[l,c]=S.useState(null),[u,d]=S.useState(null),[h,f]=S.useState(null),[p,g]=S.useState(null),[m,v]=S.useState(null),[y,x]=S.useState(0),[b,w]=S.useState(0),[j,N]=S.useState(!1),[C,k]=S.useState(!1),E=jt(e,z=>c(z)),M=lg(s);return a.jsx(iCe,{scope:r,type:n,dir:M,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:v,scrollbarYEnabled:C,onScrollbarYEnabledChange:k,onCornerWidthChange:x,onCornerHeightChange:w,children:a.jsx(et.div,{dir:M,...o,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});dne.displayName=T6;var hne="ScrollAreaViewport",fne=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:s,...i}=t,o=So(hne,r),l=S.useRef(null),c=jt(e,l,o.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(et.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});fne.displayName=hne;var Ec="ScrollAreaScrollbar",P6=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=So(Ec,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=t.orientation==="horizontal";return S.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(aCe,{...n,ref:e,forceMount:r}):s.type==="scroll"?a.jsx(oCe,{...n,ref:e,forceMount:r}):s.type==="auto"?a.jsx(pne,{...n,ref:e,forceMount:r}):s.type==="always"?a.jsx(O6,{...n,ref:e}):null});P6.displayName=Ec;var aCe=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=So(Ec,t.__scopeScrollArea),[i,o]=S.useState(!1);return S.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Xn,{present:r||i,children:a.jsx(pne,{"data-state":i?"visible":"hidden",...n,ref:e})})}),oCe=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=So(Ec,t.__scopeScrollArea),i=t.orientation==="horizontal",o=PT(()=>c("SCROLL_END"),100),[l,c]=sCe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return S.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),S.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const p=u[d];h!==p&&(c("SCROLL"),o()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,i,c,o]),a.jsx(Xn,{present:r||l!=="hidden",children:a.jsx(O6,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),pne=S.forwardRef((t,e)=>{const r=So(Ec,t.__scopeScrollArea),{forceMount:n,...s}=t,[i,o]=S.useState(!1),l=t.orientation==="horizontal",c=PT(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?u:d)}},10);return jx(r.viewport,c),jx(r.content,c),a.jsx(Xn,{present:n||i,children:a.jsx(O6,{"data-state":i?"visible":"hidden",...s,ref:e})})}),O6=S.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,s=So(Ec,t.__scopeScrollArea),i=S.useRef(null),o=S.useRef(0),[l,c]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=xne(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function h(f,p){return fCe(f,o.current,l,p)}return r==="horizontal"?a.jsx(lCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollLeft,p=g9(f,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):r==="vertical"?a.jsx(cCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollTop,p=g9(f,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),lCe=S.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,i=So(Ec,t.__scopeScrollArea),[o,l]=S.useState(),c=S.useRef(null),u=jt(e,c,i.onScrollbarXChange);return S.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(gne,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":TT(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),wne(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:YE(o.paddingLeft),paddingEnd:YE(o.paddingRight)}})}})}),cCe=S.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...s}=t,i=So(Ec,t.__scopeScrollArea),[o,l]=S.useState(),c=S.useRef(null),u=jt(e,c,i.onScrollbarYChange);return S.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(gne,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":TT(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),wne(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:YE(o.paddingTop),paddingEnd:YE(o.paddingBottom)}})}})}),[uCe,mne]=une(Ec),gne=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=t,p=So(Ec,r),[g,m]=S.useState(null),v=jt(e,E=>m(E)),y=S.useRef(null),x=S.useRef(""),b=p.viewport,w=n.content-n.viewport,j=pn(d),N=pn(c),C=PT(h,10);function k(E){if(y.current){const M=E.clientX-y.current.left,z=E.clientY-y.current.top;u({x:M,y:z})}}return S.useEffect(()=>{const E=M=>{const z=M.target;(g==null?void 0:g.contains(z))&&j(M,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[b,g,w,j]),S.useEffect(N,[n,N]),jx(g,C),jx(p.content,C),a.jsx(uCe,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:pn(i),onThumbPointerUp:pn(o),onThumbPositionChange:N,onThumbPointerDown:pn(l),children:a.jsx(et.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:ze(t.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),y.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),k(E))}),onPointerMove:ze(t.onPointerMove,k),onPointerUp:ze(t.onPointerUp,E=>{const M=E.target;M.hasPointerCapture(E.pointerId)&&M.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),KE="ScrollAreaThumb",yne=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=mne(KE,t.__scopeScrollArea);return a.jsx(Xn,{present:r||s.hasThumb,children:a.jsx(dCe,{ref:e,...n})})}),dCe=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...s}=t,i=So(KE,r),o=mne(KE,r),{onThumbPositionChange:l}=o,c=jt(e,h=>o.onThumbChange(h)),u=S.useRef(void 0),d=PT(()=>{u.current&&(u.current(),u.current=void 0)},100);return S.useEffect(()=>{const h=i.viewport;if(h){const f=()=>{if(d(),!u.current){const p=pCe(h,l);u.current=p,l()}};return l(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,d,l]),a.jsx(et.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ze(t.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),g=h.clientX-p.left,m=h.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:ze(t.onPointerUp,o.onThumbPointerUp)})});yne.displayName=KE;var I6="ScrollAreaCorner",vne=S.forwardRef((t,e)=>{const r=So(I6,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?a.jsx(hCe,{...t,ref:e}):null});vne.displayName=I6;var hCe=S.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,s=So(I6,r),[i,o]=S.useState(0),[l,c]=S.useState(0),u=!!(i&&l);return jx(s.scrollbarX,()=>{var h;const d=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),jx(s.scrollbarY,()=>{var h;const d=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?a.jsx(et.div,{...n,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function YE(t){return t?parseInt(t,10):0}function xne(t,e){const r=t/e;return isNaN(r)?0:r}function TT(t){const e=xne(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function fCe(t,e,r,n="ltr"){const s=TT(r),i=s/2,o=e||i,l=s-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,h=n==="ltr"?[0,d]:[d*-1,0];return bne([c,u],h)(t)}function g9(t,e,r="ltr"){const n=TT(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,o=e.content-e.viewport,l=i-n,c=r==="ltr"?[0,o]:[o*-1,0],u=r4(t,c);return bne([0,o],[0,l])(u)}function bne(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function wne(t,e){return t>0&&t<e}var pCe=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function s(){const i={left:t.scrollLeft,top:t.scrollTop},o=r.left!==i.left,l=r.top!==i.top;(o||l)&&e(),r=i,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function PT(t,e){const r=pn(t),n=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),S.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function jx(t,e){const r=pn(e);gn(()=>{let n=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(t),()=>{window.cancelAnimationFrame(n),s.unobserve(t)}}},[t,r])}var _ne=dne,mCe=fne,gCe=vne;const Yj=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(_ne,{ref:n,className:Oe("relative overflow-hidden",t),...r,children:[a.jsx(mCe,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(jne,{}),a.jsx(gCe,{})]}));Yj.displayName=_ne.displayName;const jne=S.forwardRef(({className:t,orientation:e="vertical",...r},n)=>a.jsx(P6,{ref:n,orientation:e,className:Oe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:a.jsx(yne,{className:"relative flex-1 rounded-full bg-border"})}));jne.displayName=P6.displayName;var yCe="Separator",y9="horizontal",vCe=["horizontal","vertical"],Sne=S.forwardRef((t,e)=>{const{decorative:r,orientation:n=y9,...s}=t,i=xCe(n)?n:y9,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(et.div,{"data-orientation":i,...l,...s,ref:e})});Sne.displayName=yCe;function xCe(t){return vCe.includes(t)}var Nne=Sne;const Es=S.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},s)=>a.jsx(Nne,{ref:s,decorative:r,orientation:e,className:Oe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Es.displayName=Nne.displayName;function ir({className:t,...e}){return a.jsx("div",{className:Oe("animate-pulse rounded-md bg-muted",t),...e})}const bCe="https://nqibmbtqcjucktqcreob.supabase.co",wCe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg",be=jte(bCe,wCe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}});function Xi(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Yu(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function _Ce(t,e){const r=Xi(t);return isNaN(e)?Yu(t,NaN):(r.setDate(r.getDate()+e),r)}const Ane=6048e5,jCe=864e5;let SCe={};function OT(){return SCe}function e1(t,e){var l,c,u,d;const r=OT(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Xi(t),i=s.getDay(),o=(i<n?7:0)+i-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function XE(t){return e1(t,{weekStartsOn:1})}function Ene(t){const e=Xi(t),r=e.getFullYear(),n=Yu(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const s=XE(n),i=Yu(t,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const o=XE(i);return e.getTime()>=s.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function QE(t){const e=Xi(t);return e.setHours(0,0,0,0),e}function v9(t){const e=Xi(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Cne(t,e){const r=QE(t),n=QE(e),s=+r-v9(r),i=+n-v9(n);return Math.round((s-i)/jCe)}function NCe(t){const e=Ene(t),r=Yu(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),XE(r)}function kne(t){return Yu(t,Date.now())}function Tne(t,e){const r=QE(t),n=QE(e);return+r==+n}function ACe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function ECe(t){if(!ACe(t)&&typeof t!="number")return!1;const e=Xi(t);return!isNaN(Number(e))}function lO(t,e){const r=Xi(t),n=Xi(e),s=x9(r,n),i=Math.abs(Cne(r,n));r.setDate(r.getDate()-s*i);const o=+(x9(r,n)===-s),l=s*(i-o);return l===0?0:l}function x9(t,e){const r=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return r<0?-1:r>0?1:r}function CCe(t){const e=Xi(t),r=Yu(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const kCe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},TCe=(t,e,r)=>{let n;const s=kCe[t];return typeof s=="string"?n=s:e===1?n=s.one:n=s.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function cO(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const PCe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},OCe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ICe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},RCe={date:cO({formats:PCe,defaultWidth:"full"}),time:cO({formats:OCe,defaultWidth:"full"}),dateTime:cO({formats:ICe,defaultWidth:"full"})},MCe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},DCe=(t,e,r,n)=>MCe[t];function Y0(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const LCe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},FCe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$Ce={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},BCe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},UCe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},zCe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},HCe=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},WCe={ordinalNumber:HCe,era:Y0({values:LCe,defaultWidth:"wide"}),quarter:Y0({values:FCe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Y0({values:$Ce,defaultWidth:"wide"}),day:Y0({values:BCe,defaultWidth:"wide"}),dayPeriod:Y0({values:UCe,defaultWidth:"wide",formattingValues:zCe,defaultFormattingWidth:"wide"})};function X0(t){return(e,r={})=>{const n=r.width,s=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?qCe(l,h=>h.test(o)):VCe(l,h=>h.test(o));let u;u=t.valueCallback?t.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=e.slice(o.length);return{value:u,rest:d}}}function VCe(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function qCe(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function GCe(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const s=n[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const KCe=/^(\d+)(th|st|nd|rd)?/i,YCe=/\d+/i,XCe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},QCe={any:[/^b/i,/^(a|c)/i]},ZCe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},JCe={any:[/1/i,/2/i,/3/i,/4/i]},eke={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},tke={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},rke={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},nke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ske={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ike={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ake={ordinalNumber:GCe({matchPattern:KCe,parsePattern:YCe,valueCallback:t=>parseInt(t,10)}),era:X0({matchPatterns:XCe,defaultMatchWidth:"wide",parsePatterns:QCe,defaultParseWidth:"any"}),quarter:X0({matchPatterns:ZCe,defaultMatchWidth:"wide",parsePatterns:JCe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:X0({matchPatterns:eke,defaultMatchWidth:"wide",parsePatterns:tke,defaultParseWidth:"any"}),day:X0({matchPatterns:rke,defaultMatchWidth:"wide",parsePatterns:nke,defaultParseWidth:"any"}),dayPeriod:X0({matchPatterns:ske,defaultMatchWidth:"any",parsePatterns:ike,defaultParseWidth:"any"})},Pne={code:"en-US",formatDistance:TCe,formatLong:RCe,formatRelative:DCe,localize:WCe,match:ake,options:{weekStartsOn:0,firstWeekContainsDate:1}};function oke(t){const e=Xi(t);return Cne(e,CCe(e))+1}function lke(t){const e=Xi(t),r=+XE(e)-+NCe(e);return Math.round(r/Ane)+1}function One(t,e){var d,h,f,p;const r=Xi(t),n=r.getFullYear(),s=OT(),i=(e==null?void 0:e.firstWeekContainsDate)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(f=s.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=Yu(t,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=e1(o,e),c=Yu(t,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const u=e1(c,e);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function cke(t,e){var l,c,u,d;const r=OT(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=One(t,e),i=Yu(t,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),e1(i,e)}function uke(t,e){const r=Xi(t),n=+e1(r,e)-+cke(r,e);return Math.round(n/Ane)+1}function fr(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const yd={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return fr(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):fr(r+1,2)},d(t,e){return fr(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return fr(t.getHours()%12||12,e.length)},H(t,e){return fr(t.getHours(),e.length)},m(t,e){return fr(t.getMinutes(),e.length)},s(t,e){return fr(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return fr(s,e.length)}},Tg={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},b9={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return yd.y(t,e)},Y:function(t,e,r,n){const s=One(t,n),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return fr(o,2)}return e==="Yo"?r.ordinalNumber(i,{unit:"year"}):fr(i,e.length)},R:function(t,e){const r=Ene(t);return fr(r,e.length)},u:function(t,e){const r=t.getFullYear();return fr(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return fr(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return fr(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return yd.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return fr(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const s=uke(t,n);return e==="wo"?r.ordinalNumber(s,{unit:"week"}):fr(s,e.length)},I:function(t,e,r){const n=lke(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):fr(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):yd.d(t,e)},D:function(t,e,r){const n=oke(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):fr(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return fr(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const s=t.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return fr(i,e.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),s=n===0?7:n;switch(e){case"i":return String(s);case"ii":return fr(s,e.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let s;switch(n===12?s=Tg.noon:n===0?s=Tg.midnight:s=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let s;switch(n>=17?s=Tg.evening:n>=12?s=Tg.afternoon:n>=4?s=Tg.morning:s=Tg.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return yd.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):yd.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):fr(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):fr(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):yd.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):yd.s(t,e)},S:function(t,e){return yd.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return _9(n);case"XXXX":case"XX":return Hf(n);case"XXXXX":case"XXX":default:return Hf(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return _9(n);case"xxxx":case"xx":return Hf(n);case"xxxxx":case"xxx":default:return Hf(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+w9(n,":");case"OOOO":default:return"GMT"+Hf(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+w9(n,":");case"zzzz":default:return"GMT"+Hf(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return fr(n,e.length)},T:function(t,e,r){const n=t.getTime();return fr(n,e.length)}};function w9(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+e+fr(i,2)}function _9(t,e){return t%60===0?(t>0?"-":"+")+fr(Math.abs(t)/60,2):Hf(t,e)}function Hf(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),s=fr(Math.trunc(n/60),2),i=fr(n%60,2);return r+s+e+i}const j9=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Ine=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},dke=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return j9(t,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",j9(n,e)).replace("{{time}}",Ine(s,e))},hke={p:Ine,P:dke},fke=/^D+$/,pke=/^Y+$/,mke=["D","DD","YY","YYYY"];function gke(t){return fke.test(t)}function yke(t){return pke.test(t)}function vke(t,e,r){const n=xke(t,e,r);if(console.warn(n),mke.includes(t))throw new RangeError(n)}function xke(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const bke=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_ke=/^'([^]*?)'?$/,jke=/''/g,Ske=/[a-zA-Z]/;function t1(t,e,r){var d,h,f,p,g,m,v,y;const n=OT(),s=(r==null?void 0:r.locale)??n.locale??Pne,i=(r==null?void 0:r.firstWeekContainsDate)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(f=n.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((m=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((y=(v=n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??0,l=Xi(t);if(!ECe(l))throw new RangeError("Invalid time value");let c=e.match(wke).map(x=>{const b=x[0];if(b==="p"||b==="P"){const w=hke[b];return w(x,s.formatLong)}return x}).join("").match(bke).map(x=>{if(x==="''")return{isToken:!1,value:"'"};const b=x[0];if(b==="'")return{isToken:!1,value:Nke(x)};if(b9[b])return{isToken:!0,value:x};if(b.match(Ske))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:x}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(x=>{if(!x.isToken)return x.value;const b=x.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&yke(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&gke(b))&&vke(b,e,String(t));const w=b9[b[0]];return w(l,b,s.localize,u)}).join("")}function Nke(t){const e=t.match(_ke);return e?e[1].replace(jke,"'"):t}function Ake(t){return Tne(t,kne(t))}function Eke(t,e){return _Ce(t,-e)}function Cke(t){return Tne(t,Eke(kne(t),1))}function kke(t){if(!t||t.length===0)return[];const e=new Map;return t.forEach(r=>{const n=new Date(r.created_at),s=t1(n,"yyyy-MM-dd");let i;Ake(n)?i="Today":Cke(n)?i="Yesterday":i=t1(n,"MMMM d, yyyy"),e.has(s)?e.get(s).notes.push(r):e.set(s,{date:i,dateKey:s,notes:[r]})}),Array.from(e.values()).sort((r,n)=>n.dateKey.localeCompare(r.dateKey)).map(r=>({...r,notes:r.notes.sort((n,s)=>new Date(s.created_at).getTime()-new Date(n.created_at).getTime())}))}function Tke(t){return t1(new Date(t),"HH:mm")}function Pke(){const{user:t}=Pt(),{toast:e}=vn(),r=e6(),n=["user-notes",t==null?void 0:t.id],{data:s,isLoading:i,error:o}=V1e({queryKey:n,queryFn:async()=>{const{data:h,error:f}=await be.from("user_notes").select("*").order("created_at",{ascending:!1});if(f)throw f;return h},enabled:!!t}),l=WP({mutationFn:async h=>{if(!t)throw new Error("Not authenticated");const{data:f,error:p}=await be.from("user_notes").insert({user_id:t.id,content:h}).select().single();if(p)throw p;return f},onSuccess:()=>{r.invalidateQueries({queryKey:n})},onError:h=>{e({title:"Error",description:"Could not save note.",variant:"destructive"}),console.error("Create note error:",h)}}),c=WP({mutationFn:async({id:h,content:f})=>{const{data:p,error:g}=await be.from("user_notes").update({content:f,updated_at:new Date().toISOString()}).eq("id",h).select().single();if(g)throw g;return p},onSuccess:()=>{r.invalidateQueries({queryKey:n})},onError:h=>{e({title:"Error",description:"Could not update note.",variant:"destructive"}),console.error("Update note error:",h)}}),u=WP({mutationFn:async h=>{const{error:f}=await be.from("user_notes").delete().eq("id",h);if(f)throw f},onSuccess:()=>{r.invalidateQueries({queryKey:n}),e({title:"Deleted",description:"Note has been removed."})},onError:h=>{e({title:"Error",description:"Could not delete note.",variant:"destructive"}),console.error("Delete note error:",h)}}),d=S.useMemo(()=>kke(s),[s]);return{notes:s,groupedNotes:d,isLoading:i,error:o,createNote:async h=>{await l.mutateAsync(h)},updateNote:async h=>{await c.mutateAsync(h)},deleteNote:async h=>{await u.mutateAsync(h)},isCreating:l.isPending,isUpdating:c.isPending,isDeleting:u.isPending}}function Oke({note:t,onUpdate:e,onDelete:r,isUpdating:n,isDeleting:s}){const[i,o]=S.useState(!1),[l,c]=S.useState(t.content),u=async()=>{l.trim()&&l!==t.content&&await e(t.id,l.trim()),o(!1)},d=()=>{c(t.content),o(!1)},h=async()=>{await r(t.id)};return i?a.jsxs("div",{className:"group relative p-3 rounded-lg bg-muted/50 border border-border mb-2",children:[a.jsx(Wt,{value:l,onChange:f=>c(f.target.value),className:"min-h-[80px] resize-none text-sm",autoFocus:!0}),a.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[a.jsxs(ve,{size:"sm",variant:"ghost",onClick:d,disabled:n,children:[a.jsx(Rs,{className:"h-4 w-4 mr-1"}),"Cancel"]}),a.jsxs(ve,{size:"sm",onClick:u,disabled:n||!l.trim(),children:[a.jsx(Gs,{className:"h-4 w-4 mr-1"}),"Save"]})]})]}):a.jsxs("div",{className:"group relative p-3 rounded-lg hover:bg-muted/50 transition-colors mb-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:Tke(t.created_at)}),a.jsx("p",{className:"text-sm text-foreground mt-1 whitespace-pre-wrap break-words",children:t.content}),a.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[a.jsx(ve,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>o(!0),disabled:s,children:a.jsx(zJ,{className:"h-3.5 w-3.5"})}),a.jsx(ve,{size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:h,disabled:s,children:a.jsx(As,{className:"h-3.5 w-3.5"})})]})]})}function Ike({open:t,onOpenChange:e}){const[r,n]=S.useState(""),{groupedNotes:s,isLoading:i,createNote:o,updateNote:l,deleteNote:c,isCreating:u,isUpdating:d,isDeleting:h}=Pke(),f=async()=>{!r.trim()||u||(await o(r.trim()),n(""))},p=g=>{(g.ctrlKey||g.metaKey)&&g.key==="Enter"&&(g.preventDefault(),f())};return a.jsx(Vr,{open:t,onOpenChange:e,children:a.jsxs(Rr,{className:"sm:max-w-[800px] h-[80vh] flex flex-col p-0",children:[a.jsx(Mr,{className:"px-6 py-4 border-b border-border",children:a.jsxs(Dr,{className:"flex items-center gap-2",children:[a.jsx(gD,{className:"h-5 w-5 text-primary"}),"My Notebook"]})}),a.jsx(Yj,{className:"flex-1 px-6 overflow-y-auto",children:i?a.jsx("div",{className:"py-4 space-y-4",children:[1,2,3].map(g=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(ir,{className:"h-4 w-24"}),a.jsx(ir,{className:"h-16 w-full"})]},g))}):s.length===0?a.jsxs("div",{className:"py-12 text-center",children:[a.jsx(gD,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground text-sm",children:"No notes yet."}),a.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:"Write your first note below."})]}):a.jsx("div",{className:"py-4",children:s.map(g=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3 my-4 first:mt-0",children:[a.jsx(Es,{className:"flex-1"}),a.jsx("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:g.date}),a.jsx(Es,{className:"flex-1"})]}),g.notes.map(m=>a.jsx(Oke,{note:m,onUpdate:(v,y)=>l({id:v,content:y}),onDelete:c,isUpdating:d,isDeleting:h},m.id))]},g.dateKey))})}),a.jsxs("div",{className:"border-t border-border p-4 bg-background",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Wt,{placeholder:"Write a new note... (Ctrl+Enter to save)",value:r,onChange:g=>n(g.target.value),onKeyDown:p,className:"min-h-[80px] pr-12 resize-none",disabled:u}),a.jsx(ve,{size:"icon",className:"absolute bottom-2 right-2 h-8 w-8",onClick:f,disabled:!r.trim()||u,children:a.jsx(VJ,{className:"h-4 w-4"})})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"Your notes are saved automatically"})]})]})})}async function Rke(t,e,r=3600){if(!e)return null;const{data:n,error:s}=await be.storage.from(t).createSignedUrl(e,r);return s?(console.error("Signed URL error:",s),null):n.signedUrl}async function Mke(t,e=3600){if(!t)return null;const{data:r,error:n}=await be.storage.from("avatars").createSignedUrl(t,e);return n?(console.error("Avatar signed URL error:",n),null):r.signedUrl}async function Iy(t){return t?t.startsWith("https://")?t:Mke(t):null}async function IT(t,e){const r={};return await Promise.all(t.map(async n=>{if(n.storage_path){const s=await Rke(e,n.storage_path);s&&(r[n.id]=s)}})),r}const S9=({pageTitle:t="Dashboard",onToggleSidebar:e,onToggleMobile:r,isMobileOpen:n,showSidebarControls:s=!0})=>{const{user:i,studentPoints:o,researchProfile:l,signOut:c}=Pt(),u=wr(),{theme:d}=j6(),[h,f]=S.useState(!1),[p,g]=S.useState(null);S.useEffect(()=>{(async()=>{const b=await Iy(l==null?void 0:l.avatar_url);g(b)})()},[l==null?void 0:l.avatar_url]);const m=d==="dark"?"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new_light.png":"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",v=async()=>{await c(),u("/login")},y=()=>l!=null&&l.nickname?l.nickname.slice(0,2).toUpperCase():i!=null&&i.email?i.email.slice(0,2).toUpperCase():"U";return!i||!s?a.jsxs("header",{className:"sticky top-0 z-40 flex items-center justify-between w-full bg-card border-b border-border px-4 py-4 lg:px-6",children:[a.jsx(mt,{to:"/",className:"flex items-center",children:a.jsx("img",{src:m,alt:"Academly.ai",className:"h-8 w-auto"})}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(mt,{to:"/pricing",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Pricing"}),a.jsx(mt,{to:"/how-it-works",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"How it works"}),i?a.jsx(ve,{asChild:!0,size:"sm",children:a.jsx(mt,{to:"/dashboard",children:"Dashboard"})}):a.jsx(ve,{asChild:!0,size:"sm",children:a.jsx(mt,{to:"/login",children:"Login"})})]})]}):a.jsx("header",{className:"ta-header astro-header",children:a.jsxs("div",{className:"ta-header-content",children:[a.jsxs("div",{className:"ta-header-left",children:[a.jsx("button",{onClick:r,className:"lg:hidden flex items-center justify-center w-10 h-10 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors","aria-label":"Toggle mobile menu",children:n?a.jsx(Rs,{className:"w-5 h-5"}):a.jsx(LF,{className:"w-5 h-5"})}),a.jsx("button",{onClick:e,className:"hidden lg:flex items-center justify-center w-11 h-11 text-muted-foreground hover:text-foreground border border-border rounded-lg transition-colors","aria-label":"Toggle sidebar",children:a.jsx("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 1C0.583252 0.585788 0.919038 0.25 1.33325 0.25H14.6666C15.0808 0.25 15.4166 0.585786 15.4166 1C15.4166 1.41421 15.0808 1.75 14.6666 1.75L1.33325 1.75C0.919038 1.75 0.583252 1.41422 0.583252 1ZM0.583252 11C0.583252 10.5858 0.919038 10.25 1.33325 10.25L14.6666 10.25C15.0808 10.25 15.4166 10.5858 15.4166 11C15.4166 11.4142 15.0808 11.75 14.6666 11.75L1.33325 11.75C0.919038 11.75 0.583252 11.4142 0.583252 11ZM1.33325 5.25C0.919038 5.25 0.583252 5.58579 0.583252 6C0.583252 6.41421 0.919038 6.75 1.33325 6.75L7.99992 6.75C8.41413 6.75 8.74992 6.41421 8.74992 6C8.74992 5.58579 8.41413 5.25 7.99992 5.25L1.33325 5.25Z",fill:"currentColor"})})}),a.jsx(mt,{to:"/dashboard",className:"lg:hidden",children:a.jsx("img",{src:m,alt:"Academly.ai",className:"h-8 w-auto"})}),a.jsx("h1",{className:"ta-header-title",children:t})]}),a.jsxs("div",{className:"ta-header-right",children:[a.jsx("button",{onClick:()=>f(!0),className:"flex items-center justify-center w-10 h-10 text-muted-foreground hover:text-foreground hover:bg-muted rounded-full border border-border transition-colors","aria-label":"Open notes",children:a.jsx(gD,{className:"w-5 h-5"})}),a.jsx(qEe,{}),a.jsx(Ike,{open:h,onOpenChange:f}),o&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-full bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 shadow-sm shadow-primary/10",children:[a.jsx(jo,{className:"h-4 w-4 text-primary"}),a.jsxs("span",{className:"text-sm font-semibold text-primary",children:[Math.floor(o.remaining).toLocaleString("de-DE")," SP"]})]}),a.jsxs(Ore,{children:[a.jsx(Ire,{asChild:!0,children:a.jsx("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:a.jsxs(NT,{className:"h-10 w-10 border-2 border-border",children:[p?a.jsx(AT,{src:p,alt:"Avatar"}):null,a.jsx(ET,{className:"bg-brand-50 text-brand-500 font-semibold",children:y()})]})})}),a.jsxs(b6,{className:"w-60",align:"end",forceMount:!0,children:[a.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[a.jsx("p",{className:"font-medium text-foreground",children:(l==null?void 0:l.nickname)||"User"}),a.jsx("p",{className:"text-sm text-muted-foreground truncate",children:i==null?void 0:i.email})]}),a.jsxs(Oy,{onClick:()=>u("/account"),className:"cursor-pointer",children:[a.jsx(Ij,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Manage Account"})]}),a.jsxs(Oy,{onClick:()=>u("/history"),className:"cursor-pointer",children:[a.jsx(Bxe,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"History"})]}),a.jsx(w6,{}),a.jsxs(Oy,{onClick:v,className:"cursor-pointer text-destructive focus:text-destructive",children:[a.jsx(Hxe,{className:"mr-2 h-4 w-4"}),a.jsx("span",{children:"Sign Out"})]})]})]})]})]})})},Wr=({children:t,className:e=""})=>a.jsx("div",{className:`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 ${e}`,children:t}),bi=()=>a.jsx("footer",{className:"border-t border-border bg-card",children:a.jsx(Wr,{children:a.jsxs("div",{className:"py-12 lg:py-16",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-8 lg:gap-12",children:[a.jsxs("div",{className:"col-span-2 md:col-span-1",children:[a.jsxs(mt,{to:"/",className:"flex items-center space-x-2 mb-4",children:[a.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary flex items-center justify-center",children:a.jsx("span",{className:"text-primary-foreground font-bold text-sm",children:"A"})}),a.jsx("span",{className:"font-bold text-lg text-foreground",children:"Academly.ai"})]}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Your complete AI-powered thesis writing platform. Structure, write, and submit."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Product"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(mt,{to:"/how-it-works",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"How it Works"})}),a.jsx("li",{children:a.jsx(mt,{to:"/pricing",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Pricing"})}),a.jsx("li",{children:a.jsx(mt,{to:"/login",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Sign In"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Blog"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(mt,{to:"/blog",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"All articles"})}),a.jsx("li",{children:a.jsx(mt,{to:"/vs/chatgpt",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs ChatGPT"})}),a.jsx("li",{children:a.jsx(mt,{to:"/vs/jenni-ai",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Academly vs Jenni AI"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Support"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx("a",{href:"https://docs.academly.ai/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Documentation"})}),a.jsx("li",{children:a.jsx("a",{href:"mailto:support@academly.ai",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Help & FAQ"})}),a.jsx("li",{children:a.jsx("a",{href:"mailto:contact@academly.ai",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Contact Us"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground mb-4",children:"Legal"}),a.jsxs("ul",{className:"space-y-3",children:[a.jsx("li",{children:a.jsx(mt,{to:"/legal",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Imprint"})}),a.jsx("li",{children:a.jsx(mt,{to:"/legal#privacy",className:"text-sm text-muted-foreground hover:text-primary transition-colors",children:"Privacy Policy"})})]})]})]}),a.jsxs("div",{className:"border-t border-border mt-12 pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["© ",new Date().getFullYear()," Academly.ai. All rights reserved."]}),a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsx("a",{href:"https://youtube.com/@academly-ai?si=hAadi72xwmt5fJ3u",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})})}),a.jsx("a",{href:"https://discord.gg/YFHAZY8d9",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}),a.jsx("a",{href:"https://docs.academly.ai/",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),a.jsx("a",{href:"https://www.linkedin.com/company/academly-ai",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-primary transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z",clipRule:"evenodd"})})})]})]})]})})}),Dke=[{name:"Dashboard",path:"/dashboard",icon:a.jsx(zxe,{className:"w-5 h-5"})},{name:"My Library",path:"/documents",icon:a.jsx(Ir,{className:"w-5 h-5"})},{name:"My Citations",path:"/reference-checker",icon:a.jsx(a0,{className:"w-5 h-5"})},{name:"My Thesis",path:"/thesis-manager",icon:a.jsx(BJ,{className:"w-5 h-5"})}],Lke=[{name:"Topic Explorer",icon:a.jsx(xi,{className:"w-5 h-5"}),subItems:[{name:"Topic Ideas",path:"/topic-explorer/ideas"},{name:"Outline",path:"/topic-explorer/outline"},{name:"Literature Keywords",path:"/topic-explorer/keywords"}]},{name:"Theory & Background",path:"/thesis-builder",icon:a.jsx(xi,{className:"w-5 h-5"})},{name:"Methods & Approach",path:"/methods-approach",icon:a.jsx($J,{className:"w-5 h-5"})},{name:"Discussion",path:"/discussion",icon:a.jsx(Wm,{className:"w-5 h-5"})},{name:"Conclusion",path:"/conclusion",icon:a.jsx(i0e,{className:"w-5 h-5"})}],Fke=[{name:"Qualitative",icon:a.jsx(Gxe,{className:"w-5 h-5"}),subItems:[{name:"Research Setup",path:"/qualitative/research-setup"},{name:"Codebook",path:"/qualitative/kodierbogen"},{name:"Codebook (Grid)",path:"/qualitative/kodierbogen-grid"},{name:"Interviews",path:"/qualitative/interviews"},{name:"Coding",path:"/qualitative/kodieren"},{name:"Analysis",path:"/qualitative/auswertung"}]}],$ke=[{name:"Summaries",path:"/summary",icon:a.jsx(sc,{className:"w-5 h-5"})},{name:"Text Extractor",path:"/pdf-extract",icon:a.jsx(Ixe,{className:"w-5 h-5"})},{name:"Page Selector",path:"/pdf-slicer",icon:a.jsx(WJ,{className:"w-5 h-5"})},{name:"Supervisor",path:"/supervisor",icon:a.jsx(DJ,{className:"w-5 h-5"})}],N9=[{label:"Workspace",items:Dke,type:"workspace"},{label:"Writing",items:Lke,type:"writing"},{label:"Qualitative",items:Fke,type:"qualitative"},{label:"Utilities",items:$ke,type:"utilities"}];function Bke({isExpanded:t,isHovered:e,isMobileOpen:r,onHoverChange:n,onMobileClose:s}){const i=mf(),o=i.pathname,{theme:l}=j6(),[c,u]=S.useState(null),[d,h]=S.useState({}),f=S.useRef({}),p=S.useCallback(y=>o===y,[o]),g=t||e||r;S.useEffect(()=>{let y=!1;N9.forEach(x=>{x.items.forEach((b,w)=>{b.subItems&&b.subItems.forEach(j=>{p(j.path)&&(u({type:x.type,index:w}),y=!0)})})}),y||u(null)},[i,p]),S.useEffect(()=>{if(c!==null){const y=`${c.type}-${c.index}`;f.current[y]&&h(x=>{var b;return{...x,[y]:((b=f.current[y])==null?void 0:b.scrollHeight)||0}})}},[c]);const m=(y,x)=>{u(b=>b&&b.type===x&&b.index===y?null:{type:x,index:y})},v=(y,x)=>a.jsx("ul",{className:"flex flex-col gap-1.5",children:y.map((b,w)=>a.jsx("li",{children:b.subItems?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>m(w,x),className:`astro-menu-item group w-full ${(c==null?void 0:c.type)===x&&(c==null?void 0:c.index)===w?"astro-menu-item-active":"astro-menu-item-inactive"} ${g?"":"justify-center"}`,children:[a.jsx("span",{className:`w-5 h-5 flex-shrink-0 transition-colors ${(c==null?void 0:c.type)===x&&(c==null?void 0:c.index)===w?"text-primary":"text-muted-foreground group-hover:text-foreground"}`,children:b.icon}),g&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flex-1 text-left",children:b.name}),a.jsx(ad,{className:`w-4 h-4 transition-transform duration-300 ${(c==null?void 0:c.type)===x&&(c==null?void 0:c.index)===w?"rotate-180":""}`})]})]}),g&&a.jsx("div",{ref:j=>{f.current[`${x}-${w}`]=j},className:"overflow-hidden transition-all duration-300 ease-out",style:{height:(c==null?void 0:c.type)===x&&(c==null?void 0:c.index)===w?`${d[`${x}-${w}`]}px`:"0px"},children:a.jsx("ul",{className:"mt-2 ml-9 space-y-1",children:b.subItems.map(j=>a.jsx("li",{children:a.jsx(mt,{to:j.path,onClick:s,className:`astro-dropdown-item ${p(j.path)?"astro-dropdown-item-active":"astro-dropdown-item-inactive"}`,children:j.name})},j.name))})})]}):b.path?a.jsxs(mt,{to:b.path,onClick:s,className:`astro-menu-item group ${p(b.path)?"astro-menu-item-active":"astro-menu-item-inactive"} ${g?"":"justify-center"}`,children:[a.jsx("span",{className:`w-5 h-5 flex-shrink-0 transition-colors ${p(b.path)?"text-primary":"text-muted-foreground group-hover:text-foreground"}`,children:b.icon}),g&&a.jsx("span",{children:b.name})]}):null},b.name))});return a.jsxs(a.Fragment,{children:[r&&a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:s}),a.jsxs("aside",{className:`ta-sidebar astro-sidebar ${g?"ta-sidebar-expanded":"ta-sidebar-collapsed"} ${r?"ta-sidebar-mobile-open":"ta-sidebar-mobile-closed"}`,onMouseEnter:()=>!t&&n(!0),onMouseLeave:()=>n(!1),children:[a.jsx("div",{className:`ta-sidebar-logo ${g?"":"justify-center"}`,children:a.jsx(mt,{to:"/dashboard",className:"flex items-center",children:g?a.jsx("img",{src:l==="dark"?"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new_light.png":"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",alt:"Academly.ai",className:"h-10 w-auto"}):a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:a.jsx("span",{className:"text-primary-foreground font-bold text-sm",children:"ST"})})})}),a.jsx("nav",{className:"ta-sidebar-nav no-scrollbar",children:N9.map(y=>a.jsxs("div",{className:"ta-sidebar-section",children:[a.jsx("h2",{className:`ta-sidebar-section-label ${g?"":"text-center"}`,children:g?y.label:"•••"}),v(y.items,y.type)]},y.type))})]})]})}function Uke(){return a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[a.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),a.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:a.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}function A9({variant:t="received",layout:e="default",className:r,children:n}){return a.jsx("div",{className:Oe("flex gap-2 max-w-[80%]",t==="sent"?"ml-auto flex-row-reverse":"",e==="ai"?"items-start":"items-end",r),children:n})}function E9({variant:t="received",isLoading:e,className:r,children:n}){return a.jsx("div",{className:Oe("rounded-xl px-3 py-2 text-sm",t==="sent"?"bg-primary text-primary-foreground":"bg-muted text-foreground",r),children:e?a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(Uke,{})}):n})}function C9({src:t,fallback:e="AI",className:r}){return a.jsxs(NT,{className:Oe("h-8 w-8 shrink-0",r),children:[t&&a.jsx(AT,{src:t}),a.jsx(ET,{className:"text-xs",children:e})]})}const Rne=S.forwardRef(({className:t,...e},r)=>a.jsx(Wt,{autoComplete:"off",ref:r,name:"message",className:Oe("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",t),...e}));Rne.displayName="ChatInput";const hN={dimensions:{sm:"sm:max-w-sm sm:h-[500px]",md:"sm:max-w-md sm:h-[min(600px,calc(100vh-120px))]",lg:"sm:max-w-lg sm:h-[min(700px,calc(100vh-120px))]",xl:"sm:max-w-xl sm:h-[min(800px,calc(100vh-120px))]",full:"sm:w-full sm:h-full"},positions:{"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5"},states:{open:"pointer-events-auto opacity-100 visible scale-100 translate-y-0",closed:"pointer-events-none opacity-0 invisible scale-100 sm:translate-y-5"}},Mne=({className:t,position:e="bottom-right",size:r="md",icon:n,children:s,...i})=>{const[o,l]=S.useState(!1),c=S.useRef(null),u=()=>l(!o);return a.jsxs("div",{className:Oe(`fixed ${hN.positions[e]} z-50 flex flex-col items-end gap-3 pointer-events-none`,t),...i,children:[a.jsxs("div",{ref:c,className:Oe("flex flex-col bg-background border border-border sm:rounded-2xl shadow-xl","transition-all duration-250 ease-out origin-bottom-right","w-full sm:w-auto",hN.dimensions[r],o?hN.states.open:hN.states.closed),children:[s,a.jsx(ve,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 text-muted-foreground hover:text-foreground sm:hidden",onClick:u,children:a.jsx(Rs,{className:"h-4 w-4"})})]}),a.jsx($ne,{icon:n,isOpen:o,toggleChat:u})]})};Mne.displayName="ExpandableChat";const Dne=({className:t,...e})=>a.jsx("div",{className:Oe("flex items-center justify-between p-4 border-b border-border",t),...e});Dne.displayName="ExpandableChatHeader";const Lne=({className:t,...e})=>a.jsx("div",{className:Oe("flex-1 overflow-y-auto",t),...e});Lne.displayName="ExpandableChatBody";const Fne=({className:t,...e})=>a.jsx("div",{className:Oe("border-t border-border p-4",t),...e});Fne.displayName="ExpandableChatFooter";const $ne=({className:t,icon:e,isOpen:r,toggleChat:n,...s})=>a.jsx(ve,{variant:"default",onClick:n,className:Oe("w-14 h-14 rounded-full shadow-lg hover:shadow-xl transition-shadow pointer-events-auto",t),...s,children:r?a.jsx(Rs,{className:"h-6 w-6"}):e||a.jsx(qxe,{className:"h-6 w-6"})});$ne.displayName="ExpandableChatToggle";function zke(t={}){const{offset:e=20,smooth:r=!1,content:n}=t,s=S.useRef(null),i=S.useRef(0),o=S.useRef(!1),[l,c]=S.useState({isAtBottom:!0,autoScrollEnabled:!0}),u=S.useCallback(p=>{const{scrollTop:g,scrollHeight:m,clientHeight:v}=p;return Math.abs(m-g-v)<=e},[e]),d=S.useCallback(p=>{if(!s.current)return;const g=s.current.scrollHeight-s.current.clientHeight;p?s.current.scrollTop=g:s.current.scrollTo({top:g,behavior:r?"smooth":"auto"}),c({isAtBottom:!0,autoScrollEnabled:!0}),o.current=!1},[r]),h=S.useCallback(()=>{if(!s.current)return;const p=u(s.current);c(g=>({isAtBottom:p,autoScrollEnabled:p?!0:g.autoScrollEnabled}))},[u]);S.useEffect(()=>{const p=s.current;if(p)return p.addEventListener("scroll",h,{passive:!0}),()=>p.removeEventListener("scroll",h)},[h]),S.useEffect(()=>{const p=s.current;if(!p)return;const g=p.scrollHeight;g!==i.current&&(l.autoScrollEnabled&&requestAnimationFrame(()=>{d(i.current===0)}),i.current=g)},[n,l.autoScrollEnabled,d]),S.useEffect(()=>{const p=s.current;if(!p)return;const g=new ResizeObserver(()=>{l.autoScrollEnabled&&d(!0)});return g.observe(p),()=>g.disconnect()},[l.autoScrollEnabled,d]);const f=S.useCallback(()=>{(s.current?u(s.current):!1)||(o.current=!0,c(g=>({...g,autoScrollEnabled:!1})))},[u]);return{scrollRef:s,isAtBottom:l.isAtBottom,autoScrollEnabled:l.autoScrollEnabled,scrollToBottom:()=>d(!1),disableAutoScroll:f}}const Bne=S.forwardRef(({className:t,children:e,smooth:r=!1,...n},s)=>{const{scrollRef:i,isAtBottom:o,autoScrollEnabled:l,scrollToBottom:c,disableAutoScroll:u}=zke({smooth:r,content:e});return a.jsxs("div",{className:Oe("relative w-full h-full",t),...n,children:[a.jsx("div",{className:"h-full overflow-y-auto p-4",ref:i,onWheel:u,onTouchMove:u,children:a.jsx("div",{className:"flex flex-col gap-4",children:e})}),!o&&a.jsx(ve,{onClick:()=>{c()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md","aria-label":"Scroll to bottom",children:a.jsx(wxe,{className:"h-4 w-4"})})]})});Bne.displayName="ChatMessageList";function Hke(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Wke=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vke=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qke={};function k9(t,e){return(qke.jsx?Vke:Wke).test(t)}const Gke=/[ \t\n\f\r]/g;function Kke(t){return typeof t=="object"?t.type==="text"?T9(t.value):!1:T9(t)}function T9(t){return t.replace(Gke,"")===""}class Xj{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Xj.prototype.normal={};Xj.prototype.property={};Xj.prototype.space=void 0;function Une(t,e){const r={},n={};for(const s of t)Object.assign(r,s.property),Object.assign(n,s.normal);return new Xj(r,n,e)}function n4(t){return t.toLowerCase()}class Zi{constructor(e,r){this.attribute=r,this.property=e}}Zi.prototype.attribute="";Zi.prototype.booleanish=!1;Zi.prototype.boolean=!1;Zi.prototype.commaOrSpaceSeparated=!1;Zi.prototype.commaSeparated=!1;Zi.prototype.defined=!1;Zi.prototype.mustUseProperty=!1;Zi.prototype.number=!1;Zi.prototype.overloadedBoolean=!1;Zi.prototype.property="";Zi.prototype.spaceSeparated=!1;Zi.prototype.space=void 0;let Yke=0;const Mt=dg(),Tn=dg(),s4=dg(),We=dg(),Nr=dg(),Ry=dg(),na=dg();function dg(){return 2**++Yke}const i4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mt,booleanish:Tn,commaOrSpaceSeparated:na,commaSeparated:Ry,number:We,overloadedBoolean:s4,spaceSeparated:Nr},Symbol.toStringTag,{value:"Module"})),uO=Object.keys(i4);class R6 extends Zi{constructor(e,r,n,s){let i=-1;if(super(e,r),P9(this,"space",s),typeof n=="number")for(;++i<uO.length;){const o=uO[i];P9(this,uO[i],(n&i4[o])===i4[o])}}}R6.prototype.defined=!0;function P9(t,e,r){r&&(t[e]=r)}function y0(t){const e={},r={};for(const[n,s]of Object.entries(t.properties)){const i=new R6(n,t.transform(t.attributes||{},n),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),e[n]=i,r[n4(n)]=n,r[n4(i.attribute)]=n}return new Xj(e,r,t.space)}const zne=y0({properties:{ariaActiveDescendant:null,ariaAtomic:Tn,ariaAutoComplete:null,ariaBusy:Tn,ariaChecked:Tn,ariaColCount:We,ariaColIndex:We,ariaColSpan:We,ariaControls:Nr,ariaCurrent:null,ariaDescribedBy:Nr,ariaDetails:null,ariaDisabled:Tn,ariaDropEffect:Nr,ariaErrorMessage:null,ariaExpanded:Tn,ariaFlowTo:Nr,ariaGrabbed:Tn,ariaHasPopup:null,ariaHidden:Tn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nr,ariaLevel:We,ariaLive:null,ariaModal:Tn,ariaMultiLine:Tn,ariaMultiSelectable:Tn,ariaOrientation:null,ariaOwns:Nr,ariaPlaceholder:null,ariaPosInSet:We,ariaPressed:Tn,ariaReadOnly:Tn,ariaRelevant:null,ariaRequired:Tn,ariaRoleDescription:Nr,ariaRowCount:We,ariaRowIndex:We,ariaRowSpan:We,ariaSelected:Tn,ariaSetSize:We,ariaSort:null,ariaValueMax:We,ariaValueMin:We,ariaValueNow:We,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Hne(t,e){return e in t?t[e]:e}function Wne(t,e){return Hne(t,e.toLowerCase())}const Xke=y0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ry,acceptCharset:Nr,accessKey:Nr,action:null,allow:null,allowFullScreen:Mt,allowPaymentRequest:Mt,allowUserMedia:Mt,alt:null,as:null,async:Mt,autoCapitalize:null,autoComplete:Nr,autoFocus:Mt,autoPlay:Mt,blocking:Nr,capture:null,charSet:null,checked:Mt,cite:null,className:Nr,cols:We,colSpan:null,content:null,contentEditable:Tn,controls:Mt,controlsList:Nr,coords:We|Ry,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Mt,defer:Mt,dir:null,dirName:null,disabled:Mt,download:s4,draggable:Tn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Mt,formTarget:null,headers:Nr,height:We,hidden:s4,high:We,href:null,hrefLang:null,htmlFor:Nr,httpEquiv:Nr,id:null,imageSizes:null,imageSrcSet:null,inert:Mt,inputMode:null,integrity:null,is:null,isMap:Mt,itemId:null,itemProp:Nr,itemRef:Nr,itemScope:Mt,itemType:Nr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Mt,low:We,manifest:null,max:null,maxLength:We,media:null,method:null,min:null,minLength:We,multiple:Mt,muted:Mt,name:null,nonce:null,noModule:Mt,noValidate:Mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Mt,optimum:We,pattern:null,ping:Nr,placeholder:null,playsInline:Mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Mt,referrerPolicy:null,rel:Nr,required:Mt,reversed:Mt,rows:We,rowSpan:We,sandbox:Nr,scope:null,scoped:Mt,seamless:Mt,selected:Mt,shadowRootClonable:Mt,shadowRootDelegatesFocus:Mt,shadowRootMode:null,shape:null,size:We,sizes:null,slot:null,span:We,spellCheck:Tn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:We,step:null,style:null,tabIndex:We,target:null,title:null,translate:null,type:null,typeMustMatch:Mt,useMap:null,value:Tn,width:We,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nr,axis:null,background:null,bgColor:null,border:We,borderColor:null,bottomMargin:We,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Mt,declare:Mt,event:null,face:null,frame:null,frameBorder:null,hSpace:We,leftMargin:We,link:null,longDesc:null,lowSrc:null,marginHeight:We,marginWidth:We,noResize:Mt,noHref:Mt,noShade:Mt,noWrap:Mt,object:null,profile:null,prompt:null,rev:null,rightMargin:We,rules:null,scheme:null,scrolling:Tn,standby:null,summary:null,text:null,topMargin:We,valueType:null,version:null,vAlign:null,vLink:null,vSpace:We,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Mt,disableRemotePlayback:Mt,prefix:null,property:null,results:We,security:null,unselectable:null},space:"html",transform:Wne}),Qke=y0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:na,accentHeight:We,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:We,amplitude:We,arabicForm:null,ascent:We,attributeName:null,attributeType:null,azimuth:We,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:We,by:null,calcMode:null,capHeight:We,className:Nr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:We,diffuseConstant:We,direction:null,display:null,dur:null,divisor:We,dominantBaseline:null,download:Mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:We,enableBackground:null,end:null,event:null,exponent:We,externalResourcesRequired:null,fill:null,fillOpacity:We,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ry,g2:Ry,glyphName:Ry,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:We,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:We,horizOriginX:We,horizOriginY:We,id:null,ideographic:We,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:We,k:We,k1:We,k2:We,k3:We,k4:We,kernelMatrix:na,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:We,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:We,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:We,overlineThickness:We,paintOrder:null,panose1:null,path:null,pathLength:We,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:We,pointsAtY:We,pointsAtZ:We,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:na,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:na,rev:na,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:na,requiredFeatures:na,requiredFonts:na,requiredFormats:na,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:We,specularExponent:We,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:We,strikethroughThickness:We,string:null,stroke:null,strokeDashArray:na,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:We,strokeOpacity:We,strokeWidth:null,style:null,surfaceScale:We,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:na,tabIndex:We,tableValues:null,target:null,targetX:We,targetY:We,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:na,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:We,underlineThickness:We,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:We,values:null,vAlphabetic:We,vMathematical:We,vectorEffect:null,vHanging:We,vIdeographic:We,version:null,vertAdvY:We,vertOriginX:We,vertOriginY:We,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:We,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Hne}),Vne=y0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),qne=y0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wne}),Gne=y0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Zke={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Jke=/[A-Z]/g,O9=/-[a-z]/g,eTe=/^data[-\w.:]+$/i;function tTe(t,e){const r=n4(e);let n=e,s=Zi;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&eTe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(O9,nTe);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!O9.test(i)){let o=i.replace(Jke,rTe);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=R6}return new s(n,e)}function rTe(t){return"-"+t.toLowerCase()}function nTe(t){return t.charAt(1).toUpperCase()}const sTe=Une([zne,Xke,Vne,qne,Gne],"html"),M6=Une([zne,Qke,Vne,qne,Gne],"svg");function iTe(t){return t.join(" ").trim()}var D6={},I9=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,aTe=/\n/g,oTe=/^\s*/,lTe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,cTe=/^:\s*/,uTe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,dTe=/^[;\s]*/,hTe=/^\s+|\s+$/g,fTe=`
`,R9="/",M9="*",Zf="",pTe="comment",mTe="declaration",gTe=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var r=1,n=1;function s(g){var m=g.match(aTe);m&&(r+=m.length);var v=g.lastIndexOf(fTe);n=~v?g.length-v:n+g.length}function i(){var g={line:r,column:n};return function(m){return m.position=new o(g),u(),m}}function o(g){this.start=g,this.end={line:r,column:n},this.source=e.source}o.prototype.content=t;function l(g){var m=new Error(e.source+":"+r+":"+n+": "+g);if(m.reason=g,m.filename=e.source,m.line=r,m.column=n,m.source=t,!e.silent)throw m}function c(g){var m=g.exec(t);if(m){var v=m[0];return s(v),t=t.slice(v.length),m}}function u(){c(oTe)}function d(g){var m;for(g=g||[];m=h();)m!==!1&&g.push(m);return g}function h(){var g=i();if(!(R9!=t.charAt(0)||M9!=t.charAt(1))){for(var m=2;Zf!=t.charAt(m)&&(M9!=t.charAt(m)||R9!=t.charAt(m+1));)++m;if(m+=2,Zf===t.charAt(m-1))return l("End of comment missing");var v=t.slice(2,m-2);return n+=2,s(v),t=t.slice(m),n+=2,g({type:pTe,comment:v})}}function f(){var g=i(),m=c(lTe);if(m){if(h(),!c(cTe))return l("property missing ':'");var v=c(uTe),y=g({type:mTe,property:D9(m[0].replace(I9,Zf)),value:v?D9(v[0].replace(I9,Zf)):Zf});return c(dTe),y}}function p(){var g=[];d(g);for(var m;m=f();)m!==!1&&(g.push(m),d(g));return g}return u(),p()};function D9(t){return t?t.replace(hTe,Zf):Zf}var yTe=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D6,"__esModule",{value:!0});D6.default=xTe;var vTe=yTe(gTe);function xTe(t,e){var r=null;if(!t||typeof t!="string")return r;var n=(0,vTe.default)(t),s=typeof e=="function";return n.forEach(function(i){if(i.type==="declaration"){var o=i.property,l=i.value;s?e(o,l,i):l&&(r=r||{},r[o]=l)}}),r}var RT={};Object.defineProperty(RT,"__esModule",{value:!0});RT.camelCase=void 0;var bTe=/^--[a-zA-Z0-9_-]+$/,wTe=/-([a-z])/g,_Te=/^[^-]+$/,jTe=/^-(webkit|moz|ms|o|khtml)-/,STe=/^-(ms)-/,NTe=function(t){return!t||_Te.test(t)||bTe.test(t)},ATe=function(t,e){return e.toUpperCase()},L9=function(t,e){return"".concat(e,"-")},ETe=function(t,e){return e===void 0&&(e={}),NTe(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(STe,L9):t=t.replace(jTe,L9),t.replace(wTe,ATe))};RT.camelCase=ETe;var CTe=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},kTe=CTe(D6),TTe=RT;function a4(t,e){var r={};return!t||typeof t!="string"||(0,kTe.default)(t,function(n,s){n&&s&&(r[(0,TTe.camelCase)(n,e)]=s)}),r}a4.default=a4;var PTe=a4;const OTe=qt(PTe),Kne=Yne("end"),L6=Yne("start");function Yne(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function ITe(t){const e=L6(t),r=Kne(t);if(e&&r)return{start:e,end:r}}function pw(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?F9(t.position):"start"in t||"end"in t?F9(t):"line"in t||"column"in t?o4(t):""}function o4(t){return $9(t&&t.line)+":"+$9(t&&t.column)}function F9(t){return o4(t&&t.start)+"-"+o4(t&&t.end)}function $9(t){return t&&typeof t=="number"?t:1}class ri extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let s="",i={},o=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?i.ruleId=n:(i.source=n.slice(0,c),i.ruleId=n.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=pw(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ri.prototype.file="";ri.prototype.name="";ri.prototype.reason="";ri.prototype.message="";ri.prototype.stack="";ri.prototype.column=void 0;ri.prototype.line=void 0;ri.prototype.ancestors=void 0;ri.prototype.cause=void 0;ri.prototype.fatal=void 0;ri.prototype.place=void 0;ri.prototype.ruleId=void 0;ri.prototype.source=void 0;const F6={}.hasOwnProperty,RTe=new Map,MTe=/[A-Z]/g,DTe=new Set(["table","tbody","thead","tfoot","tr"]),LTe=new Set(["td","th"]),Xne="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function FTe(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=qTe(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=VTe(r,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?M6:sTe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=Qne(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function Qne(t,e,r){if(e.type==="element")return $Te(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return BTe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return zTe(t,e,r);if(e.type==="mdxjsEsm")return UTe(t,e);if(e.type==="root")return HTe(t,e,r);if(e.type==="text")return WTe(t,e)}function $Te(t,e,r){const n=t.schema;let s=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=M6,t.schema=s),t.ancestors.push(e);const i=Jne(t,e.tagName,!1),o=GTe(t,e);let l=B6(t,e);return DTe.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Kke(c):!0})),Zne(t,o,i,e),$6(o,l),t.ancestors.pop(),t.schema=n,t.create(e,i,o,r)}function BTe(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}r1(t,e.position)}function UTe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);r1(t,e.position)}function zTe(t,e,r){const n=t.schema;let s=n;e.name==="svg"&&n.space==="html"&&(s=M6,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:Jne(t,e.name,!0),o=KTe(t,e),l=B6(t,e);return Zne(t,o,i,e),$6(o,l),t.ancestors.pop(),t.schema=n,t.create(e,i,o,r)}function HTe(t,e,r){const n={};return $6(n,B6(t,e)),t.create(e,t.Fragment,n,r)}function WTe(t,e){return e.value}function Zne(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function $6(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function VTe(t,e,r){return n;function n(s,i,o,l){const u=Array.isArray(o.children)?r:e;return l?u(i,o,l):u(i,o)}}function qTe(t,e){return r;function r(n,s,i,o){const l=Array.isArray(i.children),c=L6(n);return e(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function GTe(t,e){const r={};let n,s;for(s in e.properties)if(s!=="children"&&F6.call(e.properties,s)){const i=YTe(t,s,e.properties[s]);if(i){const[o,l]=i;t.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&LTe.has(e.tagName)?n=l:r[o]=l}}if(n){const i=r.style||(r.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function KTe(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const i=n.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,t.evaluater.evaluateExpression(l.argument))}else r1(t,e.position);else{const s=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const l=n.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else r1(t,e.position);else i=n.value===null?!0:n.value;r[s]=i}return r}function B6(t,e){const r=[];let n=-1;const s=t.passKeys?new Map:RTe;for(;++n<e.children.length;){const i=e.children[n];let o;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=Qne(t,i,o);l!==void 0&&r.push(l)}return r}function YTe(t,e,r){const n=tTe(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Hke(r):iTe(r)),n.property==="style"){let s=typeof r=="object"?r:XTe(t,String(r));return t.stylePropertyNameCase==="css"&&(s=QTe(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&n.space?Zke[n.property]||n.property:n.attribute,r]}}function XTe(t,e){try{return OTe(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,s=new ri("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=Xne+"#cannot-parse-style-attribute",s}}function Jne(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,o;for(;++i<s.length;){const l=k9(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}n=o}else n=k9(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const s=n.value;return F6.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(n);r1(t)}function r1(t,e){const r=new ri("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=Xne+"#cannot-handle-mdx-estrees-without-createevaluater",r}function QTe(t){const e={};let r;for(r in t)F6.call(t,r)&&(e[ZTe(r)]=t[r]);return e}function ZTe(t){let e=t.replace(MTe,JTe);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function JTe(t){return"-"+t.toLowerCase()}const dO={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},e2e={};function t2e(t,e){const r=e2e,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ese(t,n,s)}function ese(t,e,r){if(r2e(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return B9(t.children,e,r)}return Array.isArray(t)?B9(t,e,r):""}function B9(t,e,r){const n=[];let s=-1;for(;++s<t.length;)n[s]=ese(t[s],e,r);return n.join("")}function r2e(t){return!!(t&&typeof t=="object")}const U9=document.createElement("i");function U6(t){const e="&"+t+";";U9.innerHTML=e;const r=U9.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function bc(t,e,r,n){const s=t.length;let i=0,o;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);i<n.length;)o=n.slice(i,i+1e4),o.unshift(e,0),t.splice(...o),i+=1e4,e+=1e4}function so(t,e){return t.length>0?(bc(t,t.length,0,e),t):e}const z9={}.hasOwnProperty;function n2e(t){const e={};let r=-1;for(;++r<t.length;)s2e(e,t[r]);return e}function s2e(t,e){let r;for(r in e){const s=(z9.call(t,r)?t[r]:void 0)||(t[r]={}),i=e[r];let o;if(i)for(o in i){z9.call(s,o)||(s[o]=[]);const l=i[o];i2e(s[o],Array.isArray(l)?l:l?[l]:[])}}}function i2e(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);bc(t,0,0,n)}function tse(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function My(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rc=vf(/[A-Za-z]/),ka=vf(/[\dA-Za-z]/),a2e=vf(/[#-'*+\--9=?A-Z^-~]/);function l4(t){return t!==null&&(t<32||t===127)}const c4=vf(/\d/),o2e=vf(/[\dA-Fa-f]/),l2e=vf(/[!-/:-@[-`{-~]/);function _t(t){return t!==null&&t<-2}function Ki(t){return t!==null&&(t<0||t===32)}function or(t){return t===-2||t===-1||t===32}const c2e=vf(new RegExp("\\p{P}|\\p{S}","u")),u2e=vf(/\s/);function vf(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function v0(t){const e=[];let r=-1,n=0,s=0;for(;++r<t.length;){const i=t.charCodeAt(r);let o="";if(i===37&&ka(t.charCodeAt(r+1))&&ka(t.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+s+1,o=""),s&&(r+=s,s=0)}return e.join("")+t.slice(n)}function Tr(t,e,r,n){const s=n?n-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return or(c)?(t.enter(r),l(c)):e(c)}function l(c){return or(c)&&i++<s?(t.consume(c),l):(t.exit(r),e(c))}}const d2e={tokenize:h2e};function h2e(t){const e=t.attempt(this.parser.constructs.contentInitial,n,s);let r;return e;function n(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Tr(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return _t(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),o)}}const f2e={tokenize:p2e},H9={tokenize:m2e};function p2e(t){const e=this,r=[];let n=0,s,i,o;return l;function l(b){if(n<r.length){const w=r[n];return e.containerState=w[1],t.attempt(w[0].continuation,c,u)(b)}return u(b)}function c(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&x();const w=e.events.length;let j=w,N;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){N=e.events[j][1].end;break}y(n);let C=w;for(;C<e.events.length;)e.events[C][1].end={...N},C++;return bc(e.events,j+1,0,e.events.slice(w)),e.events.length=C,u(b)}return l(b)}function u(b){if(n===r.length){if(!s)return f(b);if(s.currentConstruct&&s.currentConstruct.concrete)return g(b);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(H9,d,h)(b)}function d(b){return s&&x(),y(n),f(b)}function h(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,g(b)}function f(b){return e.containerState={},t.attempt(H9,p,g)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),f(b)}function g(b){if(b===null){s&&x(),y(0),t.consume(b);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),m(b)}function m(b){if(b===null){v(t.exit("chunkFlow"),!0),y(0),t.consume(b);return}return _t(b)?(t.consume(b),v(t.exit("chunkFlow")),n=0,e.interrupt=void 0,l):(t.consume(b),m)}function v(b,w){const j=e.sliceStream(b);if(w&&j.push(null),b.previous=i,i&&(i.next=b),i=b,s.defineSkip(b.start),s.write(j),e.parser.lazy[b.start.line]){let N=s.events.length;for(;N--;)if(s.events[N][1].start.offset<o&&(!s.events[N][1].end||s.events[N][1].end.offset>o))return;const C=e.events.length;let k=C,E,M;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(E){M=e.events[k][1].end;break}E=!0}for(y(n),N=C;N<e.events.length;)e.events[N][1].end={...M},N++;bc(e.events,k+1,0,e.events.slice(C)),e.events.length=N}}function y(b){let w=r.length;for(;w-- >b;){const j=r[w];e.containerState=j[1],j[0].exit.call(e,t)}r.length=b}function x(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function m2e(t,e,r){return Tr(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function W9(t){if(t===null||Ki(t)||u2e(t))return 1;if(c2e(t))return 2}function z6(t,e,r){const n=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!n.includes(i)&&(e=i(e,r),n.push(i))}return e}const u4={name:"attention",resolveAll:g2e,tokenize:y2e};function g2e(t,e){let r=-1,n,s,i,o,l,c,u,d;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;c=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[r][1].start};V9(h,-c),V9(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:f},i={type:c>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},t[n][1].end={...o.start},t[r][1].start={...l.end},u=[],t[n][1].end.offset-t[n][1].start.offset&&(u=so(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=so(u,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),u=so(u,z6(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=so(u,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[r][1].end.offset-t[r][1].start.offset?(d=2,u=so(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):d=0,bc(t,n-1,r-n+3,u),r=n+u.length-d-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function y2e(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,s=W9(n);let i;return o;function o(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const u=t.exit("attentionSequence"),d=W9(c),h=!d||d===2&&s||r.includes(c),f=!s||s===2&&d||r.includes(n);return u._open=!!(i===42?h:h&&(s||!f)),u._close=!!(i===42?f:f&&(d||!h)),e(c)}}function V9(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const v2e={name:"autolink",tokenize:x2e};function x2e(t,e,r){let n=0;return s;function s(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(p){return rc(p)?(t.consume(p),o):p===64?r(p):u(p)}function o(p){return p===43||p===45||p===46||ka(p)?(n=1,l(p)):u(p)}function l(p){return p===58?(t.consume(p),n=0,c):(p===43||p===45||p===46||ka(p))&&n++<32?(t.consume(p),l):(n=0,u(p))}function c(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||l4(p)?r(p):(t.consume(p),c)}function u(p){return p===64?(t.consume(p),d):a2e(p)?(t.consume(p),u):r(p)}function d(p){return ka(p)?h(p):r(p)}function h(p){return p===46?(t.consume(p),n=0,d):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):f(p)}function f(p){if((p===45||ka(p))&&n++<63){const g=p===45?f:h;return t.consume(p),g}return r(p)}}const MT={partial:!0,tokenize:b2e};function b2e(t,e,r){return n;function n(i){return or(i)?Tr(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||_t(i)?e(i):r(i)}}const rse={continuation:{tokenize:_2e},exit:j2e,name:"blockQuote",tokenize:w2e};function w2e(t,e,r){const n=this;return s;function s(o){if(o===62){const l=n.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),i}return r(o)}function i(o){return or(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function _2e(t,e,r){const n=this;return s;function s(o){return or(o)?Tr(t,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(rse,e,r)(o)}}function j2e(t){t.exit("blockQuote")}const nse={name:"characterEscape",tokenize:S2e};function S2e(t,e,r){return n;function n(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return l2e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(i)}}const sse={name:"characterReference",tokenize:N2e};function N2e(t,e,r){const n=this;let s=0,i,o;return l;function l(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),c}function c(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),i=31,o=ka,d(h))}function u(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=o2e,d):(t.enter("characterReferenceValue"),i=7,o=c4,d(h))}function d(h){if(h===59&&s){const f=t.exit("characterReferenceValue");return o===ka&&!U6(n.sliceSerialize(f))?r(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&s++<i?(t.consume(h),d):r(h)}}const q9={partial:!0,tokenize:E2e},G9={concrete:!0,name:"codeFenced",tokenize:A2e};function A2e(t,e,r){const n=this,s={partial:!0,tokenize:j};let i=0,o=0,l;return c;function c(N){return u(N)}function u(N){const C=n.events[n.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,l=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(N)}function d(N){return N===l?(o++,t.consume(N),d):o<3?r(N):(t.exit("codeFencedFenceSequence"),or(N)?Tr(t,h,"whitespace")(N):h(N))}function h(N){return N===null||_t(N)?(t.exit("codeFencedFence"),n.interrupt?e(N):t.check(q9,m,w)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(N))}function f(N){return N===null||_t(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(N)):or(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Tr(t,p,"whitespace")(N)):N===96&&N===l?r(N):(t.consume(N),f)}function p(N){return N===null||_t(N)?h(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||_t(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(N)):N===96&&N===l?r(N):(t.consume(N),g)}function m(N){return t.attempt(s,w,v)(N)}function v(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),y}function y(N){return i>0&&or(N)?Tr(t,x,"linePrefix",i+1)(N):x(N)}function x(N){return N===null||_t(N)?t.check(q9,m,w)(N):(t.enter("codeFlowValue"),b(N))}function b(N){return N===null||_t(N)?(t.exit("codeFlowValue"),x(N)):(t.consume(N),b)}function w(N){return t.exit("codeFenced"),e(N)}function j(N,C,k){let E=0;return M;function M(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),z}function z(U){return N.enter("codeFencedFence"),or(U)?Tr(N,I,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):I(U)}function I(U){return U===l?(N.enter("codeFencedFenceSequence"),q(U)):k(U)}function q(U){return U===l?(E++,N.consume(U),q):E>=o?(N.exit("codeFencedFenceSequence"),or(U)?Tr(N,A,"whitespace")(U):A(U)):k(U)}function A(U){return U===null||_t(U)?(N.exit("codeFencedFence"),C(U)):k(U)}}}function E2e(t,e,r){const n=this;return s;function s(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const hO={name:"codeIndented",tokenize:k2e},C2e={partial:!0,tokenize:T2e};function k2e(t,e,r){const n=this;return s;function s(u){return t.enter("codeIndented"),Tr(t,i,"linePrefix",5)(u)}function i(u){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?c(u):_t(u)?t.attempt(C2e,o,c)(u):(t.enter("codeFlowValue"),l(u))}function l(u){return u===null||_t(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),l)}function c(u){return t.exit("codeIndented"),e(u)}}function T2e(t,e,r){const n=this;return s;function s(o){return n.parser.lazy[n.now().line]?r(o):_t(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):Tr(t,i,"linePrefix",5)(o)}function i(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):_t(o)?s(o):r(o)}}const P2e={name:"codeText",previous:I2e,resolve:O2e,tokenize:R2e};function O2e(t){let e=t.length-4,r=3,n,s;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)s===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(s=n):(n===e||t[n][1].type==="lineEnding")&&(t[s][1].type="codeTextData",n!==s+2&&(t[s][1].end=t[n-1][1].end,t.splice(s+2,n-s-2),e-=n-s-2,n=s+2),s=void 0);return t}function I2e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function R2e(t,e,r){let n=0,s,i;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),n++,l):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?r(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(i=t.enter("codeTextSequence"),s=0,d(h)):_t(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||_t(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),u)}function d(h){return h===96?(t.consume(h),s++,d):s===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(i.type="codeTextData",u(h))}}class M2e{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const s=r||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&Q0(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Q0(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Q0(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);Q0(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Q0(this.left,r.reverse())}}}function Q0(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function ise(t){const e={};let r=-1,n,s,i,o,l,c,u;const d=new M2e(t);for(;++r<d.length;){for(;r in e;)r=e[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,D2e(d,r)),r=e[r],u=!0);else if(n[1]._container){for(i=r,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(n[1].end={...d.get(s)[1].start},l=d.slice(s,r),l.unshift(n),d.splice(s,r-s+1,l))}}return bc(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function D2e(t,e){const r=t.get(e)[1],n=t.get(e)[2];let s=e-1;const i=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,h,f=-1,p=r,g=0,m=0;const v=[m];for(;p;){for(;t.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=n.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(m=f+1,v.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),f=v.length;f--;){const y=l.slice(v[f],v[f+1]),x=i.pop();c.push([x,x+y.length-1]),t.splice(x,2,y)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const L2e={resolve:$2e,tokenize:B2e},F2e={partial:!0,tokenize:U2e};function $2e(t){return ise(t),t}function B2e(t,e){let r;return n;function n(l){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):_t(l)?t.check(F2e,o,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function o(l){return t.consume(l),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function U2e(t,e,r){const n=this;return s;function s(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Tr(t,i,"linePrefix")}function i(o){if(o===null||_t(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function ase(t,e,r,n,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(t.enter(n),t.enter(s),t.enter(i),t.consume(y),t.exit(i),f):y===null||y===32||y===41||l4(y)?r(y):(t.enter(n),t.enter(o),t.enter(l),t.enter("chunkString",{contentType:"string"}),m(y))}function f(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(s),t.exit(n),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(l),f(y)):y===null||y===60||_t(y)?r(y):(t.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function m(y){return!d&&(y===null||y===41||Ki(y))?(t.exit("chunkString"),t.exit(l),t.exit(o),t.exit(n),e(y)):d<u&&y===40?(t.consume(y),d++,m):y===41?(t.consume(y),d--,m):y===null||y===32||y===40||l4(y)?r(y):(t.consume(y),y===92?v:m)}function v(y){return y===40||y===41||y===92?(t.consume(y),m):m(y)}}function ose(t,e,r,n,s,i){const o=this;let l=0,c;return u;function u(p){return t.enter(n),t.enter(s),t.consume(p),t.exit(s),t.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(n),e):_t(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||_t(p)||l++>999?(t.exit("chunkString"),d(p)):(t.consume(p),c||(c=!or(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(t.consume(p),l++,h):h(p)}}function lse(t,e,r,n,s,i){let o;return l;function l(f){return f===34||f===39||f===40?(t.enter(n),t.enter(s),t.consume(f),t.exit(s),o=f===40?41:f,c):r(f)}function c(f){return f===o?(t.enter(s),t.consume(f),t.exit(s),t.exit(n),e):(t.enter(i),u(f))}function u(f){return f===o?(t.exit(i),c(o)):f===null?r(f):_t(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Tr(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||_t(f)?(t.exit("chunkString"),u(f)):(t.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(t.consume(f),d):d(f)}}function mw(t,e){let r;return n;function n(s){return _t(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r=!0,n):or(s)?Tr(t,n,r?"linePrefix":"lineSuffix")(s):e(s)}}const z2e={name:"definition",tokenize:W2e},H2e={partial:!0,tokenize:V2e};function W2e(t,e,r){const n=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return ose.call(n,t,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=My(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):r(p)}function c(p){return Ki(p)?mw(t,u)(p):u(p)}function u(p){return ase(t,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return t.attempt(H2e,h,h)(p)}function h(p){return or(p)?Tr(t,f,"whitespace")(p):f(p)}function f(p){return p===null||_t(p)?(t.exit("definition"),n.parser.defined.push(s),e(p)):r(p)}}function V2e(t,e,r){return n;function n(l){return Ki(l)?mw(t,s)(l):r(l)}function s(l){return lse(t,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return or(l)?Tr(t,o,"whitespace")(l):o(l)}function o(l){return l===null||_t(l)?e(l):r(l)}}const q2e={name:"hardBreakEscape",tokenize:G2e};function G2e(t,e,r){return n;function n(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return _t(i)?(t.exit("hardBreakEscape"),e(i)):r(i)}}const K2e={name:"headingAtx",resolve:Y2e,tokenize:X2e};function Y2e(t,e){let r=t.length-2,n=3,s,i;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(s={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},i={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},bc(t,n,r-n+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function X2e(t,e,r){let n=0;return s;function s(d){return t.enter("atxHeading"),i(d)}function i(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(t.consume(d),o):d===null||Ki(d)?(t.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||_t(d)?(t.exit("atxHeading"),e(d)):or(d)?Tr(t,l,"whitespace")(d):(t.enter("atxHeadingText"),u(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Ki(d)?(t.exit("atxHeadingText"),l(d)):(t.consume(d),u)}}const Q2e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],K9=["pre","script","style","textarea"],Z2e={concrete:!0,name:"htmlFlow",resolveTo:tPe,tokenize:rPe},J2e={partial:!0,tokenize:sPe},ePe={partial:!0,tokenize:nPe};function tPe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function rPe(t,e,r){const n=this;let s,i,o,l,c;return u;function u(W){return d(W)}function d(W){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(W),h}function h(W){return W===33?(t.consume(W),f):W===47?(t.consume(W),i=!0,m):W===63?(t.consume(W),s=3,n.interrupt?e:$):rc(W)?(t.consume(W),o=String.fromCharCode(W),v):r(W)}function f(W){return W===45?(t.consume(W),s=2,p):W===91?(t.consume(W),s=5,l=0,g):rc(W)?(t.consume(W),s=4,n.interrupt?e:$):r(W)}function p(W){return W===45?(t.consume(W),n.interrupt?e:$):r(W)}function g(W){const X="CDATA[";return W===X.charCodeAt(l++)?(t.consume(W),l===X.length?n.interrupt?e:I:g):r(W)}function m(W){return rc(W)?(t.consume(W),o=String.fromCharCode(W),v):r(W)}function v(W){if(W===null||W===47||W===62||Ki(W)){const X=W===47,oe=o.toLowerCase();return!X&&!i&&K9.includes(oe)?(s=1,n.interrupt?e(W):I(W)):Q2e.includes(o.toLowerCase())?(s=6,X?(t.consume(W),y):n.interrupt?e(W):I(W)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(W):i?x(W):b(W))}return W===45||ka(W)?(t.consume(W),o+=String.fromCharCode(W),v):r(W)}function y(W){return W===62?(t.consume(W),n.interrupt?e:I):r(W)}function x(W){return or(W)?(t.consume(W),x):M(W)}function b(W){return W===47?(t.consume(W),M):W===58||W===95||rc(W)?(t.consume(W),w):or(W)?(t.consume(W),b):M(W)}function w(W){return W===45||W===46||W===58||W===95||ka(W)?(t.consume(W),w):j(W)}function j(W){return W===61?(t.consume(W),N):or(W)?(t.consume(W),j):b(W)}function N(W){return W===null||W===60||W===61||W===62||W===96?r(W):W===34||W===39?(t.consume(W),c=W,C):or(W)?(t.consume(W),N):k(W)}function C(W){return W===c?(t.consume(W),c=null,E):W===null||_t(W)?r(W):(t.consume(W),C)}function k(W){return W===null||W===34||W===39||W===47||W===60||W===61||W===62||W===96||Ki(W)?j(W):(t.consume(W),k)}function E(W){return W===47||W===62||or(W)?b(W):r(W)}function M(W){return W===62?(t.consume(W),z):r(W)}function z(W){return W===null||_t(W)?I(W):or(W)?(t.consume(W),z):r(W)}function I(W){return W===45&&s===2?(t.consume(W),K):W===60&&s===1?(t.consume(W),G):W===62&&s===4?(t.consume(W),L):W===63&&s===3?(t.consume(W),$):W===93&&s===5?(t.consume(W),H):_t(W)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(J2e,F,q)(W)):W===null||_t(W)?(t.exit("htmlFlowData"),q(W)):(t.consume(W),I)}function q(W){return t.check(ePe,A,F)(W)}function A(W){return t.enter("lineEnding"),t.consume(W),t.exit("lineEnding"),U}function U(W){return W===null||_t(W)?q(W):(t.enter("htmlFlowData"),I(W))}function K(W){return W===45?(t.consume(W),$):I(W)}function G(W){return W===47?(t.consume(W),o="",Y):I(W)}function Y(W){if(W===62){const X=o.toLowerCase();return K9.includes(X)?(t.consume(W),L):I(W)}return rc(W)&&o.length<8?(t.consume(W),o+=String.fromCharCode(W),Y):I(W)}function H(W){return W===93?(t.consume(W),$):I(W)}function $(W){return W===62?(t.consume(W),L):W===45&&s===2?(t.consume(W),$):I(W)}function L(W){return W===null||_t(W)?(t.exit("htmlFlowData"),F(W)):(t.consume(W),L)}function F(W){return t.exit("htmlFlow"),e(W)}}function nPe(t,e,r){const n=this;return s;function s(o){return _t(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):r(o)}function i(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function sPe(t,e,r){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(MT,e,r)}}const iPe={name:"htmlText",tokenize:aPe};function aPe(t,e,r){const n=this;let s,i,o;return l;function l($){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume($),c}function c($){return $===33?(t.consume($),u):$===47?(t.consume($),j):$===63?(t.consume($),b):rc($)?(t.consume($),k):r($)}function u($){return $===45?(t.consume($),d):$===91?(t.consume($),i=0,g):rc($)?(t.consume($),x):r($)}function d($){return $===45?(t.consume($),p):r($)}function h($){return $===null?r($):$===45?(t.consume($),f):_t($)?(o=h,G($)):(t.consume($),h)}function f($){return $===45?(t.consume($),p):h($)}function p($){return $===62?K($):$===45?f($):h($)}function g($){const L="CDATA[";return $===L.charCodeAt(i++)?(t.consume($),i===L.length?m:g):r($)}function m($){return $===null?r($):$===93?(t.consume($),v):_t($)?(o=m,G($)):(t.consume($),m)}function v($){return $===93?(t.consume($),y):m($)}function y($){return $===62?K($):$===93?(t.consume($),y):m($)}function x($){return $===null||$===62?K($):_t($)?(o=x,G($)):(t.consume($),x)}function b($){return $===null?r($):$===63?(t.consume($),w):_t($)?(o=b,G($)):(t.consume($),b)}function w($){return $===62?K($):b($)}function j($){return rc($)?(t.consume($),N):r($)}function N($){return $===45||ka($)?(t.consume($),N):C($)}function C($){return _t($)?(o=C,G($)):or($)?(t.consume($),C):K($)}function k($){return $===45||ka($)?(t.consume($),k):$===47||$===62||Ki($)?E($):r($)}function E($){return $===47?(t.consume($),K):$===58||$===95||rc($)?(t.consume($),M):_t($)?(o=E,G($)):or($)?(t.consume($),E):K($)}function M($){return $===45||$===46||$===58||$===95||ka($)?(t.consume($),M):z($)}function z($){return $===61?(t.consume($),I):_t($)?(o=z,G($)):or($)?(t.consume($),z):E($)}function I($){return $===null||$===60||$===61||$===62||$===96?r($):$===34||$===39?(t.consume($),s=$,q):_t($)?(o=I,G($)):or($)?(t.consume($),I):(t.consume($),A)}function q($){return $===s?(t.consume($),s=void 0,U):$===null?r($):_t($)?(o=q,G($)):(t.consume($),q)}function A($){return $===null||$===34||$===39||$===60||$===61||$===96?r($):$===47||$===62||Ki($)?E($):(t.consume($),A)}function U($){return $===47||$===62||Ki($)?E($):r($)}function K($){return $===62?(t.consume($),t.exit("htmlTextData"),t.exit("htmlText"),e):r($)}function G($){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),Y}function Y($){return or($)?Tr(t,H,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):H($)}function H($){return t.enter("htmlTextData"),o($)}}const H6={name:"labelEnd",resolveAll:uPe,resolveTo:dPe,tokenize:hPe},oPe={tokenize:fPe},lPe={tokenize:pPe},cPe={tokenize:mPe};function uPe(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",e+=s}}return t.length!==r.length&&bc(t,0,t.length,r),t}function dPe(t,e){let r=t.length,n=0,s,i,o,l;for(;r--;)if(s=t[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(o=r);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},d={type:"labelText",start:{...t[i+n+2][1].end},end:{...t[o-2][1].start}};return l=[["enter",c,e],["enter",u,e]],l=so(l,t.slice(i+1,i+n+3)),l=so(l,[["enter",d,e]]),l=so(l,z6(e.parser.constructs.insideSpan.null,t.slice(i+n+4,o-3),e)),l=so(l,[["exit",d,e],t[o-2],t[o-1],["exit",u,e]]),l=so(l,t.slice(o+1)),l=so(l,[["exit",c,e]]),bc(t,i,t.length,l),t}function hPe(t,e,r){const n=this;let s=n.events.length,i,o;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){i=n.events[s][1];break}return l;function l(f){return i?i._inactive?h(f):(o=n.parser.defined.includes(My(n.sliceSerialize({start:i.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),c):r(f)}function c(f){return f===40?t.attempt(oPe,d,o?d:h)(f):f===91?t.attempt(lPe,d,o?u:h)(f):o?d(f):h(f)}function u(f){return t.attempt(cPe,d,h)(f)}function d(f){return e(f)}function h(f){return i._balanced=!0,r(f)}}function fPe(t,e,r){return n;function n(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),s}function s(h){return Ki(h)?mw(t,i)(h):i(h)}function i(h){return h===41?d(h):ase(t,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ki(h)?mw(t,c)(h):d(h)}function l(h){return r(h)}function c(h){return h===34||h===39||h===40?lse(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Ki(h)?mw(t,d)(h):d(h)}function d(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):r(h)}}function pPe(t,e,r){const n=this;return s;function s(l){return ose.call(n,t,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return n.parser.defined.includes(My(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(l):r(l)}function o(l){return r(l)}}function mPe(t,e,r){return n;function n(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):r(i)}}const gPe={name:"labelStartImage",resolveAll:H6.resolveAll,tokenize:yPe};function yPe(t,e,r){const n=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):e(l)}}const vPe={name:"labelStartLink",resolveAll:H6.resolveAll,tokenize:xPe};function xPe(t,e,r){const n=this;return s;function s(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const fO={name:"lineEnding",tokenize:bPe};function bPe(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Tr(t,e,"linePrefix")}}const wA={name:"thematicBreak",tokenize:wPe};function wPe(t,e,r){let n=0,s;return i;function i(u){return t.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(t.enter("thematicBreakSequence"),c(u)):n>=3&&(u===null||_t(u))?(t.exit("thematicBreak"),e(u)):r(u)}function c(u){return u===s?(t.consume(u),n++,c):(t.exit("thematicBreakSequence"),or(u)?Tr(t,l,"whitespace")(u):l(u))}}const Ei={continuation:{tokenize:NPe},exit:EPe,name:"list",tokenize:SPe},_Pe={partial:!0,tokenize:CPe},jPe={partial:!0,tokenize:APe};function SPe(t,e,r){const n=this,s=n.events[n.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:c4(p)){if(n.containerState.type||(n.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(wA,r,u)(p):u(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return r(p)}function c(p){return c4(p)&&++o<10?(t.consume(p),c):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):r(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(MT,n.interrupt?r:d,t.attempt(_Pe,f,h))}function d(p){return n.containerState.initialBlankLine=!0,i++,f(p)}function h(p){return or(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=i+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function NPe(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(MT,s,i);function s(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Tr(t,e,"listItemIndent",n.containerState.size+1)(l)}function i(l){return n.containerState.furtherBlankLines||!or(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(jPe,e,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Tr(t,t.attempt(Ei,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function APe(t,e,r){const n=this;return Tr(t,s,"listItemIndent",n.containerState.size+1);function s(i){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(i):r(i)}}function EPe(t){t.exit(this.containerState.type)}function CPe(t,e,r){const n=this;return Tr(t,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=n.events[n.events.length-1];return!or(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):r(i)}}const Y9={name:"setextUnderline",resolveTo:kPe,tokenize:TPe};function kPe(t,e){let r=t.length,n,s,i;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(s=r)}else t[r][1].type==="content"&&t.splice(r,1),!i&&t[r][1].type==="definition"&&(i=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[n][1],e]),t[n][1].end={...t[i][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function TPe(t,e,r){const n=this;let s;return i;function i(u){let d=n.events.length,h;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){h=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(t.enter("setextHeadingLine"),s=u,o(u)):r(u)}function o(u){return t.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(t.consume(u),l):(t.exit("setextHeadingLineSequence"),or(u)?Tr(t,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_t(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const PPe={tokenize:OPe};function OPe(t){const e=this,r=t.attempt(MT,n,t.attempt(this.parser.constructs.flowInitial,s,Tr(t,t.attempt(this.parser.constructs.flow,s,t.attempt(L2e,s)),"linePrefix")));return r;function n(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const IPe={resolveAll:use()},RPe=cse("string"),MPe=cse("text");function cse(t){return{resolveAll:use(t==="text"?DPe:void 0),tokenize:e};function e(r){const n=this,s=this.parser.constructs[t],i=r.attempt(s,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),c}function c(d){return u(d)?(r.exit("data"),i(d)):(r.consume(d),c)}function u(d){if(d===null)return!0;const h=s[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function use(t){return e;function e(r,n){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(r,n):r}}function DPe(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],s=e.sliceStream(n);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(l=0),l){const u={type:r===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:n.start._bufferIndex+o,_index:n.start._index+i,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(t.splice(r,0,["enter",u,e],["exit",u,e]),r+=2)}r++}return t}const LPe={42:Ei,43:Ei,45:Ei,48:Ei,49:Ei,50:Ei,51:Ei,52:Ei,53:Ei,54:Ei,55:Ei,56:Ei,57:Ei,62:rse},FPe={91:z2e},$Pe={[-2]:hO,[-1]:hO,32:hO},BPe={35:K2e,42:wA,45:[Y9,wA],60:Z2e,61:Y9,95:wA,96:G9,126:G9},UPe={38:sse,92:nse},zPe={[-5]:fO,[-4]:fO,[-3]:fO,33:gPe,38:sse,42:u4,60:[v2e,iPe],91:vPe,92:[q2e,nse],93:H6,95:u4,96:P2e},HPe={null:[u4,IPe]},WPe={null:[42,95]},VPe={null:[]},qPe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WPe,contentInitial:FPe,disable:VPe,document:LPe,flow:BPe,flowInitial:$Pe,insideSpan:HPe,string:UPe,text:zPe},Symbol.toStringTag,{value:"Module"}));function GPe(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:C(j),check:C(N),consume:x,enter:b,exit:w,interrupt:C(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:t,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=e.tokenize.call(u,c);return e.resolveAll&&i.push(e),u;function h(z){return o=so(o,z),v(),o[o.length-1]!==null?[]:(k(e,0),u.events=z6(i,u.events,u),u.events)}function f(z,I){return YPe(p(z),I)}function p(z){return KPe(o,z)}function g(){const{_bufferIndex:z,_index:I,line:q,column:A,offset:U}=n;return{_bufferIndex:z,_index:I,line:q,column:A,offset:U}}function m(z){s[z.line]=z.column,M()}function v(){let z;for(;n._index<o.length;){const I=o[n._index];if(typeof I=="string")for(z=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===z&&n._bufferIndex<I.length;)y(I.charCodeAt(n._bufferIndex));else y(I)}}function y(z){d=d(z)}function x(z){_t(z)?(n.line++,n.column=1,n.offset+=z===-3?2:1,M()):z!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=z}function b(z,I){const q=I||{};return q.type=z,q.start=g(),u.events.push(["enter",q,u]),l.push(q),q}function w(z){const I=l.pop();return I.end=g(),u.events.push(["exit",I,u]),I}function j(z,I){k(z,I.from)}function N(z,I){I.restore()}function C(z,I){return q;function q(A,U,K){let G,Y,H,$;return Array.isArray(A)?F(A):"tokenize"in A?F([A]):L(A);function L(le){return B;function B(R){const ee=R!==null&&le[R],te=R!==null&&le.null,Z=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(te)?te:te?[te]:[]];return F(Z)(R)}}function F(le){return G=le,Y=0,le.length===0?K:W(le[Y])}function W(le){return B;function B(R){return $=E(),H=le,le.partial||(u.currentConstruct=le),le.name&&u.parser.constructs.disable.null.includes(le.name)?oe():le.tokenize.call(I?Object.assign(Object.create(u),I):u,c,X,oe)(R)}}function X(le){return z(H,$),U}function oe(le){return $.restore(),++Y<G.length?W(G[Y]):K}}}function k(z,I){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&bc(u.events,I,u.events.length-I,z.resolve(u.events.slice(I),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function E(){const z=g(),I=u.previous,q=u.currentConstruct,A=u.events.length,U=Array.from(l);return{from:A,restore:K};function K(){n=z,u.previous=I,u.currentConstruct=q,u.events.length=A,l=U,M()}}function M(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function KPe(t,e){const r=e.start._index,n=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let o;if(r===s)o=[t[r].slice(n,i)];else{if(o=t.slice(r,s),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function YPe(t,e){let r=-1;const n=[];let s;for(;++r<t.length;){const i=t[r];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=e?" ":"	";break}case-1:{if(!e&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,n.push(o)}return n.join("")}function XPe(t){const n={constructs:n2e([qPe,...(t||{}).extensions||[]]),content:s(d2e),defined:[],document:s(f2e),flow:s(PPe),lazy:{},string:s(RPe),text:s(MPe)};return n;function s(i){return o;function o(l){return GPe(n,i,l)}}}function QPe(t){for(;!ise(t););return t}const X9=/[\0\t\n\r]/g;function ZPe(){let t=1,e="",r=!0,n;return s;function s(i,o,l){const c=[];let u,d,h,f,p;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,e="",r&&(i.charCodeAt(0)===65279&&h++,r=void 0);h<i.length;){if(X9.lastIndex=h,u=X9.exec(i),f=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(f),!u){e=i.slice(h);break}if(p===10&&h===f&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),h<f&&(c.push(i.slice(h,f)),t+=f-h),p){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:n=!0,t=1}h=f+1}return l&&(n&&c.push(-5),e&&c.push(e),c.push(null)),c}}const JPe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eOe(t){return t.replace(JPe,tOe)}function tOe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return tse(r.slice(i?2:1),i?16:10)}return U6(r)||t}const dse={}.hasOwnProperty;function rOe(t,e,r){return typeof e!="string"&&(r=e,e=void 0),nOe(r)(QPe(XPe(r).document().write(ZPe()(t,e,!0))))}function nOe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(D),autolinkProtocol:E,autolinkEmail:E,atxHeading:i(ie),blockQuote:i(te),characterEscape:E,characterReference:E,codeFenced:i(Z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Z,o),codeText:i(J,o),codeTextData:E,data:E,codeFlowValue:E,definition:i(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(P),hardBreakEscape:i(V),hardBreakTrailing:i(V),htmlFlow:i(O,o),htmlFlowData:E,htmlText:i(O,o),htmlTextData:E,image:i(T),label:o,link:i(D),listItem:i(ue),listItemValue:f,listOrdered:i(ne,h),listUnordered:i(ne),paragraph:i(re),reference:W,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ie),strong:i(pe),thematicBreak:i(ye)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ee,autolinkProtocol:R,blockQuote:c(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:le,characterReference:B,codeFenced:c(v),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:M,codeIndented:c(y),codeText:c(U),codeTextData:M,data:M,definition:c(),definitionDestinationString:w,definitionLabelString:x,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(q),htmlFlowData:M,htmlText:c(A),htmlTextData:M,image:c(G),label:H,labelText:Y,lineEnding:z,link:c(K),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:X,resourceDestinationString:$,resourceTitleString:L,resource:F,setextHeading:c(k),setextHeadingLineSequence:C,setextHeadingText:N,strong:c(),thematicBreak:c()}};hse(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ae){let de={type:"root",children:[]};const ge={stack:[de],tokenStack:[],config:e,enter:l,exit:u,buffer:o,resume:d,data:r},we=[];let je=-1;for(;++je<ae.length;)if(ae[je][1].type==="listOrdered"||ae[je][1].type==="listUnordered")if(ae[je][0]==="enter")we.push(je);else{const Se=we.pop();je=s(ae,Se,je)}for(je=-1;++je<ae.length;){const Se=e[ae[je][0]];dse.call(Se,ae[je][1].type)&&Se[ae[je][1].type].call(Object.assign({sliceSerialize:ae[je][2].sliceSerialize},ge),ae[je][1])}if(ge.tokenStack.length>0){const Se=ge.tokenStack[ge.tokenStack.length-1];(Se[1]||Q9).call(ge,void 0,Se[0])}for(de.position={start:vd(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:vd(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<e.transforms.length;)de=e.transforms[je](de)||de;return de}function s(ae,de,ge){let we=de-1,je=-1,Se=!1,Ue,Ae,fe,Ee;for(;++we<=ge;){const Ce=ae[we];switch(Ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ce[0]==="enter"?je++:je--,Ee=void 0;break}case"lineEndingBlank":{Ce[0]==="enter"&&(Ue&&!Ee&&!je&&!fe&&(fe=we),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!je&&Ce[0]==="enter"&&Ce[1].type==="listItemPrefix"||je===-1&&Ce[0]==="exit"&&(Ce[1].type==="listUnordered"||Ce[1].type==="listOrdered")){if(Ue){let Ge=we;for(Ae=void 0;Ge--;){const dt=ae[Ge];if(dt[1].type==="lineEnding"||dt[1].type==="lineEndingBlank"){if(dt[0]==="exit")continue;Ae&&(ae[Ae][1].type="lineEndingBlank",Se=!0),dt[1].type="lineEnding",Ae=Ge}else if(!(dt[1].type==="linePrefix"||dt[1].type==="blockQuotePrefix"||dt[1].type==="blockQuotePrefixWhitespace"||dt[1].type==="blockQuoteMarker"||dt[1].type==="listItemIndent"))break}fe&&(!Ae||fe<Ae)&&(Ue._spread=!0),Ue.end=Object.assign({},Ae?ae[Ae][1].start:Ce[1].end),ae.splice(Ae||we,0,["exit",Ue,Ce[2]]),we++,ge++}if(Ce[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},Ce[1].start),end:void 0};Ue=Ge,ae.splice(we,0,["enter",Ge,Ce[2]]),we++,ge++,fe=void 0,Ee=!0}}}return ae[de][1]._spread=Se,ge}function i(ae,de){return ge;function ge(we){l.call(this,ae(we),we),de&&de.call(this,we)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ae,de,ge){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([de,ge||void 0]),ae.position={start:vd(de.start),end:void 0}}function c(ae){return de;function de(ge){ae&&ae.call(this,ge),u.call(this,ge)}}function u(ae,de){const ge=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==ae.type&&(de?de.call(this,ae,we[0]):(we[1]||Q9).call(this,ae,we[0]));else throw new Error("Cannot close `"+ae.type+"` ("+pw({start:ae.start,end:ae.end})+"): it’s not open");ge.position.end=vd(ae.end)}function d(){return t2e(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(ae){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.lang=ae}function g(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.meta=ae}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/(\r?\n|\r)$/g,"")}function x(ae){const de=this.resume(),ge=this.stack[this.stack.length-1];ge.label=de,ge.identifier=My(this.sliceSerialize(ae)).toLowerCase()}function b(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function w(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function j(ae){const de=this.stack[this.stack.length-1];if(!de.depth){const ge=this.sliceSerialize(ae).length;de.depth=ge}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function C(ae){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function E(ae){const ge=this.stack[this.stack.length-1].children;let we=ge[ge.length-1];(!we||we.type!=="text")&&(we=xe(),we.position={start:vd(ae.start),end:void 0},ge.push(we)),this.stack.push(we)}function M(ae){const de=this.stack.pop();de.value+=this.sliceSerialize(ae),de.position.end=vd(ae.end)}function z(ae){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=de.children[de.children.length-1];ge.position.end=vd(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(E.call(this,ae),M.call(this,ae))}function I(){this.data.atHardBreak=!0}function q(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function A(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function U(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function K(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function G(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Y(ae){const de=this.sliceSerialize(ae),ge=this.stack[this.stack.length-2];ge.label=eOe(de),ge.identifier=My(de).toLowerCase()}function H(){const ae=this.stack[this.stack.length-1],de=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const we=ae.children;ge.children=we}else ge.alt=de}function $(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function L(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function F(){this.data.inReference=void 0}function W(){this.data.referenceType="collapsed"}function X(ae){const de=this.resume(),ge=this.stack[this.stack.length-1];ge.label=de,ge.identifier=My(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function oe(ae){this.data.characterReferenceType=ae.type}function le(ae){const de=this.sliceSerialize(ae),ge=this.data.characterReferenceType;let we;ge?(we=tse(de,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=U6(de);const je=this.stack[this.stack.length-1];je.value+=we}function B(ae){const de=this.stack.pop();de.position.end=vd(ae.end)}function R(ae){M.call(this,ae);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(ae)}function ee(ae){M.call(this,ae);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(ae)}function te(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function J(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function P(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function V(){return{type:"break"}}function O(){return{type:"html",value:""}}function T(){return{type:"image",title:null,url:"",alt:null}}function D(){return{type:"link",title:null,url:"",children:[]}}function ne(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function ue(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function re(){return{type:"paragraph",children:[]}}function pe(){return{type:"strong",children:[]}}function xe(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function vd(t){return{line:t.line,column:t.column,offset:t.offset}}function hse(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?hse(t,n):sOe(t,n)}}function sOe(t,e){let r;for(r in e)if(dse.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function Q9(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+pw({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+pw({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+pw({start:e.start,end:e.end})+") is still open")}function iOe(t){const e=this;e.parser=r;function r(n){return rOe(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function aOe(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function oOe(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
`}]}function lOe(t,e){const r=e.value?e.value+`
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function cOe(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function uOe(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function dOe(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),s=v0(n.toLowerCase()),i=t.footnoteOrder.indexOf(n);let o,l=t.footnoteCounts.get(n);l===void 0?(l=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=i+1,l+=1,t.footnoteCounts.set(n,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,u),t.applyData(e,u)}function hOe(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function fOe(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function fse(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=n:s.push({type:"text",value:n}),s}function pOe(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return fse(t,e);const s={src:v0(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function mOe(t,e){const r={src:v0(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function gOe(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function yOe(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return fse(t,e);const s={href:v0(n.url||"")};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function vOe(t,e){const r={href:v0(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function xOe(t,e,r){const n=t.all(e),s=r?bOe(r):pse(e),i={},o=[];if(typeof e.checked=="boolean"){const d=n[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const d=n[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const c=n[n.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return t.patch(e,u),t.applyData(e,u)}function bOe(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=pse(r[n])}return e}function pse(t){const e=t.spread;return e??t.children.length>1}function wOe(t,e){const r={},n=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++s<n.length;){const o=n[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,i),t.applyData(e,i)}function _Oe(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function jOe(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function SOe(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function NOe(t,e){const r=t.all(e),n=r.shift(),s=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},l=L6(e.children[1]),c=Kne(e.children[e.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function AOe(t,e,r){const n=r?r.children:void 0,i=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:e.children.length;let c=-1;const u=[];for(;++c<l;){const h=e.children[c],f={},p=o?o[c]:void 0;p&&(f.align=p);let g={type:"element",tagName:i,properties:f,children:[]};h&&(g.children=t.all(h),t.patch(h,g),g=t.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,d),t.applyData(e,d)}function EOe(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Z9=9,J9=32;function COe(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),s=0;const i=[];for(;n;)i.push(eH(e.slice(s,n.index),s>0,!0),n[0]),s=n.index+n[0].length,n=r.exec(e);return i.push(eH(e.slice(s),s>0,!1)),i.join("")}function eH(t,e,r){let n=0,s=t.length;if(e){let i=t.codePointAt(n);for(;i===Z9||i===J9;)n++,i=t.codePointAt(n)}if(r){let i=t.codePointAt(s-1);for(;i===Z9||i===J9;)s--,i=t.codePointAt(s-1)}return s>n?t.slice(n,s):""}function kOe(t,e){const r={type:"text",value:COe(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function TOe(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const POe={blockquote:aOe,break:oOe,code:lOe,delete:cOe,emphasis:uOe,footnoteReference:dOe,heading:hOe,html:fOe,imageReference:pOe,image:mOe,inlineCode:gOe,linkReference:yOe,link:vOe,listItem:xOe,list:wOe,paragraph:_Oe,root:jOe,strong:SOe,table:NOe,tableCell:EOe,tableRow:AOe,text:kOe,thematicBreak:TOe,toml:fN,yaml:fN,definition:fN,footnoteDefinition:fN};function fN(){}const mse=-1,DT=0,gw=1,ZE=2,W6=3,V6=4,q6=5,G6=6,gse=7,yse=8,tH=typeof self=="object"?self:globalThis,OOe=(t,e)=>{const r=(s,i)=>(t.set(i,s),s),n=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case DT:case mse:return r(o,s);case gw:{const l=r([],s);for(const c of o)l.push(n(c));return l}case ZE:{const l=r({},s);for(const[c,u]of o)l[n(c)]=n(u);return l}case W6:return r(new Date(o),s);case V6:{const{source:l,flags:c}=o;return r(new RegExp(l,c),s)}case q6:{const l=r(new Map,s);for(const[c,u]of o)l.set(n(c),n(u));return l}case G6:{const l=r(new Set,s);for(const c of o)l.add(n(c));return l}case gse:{const{name:l,message:c}=o;return r(new tH[l](c),s)}case yse:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new tH[i](o),s)};return n},rH=t=>OOe(new Map,t)(0),Pg="",{toString:IOe}={},{keys:ROe}=Object,Z0=t=>{const e=typeof t;if(e!=="object"||!t)return[DT,e];const r=IOe.call(t).slice(8,-1);switch(r){case"Array":return[gw,Pg];case"Object":return[ZE,Pg];case"Date":return[W6,Pg];case"RegExp":return[V6,Pg];case"Map":return[q6,Pg];case"Set":return[G6,Pg];case"DataView":return[gw,r]}return r.includes("Array")?[gw,r]:r.includes("Error")?[gse,r]:[ZE,r]},pN=([t,e])=>t===DT&&(e==="function"||e==="symbol"),MOe=(t,e,r,n)=>{const s=(o,l)=>{const c=n.push(o)-1;return r.set(l,c),c},i=o=>{if(r.has(o))return r.get(o);let[l,c]=Z0(o);switch(l){case DT:{let d=o;switch(c){case"bigint":l=yse,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([mse],o)}return s([l,d],o)}case gw:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),s([c,[...f]],o)}const d=[],h=s([l,d],o);for(const f of o)d.push(i(f));return h}case ZE:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const d=[],h=s([l,d],o);for(const f of ROe(o))(t||!pN(Z0(o[f])))&&d.push([i(f),i(o[f])]);return h}case W6:return s([l,o.toISOString()],o);case V6:{const{source:d,flags:h}=o;return s([l,{source:d,flags:h}],o)}case q6:{const d=[],h=s([l,d],o);for(const[f,p]of o)(t||!(pN(Z0(f))||pN(Z0(p))))&&d.push([i(f),i(p)]);return h}case G6:{const d=[],h=s([l,d],o);for(const f of o)(t||!pN(Z0(f)))&&d.push(i(f));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},nH=(t,{json:e,lossy:r}={})=>{const n=[];return MOe(!(e||r),!!e,new Map,n)(t),n},JE=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?rH(nH(t,e)):structuredClone(t):(t,e)=>rH(nH(t,e));function DOe(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function LOe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function FOe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||DOe,n=t.options.footnoteBackLabel||LOe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[c]);if(!u)continue;const d=t.all(u),h=String(u.identifier).toUpperCase(),f=v0(h.toLowerCase());let p=0;const g=[],m=t.footnoteCounts.get(h);for(;m!==void 0&&++p<=m;){g.length>0&&g.push({type:"text",value:" "});let x=typeof r=="string"?r:r(c,p);typeof x=="string"&&(x={type:"text",value:x}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(d,!0)};t.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...JE(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
`}]}}const vse=function(t){if(t==null)return zOe;if(typeof t=="function")return LT(t);if(typeof t=="object")return Array.isArray(t)?$Oe(t):BOe(t);if(typeof t=="string")return UOe(t);throw new Error("Expected function, string, or object as test")};function $Oe(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=vse(t[r]);return LT(n);function n(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function BOe(t){const e=t;return LT(r);function r(n){const s=n;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function UOe(t){return LT(e);function e(r){return r&&r.type===t}}function LT(t){return e;function e(r,n,s){return!!(HOe(r)&&t.call(this,r,typeof n=="number"?n:void 0,s||void 0))}}function zOe(){return!0}function HOe(t){return t!==null&&typeof t=="object"&&"type"in t}const xse=[],WOe=!0,sH=!1,VOe="skip";function qOe(t,e,r,n){let s;typeof e=="function"&&typeof r!="function"?(n=r,r=e):s=e;const i=vse(s),o=n?-1:1;l(t,void 0,[])();function l(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=xse,g,m,v;if((!e||i(c,u,d[d.length-1]||void 0))&&(p=GOe(r(c,d)),p[0]===sH))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==VOe)for(m=(n?y.children.length:-1)+o,v=d.concat(y);m>-1&&m<y.children.length;){const x=y.children[m];if(g=l(x,m,v)(),g[0]===sH)return g;m=typeof g[1]=="number"?g[1]:m+o}}return p}}}function GOe(t){return Array.isArray(t)?t:typeof t=="number"?[WOe,t]:t==null?xse:[t]}function bse(t,e,r,n){let s,i,o;typeof e=="function"&&typeof r!="function"?(i=void 0,o=e,s=r):(i=e,o=r,s=n),qOe(t,i,l,s);function l(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const d4={}.hasOwnProperty,KOe={};function YOe(t,e){const r=e||KOe,n=new Map,s=new Map,i=new Map,o={...POe,...r.handlers},l={all:u,applyData:QOe,definitionById:n,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:XOe,wrap:JOe};return bse(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?n:s,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),l;function c(d,h){const f=d.type,p=l.handlers[f];if(d4.call(l.handlers,f)&&p)return p(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:m,...v}=d,y=JE(v);return y.children=l.all(d),y}return JE(d)}return(l.options.unknownHandler||ZOe)(l,d,h)}function u(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const g=l.one(f[p],d);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=iH(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=iH(m.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function XOe(t,e){t.position&&(e.position=ITe(t))}function QOe(t,e){let r=e;if(t&&t.data){const n=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&i&&Object.assign(r.properties,JE(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function ZOe(t,e){const r=e.data||{},n="value"in e&&!(d4.call(r,"hProperties")||d4.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function JOe(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
`});++n<t.length;)n&&r.push({type:"text",value:`
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
`}),r}function iH(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function aH(t,e){const r=YOe(t,e),n=r.one(t,void 0),s=FOe(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function eIe(t,e){return t&&"run"in t?async function(r,n){const s=aH(r,{file:n,...e});await t.run(s,n)}:function(r,n){return aH(r,{file:n,...t||e})}}function oH(t){if(t)throw t}var _A=Object.prototype.hasOwnProperty,wse=Object.prototype.toString,lH=Object.defineProperty,cH=Object.getOwnPropertyDescriptor,uH=function(e){return typeof Array.isArray=="function"?Array.isArray(e):wse.call(e)==="[object Array]"},dH=function(e){if(!e||wse.call(e)!=="[object Object]")return!1;var r=_A.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&_A.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var s;for(s in e);return typeof s>"u"||_A.call(e,s)},hH=function(e,r){lH&&r.name==="__proto__"?lH(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},fH=function(e,r){if(r==="__proto__")if(_A.call(e,r)){if(cH)return cH(e,r).value}else return;return e[r]},tIe=function t(){var e,r,n,s,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(e=arguments[c],e!=null)for(r in e)n=fH(l,r),s=fH(e,r),l!==s&&(d&&s&&(dH(s)||(i=uH(s)))?(i?(i=!1,o=n&&uH(n)?n:[]):o=n&&dH(n)?n:{},hH(l,{name:r,newValue:t(d,o,s)})):typeof s<"u"&&hH(l,{name:r,newValue:s}));return l};const pO=qt(tIe);function h4(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function rIe(){const t=[],e={run:r,use:n};return e;function r(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const d=t[++i];let h=-1;if(c){o(c);return}for(;++h<s.length;)(u[h]===null||u[h]===void 0)&&(u[h]=s[h]);s=u,d?nIe(d,l)(...u):o(null,...u)}}function n(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function nIe(t,e){let r;return n;function n(...o){const l=t.length>o.length;let c;l&&o.push(s);try{c=t.apply(this,o)}catch(u){const d=u;if(l&&r)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){r||(r=!0,e(o,...l))}function i(o){s(null,o)}}const Cl={basename:sIe,dirname:iIe,extname:aIe,join:oIe,sep:"/"};function sIe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Qj(t);let r=0,n=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else n<0&&(i=!0,n=s+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){r=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(n=s):(l=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function iIe(t){if(Qj(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function aIe(t){Qj(t);let e=t.length,r=-1,n=0,s=-1,i=0,o;for(;e--;){const l=t.codePointAt(e);if(l===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===n+1?"":t.slice(s,r)}function oIe(...t){let e=-1,r;for(;++e<t.length;)Qj(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":lIe(r)}function lIe(t){Qj(t);const e=t.codePointAt(0)===47;let r=cIe(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function cIe(t,e){let r="",n=0,s=-1,i=0,o=-1,l,c;for(;++o<=t.length;){if(o<t.length)l=t.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),s=o,i=0;continue}}else if(r.length>0){r="",n=0,s=o,i=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(s+1,o):r=t.slice(s+1,o),n=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return r}function Qj(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const uIe={cwd:dIe};function dIe(){return"/"}function f4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function hIe(t){if(typeof t=="string")t=new URL(t);else if(!f4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return fIe(t)}function fIe(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const mO=["history","path","basename","stem","extname","dirname"];class _se{constructor(e){let r;e?f4(e)?r={path:e}:typeof e=="string"||pIe(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":uIe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<mO.length;){const i=mO[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)mO.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Cl.basename(this.path):void 0}set basename(e){yO(e,"basename"),gO(e,"basename"),this.path=Cl.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Cl.dirname(this.path):void 0}set dirname(e){pH(this.basename,"dirname"),this.path=Cl.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Cl.extname(this.path):void 0}set extname(e){if(gO(e,"extname"),pH(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Cl.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){f4(e)&&(e=hIe(e)),yO(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Cl.basename(this.path,this.extname):void 0}set stem(e){yO(e,"stem"),gO(e,"stem"),this.path=Cl.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const s=this.message(e,r,n);throw s.fatal=!0,s}info(e,r,n){const s=this.message(e,r,n);return s.fatal=void 0,s}message(e,r,n){const s=new ri(e,r,n);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function gO(t,e){if(t&&t.includes(Cl.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Cl.sep+"`")}function yO(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function pH(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function pIe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const mIe=function(t){const n=this.constructor.prototype,s=n[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,n),i},gIe={}.hasOwnProperty;class K6 extends mIe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=rIe()}copy(){const e=new K6;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(pO(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(bO("data",this.frozen),this.namespace[e]=r,this):gIe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(bO("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const s=r.call(e,...n);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=mN(e),n=this.parser||this.Parser;return vO("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),vO("process",this.parser||this.Parser),xO("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,o){const l=mN(e),c=n.parse(l);n.run(c,l,function(d,h,f){if(d||!h||!f)return u(d);const p=h,g=n.stringify(p,f);xIe(g)?f.value=g:f.result=g,u(d,f)});function u(d,h){d||!h?o(d):i?i(h):r(void 0,h)}}}processSync(e){let r=!1,n;return this.freeze(),vO("processSync",this.parser||this.Parser),xO("processSync",this.compiler||this.Compiler),this.process(e,s),gH("processSync","process",r),n;function s(i,o){r=!0,oH(i),n=o}}run(e,r,n){mH(e),this.freeze();const s=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(o,l){const c=mN(r);s.run(e,c,u);function u(d,h,f){const p=h||e;d?l(d):o?o(p):n(void 0,p,f)}}}runSync(e,r){let n=!1,s;return this.run(e,r,i),gH("runSync","run",n),s;function i(o,l){oH(o),s=l,n=!0}}stringify(e,r){this.freeze();const n=mN(r),s=this.compiler||this.Compiler;return xO("stringify",s),mH(e),s(e,n)}use(e,...r){const n=this.attachers,s=this.namespace;if(bO("use",this.frozen),e!=null)if(typeof e=="function")c(e,r);else if(typeof e=="object")Array.isArray(e)?l(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=pO(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===u){f=h;break}if(f===-1)n.push([u,...d]);else if(d.length>0){let[p,...g]=d;const m=n[f][1];h4(m)&&h4(p)&&(p=pO(!0,m,p)),n[f]=[u,p,...g]}}}}const yIe=new K6().freeze();function vO(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function xO(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function bO(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mH(t){if(!h4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function gH(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function mN(t){return vIe(t)?t:new _se(t)}function vIe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function xIe(t){return typeof t=="string"||bIe(t)}function bIe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const wIe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yH=[],vH={allowDangerousHtml:!0},_Ie=/^(https?|ircs?|mailto|xmpp)$/i,jIe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function fc(t){const e=SIe(t),r=NIe(t);return AIe(e.runSync(e.parse(r),r),t)}function SIe(t){const e=t.rehypePlugins||yH,r=t.remarkPlugins||yH,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...vH}:vH;return yIe().use(iOe).use(r).use(eIe,n).use(e)}function NIe(t){const e=t.children||"",r=new _se;return typeof e=="string"&&(r.value=e),r}function AIe(t,e){const r=e.allowedElements,n=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||EIe;for(const d of jIe)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+wIe+d.id,void 0);return bse(t,u),FTe(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in dO)if(Object.hasOwn(dO,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],m=dO[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=r?!r.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&n&&typeof h=="number"&&(p=!n(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function EIe(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||r!==-1&&e>r||n!==-1&&e>n||_Ie.test(t.slice(0,e))?t:""}function xH(){const[t,e]=S.useState(()=>{try{const c=sessionStorage.getItem("platform_assistant_messages");return c?JSON.parse(c):[{id:1,content:"Hi! I'm your Academly assistant. Ask me anything about the platform or your thesis! 👋",sender:"ai"}]}catch{return[{id:1,content:"Hi! I'm your Academly assistant. Ask me anything about the platform or your thesis! 👋",sender:"ai"}]}}),[r,n]=S.useState(""),[s,i]=S.useState(!1);S.useEffect(()=>{try{sessionStorage.setItem("platform_assistant_messages",JSON.stringify(t))}catch{}},[t]);const o=async c=>{if(c.preventDefault(),!r.trim()||s)return;const u=r.trim(),d=[...t,{id:t.length+1,content:u,sender:"user"}];e(d),n(""),i(!0);try{const h=t.map(g=>({role:g.sender==="ai"?"assistant":"user",content:g.content})),{data:f,error:p}=await be.functions.invoke("platform-assistant",{body:{message:u,chat_history:h}});if(p)throw p;e([...d,{id:d.length+1,content:(f==null?void 0:f.message)||"Sorry, I couldn't process that.",sender:"ai"}])}catch{e([...d,{id:d.length+1,content:"Something went wrong. Please try again.",sender:"ai"}])}finally{i(!1)}},l=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),o(c))};return a.jsxs(Mne,{size:"md",position:"bottom-right",icon:a.jsx(jxe,{className:"h-6 w-6"}),children:[a.jsx(Dne,{children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Academly Assistant ✨"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask me anything about the platform"})]})}),a.jsx(Lne,{children:a.jsxs(Bne,{smooth:!0,children:[t.map(c=>a.jsxs(A9,{variant:c.sender==="ai"?"received":"sent",layout:"ai",children:[c.sender==="ai"&&a.jsx(C9,{fallback:"🎓"}),a.jsx(E9,{variant:c.sender==="ai"?"received":"sent",children:c.sender==="ai"?a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>p]:mb-2 [&>p]:leading-relaxed",children:a.jsx(fc,{children:c.content})}):c.content})]},c.id)),s&&a.jsxs(A9,{variant:"received",layout:"ai",children:[a.jsx(C9,{fallback:"🎓"}),a.jsx(E9,{isLoading:!0})]})]})}),a.jsx(Fne,{children:a.jsxs("form",{onSubmit:o,className:"flex items-end gap-2",children:[a.jsx(Rne,{value:r,onChange:c=>n(c.target.value),onKeyDown:l,placeholder:"Type your message...",className:"min-h-12 resize-none rounded-lg bg-background border-0 p-3 shadow-none focus-visible:ring-0",disabled:s}),a.jsx("div",{className:"flex flex-col gap-1",children:a.jsxs(ve,{type:"submit",size:"sm",disabled:s||!r.trim(),className:"gap-1.5",children:["Send",a.jsx(Pxe,{className:"h-3.5 w-3.5"})]})})]})})]})}const lr=({children:t,showSidebar:e=!1,pageTitle:r="Dashboard",fullWidth:n=!1,hidePlatformAssistant:s=!1})=>{const{user:i}=Pt(),[o,l]=S.useState(!0),[c,u]=S.useState(!1),[d,h]=S.useState(!1),f=o||c;return e&&i?a.jsxs("div",{className:"ta-layout astro-gradient-bg min-h-screen",children:[a.jsx(Bke,{isExpanded:o,isHovered:c,isMobileOpen:d,onHoverChange:u,onMobileClose:()=>h(!1)}),a.jsxs("div",{className:`ta-main ${f?"ta-main-expanded":"ta-main-collapsed"}`,children:[a.jsx(S9,{pageTitle:r,onToggleSidebar:()=>l(!o),onToggleMobile:()=>h(!d),isMobileOpen:d}),a.jsx("main",{className:"ta-content animate-fade-in",children:a.jsx("div",{className:n?"":"max-w-screen-xl mx-auto",children:t})})]}),!s&&a.jsx(xH,{})]}):a.jsxs("div",{className:"min-h-screen flex flex-col w-full bg-background",children:[a.jsx(S9,{showSidebarControls:!1}),a.jsx("main",{className:"flex-1 w-full",children:t}),a.jsx(bi,{}),!s&&a.jsx(xH,{})]})};function CIe(){const[t,e]=S.useState(null),[r,n]=S.useState(!0),[s,i]=S.useState(null),o=async()=>{try{n(!0),i(null);const{data:l,error:c}=await be.from("v_dashboard_stats").select("*").single();if(c)throw c;e(l)}catch(l){console.error("Error fetching dashboard stats:",l),i(l)}finally{n(!1)}};return S.useEffect(()=>{o()},[]),{stats:t,loading:r,error:s,refetch:o}}const Me=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Oe("rounded-3xl border border-border/50 bg-card/80 backdrop-blur-sm text-card-foreground","shadow-lg shadow-primary/5 hover:shadow-xl hover:shadow-primary/10","transition-all duration-300 ease-out","dark:bg-card/90 dark:border-border/30 dark:shadow-black/20 dark:hover:shadow-primary/20",t),...e}));Me.displayName="Card";const qe=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Oe("flex flex-col space-y-1.5 px-6 py-5",t),...e}));qe.displayName="CardHeader";const Je=S.forwardRef(({className:t,...e},r)=>a.jsx("h3",{ref:r,className:Oe("text-base font-semibold leading-none tracking-tight text-foreground",t),...e}));Je.displayName="CardTitle";const fn=S.forwardRef(({className:t,...e},r)=>a.jsx("p",{ref:r,className:Oe("text-sm text-muted-foreground",t),...e}));fn.displayName="CardDescription";const $e=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Oe("px-6 pb-6 pt-0",t),...e}));$e.displayName="CardContent";const kIe=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Oe("flex items-center px-6 pb-6 pt-0",t),...e}));kIe.displayName="CardFooter";var Y6="Progress",X6=100,[TIe,gyt]=Ln(Y6),[PIe,OIe]=TIe(Y6),jse=S.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=IIe,...o}=t;(s||s===0)&&!bH(s)&&console.error(RIe(`${s}`,"Progress"));const l=bH(s)?s:X6;n!==null&&!wH(n,l)&&console.error(MIe(`${n}`,"Progress"));const c=wH(n,l)?n:null,u=eC(c)?i(c,l):void 0;return a.jsx(PIe,{scope:r,value:c,max:l,children:a.jsx(et.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":eC(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":Ase(c,l),"data-value":c??void 0,"data-max":l,...o,ref:e})})});jse.displayName=Y6;var Sse="ProgressIndicator",Nse=S.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=OIe(Sse,r);return a.jsx(et.div,{"data-state":Ase(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});Nse.displayName=Sse;function IIe(t,e){return`${Math.round(t/e*100)}%`}function Ase(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function eC(t){return typeof t=="number"}function bH(t){return eC(t)&&!isNaN(t)&&t>0}function wH(t,e){return eC(t)&&!isNaN(t)&&t<=e&&t>=0}function RIe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${X6}\`.`}function MIe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
  - a positive number
  - less than the value passed to \`max\` (or ${X6} if no \`max\` prop is set)
  - \`null\` or \`undefined\` if the progress is indeterminate.

Defaulting to \`null\`.`}var Ese=jse,DIe=Nse;const Cse=S.createContext({});function LIe(t){const e=S.useRef(null);return e.current===null&&(e.current=t()),e.current}const Q6=typeof window<"u",FIe=Q6?S.useLayoutEffect:S.useEffect,Z6=S.createContext(null);function J6(t,e){t.indexOf(e)===-1&&t.push(e)}function e$(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const Xu=(t,e,r)=>r>e?e:r<t?t:r;let tC=()=>{};const Qu={},kse=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Tse(t){return typeof t=="object"&&t!==null}const Pse=t=>/^0[^.\s]+$/u.test(t);function t$(t){let e;return()=>(e===void 0&&(e=t()),e)}const mo=t=>t,$Ie=(t,e)=>r=>e(t(r)),Zj=(...t)=>t.reduce($Ie),n1=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class r${constructor(){this.subscriptions=[]}add(e){return J6(this.subscriptions,e),()=>e$(this.subscriptions,e)}notify(e,r,n){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,r,n);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pc=t=>t*1e3,lo=t=>t/1e3;function Ose(t,e){return e?t*(1e3/e):0}const Ise=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,BIe=1e-7,UIe=12;function zIe(t,e,r,n,s){let i,o,l=0;do o=e+(r-e)/2,i=Ise(o,n,s)-t,i>0?r=o:e=o;while(Math.abs(i)>BIe&&++l<UIe);return o}function Jj(t,e,r,n){if(t===e&&r===n)return mo;const s=i=>zIe(i,0,1,t,r);return i=>i===0||i===1?i:Ise(s(i),e,n)}const Rse=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Mse=t=>e=>1-t(1-e),Dse=Jj(.33,1.53,.69,.99),n$=Mse(Dse),Lse=Rse(n$),Fse=t=>(t*=2)<1?.5*n$(t):.5*(2-Math.pow(2,-10*(t-1))),s$=t=>1-Math.sin(Math.acos(t)),$se=Mse(s$),Bse=Rse(s$),HIe=Jj(.42,0,1,1),WIe=Jj(0,0,.58,1),Use=Jj(.42,0,.58,1),VIe=t=>Array.isArray(t)&&typeof t[0]!="number",zse=t=>Array.isArray(t)&&typeof t[0]=="number",_H={linear:mo,easeIn:HIe,easeInOut:Use,easeOut:WIe,circIn:s$,circInOut:Bse,circOut:$se,backIn:n$,backInOut:Lse,backOut:Dse,anticipate:Fse},qIe=t=>typeof t=="string",jH=t=>{if(zse(t)){tC(t.length===4);const[e,r,n,s]=t;return Jj(e,r,n,s)}else if(qIe(t))return tC(_H[t]!==void 0),_H[t];return t},gN=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],SH={value:null,addProjectionMetrics:null};function GIe(t,e){let r=new Set,n=new Set,s=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function u(h){o.has(h)&&(d.schedule(h),t()),c++,h(l)}const d={schedule:(h,f=!1,p=!1)=>{const m=p&&s?r:n;return f&&o.add(h),m.has(h)||m.add(h),h},cancel:h=>{n.delete(h),o.delete(h)},process:h=>{if(l=h,s){i=!0;return}s=!0,[r,n]=[n,r],r.forEach(u),e&&SH.value&&SH.value.frameloop[e].push(c),c=0,r.clear(),s=!1,i&&(i=!1,d.process(h))}};return d}const KIe=40;function Hse(t,e){let r=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=gN.reduce((b,w)=>(b[w]=GIe(i,e?w:void 0),b),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:h,preRender:f,render:p,postRender:g}=o,m=()=>{const b=Qu.useManualTiming?s.timestamp:performance.now();r=!1,Qu.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(b-s.timestamp,KIe),1)),s.timestamp=b,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),f.process(s),p.process(s),g.process(s),s.isProcessing=!1,r&&e&&(n=!1,t(m))},v=()=>{r=!0,n=!0,s.isProcessing||t(m)};return{schedule:gN.reduce((b,w)=>{const j=o[w];return b[w]=(N,C=!1,k=!1)=>(r||v(),j.schedule(N,C,k)),b},{}),cancel:b=>{for(let w=0;w<gN.length;w++)o[gN[w]].cancel(b)},state:s,steps:o}}const{schedule:Qr,cancel:ef,state:bs,steps:wO}=Hse(typeof requestAnimationFrame<"u"?requestAnimationFrame:mo,!0);let jA;function YIe(){jA=void 0}const Bi={now:()=>(jA===void 0&&Bi.set(bs.isProcessing||Qu.useManualTiming?bs.timestamp:performance.now()),jA),set:t=>{jA=t,queueMicrotask(YIe)}},Wse=t=>e=>typeof e=="string"&&e.startsWith(t),Vse=Wse("--"),XIe=Wse("var(--"),i$=t=>XIe(t)?QIe.test(t.split("/*")[0].trim()):!1,QIe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,x0={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},s1={...x0,transform:t=>Xu(0,1,t)},yN={...x0,default:1},yw=t=>Math.round(t*1e5)/1e5,a$=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZIe(t){return t==null}const JIe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,o$=(t,e)=>r=>!!(typeof r=="string"&&JIe.test(r)&&r.startsWith(t)||e&&!ZIe(r)&&Object.prototype.hasOwnProperty.call(r,e)),qse=(t,e,r)=>n=>{if(typeof n!="string")return n;const[s,i,o,l]=n.match(a$);return{[t]:parseFloat(s),[e]:parseFloat(i),[r]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},eRe=t=>Xu(0,255,t),_O={...x0,transform:t=>Math.round(eRe(t))},ap={test:o$("rgb","red"),parse:qse("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+_O.transform(t)+", "+_O.transform(e)+", "+_O.transform(r)+", "+yw(s1.transform(n))+")"};function tRe(t){let e="",r="",n="",s="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),s=t.substring(4,5),e+=e,r+=r,n+=n,s+=s),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}}const p4={test:o$("#"),parse:tRe,transform:ap.transform},eS=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Sd=eS("deg"),mc=eS("%"),wt=eS("px"),rRe=eS("vh"),nRe=eS("vw"),NH={...mc,parse:t=>mc.parse(t)/100,transform:t=>mc.transform(t*100)},ly={test:o$("hsl","hue"),parse:qse("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+mc.transform(yw(e))+", "+mc.transform(yw(r))+", "+yw(s1.transform(n))+")"},Pn={test:t=>ap.test(t)||p4.test(t)||ly.test(t),parse:t=>ap.test(t)?ap.parse(t):ly.test(t)?ly.parse(t):p4.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ap.transform(t):ly.transform(t),getAnimatableNone:t=>{const e=Pn.parse(t);return e.alpha=0,Pn.transform(e)}},sRe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function iRe(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(a$))==null?void 0:e.length)||0)+(((r=t.match(sRe))==null?void 0:r.length)||0)>0}const Gse="number",Kse="color",aRe="var",oRe="var(",AH="${}",lRe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function i1(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(lRe,c=>(Pn.test(c)?(n.color.push(i),s.push(Kse),r.push(Pn.parse(c))):c.startsWith(oRe)?(n.var.push(i),s.push(aRe),r.push(c)):(n.number.push(i),s.push(Gse),r.push(parseFloat(c))),++i,AH)).split(AH);return{values:r,split:l,indexes:n,types:s}}function Yse(t){return i1(t).values}function Xse(t){const{split:e,types:r}=i1(t),n=e.length;return s=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],s[o]!==void 0){const l=r[o];l===Gse?i+=yw(s[o]):l===Kse?i+=Pn.transform(s[o]):i+=s[o]}return i}}const cRe=t=>typeof t=="number"?0:Pn.test(t)?Pn.getAnimatableNone(t):t;function uRe(t){const e=Yse(t);return Xse(t)(e.map(cRe))}const tf={test:iRe,parse:Yse,createTransformer:Xse,getAnimatableNone:uRe};function jO(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dRe({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let s=0,i=0,o=0;if(!e)s=i=o=r;else{const l=r<.5?r*(1+e):r+e-r*e,c=2*r-l;s=jO(c,l,t+1/3),i=jO(c,l,t),o=jO(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function rC(t,e){return r=>r>0?e:t}const rn=(t,e,r)=>t+(e-t)*r,SO=(t,e,r)=>{const n=t*t,s=r*(e*e-n)+n;return s<0?0:Math.sqrt(s)},hRe=[p4,ap,ly],fRe=t=>hRe.find(e=>e.test(t));function EH(t){const e=fRe(t);if(!e)return!1;let r=e.parse(t);return e===ly&&(r=dRe(r)),r}const CH=(t,e)=>{const r=EH(t),n=EH(e);if(!r||!n)return rC(t,e);const s={...r};return i=>(s.red=SO(r.red,n.red,i),s.green=SO(r.green,n.green,i),s.blue=SO(r.blue,n.blue,i),s.alpha=rn(r.alpha,n.alpha,i),ap.transform(s))},m4=new Set(["none","hidden"]);function pRe(t,e){return m4.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function mRe(t,e){return r=>rn(t,e,r)}function l$(t){return typeof t=="number"?mRe:typeof t=="string"?i$(t)?rC:Pn.test(t)?CH:vRe:Array.isArray(t)?Qse:typeof t=="object"?Pn.test(t)?CH:gRe:rC}function Qse(t,e){const r=[...t],n=r.length,s=t.map((i,o)=>l$(i)(i,e[o]));return i=>{for(let o=0;o<n;o++)r[o]=s[o](i);return r}}function gRe(t,e){const r={...t,...e},n={};for(const s in r)t[s]!==void 0&&e[s]!==void 0&&(n[s]=l$(t[s])(t[s],e[s]));return s=>{for(const i in n)r[i]=n[i](s);return r}}function yRe(t,e){const r=[],n={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],o=t.indexes[i][n[i]],l=t.values[o]??0;r[s]=l,n[i]++}return r}const vRe=(t,e)=>{const r=tf.createTransformer(e),n=i1(t),s=i1(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?m4.has(t)&&!s.values.length||m4.has(e)&&!n.values.length?pRe(t,e):Zj(Qse(yRe(n,s),s.values),r):rC(t,e)};function Zse(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?rn(t,e,r):l$(t)(t,e)}const xRe=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>Qr.update(e,r),stop:()=>ef(e),now:()=>bs.isProcessing?bs.timestamp:Bi.now()}},Jse=(t,e,r=10)=>{let n="";const s=Math.max(Math.round(e/r),2);for(let i=0;i<s;i++)n+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},nC=2e4;function c$(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<nC;)e+=r,n=t.next(e);return e>=nC?1/0:e}function bRe(t,e=100,r){const n=r({...t,keyframes:[0,e]}),s=Math.min(c$(n),nC);return{type:"keyframes",ease:i=>n.next(s*i).value/e,duration:lo(s)}}const wRe=5;function eie(t,e,r){const n=Math.max(e-wRe,0);return Ose(r-t(n),e-n)}const un={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},NO=.001;function _Re({duration:t=un.duration,bounce:e=un.bounce,velocity:r=un.velocity,mass:n=un.mass}){let s,i,o=1-e;o=Xu(un.minDamping,un.maxDamping,o),t=Xu(un.minDuration,un.maxDuration,lo(t)),o<1?(s=u=>{const d=u*o,h=d*t,f=d-r,p=g4(u,o),g=Math.exp(-h);return NO-f/p*g},i=u=>{const h=u*o*t,f=h*r+r,p=Math.pow(o,2)*Math.pow(u,2)*t,g=Math.exp(-h),m=g4(Math.pow(u,2),o);return(-s(u)+NO>0?-1:1)*((f-p)*g)/m}):(s=u=>{const d=Math.exp(-u*t),h=(u-r)*t+1;return-NO+d*h},i=u=>{const d=Math.exp(-u*t),h=(r-u)*(t*t);return d*h});const l=5/t,c=SRe(s,i,l);if(t=pc(t),isNaN(c))return{stiffness:un.stiffness,damping:un.damping,duration:t};{const u=Math.pow(c,2)*n;return{stiffness:u,damping:o*2*Math.sqrt(n*u),duration:t}}}const jRe=12;function SRe(t,e,r){let n=r;for(let s=1;s<jRe;s++)n=n-t(n)/e(n);return n}function g4(t,e){return t*Math.sqrt(1-e*e)}const NRe=["duration","bounce"],ARe=["stiffness","damping","mass"];function kH(t,e){return e.some(r=>t[r]!==void 0)}function ERe(t){let e={velocity:un.velocity,stiffness:un.stiffness,damping:un.damping,mass:un.mass,isResolvedFromDuration:!1,...t};if(!kH(t,ARe)&&kH(t,NRe))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),s=n*n,i=2*Xu(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:un.mass,stiffness:s,damping:i}}else{const r=_Re(t);e={...e,...r,mass:un.mass},e.isResolvedFromDuration=!0}return e}function sC(t=un.visualDuration,e=un.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:s}=r;const i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=ERe({...r,velocity:-lo(r.velocity||0)}),g=f||0,m=u/(2*Math.sqrt(c*d)),v=o-i,y=lo(Math.sqrt(c/d)),x=Math.abs(v)<5;n||(n=x?un.restSpeed.granular:un.restSpeed.default),s||(s=x?un.restDelta.granular:un.restDelta.default);let b;if(m<1){const j=g4(y,m);b=N=>{const C=Math.exp(-m*y*N);return o-C*((g+m*y*v)/j*Math.sin(j*N)+v*Math.cos(j*N))}}else if(m===1)b=j=>o-Math.exp(-y*j)*(v+(g+y*v)*j);else{const j=y*Math.sqrt(m*m-1);b=N=>{const C=Math.exp(-m*y*N),k=Math.min(j*N,300);return o-C*((g+m*y*v)*Math.sinh(k)+j*v*Math.cosh(k))/j}}const w={calculatedDuration:p&&h||null,next:j=>{const N=b(j);if(p)l.done=j>=h;else{let C=j===0?g:0;m<1&&(C=j===0?pc(g):eie(b,j,N));const k=Math.abs(C)<=n,E=Math.abs(o-N)<=s;l.done=k&&E}return l.value=l.done?o:N,l},toString:()=>{const j=Math.min(c$(w),nC),N=Jse(C=>w.next(j*C).value,j,30);return j+"ms "+N},toTransition:()=>{}};return w}sC.applyToOptions=t=>{const e=bRe(t,100,sC);return t.ease=e.ease,t.duration=pc(e.duration),t.type="keyframes",t};function y4({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const h=t[0],f={done:!1,value:h},p=k=>l!==void 0&&k<l||c!==void 0&&k>c,g=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let m=r*e;const v=h+m,y=o===void 0?v:o(v);y!==v&&(m=y-h);const x=k=>-m*Math.exp(-k/n),b=k=>y+x(k),w=k=>{const E=x(k),M=b(k);f.done=Math.abs(E)<=u,f.value=f.done?y:M};let j,N;const C=k=>{p(f.value)&&(j=k,N=sC({keyframes:[f.value,g(f.value)],velocity:eie(b,k,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:k=>{let E=!1;return!N&&j===void 0&&(E=!0,w(k),C(k)),j!==void 0&&k>=j?N.next(k-j):(!E&&w(k),f)}}}function CRe(t,e,r){const n=[],s=r||Qu.mix||Zse,i=t.length-1;for(let o=0;o<i;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||mo:e;l=Zj(c,l)}n.push(l)}return n}function kRe(t,e,{clamp:r=!0,ease:n,mixer:s}={}){const i=t.length;if(tC(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=CRe(e,n,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const f=n1(t[h],t[h+1],d);return l[h](f)};return r?d=>u(Xu(t[0],t[i-1],d)):u}function TRe(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const s=n1(0,e,n);t.push(rn(r,1,s))}}function PRe(t){const e=[0];return TRe(e,t.length-1),e}function ORe(t,e){return t.map(r=>r*e)}function IRe(t,e){return t.map(()=>e||Use).splice(0,t.length-1)}function vw({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const s=VIe(n)?n.map(jH):jH(n),i={done:!1,value:e[0]},o=ORe(r&&r.length===e.length?r:PRe(e),t),l=kRe(o,e,{ease:Array.isArray(s)?s:IRe(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const RRe=t=>t!==null;function u$(t,{repeat:e,repeatType:r="loop"},n,s=1){const i=t.filter(RRe),l=s<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!l||n===void 0?i[l]:n}const MRe={decay:y4,inertia:y4,tween:vw,keyframes:vw,spring:sC};function tie(t){typeof t.type=="string"&&(t.type=MRe[t.type])}class d${constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}}const DRe=t=>t/100;class h$ extends d${constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var n,s;const{motionValue:r}=this.options;r&&r.updatedAt!==Bi.now()&&this.tick(Bi.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(n=this.options).onStop)==null||s.call(n))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;tie(e);const{type:r=vw,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:l}=e;const c=r||vw;c!==vw&&typeof l[0]!="number"&&(this.mixKeyframes=Zj(DRe,Zse(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=c$(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=u}updateTime(e){const r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){const{generator:n,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return n.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:f,repeatDelay:p,type:g,onUpdate:m,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let b=this.currentTime,w=n;if(h){const k=Math.min(this.currentTime,s)/l;let E=Math.floor(k),M=k%1;!M&&k>=1&&(M=1),M===1&&E--,E=Math.min(E,h+1),!!(E%2)&&(f==="reverse"?(M=1-M,p&&(M-=p/l)):f==="mirror"&&(w=o)),b=Xu(0,1,M)*l}const j=x?{done:!1,value:d[0]}:w.next(b);i&&(j.value=i(j.value));let{done:N}=j;!x&&c!==null&&(N=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return C&&g!==y4&&(j.value=u$(d,this.options,v,this.speed)),m&&m(j.value),C&&this.finish(),j}then(e,r){return this.finished.then(e,r)}get duration(){return lo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+lo(e)}get time(){return lo(this.currentTime)}set time(e){var r;e=pc(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(r=this.driver)==null||r.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Bi.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=lo(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=xRe,startTime:r}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Bi.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(e=this.options).onComplete)==null||r.call(e)}cancel(){var e,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(e=this.options).onCancel)==null||r.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),e.observe(this)}}function LRe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const op=t=>t*180/Math.PI,v4=t=>{const e=op(Math.atan2(t[1],t[0]));return x4(e)},FRe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:v4,rotateZ:v4,skewX:t=>op(Math.atan(t[1])),skewY:t=>op(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},x4=t=>(t=t%360,t<0&&(t+=360),t),TH=v4,PH=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),OH=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),$Re={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:PH,scaleY:OH,scale:t=>(PH(t)+OH(t))/2,rotateX:t=>x4(op(Math.atan2(t[6],t[5]))),rotateY:t=>x4(op(Math.atan2(-t[2],t[0]))),rotateZ:TH,rotate:TH,skewX:t=>op(Math.atan(t[4])),skewY:t=>op(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function b4(t){return t.includes("scale")?1:0}function w4(t,e){if(!t||t==="none")return b4(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(r)n=$Re,s=r;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=FRe,s=l}if(!s)return b4(e);const i=n[e],o=s[1].split(",").map(URe);return typeof i=="function"?i(o):o[i]}const BRe=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return w4(r,e)};function URe(t){return parseFloat(t.trim())}const b0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],w0=new Set(b0),IH=t=>t===x0||t===wt,zRe=new Set(["x","y","z"]),HRe=b0.filter(t=>!zRe.has(t));function WRe(t){const e=[];return HRe.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const Pm={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>w4(e,"x"),y:(t,{transform:e})=>w4(e,"y")};Pm.translateX=Pm.x;Pm.translateY=Pm.y;const Om=new Set;let _4=!1,j4=!1,S4=!1;function rie(){if(j4){const t=Array.from(Om).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const s=WRe(n);s.length&&(r.set(n,s),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const s=r.get(n);s&&s.forEach(([i,o])=>{var l;(l=n.getValue(i))==null||l.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}j4=!1,_4=!1,Om.forEach(t=>t.complete(S4)),Om.clear()}function nie(){Om.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(j4=!0)})}function VRe(){S4=!0,nie(),rie(),S4=!1}class f${constructor(e,r,n,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Om.add(this),_4||(_4=!0,Qr.read(nie),Qr.resolveKeyframes(rie))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&r){const l=n.readValue(r,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}LRe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Om.delete(this)}cancel(){this.state==="scheduled"&&(Om.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const qRe=t=>t.startsWith("--");function GRe(t,e,r){qRe(e)?t.style.setProperty(e,r):t.style[e]=r}const KRe=t$(()=>window.ScrollTimeline!==void 0),YRe={};function XRe(t,e){const r=t$(t);return()=>YRe[e]??r()}const sie=XRe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Eb=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,RH={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Eb([0,.65,.55,1]),circOut:Eb([.55,0,1,.45]),backIn:Eb([.31,.01,.66,-.59]),backOut:Eb([.33,1.53,.69,.99])};function iie(t,e){if(t)return typeof t=="function"?sie()?Jse(t,e):"ease-out":zse(t)?Eb(t):Array.isArray(t)?t.map(r=>iie(r,e)||RH.easeOut):RH[t]}function QRe(t,e,r,{delay:n=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:r};c&&(d.offset=c);const h=iie(l,s);Array.isArray(h)&&(d.easing=h);const f={delay:n,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(d,f)}function aie(t){return typeof t=="function"&&"applyToOptions"in t}function ZRe({type:t,...e}){return aie(t)&&sie()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class JRe extends d${constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:r,name:n,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,tC(typeof e.type!="string");const u=ZRe(e);this.animation=QRe(r,n,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=u$(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):GRe(r,n,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,r;(r=(e=this.animation).finish)==null||r.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,r;this.isPseudoElement||(r=(e=this.animation).commitStyles)==null||r.call(e)}get duration(){var r,n;const e=((n=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:n.call(r).duration)||0;return lo(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+lo(e)}get time(){return lo(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pc(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){var n;return this.allowFlatten&&((n=this.animation.effect)==null||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&KRe()?(this.animation.timeline=e,mo):r(this)}}const oie={anticipate:Fse,backInOut:Lse,circInOut:Bse};function eMe(t){return t in oie}function tMe(t){typeof t.ease=="string"&&eMe(t.ease)&&(t.ease=oie[t.ease])}const MH=10;class rMe extends JRe{constructor(e){tMe(e),tie(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:r,onUpdate:n,onComplete:s,element:i,...o}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}const l=new h$({...o,autoplay:!1}),c=pc(this.finishedTime??this.time);r.setWithVelocity(l.sample(c-MH).value,l.sample(c).value,MH),l.stop()}}const DH=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(tf.test(t)||t==="0")&&!t.startsWith("url("));function nMe(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function sMe(t,e,r,n){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=DH(s,e),l=DH(i,e);return!o||!l?!1:nMe(t)||(r==="spring"||aie(r))&&n}function N4(t){t.duration=0,t.type="keyframes"}const iMe=new Set(["opacity","clipPath","filter","transform"]),aMe=t$(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function oMe(t){var d;const{motionValue:e,name:r,repeatDelay:n,repeatType:s,damping:i,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return aMe()&&r&&iMe.has(r)&&(r!=="transform"||!u)&&!c&&!n&&s!=="mirror"&&i!==0&&o!=="inertia"}const lMe=40;class cMe extends d${constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...h}){var g;super(),this.stop=()=>{var m,v;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=Bi.now();const f={autoplay:e,delay:r,type:n,repeat:s,repeatDelay:i,repeatType:o,name:c,motionValue:u,element:d,...h},p=(d==null?void 0:d.KeyframeResolver)||f$;this.keyframeResolver=new p(l,(m,v,y)=>this.onKeyframesResolved(m,v,f,!y),c,u,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,r,n,s){this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=Bi.now(),sMe(e,i,o,l)||((Qu.instantAnimations||!c)&&(d==null||d(u$(e,n,r))),e[0]=e[e.length-1],N4(n),n.repeat=0);const f={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>lMe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},p=!u&&oMe(f)?new rMe({...f,element:f.motionValue.owner.current}):new h$(f);p.finished.then(()=>this.notifyFinished()).catch(mo),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),VRe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const uMe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function dMe(t){const e=uMe.exec(t);if(!e)return[,];const[,r,n,s]=e;return[`--${r??n}`,s]}function lie(t,e,r=1){const[n,s]=dMe(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const o=i.trim();return kse(o)?parseFloat(o):o}return i$(s)?lie(s,e,r+1):s}function p$(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const cie=new Set(["width","height","top","left","right","bottom",...b0]),hMe={test:t=>t==="auto",parse:t=>t},uie=t=>e=>e.test(t),die=[x0,wt,mc,Sd,nRe,rRe,hMe],LH=t=>die.find(uie(t));function fMe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Pse(t):!0}const pMe=new Set(["brightness","contrast","saturate","opacity"]);function mMe(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(a$)||[];if(!n)return t;const s=r.replace(n,"");let i=pMe.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+s+")"}const gMe=/\b([a-z-]*)\(.*?\)/gu,A4={...tf,getAnimatableNone:t=>{const e=t.match(gMe);return e?e.map(mMe).join(" "):t}},FH={...x0,transform:Math.round},yMe={rotate:Sd,rotateX:Sd,rotateY:Sd,rotateZ:Sd,scale:yN,scaleX:yN,scaleY:yN,scaleZ:yN,skew:Sd,skewX:Sd,skewY:Sd,distance:wt,translateX:wt,translateY:wt,translateZ:wt,x:wt,y:wt,z:wt,perspective:wt,transformPerspective:wt,opacity:s1,originX:NH,originY:NH,originZ:wt},m$={borderWidth:wt,borderTopWidth:wt,borderRightWidth:wt,borderBottomWidth:wt,borderLeftWidth:wt,borderRadius:wt,radius:wt,borderTopLeftRadius:wt,borderTopRightRadius:wt,borderBottomRightRadius:wt,borderBottomLeftRadius:wt,width:wt,maxWidth:wt,height:wt,maxHeight:wt,top:wt,right:wt,bottom:wt,left:wt,padding:wt,paddingTop:wt,paddingRight:wt,paddingBottom:wt,paddingLeft:wt,margin:wt,marginTop:wt,marginRight:wt,marginBottom:wt,marginLeft:wt,backgroundPositionX:wt,backgroundPositionY:wt,...yMe,zIndex:FH,fillOpacity:s1,strokeOpacity:s1,numOctaves:FH},vMe={...m$,color:Pn,backgroundColor:Pn,outlineColor:Pn,fill:Pn,stroke:Pn,borderColor:Pn,borderTopColor:Pn,borderRightColor:Pn,borderBottomColor:Pn,borderLeftColor:Pn,filter:A4,WebkitFilter:A4},hie=t=>vMe[t];function fie(t,e){let r=hie(t);return r!==A4&&(r=tf),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const xMe=new Set(["auto","none","0"]);function bMe(t,e,r){let n=0,s;for(;n<t.length&&!s;){const i=t[n];typeof i=="string"&&!xMe.has(i)&&i1(i).values.length&&(s=t[n]),n++}if(s&&r)for(const i of e)t[i]=fie(r,s)}class wMe extends f${constructor(e,r,n,s,i){super(e,r,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),i$(u))){const d=lie(u,r.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!cie.has(n)||e.length!==2)return;const[s,i]=e,o=LH(s),l=LH(i);if(o!==l)if(IH(o)&&IH(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else Pm[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let s=0;s<e.length;s++)(e[s]===null||fMe(e[s]))&&n.push(s);n.length&&bMe(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pm[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const s=r[r.length-1];s!==void 0&&e.getValue(n,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:r,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const s=e.getValue(r);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,o=n[i];n[i]=Pm[r](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function pie(t,e,r){if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const mie=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function _Me(t){return Tse(t)&&"offsetHeight"in t}const $H=30,jMe=t=>!isNaN(parseFloat(t));class SMe{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var i;const s=Bi.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=Bi.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=jMe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new r$);const n=this.events[e].add(r);return e==="change"?()=>{n(),Qr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Bi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>$H)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,$H);return Ose(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,r;(e=this.dependents)==null||e.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Sx(t,e){return new SMe(t,e)}const{schedule:g$,cancel:yyt}=Hse(queueMicrotask,!1),Io={x:!1,y:!1};function gie(){return Io.x||Io.y}function NMe(t){return t==="x"||t==="y"?Io[t]?null:(Io[t]=!0,()=>{Io[t]=!1}):Io.x||Io.y?null:(Io.x=Io.y=!0,()=>{Io.x=Io.y=!1})}function yie(t,e){const r=pie(t),n=new AbortController,s={passive:!0,...e,signal:n.signal};return[r,s,()=>n.abort()]}function BH(t){return!(t.pointerType==="touch"||gie())}function AMe(t,e,r={}){const[n,s,i]=yie(t,r),o=l=>{if(!BH(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=h=>{BH(h)&&(u(h),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return n.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const vie=(t,e)=>e?t===e?!0:vie(t,e.parentElement):!1,y$=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,EMe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CMe(t){return EMe.has(t.tagName)||t.tabIndex!==-1}const SA=new WeakSet;function UH(t){return e=>{e.key==="Enter"&&t(e)}}function AO(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const kMe=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=UH(()=>{if(SA.has(r))return;AO(r,"down");const s=UH(()=>{AO(r,"up")}),i=()=>AO(r,"cancel");r.addEventListener("keyup",s,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function zH(t){return y$(t)&&!gie()}function TMe(t,e,r={}){const[n,s,i]=yie(t,r),o=l=>{const c=l.currentTarget;if(!zH(l))return;SA.add(c);const u=e(c,l),d=(p,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),SA.has(c)&&SA.delete(c),zH(p)&&typeof u=="function"&&u(p,{success:g})},h=p=>{d(p,c===window||c===document||r.useGlobalTarget||vie(c,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",f,s)};return n.forEach(l=>{(r.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),_Me(l)&&(l.addEventListener("focus",u=>kMe(u,s)),!CMe(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function xie(t){return Tse(t)&&"ownerSVGElement"in t}function PMe(t){return xie(t)&&t.tagName==="svg"}const Ys=t=>!!(t&&t.getVelocity),OMe=[...die,Pn,tf],IMe=t=>OMe.find(uie(t)),bie=S.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function RMe(t=!0){const e=S.useContext(Z6);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=e,i=S.useId();S.useEffect(()=>{if(t)return s(i)},[t]);const o=S.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,o]:[!0]}const wie=S.createContext({strict:!1}),HH={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Nx={};for(const t in HH)Nx[t]={isEnabled:e=>HH[t].some(r=>!!e[r])};function MMe(t){for(const e in t)Nx[e]={...Nx[e],...t[e]}}const DMe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function iC(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DMe.has(t)}let _ie=t=>!iC(t);function LMe(t){typeof t=="function"&&(_ie=e=>e.startsWith("on")?!iC(e):t(e))}try{LMe(require("@emotion/is-prop-valid").default)}catch{}function FMe(t,e,r){const n={};for(const s in t)s==="values"&&typeof t.values=="object"||(_ie(s)||r===!0&&iC(s)||!e&&!iC(s)||t.draggable&&s.startsWith("onDrag"))&&(n[s]=t[s]);return n}const FT=S.createContext({});function $T(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function a1(t){return typeof t=="string"||Array.isArray(t)}const v$=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],x$=["initial",...v$];function BT(t){return $T(t.animate)||x$.some(e=>a1(t[e]))}function jie(t){return!!(BT(t)||t.variants)}function $Me(t,e){if(BT(t)){const{initial:r,animate:n}=t;return{initial:r===!1||a1(r)?r:void 0,animate:a1(n)?n:void 0}}return t.inherit!==!1?e:{}}function BMe(t){const{initial:e,animate:r}=$Me(t,S.useContext(FT));return S.useMemo(()=>({initial:e,animate:r}),[WH(e),WH(r)])}function WH(t){return Array.isArray(t)?t.join(" "):t}function VH(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const J0={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(wt.test(t))t=parseFloat(t);else return t;const r=VH(t,e.target.x),n=VH(t,e.target.y);return`${r}% ${n}%`}},UMe={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,s=tf.parse(t);if(s.length>5)return n;const i=tf.createTransformer(t),o=typeof s[0]!="number"?1:0,l=r.x.scale*e.x,c=r.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=rn(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},E4={borderRadius:{...J0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:J0,borderTopRightRadius:J0,borderBottomLeftRadius:J0,borderBottomRightRadius:J0,boxShadow:UMe};function Sie(t,{layout:e,layoutId:r}){return w0.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!E4[t]||t==="opacity")}const zMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},HMe=b0.length;function WMe(t,e,r){let n="",s=!0;for(let i=0;i<HMe;i++){const o=b0[i],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||r){const u=mie(l,m$[o]);if(!c){s=!1;const d=zMe[o]||o;n+=`${d}(${u}) `}r&&(e[o]=u)}}return n=n.trim(),r?n=r(e,s?"":n):s&&(n="none"),n}function b$(t,e,r){const{style:n,vars:s,transformOrigin:i}=t;let o=!1,l=!1;for(const c in e){const u=e[c];if(w0.has(c)){o=!0;continue}else if(Vse(c)){s[c]=u;continue}else{const d=mie(u,m$[c]);c.startsWith("origin")?(l=!0,i[c]=d):n[c]=d}}if(e.transform||(o||r?n.transform=WMe(e,t.transform,r):n.transform&&(n.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;n.transformOrigin=`${c} ${u} ${d}`}}const w$=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Nie(t,e,r){for(const n in e)!Ys(e[n])&&!Sie(n,r)&&(t[n]=e[n])}function VMe({transformTemplate:t},e){return S.useMemo(()=>{const r=w$();return b$(r,e,t),Object.assign({},r.vars,r.style)},[e])}function qMe(t,e){const r=t.style||{},n={};return Nie(n,r,t),Object.assign(n,VMe(t,e)),n}function GMe(t,e){const r={},n=qMe(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const KMe={offset:"stroke-dashoffset",array:"stroke-dasharray"},YMe={offset:"strokeDashoffset",array:"strokeDasharray"};function XMe(t,e,r=1,n=0,s=!0){t.pathLength=1;const i=s?KMe:YMe;t[i.offset]=wt.transform(-n);const o=wt.transform(e),l=wt.transform(r);t[i.array]=`${o} ${l}`}function Aie(t,{attrX:e,attrY:r,attrScale:n,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...l},c,u,d){if(b$(t,l,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:f}=t;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),s!==void 0&&XMe(h,s,i,o,!1)}const Eie=()=>({...w$(),attrs:{}}),Cie=t=>typeof t=="string"&&t.toLowerCase()==="svg";function QMe(t,e,r,n){const s=S.useMemo(()=>{const i=Eie();return Aie(i,e,Cie(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Nie(i,t.style,t),s.style={...i,...s.style}}return s}const ZMe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function _$(t){return typeof t!="string"||t.includes("-")?!1:!!(ZMe.indexOf(t)>-1||/[A-Z]/u.test(t))}function JMe(t,e,r,{latestValues:n},s,i=!1){const l=(_$(t)?QMe:GMe)(e,n,s,t),c=FMe(e,typeof t=="string",i),u=t!==S.Fragment?{...c,...l,ref:r}:{},{children:d}=e,h=S.useMemo(()=>Ys(d)?d.get():d,[d]);return S.createElement(t,{...u,children:h})}function qH(t){const e=[{},{}];return t==null||t.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function j$(t,e,r,n){if(typeof e=="function"){const[s,i]=qH(n);e=e(r!==void 0?r:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=qH(n);e=e(r!==void 0?r:t.custom,s,i)}return e}function NA(t){return Ys(t)?t.get():t}function eDe({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,s){return{latestValues:tDe(r,n,s,t),renderState:e()}}function tDe(t,e,r,n){const s={},i=n(t,{});for(const f in i)s[f]=NA(i[f]);let{initial:o,animate:l}=t;const c=BT(t),u=jie(t);e&&u&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=r?r.initial===!1:!1;d=d||o===!1;const h=d?l:o;if(h&&typeof h!="boolean"&&!$T(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const g=j$(t,f[p]);if(g){const{transitionEnd:m,transition:v,...y}=g;for(const x in y){let b=y[x];if(Array.isArray(b)){const w=d?b.length-1:0;b=b[w]}b!==null&&(s[x]=b)}for(const x in m)s[x]=m[x]}}}return s}const kie=t=>(e,r)=>{const n=S.useContext(FT),s=S.useContext(Z6),i=()=>eDe(t,e,n,s);return r?i():LIe(i)};function S$(t,e,r){var i;const{style:n}=t,s={};for(const o in n)(Ys(n[o])||e.style&&Ys(e.style[o])||Sie(o,t)||((i=r==null?void 0:r.getValue(o))==null?void 0:i.liveStyle)!==void 0)&&(s[o]=n[o]);return s}const rDe=kie({scrapeMotionValuesFromProps:S$,createRenderState:w$});function Tie(t,e,r){const n=S$(t,e,r);for(const s in t)if(Ys(t[s])||Ys(e[s])){const i=b0.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[i]=t[s]}return n}const nDe=kie({scrapeMotionValuesFromProps:Tie,createRenderState:Eie}),sDe=Symbol.for("motionComponentSymbol");function cy(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function iDe(t,e,r){return S.useCallback(n=>{n&&t.onMount&&t.onMount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):cy(r)&&(r.current=n))},[e])}const N$=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),aDe="framerAppearId",Pie="data-"+N$(aDe),Oie=S.createContext({});function oDe(t,e,r,n,s){var m,v;const{visualElement:i}=S.useContext(FT),o=S.useContext(wie),l=S.useContext(Z6),c=S.useContext(bie).reducedMotion,u=S.useRef(null);n=n||o.renderer,!u.current&&n&&(u.current=n(t,{visualState:e,parent:i,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,h=S.useContext(Oie);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&lDe(u.current,r,s,h);const f=S.useRef(!1);S.useInsertionEffect(()=>{d&&f.current&&d.update(r,l)});const p=r[Pie],g=S.useRef(!!p&&!((m=window.MotionHandoffIsComplete)!=null&&m.call(window,p))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,p)));return FIe(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),g.current&&d.animationState&&d.animationState.animateChanges())}),S.useEffect(()=>{d&&(!g.current&&d.animationState&&d.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,p)}),g.current=!1),d.enteringChildren=void 0)}),d}function lDe(t,e,r,n){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:Iie(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&cy(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:d,layoutScroll:c,layoutRoot:u})}function Iie(t){if(t)return t.options.allowProjection!==!1?t.projection:Iie(t.parent)}function EO(t,{forwardMotionProps:e=!1}={},r,n){r&&MMe(r);const s=_$(t)?nDe:rDe;function i(l,c){let u;const d={...S.useContext(bie),...l,layoutId:cDe(l)},{isStatic:h}=d,f=BMe(l),p=s(l,h);if(!h&&Q6){uDe();const g=dDe(d);u=g.MeasureLayout,f.visualElement=oDe(t,p,d,n,g.ProjectionNode)}return a.jsxs(FT.Provider,{value:f,children:[u&&f.visualElement?a.jsx(u,{visualElement:f.visualElement,...d}):null,JMe(t,l,iDe(p,f.visualElement,c),p,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=S.forwardRef(i);return o[sDe]=t,o}function cDe({layoutId:t}){const e=S.useContext(Cse).id;return e&&t!==void 0?e+"-"+t:t}function uDe(t,e){S.useContext(wie).strict}function dDe(t){const{drag:e,layout:r}=Nx;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function hDe(t,e){if(typeof Proxy>"u")return EO;const r=new Map,n=(i,o)=>EO(i,o,t,e),s=(i,o)=>n(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?n:(r.has(o)||r.set(o,EO(o,void 0,t,e)),r.get(o))})}function Rie({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function fDe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function pDe(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function CO(t){return t===void 0||t===1}function C4({scale:t,scaleX:e,scaleY:r}){return!CO(t)||!CO(e)||!CO(r)}function Wf(t){return C4(t)||Mie(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Mie(t){return GH(t.x)||GH(t.y)}function GH(t){return t&&t!=="0%"}function aC(t,e,r){const n=t-r,s=e*n;return r+s}function KH(t,e,r,n,s){return s!==void 0&&(t=aC(t,s,n)),aC(t,r,n)+e}function k4(t,e=0,r=1,n,s){t.min=KH(t.min,e,r,n,s),t.max=KH(t.max,e,r,n,s)}function Die(t,{x:e,y:r}){k4(t.x,e.translate,e.scale,e.originPoint),k4(t.y,r.translate,r.scale,r.originPoint)}const YH=.999999999999,XH=1.0000000000001;function mDe(t,e,r,n=!1){const s=r.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=r[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&dy(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Die(t,o)),n&&Wf(i.latestValues)&&dy(t,i.latestValues))}e.x<XH&&e.x>YH&&(e.x=1),e.y<XH&&e.y>YH&&(e.y=1)}function uy(t,e){t.min=t.min+e,t.max=t.max+e}function QH(t,e,r,n,s=.5){const i=rn(t.min,t.max,s);k4(t,e,r,i,n)}function dy(t,e){QH(t.x,e.x,e.scaleX,e.scale,e.originX),QH(t.y,e.y,e.scaleY,e.scale,e.originY)}function Lie(t,e){return Rie(pDe(t.getBoundingClientRect(),e))}function gDe(t,e,r){const n=Lie(t,r),{scroll:s}=e;return s&&(uy(n.x,s.offset.x),uy(n.y,s.offset.y)),n}const ZH=()=>({translate:0,scale:1,origin:0,originPoint:0}),hy=()=>({x:ZH(),y:ZH()}),JH=()=>({min:0,max:0}),Wn=()=>({x:JH(),y:JH()}),T4={current:null},Fie={current:!1};function yDe(){if(Fie.current=!0,!!Q6)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>T4.current=t.matches;t.addEventListener("change",e),e()}else T4.current=!1}const vDe=new WeakMap;function xDe(t,e,r){for(const n in e){const s=e[n],i=r[n];if(Ys(s))t.addValue(n,s);else if(Ys(i))t.addValue(n,Sx(s,{owner:t}));else if(i!==s)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(n);t.addValue(n,Sx(o!==void 0?o:s,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const e7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class bDe{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=f$,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Bi.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Qr.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=BT(r),this.isVariantNode=jie(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(r,{},this);for(const f in h){const p=h[f];c[f]!==void 0&&Ys(p)&&p.set(c[f])}}mount(e){var r;this.current=e,vDe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Fie.current||yDe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:T4.current,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),ef(this.notifyUpdate),ef(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=w0.has(e);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Qr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Nx){const r=Nx[e];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[e]&&s&&n(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Wn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<e7.length;n++){const s=e7[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=xDe(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=Sx(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(kse(n)||Pse(n))?n=parseFloat(n):!IMe(n)&&tf.test(r)&&(n=fie(e,r)),this.setBaseTarget(e,Ys(n)?n.get():n)),Ys(n)?n.get():n}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var i;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const o=j$(this.props,r,(i=this.presenceContext)==null?void 0:i.custom);o&&(n=o[e])}if(r&&n!==void 0)return n;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Ys(s)?s:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new r$),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){g$.render(this.render)}}class $ie extends bDe{constructor(){super(...arguments),this.KeyframeResolver=wMe}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ys(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Bie(t,{style:e,vars:r},n,s){const i=t.style;let o;for(o in e)i[o]=e[o];s==null||s.applyProjectionStyles(i,n);for(o in r)i.setProperty(o,r[o])}function wDe(t){return window.getComputedStyle(t)}class _De extends $ie{constructor(){super(...arguments),this.type="html",this.renderInstance=Bie}readValueFromInstance(e,r){var n;if(w0.has(r))return(n=this.projection)!=null&&n.isProjecting?b4(r):BRe(e,r);{const s=wDe(e),i=(Vse(r)?s.getPropertyValue(r):s[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return Lie(e,r)}build(e,r,n){b$(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return S$(e,r,n)}}const Uie=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function jDe(t,e,r,n){Bie(t,e,void 0,n);for(const s in e.attrs)t.setAttribute(Uie.has(s)?s:N$(s),e.attrs[s])}class SDe extends $ie{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Wn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(w0.has(r)){const n=hie(r);return n&&n.default||0}return r=Uie.has(r)?r:N$(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return Tie(e,r,n)}build(e,r,n){Aie(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,s){jDe(e,r,n,s)}mount(e){this.isSVGTag=Cie(e.tagName),super.mount(e)}}const NDe=(t,e)=>_$(t)?new SDe(e):new _De(e,{allowProjection:t!==S.Fragment});function Dy(t,e,r){const n=t.getProps();return j$(n,e,r!==void 0?r:n.custom,t)}const P4=t=>Array.isArray(t);function ADe(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,Sx(r))}function EDe(t){return P4(t)?t[t.length-1]||0:t}function CDe(t,e){const r=Dy(t,e);let{transitionEnd:n={},transition:s={},...i}=r||{};i={...i,...n};for(const o in i){const l=EDe(i[o]);ADe(t,o,l)}}function kDe(t){return!!(Ys(t)&&t.add)}function O4(t,e){const r=t.getValue("willChange");if(kDe(r))return r.add(e);if(!r&&Qu.WillChange){const n=new Qu.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function zie(t){return t.props[Pie]}const TDe=t=>t!==null;function PDe(t,{repeat:e,repeatType:r="loop"},n){const s=t.filter(TDe),i=e&&r!=="loop"&&e%2===1?0:s.length-1;return!i||n===void 0?s[i]:n}const ODe={type:"spring",stiffness:500,damping:25,restSpeed:10},IDe=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),RDe={type:"keyframes",duration:.8},MDe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},DDe=(t,{keyframes:e})=>e.length>2?RDe:w0.has(t)?t.startsWith("scale")?IDe(e[1]):ODe:MDe;function LDe({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const A$=(t,e,r,n={},s,i)=>o=>{const l=p$(n,t)||{},c=l.delay||n.delay||0;let{elapsed:u=0}=n;u=u-pc(c);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};LDe(l)||Object.assign(d,DDe(t,d)),d.duration&&(d.duration=pc(d.duration)),d.repeatDelay&&(d.repeatDelay=pc(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(N4(d),d.delay===0&&(h=!0)),(Qu.instantAnimations||Qu.skipAnimations)&&(h=!0,N4(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,h&&!i&&e.get()!==void 0){const f=PDe(d.keyframes,l);if(f!==void 0){Qr.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new h$(d):new cMe(d)};function FDe({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function Hie(t,e,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...l}=e;n&&(i=n);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const h=t.getValue(d,t.latestValues[d]??null),f=l[d];if(f===void 0||u&&FDe(u,d))continue;const p={delay:r,...p$(i||{},d)},g=h.get();if(g!==void 0&&!h.isAnimating&&!Array.isArray(f)&&f===g&&!p.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const y=zie(t);if(y){const x=window.MotionHandoffAnimation(y,d,Qr);x!==null&&(p.startTime=x,m=!0)}}O4(t,d),h.start(A$(d,h,f,t.shouldReduceMotion&&cie.has(d)?{type:!1}:p,t,m));const v=h.animation;v&&c.push(v)}return o&&Promise.all(c).then(()=>{Qr.update(()=>{o&&CDe(t,o)})}),c}function Wie(t,e,r,n=0,s=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,l=(o-1)*n;return typeof r=="function"?r(i,o):s===1?i*n:l-i*n}function I4(t,e,r={}){var c;const n=Dy(t,e,r.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const i=n?()=>Promise.all(Hie(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=s;return $De(t,e,u,d,h,f,r)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(r.delay)])}function $De(t,e,r=0,n=0,s=0,i=1,o){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(I4(c,e,{...o,delay:r+(typeof n=="function"?0:n)+Wie(t.variantChildren,c,n,s,i)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function BDe(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const s=e.map(i=>I4(t,i,r));n=Promise.all(s)}else if(typeof e=="string")n=I4(t,e,r);else{const s=typeof e=="function"?Dy(t,e,r.custom):e;n=Promise.all(Hie(t,s,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function Vie(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const UDe=x$.length;function qie(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?qie(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<UDe;r++){const n=x$[r],s=t.props[n];(a1(s)||s===!1)&&(e[n]=s)}return e}const zDe=[...v$].reverse(),HDe=v$.length;function WDe(t){return e=>Promise.all(e.map(({animation:r,options:n})=>BDe(t,r,n)))}function VDe(t){let e=WDe(t),r=t7(),n=!0;const s=c=>(u,d)=>{var f;const h=Dy(t,d,c==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...m}=h;u={...u,...m,...g}}return u};function i(c){e=c(t)}function o(c){const{props:u}=t,d=qie(t.parent)||{},h=[],f=new Set;let p={},g=1/0;for(let v=0;v<HDe;v++){const y=zDe[v],x=r[y],b=u[y]!==void 0?u[y]:d[y],w=a1(b),j=y===c?x.isActive:null;j===!1&&(g=v);let N=b===d[y]&&b!==u[y]&&w;if(N&&n&&t.manuallyAnimateOnMount&&(N=!1),x.protectedKeys={...p},!x.isActive&&j===null||!b&&!x.prevProp||$T(b)||typeof b=="boolean")continue;const C=qDe(x.prevProp,b);let k=C||y===c&&x.isActive&&!N&&w||v>g&&w,E=!1;const M=Array.isArray(b)?b:[b];let z=M.reduce(s(y),{});j===!1&&(z={});const{prevResolvedValues:I={}}=x,q={...I,...z},A=G=>{k=!0,f.has(G)&&(E=!0,f.delete(G)),x.needsAnimating[G]=!0;const Y=t.getValue(G);Y&&(Y.liveStyle=!1)};for(const G in q){const Y=z[G],H=I[G];if(p.hasOwnProperty(G))continue;let $=!1;P4(Y)&&P4(H)?$=!Vie(Y,H):$=Y!==H,$?Y!=null?A(G):f.add(G):Y!==void 0&&f.has(G)?A(G):x.protectedKeys[G]=!0}x.prevProp=b,x.prevResolvedValues=z,x.isActive&&(p={...p,...z}),n&&t.blockInitialAnimation&&(k=!1);const U=N&&C;k&&(!U||E)&&h.push(...M.map(G=>{const Y={type:y};if(typeof G=="string"&&n&&!U&&t.manuallyAnimateOnMount&&t.parent){const{parent:H}=t,$=Dy(H,G);if(H.enteringChildren&&$){const{delayChildren:L}=$.transition||{};Y.delay=Wie(H.enteringChildren,t,L)}}return{animation:G,options:Y}}))}if(f.size){const v={};if(typeof u.initial!="boolean"){const y=Dy(t,Array.isArray(u.initial)?u.initial[0]:u.initial);y&&y.transition&&(v.transition=y.transition)}f.forEach(y=>{const x=t.getBaseTarget(y),b=t.getValue(y);b&&(b.liveStyle=!0),v[y]=x??null}),h.push({animation:v})}let m=!!h.length;return n&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),n=!1,m?e(h):Promise.resolve()}function l(c,u){var h;if(r[c].isActive===u)return Promise.resolve();(h=t.variantChildren)==null||h.forEach(f=>{var p;return(p=f.animationState)==null?void 0:p.setActive(c,u)}),r[c].isActive=u;const d=o(c);for(const f in r)r[f].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>r,reset:()=>{r=t7()}}}function qDe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Vie(e,t):!1}function If(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function t7(){return{animate:If(!0),whileInView:If(),whileHover:If(),whileTap:If(),whileDrag:If(),whileFocus:If(),exit:If()}}class xf{constructor(e){this.isMounted=!1,this.node=e}update(){}}class GDe extends xf{constructor(e){super(e),e.animationState||(e.animationState=VDe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$T(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let KDe=0;class YDe extends xf{constructor(){super(...arguments),this.id=KDe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const s=this.node.animationState.setActive("exit",!e);r&&!e&&s.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const XDe={animation:{Feature:GDe},exit:{Feature:YDe}};function o1(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function tS(t){return{point:{x:t.pageX,y:t.pageY}}}const QDe=t=>e=>y$(e)&&t(e,tS(e));function xw(t,e,r,n){return o1(t,e,QDe(r),n)}const Gie=1e-4,ZDe=1-Gie,JDe=1+Gie,Kie=.01,e4e=0-Kie,t4e=0+Kie;function pi(t){return t.max-t.min}function r4e(t,e,r){return Math.abs(t-e)<=r}function r7(t,e,r,n=.5){t.origin=n,t.originPoint=rn(e.min,e.max,t.origin),t.scale=pi(r)/pi(e),t.translate=rn(r.min,r.max,t.origin)-t.originPoint,(t.scale>=ZDe&&t.scale<=JDe||isNaN(t.scale))&&(t.scale=1),(t.translate>=e4e&&t.translate<=t4e||isNaN(t.translate))&&(t.translate=0)}function bw(t,e,r,n){r7(t.x,e.x,r.x,n?n.originX:void 0),r7(t.y,e.y,r.y,n?n.originY:void 0)}function n7(t,e,r){t.min=r.min+e.min,t.max=t.min+pi(e)}function n4e(t,e,r){n7(t.x,e.x,r.x),n7(t.y,e.y,r.y)}function s7(t,e,r){t.min=e.min-r.min,t.max=t.min+pi(e)}function oC(t,e,r){s7(t.x,e.x,r.x),s7(t.y,e.y,r.y)}function Ha(t){return[t("x"),t("y")]}const Yie=({current:t})=>t?t.ownerDocument.defaultView:null,i7=(t,e)=>Math.abs(t-e);function s4e(t,e){const r=i7(t.x,e.x),n=i7(t.y,e.y);return Math.sqrt(r**2+n**2)}class Xie{constructor(e,r,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=TO(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=s4e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:m}=f,{timestamp:v}=bs;this.history.push({...m,timestamp:v});const{onStart:y,onMove:x}=this.handlers;p||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=kO(p,this.transformPagePoint),Qr.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:m,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=TO(f.type==="pointercancel"?this.lastMoveEventInfo:kO(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,y),m&&m(f,y)},!y$(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=s||window;const l=tS(e),c=kO(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=bs;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=r;h&&h(e,TO(c,this.history)),this.removeListeners=Zj(xw(this.contextWindow,"pointermove",this.handlePointerMove),xw(this.contextWindow,"pointerup",this.handlePointerUp),xw(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ef(this.updatePoint)}}function kO(t,e){return e?{point:e(t.point)}:t}function a7(t,e){return{x:t.x-e.x,y:t.y-e.y}}function TO({point:t},e){return{point:t,delta:a7(t,Qie(e)),offset:a7(t,i4e(e)),velocity:a4e(e,.1)}}function i4e(t){return t[0]}function Qie(t){return t[t.length-1]}function a4e(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const s=Qie(t);for(;r>=0&&(n=t[r],!(s.timestamp-n.timestamp>pc(e)));)r--;if(!n)return{x:0,y:0};const i=lo(s.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function o4e(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?rn(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?rn(r,t,n.max):Math.min(t,r)),t}function o7(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function l4e(t,{top:e,left:r,bottom:n,right:s}){return{x:o7(t.x,r,s),y:o7(t.y,e,n)}}function l7(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function c4e(t,e){return{x:l7(t.x,e.x),y:l7(t.y,e.y)}}function u4e(t,e){let r=.5;const n=pi(t),s=pi(e);return s>n?r=n1(e.min,e.max-n,t.min):n>s&&(r=n1(t.min,t.max-s,e.min)),Xu(0,1,r)}function d4e(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const R4=.35;function h4e(t=R4){return t===!1?t=0:t===!0&&(t=R4),{x:c7(t,"left","right"),y:c7(t,"top","bottom")}}function c7(t,e,r){return{min:u7(t,e),max:u7(t,r)}}function u7(t,e){return typeof t=="number"?t:t[e]||0}const f4e=new WeakMap;class p4e{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Wn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(tS(h).point)},o=(h,f)=>{const{drag:p,dragPropagation:g,onDragStart:m}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=NMe(p),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ha(y=>{let x=this.getAxisMotionValue(y).get()||0;if(mc.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const w=b.layout.layoutBox[y];w&&(x=pi(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),m&&Qr.postRender(()=>m(h,f)),O4(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:m,onDrag:v}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=f;if(g&&this.currentDirection===null){this.currentDirection=m4e(y),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),v&&v(h,f)},c=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>Ha(h=>{var f;return this.getAnimationState(h)==="paused"&&((f=this.getAxisMotionValue(h).animation)==null?void 0:f.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Xie(e,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:n,contextWindow:Yie(this.visualElement)})}stop(e,r){const n=e||this.latestPointerEvent,s=r||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!n)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Qr.postRender(()=>l(n,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:s}=this.getProps();if(!n||!vN(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=o4e(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&cy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=l4e(n.layoutBox,e):this.constraints=!1,this.elastic=h4e(r),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&Ha(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=d4e(n.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!cy(e))return!1;const n=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=gDe(n,s.root,this.visualElement.getTransformPagePoint());let o=c4e(s.layout.layoutBox,i);if(r){const l=r(fDe(o));this.hasMutatedConstraints=!!l,l&&(o=Rie(l))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ha(d=>{if(!vN(d,r,this.currentDirection))return;let h=c&&c[d]||{};o&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:n?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return O4(this.visualElement,e),n.start(A$(e,n,0,r,this.visualElement,!1))}stopAnimation(){Ha(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Ha(e=>{var r;return(r=this.getAxisMotionValue(e).animation)==null?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)==null?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Ha(r=>{const{drag:n}=this.getProps();if(!vN(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(r);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[r];i.set(e[r]-rn(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!cy(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ha(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=u4e({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Ha(o=>{if(!vN(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(rn(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;f4e.set(this.visualElement,this);const e=this.visualElement.current,r=xw(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();cy(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Qr.read(n);const o=o1(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ha(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),r(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=R4,dragMomentum:l=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function vN(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function m4e(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class g4e extends xf{constructor(e){super(e),this.removeGroupControls=mo,this.removeListeners=mo,this.controls=new p4e(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||mo}unmount(){this.removeGroupControls(),this.removeListeners()}}const d7=t=>(e,r)=>{t&&Qr.postRender(()=>t(e,r))};class y4e extends xf{constructor(){super(...arguments),this.removePointerDownListener=mo}onPointerDown(e){this.session=new Xie(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Yie(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:d7(e),onStart:d7(r),onMove:n,onEnd:(i,o)=>{delete this.session,s&&Qr.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=xw(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const AA={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let PO=!1;class v4e extends S.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=e;i&&(r.group&&r.group.add(i),n&&n.register&&s&&n.register(i),PO&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),AA.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:s,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,PO=!0,s||e.layoutDependency!==r||r===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Qr.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),g$.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=e;PO=!0,s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Zie(t){const[e,r]=RMe(),n=S.useContext(Cse);return a.jsx(v4e,{...t,layoutGroup:n,switchLayoutGroup:S.useContext(Oie),isPresent:e,safeToRemove:r})}function x4e(t,e,r){const n=Ys(t)?t:Sx(t);return n.start(A$("",n,e,r)),n.animation}const b4e=(t,e)=>t.depth-e.depth;class w4e{constructor(){this.children=[],this.isDirty=!1}add(e){J6(this.children,e),this.isDirty=!0}remove(e){e$(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(b4e),this.isDirty=!1,this.children.forEach(e)}}function _4e(t,e){const r=Bi.now(),n=({timestamp:s})=>{const i=s-r;i>=e&&(ef(n),t(i-e))};return Qr.setup(n,!0),()=>ef(n)}const Jie=["TopLeft","TopRight","BottomLeft","BottomRight"],j4e=Jie.length,h7=t=>typeof t=="string"?parseFloat(t):t,f7=t=>typeof t=="number"||wt.test(t);function S4e(t,e,r,n,s,i){s?(t.opacity=rn(0,r.opacity??1,N4e(n)),t.opacityExit=rn(e.opacity??1,0,A4e(n))):i&&(t.opacity=rn(e.opacity??1,r.opacity??1,n));for(let o=0;o<j4e;o++){const l=`border${Jie[o]}Radius`;let c=p7(e,l),u=p7(r,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||f7(c)===f7(u)?(t[l]=Math.max(rn(h7(c),h7(u),n),0),(mc.test(u)||mc.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||r.rotate)&&(t.rotate=rn(e.rotate||0,r.rotate||0,n))}function p7(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const N4e=eae(0,.5,$se),A4e=eae(.5,.95,mo);function eae(t,e,r){return n=>n<t?0:n>e?1:r(n1(t,e,n))}function m7(t,e){t.min=e.min,t.max=e.max}function ko(t,e){m7(t.x,e.x),m7(t.y,e.y)}function g7(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function y7(t,e,r,n,s){return t-=e,t=aC(t,1/r,n),s!==void 0&&(t=aC(t,1/s,n)),t}function E4e(t,e=0,r=1,n=.5,s,i=t,o=t){if(mc.test(e)&&(e=parseFloat(e),e=rn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=rn(i.min,i.max,n);t===i&&(l-=e),t.min=y7(t.min,e,r,l,s),t.max=y7(t.max,e,r,l,s)}function v7(t,e,[r,n,s],i,o){E4e(t,e[r],e[n],e[s],e.scale,i,o)}const C4e=["x","scaleX","originX"],k4e=["y","scaleY","originY"];function x7(t,e,r,n){v7(t.x,e,C4e,r?r.x:void 0,n?n.x:void 0),v7(t.y,e,k4e,r?r.y:void 0,n?n.y:void 0)}function b7(t){return t.translate===0&&t.scale===1}function tae(t){return b7(t.x)&&b7(t.y)}function w7(t,e){return t.min===e.min&&t.max===e.max}function T4e(t,e){return w7(t.x,e.x)&&w7(t.y,e.y)}function _7(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function rae(t,e){return _7(t.x,e.x)&&_7(t.y,e.y)}function j7(t){return pi(t.x)/pi(t.y)}function S7(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class P4e{constructor(){this.members=[]}add(e){J6(this.members,e),e.scheduleRender()}remove(e){if(e$(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(s=>e===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function O4e(t,e,r){let n="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((s||i||o)&&(n=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:g}=r;u&&(n=`perspective(${u}px) ${n}`),d&&(n+=`rotate(${d}deg) `),h&&(n+=`rotateX(${h}deg) `),f&&(n+=`rotateY(${f}deg) `),p&&(n+=`skewX(${p}deg) `),g&&(n+=`skewY(${g}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(n+=`scale(${l}, ${c})`),n||"none"}const OO=["","X","Y","Z"],I4e=1e3;let R4e=0;function IO(t,e,r,n){const{latestValues:s}=e;s[t]&&(r[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function nae(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=zie(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",Qr,!(s||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&nae(n)}function sae({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=R4e++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(L4e),this.nodes.forEach(U4e),this.nodes.forEach(z4e),this.nodes.forEach(F4e)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new w4e)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new r$),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=xie(o)&&!PMe(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let d,h=0;const f=()=>this.root.updateBlockedByResize=!1;Qr.read(()=>{h=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=_4e(f,250),AA.hasAnimatedSinceResize&&(AA.hasAnimatedSinceResize=!1,this.nodes.forEach(E7)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||G4e,{onLayoutAnimationStart:m,onLayoutAnimationComplete:v}=u.getProps(),y=!this.targetLayout||!rae(this.targetLayout,p),x=!h&&f;if(this.options.layoutRoot||this.resumeFrom||x||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...p$(g,"layout"),onPlay:m,onComplete:v};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(d,x)}else h||E7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ef(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(H4e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nae(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(N7);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(A7);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(B4e),this.nodes.forEach(M4e),this.nodes.forEach(D4e)):this.nodes.forEach(A7),this.clearAllSnapshots();const l=Bi.now();bs.delta=Xu(0,1e3/60,l-bs.timestamp),bs.timestamp=l,bs.isProcessing=!0,wO.update.process(bs),wO.preRender.process(bs),wO.render.process(bs),bs.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,g$.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($4e),this.sharedNodes.forEach(W4e)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!pi(this.snapshot.measuredBox.x)&&!pi(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Wn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!tae(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Wf(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),K4e(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return Wn();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Y4e))){const{scroll:d}=this.root;d&&(uy(l.x,d.offset.x),uy(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=Wn();if(ko(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:f}=d;d!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&ko(l,o),uy(l.x,h.offset.x),uy(l.y,h.offset.y))}return l}applyTransform(o,l=!1){const c=Wn();ko(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&dy(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Wf(d.latestValues)&&dy(c,d.latestValues)}return Wf(this.latestValues)&&dy(c,this.latestValues),c}removeTransform(o){const l=Wn();ko(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Wf(u.latestValues))continue;C4(u.latestValues)&&u.updateSnapshot();const d=Wn(),h=u.measurePageBox();ko(d,h),x7(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Wf(this.latestValues)&&x7(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==bs.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=bs.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Wn(),this.targetWithTransforms=Wn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),n4e(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ko(this.target,this.layout.layoutBox),Die(this.target,this.targetDelta)):ko(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||C4(this.parent.latestValues)||Mie(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Wn(),this.relativeTargetOrigin=Wn(),oC(this.relativeTargetOrigin,l,c),ko(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===bs.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;ko(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;mDe(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Wn());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(g7(this.prevProjectionDelta.x,this.projectionDelta.x),g7(this.prevProjectionDelta.y,this.projectionDelta.y)),bw(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!S7(this.projectionDelta.x,this.prevProjectionDelta.x)||!S7(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=hy(),this.projectionDelta=hy(),this.projectionDeltaWithTransform=hy()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=hy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Wn(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,m=p!==g,v=this.getStack(),y=!v||v.members.length<=1,x=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(q4e));this.animationProgress=0;let b;this.mixTargetDelta=w=>{const j=w/1e3;C7(h.x,o.x,j),C7(h.y,o.y,j),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oC(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),V4e(this.relativeTarget,this.relativeTargetOrigin,f,j),b&&T4e(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=Wn()),ko(b,this.relativeTarget)),m&&(this.animationValues=d,S4e(d,u,this.latestValues,j,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(ef(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qr.update(()=>{AA.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Sx(0)),this.currentAnimation=x4e(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(I4e),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&iae(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Wn();const h=pi(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const f=pi(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}ko(l,c),dy(l,d),bw(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new P4e),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&IO("z",o,u,this.animationValues);for(let d=0;d<OO.length;d++)IO(`rotate${OO[d]}`,o,u,this.animationValues),IO(`skew${OO[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=NA(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=NA(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Wf(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=O4e(this.projectionDeltaWithTransform,this.treeScale,d);c&&(h=c(d,h)),o.transform=h;const{x:f,y:p}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in E4){if(d[g]===void 0)continue;const{correct:m,applyTo:v,isCSSVariable:y}=E4[g],x=h==="none"?d[g]:m(d[g],u);if(v){const b=v.length;for(let w=0;w<b;w++)o[v[w]]=x}else y?this.options.visualElement.renderState.vars[g]=x:o[g]=x}this.options.layoutId&&(o.pointerEvents=u===this?NA(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(N7),this.root.sharedNodes.clear()}}}function M4e(t){t.updateLayout()}function D4e(t){var r;const e=((r=t.resumeFrom)==null?void 0:r.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?Ha(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=pi(f);f.min=n[h].min,f.max=f.min+p}):iae(i,e.layoutBox,n)&&Ha(h=>{const f=o?e.measuredBox[h]:e.layoutBox[h],p=pi(n[h]);f.max=f.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+p)});const l=hy();bw(l,n,e.layoutBox);const c=hy();o?bw(c,t.applyTransform(s,!0),e.measuredBox):bw(c,n,e.layoutBox);const u=!tae(l);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const g=Wn();oC(g,e.layoutBox,f.layoutBox);const m=Wn();oC(m,n,p.layoutBox),rae(g,m)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=g,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function L4e(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F4e(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function $4e(t){t.clearSnapshot()}function N7(t){t.clearMeasurements()}function A7(t){t.isLayoutDirty=!1}function B4e(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function E7(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function U4e(t){t.resolveTargetDelta()}function z4e(t){t.calcProjection()}function H4e(t){t.resetSkewAndRotation()}function W4e(t){t.removeLeadSnapshot()}function C7(t,e,r){t.translate=rn(e.translate,0,r),t.scale=rn(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function k7(t,e,r,n){t.min=rn(e.min,r.min,n),t.max=rn(e.max,r.max,n)}function V4e(t,e,r,n){k7(t.x,e.x,r.x,n),k7(t.y,e.y,r.y,n)}function q4e(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const G4e={duration:.45,ease:[.4,0,.1,1]},T7=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),P7=T7("applewebkit/")&&!T7("chrome/")?Math.round:mo;function O7(t){t.min=P7(t.min),t.max=P7(t.max)}function K4e(t){O7(t.x),O7(t.y)}function iae(t,e,r){return t==="position"||t==="preserve-aspect"&&!r4e(j7(e),j7(r),.2)}function Y4e(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const X4e=sae({attachResizeListener:(t,e)=>o1(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),RO={current:void 0},aae=sae({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!RO.current){const t=new X4e({});t.mount(window),t.setOptions({layoutScroll:!0}),RO.current=t}return RO.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Q4e={pan:{Feature:y4e},drag:{Feature:g4e,ProjectionNode:aae,MeasureLayout:Zie}};function I7(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,i=n[s];i&&Qr.postRender(()=>i(e,tS(e)))}class Z4e extends xf{mount(){const{current:e}=this.node;e&&(this.unmount=AMe(e,(r,n)=>(I7(this.node,n,"Start"),s=>I7(this.node,s,"End"))))}unmount(){}}class J4e extends xf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zj(o1(this.node.current,"focus",()=>this.onFocus()),o1(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function R7(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),i=n[s];i&&Qr.postRender(()=>i(e,tS(e)))}class eLe extends xf{mount(){const{current:e}=this.node;e&&(this.unmount=TMe(e,(r,n)=>(R7(this.node,n,"Start"),(s,{success:i})=>R7(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const M4=new WeakMap,MO=new WeakMap,tLe=t=>{const e=M4.get(t.target);e&&e(t)},rLe=t=>{t.forEach(tLe)};function nLe({root:t,...e}){const r=t||document;MO.has(r)||MO.set(r,{});const n=MO.get(r),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(rLe,{root:t,...e})),n[s]}function sLe(t,e,r){const n=nLe(e);return M4.set(t,r),n.observe(t),()=>{M4.delete(t),n.unobserve(t)}}const iLe={some:0,all:1};class aLe extends xf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:i}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:iLe[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),f=u?d:h;f&&f(c)};return sLe(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(oLe(e,r))&&this.startObserver()}unmount(){}}function oLe({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const lLe={inView:{Feature:aLe},tap:{Feature:eLe},focus:{Feature:J4e},hover:{Feature:Z4e}},cLe={layout:{ProjectionNode:aae,MeasureLayout:Zie}},uLe={...XDe,...lLe,...Q4e,...cLe},Jo=hDe(uLe,NDe),dLe={some:0,all:1};function hLe(t,e,{root:r,margin:n,amount:s="some"}={}){const i=pie(t),o=new WeakMap,l=u=>{u.forEach(d=>{const h=o.get(d.target);if(d.isIntersecting!==!!h)if(d.isIntersecting){const f=e(d.target,d);typeof f=="function"?o.set(d.target,f):c.unobserve(d.target)}else typeof h=="function"&&(h(d),o.delete(d.target))})},c=new IntersectionObserver(l,{root:r,rootMargin:n,threshold:typeof s=="number"?s:dLe[s]});return i.forEach(u=>c.observe(u)),()=>c.disconnect()}function fLe(t,{root:e,margin:r,amount:n,once:s=!1,initial:i=!1}={}){const[o,l]=S.useState(i);return S.useEffect(()=>{if(!t.current||s&&o)return;const c=()=>(l(!0),s?void 0:()=>l(!1)),u={root:e&&e.current||void 0,margin:r,amount:n};return hLe(t.current,c,u)},[e,t,r,s,n]),o}const pLe=id("relative overflow-hidden rounded-full bg-secondary",{variants:{variant:{default:"bg-secondary",primary:"bg-primary/10",secondary:"bg-secondary",destructive:"bg-destructive/10",outline:"bg-accent border border-border",success:"bg-success/10",warning:"bg-warning/10"},size:{sm:"h-1.5",default:"h-2.5",lg:"h-3"}},defaultVariants:{variant:"default",size:"default"}}),mLe=id("h-full w-full flex-1 rounded-full transition-all duration-500 ease-out",{variants:{variant:{default:"bg-primary",primary:"bg-primary",secondary:"bg-foreground",destructive:"bg-destructive",outline:"bg-primary",success:"bg-success",warning:"bg-warning"}},defaultVariants:{variant:"default"}}),rS=S.forwardRef(({className:t,value:e=0,variant:r,size:n,showValue:s=!1,animated:i=!0,label:o,...l},c)=>{const u=Math.min(Math.max(e,0),100);return a.jsxs("div",{className:"space-y-2",children:[o&&a.jsx("div",{className:"text-sm text-foreground",children:o}),a.jsx(Ese,{ref:c,className:Oe(pLe({variant:r,size:n}),t),...l,children:a.jsx(DIe,{className:Oe(mLe({variant:r})),asChild:!0,children:a.jsx(Jo.div,{initial:{transform:"translateX(-100%)"},animate:{transform:`translateX(-${100-u}%)`},transition:{duration:i?1.2:0,ease:"easeInOut"}})})}),s&&a.jsxs(Jo.div,{className:"text-right text-xs font-semibold text-muted-foreground tabular-nums",initial:{opacity:0,y:-5},animate:{opacity:1,y:0},transition:{delay:i?.3:0,duration:.2},children:[Math.round(u),"%"]})]})});rS.displayName=Ese.displayName;function gLe({stats:t}){const e=wr();if(!(t!=null&&t.active_thesis_id))return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No thesis created yet. Create one to track your deadline."}),a.jsx(ve,{size:"sm",variant:"outline",onClick:()=>e("/thesis-manager"),children:"Go to My Thesis"})]})]});if(!(t!=null&&t.active_thesis_due_date))return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No deadline set. Add one in your thesis."}),a.jsx(ve,{size:"sm",variant:"outline",onClick:()=>e("/thesis-manager"),children:"Go to My Thesis"})]})]});const r=new Date(t.active_thesis_due_date),n=new Date,s=t.active_thesis_created_at?new Date(t.active_thesis_created_at):new Date(n.getTime()-180*24*60*60*1e3),i=lO(r,s),o=lO(n,s),l=lO(r,n),c=i>0?Math.min(100,Math.max(0,o/i*100)):100,u=t.active_thesis_target_words||15e3,d=t.total_word_count||0,h=Math.max(0,u-d),f=l>0?Math.ceil(h/l):0;let p="success";return l<7?p="destructive":l<30&&(p="warning"),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Timeline"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Deadline"}),a.jsx("span",{className:"font-semibold",children:t1(r,"MMMM d, yyyy",{locale:Pne})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"font-semibold",children:l>0?`${l} days remaining`:"Overdue"}),a.jsxs("span",{className:"text-muted-foreground",children:[Math.round(c),"%"]})]}),a.jsx(rS,{value:c,variant:p,size:"default",animated:!0})]})]}),h>0&&l>0&&a.jsx("div",{className:"pt-3 border-t",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Recommended:"}),a.jsxs("span",{className:"font-semibold text-primary",children:["~",f," words/day"]})]})})]})]})}function yLe({stats:t}){const e=(t==null?void 0:t.total_word_count)||0,r=(t==null?void 0:t.active_thesis_target_words)||15e3,n=Math.min(100,e/r*100),s=Math.max(0,r-e);return a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{className:"flex items-center gap-2",children:"Writing Progress"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Words written"}),a.jsx("span",{className:"font-semibold",children:e.toLocaleString()})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"font-semibold",children:[Math.round(n),"%"]}),a.jsxs("span",{className:"text-muted-foreground",children:["Goal: ",r.toLocaleString()," words"]})]}),a.jsx(rS,{value:n,variant:"primary",size:"default",animated:!0})]})]}),s>0&&a.jsx("div",{className:"pt-3 border-t",children:a.jsx("div",{className:"flex items-center gap-2 text-sm",children:a.jsxs("span",{className:"text-muted-foreground",children:[s.toLocaleString()," words remaining to reach goal"]})})})]})]})}function vLe({stats:t}){const e=wr();return((t==null?void 0:t.total_codebooks)||0)>0||((t==null?void 0:t.total_interviews)||0)>0||((t==null?void 0:t.total_codings)||0)>0?a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"flex items-center gap-2 text-base",children:"Qualitative Analysis"})}),a.jsx($e,{className:"space-y-3",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(MJ,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Codebooks"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_codebooks)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Wm,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Interviews"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_interviews)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(IE,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Coded Segments"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_codings)||0})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(vx,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Analyses"})]}),a.jsx("span",{className:"font-semibold",children:(t==null?void 0:t.total_analyses)||0})]})]})})]}):a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"flex items-center gap-2 text-base",children:[a.jsx(IE,{className:"h-5 w-5 text-primary"}),"Qualitative Analysis"]})}),a.jsxs($e,{children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"No qualitative data yet"}),a.jsx(ve,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/qualitative"),children:"Start Analysis"})]})]})}var xLe=Array.isArray,Ji=xLe,bLe=typeof zr=="object"&&zr&&zr.Object===Object&&zr,oae=bLe,wLe=oae,_Le=typeof self=="object"&&self&&self.Object===Object&&self,jLe=wLe||_Le||Function("return this")(),Cc=jLe,SLe=Cc,NLe=SLe.Symbol,nS=NLe,M7=nS,lae=Object.prototype,ALe=lae.hasOwnProperty,ELe=lae.toString,eb=M7?M7.toStringTag:void 0;function CLe(t){var e=ALe.call(t,eb),r=t[eb];try{t[eb]=void 0;var n=!0}catch{}var s=ELe.call(t);return n&&(e?t[eb]=r:delete t[eb]),s}var kLe=CLe,TLe=Object.prototype,PLe=TLe.toString;function OLe(t){return PLe.call(t)}var ILe=OLe,D7=nS,RLe=kLe,MLe=ILe,DLe="[object Null]",LLe="[object Undefined]",L7=D7?D7.toStringTag:void 0;function FLe(t){return t==null?t===void 0?LLe:DLe:L7&&L7 in Object(t)?RLe(t):MLe(t)}var ld=FLe;function $Le(t){return t!=null&&typeof t=="object"}var cd=$Le,BLe=ld,ULe=cd,zLe="[object Symbol]";function HLe(t){return typeof t=="symbol"||ULe(t)&&BLe(t)==zLe}var _0=HLe,WLe=Ji,VLe=_0,qLe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,GLe=/^\w*$/;function KLe(t,e){if(WLe(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||VLe(t)?!0:GLe.test(t)||!qLe.test(t)||e!=null&&t in Object(e)}var E$=KLe;function YLe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var bf=YLe;const j0=qt(bf);var XLe=ld,QLe=bf,ZLe="[object AsyncFunction]",JLe="[object Function]",e5e="[object GeneratorFunction]",t5e="[object Proxy]";function r5e(t){if(!QLe(t))return!1;var e=XLe(t);return e==JLe||e==e5e||e==ZLe||e==t5e}var C$=r5e;const Ft=qt(C$);var n5e=Cc,s5e=n5e["__core-js_shared__"],i5e=s5e,DO=i5e,F7=function(){var t=/[^.]+$/.exec(DO&&DO.keys&&DO.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function a5e(t){return!!F7&&F7 in t}var o5e=a5e,l5e=Function.prototype,c5e=l5e.toString;function u5e(t){if(t!=null){try{return c5e.call(t)}catch{}try{return t+""}catch{}}return""}var cae=u5e,d5e=C$,h5e=o5e,f5e=bf,p5e=cae,m5e=/[\\^$.*+?()[\]{}|]/g,g5e=/^\[object .+?Constructor\]$/,y5e=Function.prototype,v5e=Object.prototype,x5e=y5e.toString,b5e=v5e.hasOwnProperty,w5e=RegExp("^"+x5e.call(b5e).replace(m5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _5e(t){if(!f5e(t)||h5e(t))return!1;var e=d5e(t)?w5e:g5e;return e.test(p5e(t))}var j5e=_5e;function S5e(t,e){return t==null?void 0:t[e]}var N5e=S5e,A5e=j5e,E5e=N5e;function C5e(t,e){var r=E5e(t,e);return A5e(r)?r:void 0}var hg=C5e,k5e=hg,T5e=k5e(Object,"create"),UT=T5e,$7=UT;function P5e(){this.__data__=$7?$7(null):{},this.size=0}var O5e=P5e;function I5e(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var R5e=I5e,M5e=UT,D5e="__lodash_hash_undefined__",L5e=Object.prototype,F5e=L5e.hasOwnProperty;function $5e(t){var e=this.__data__;if(M5e){var r=e[t];return r===D5e?void 0:r}return F5e.call(e,t)?e[t]:void 0}var B5e=$5e,U5e=UT,z5e=Object.prototype,H5e=z5e.hasOwnProperty;function W5e(t){var e=this.__data__;return U5e?e[t]!==void 0:H5e.call(e,t)}var V5e=W5e,q5e=UT,G5e="__lodash_hash_undefined__";function K5e(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=q5e&&e===void 0?G5e:e,this}var Y5e=K5e,X5e=O5e,Q5e=R5e,Z5e=B5e,J5e=V5e,e3e=Y5e;function S0(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}S0.prototype.clear=X5e;S0.prototype.delete=Q5e;S0.prototype.get=Z5e;S0.prototype.has=J5e;S0.prototype.set=e3e;var t3e=S0;function r3e(){this.__data__=[],this.size=0}var n3e=r3e;function s3e(t,e){return t===e||t!==t&&e!==e}var k$=s3e,i3e=k$;function a3e(t,e){for(var r=t.length;r--;)if(i3e(t[r][0],e))return r;return-1}var zT=a3e,o3e=zT,l3e=Array.prototype,c3e=l3e.splice;function u3e(t){var e=this.__data__,r=o3e(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():c3e.call(e,r,1),--this.size,!0}var d3e=u3e,h3e=zT;function f3e(t){var e=this.__data__,r=h3e(e,t);return r<0?void 0:e[r][1]}var p3e=f3e,m3e=zT;function g3e(t){return m3e(this.__data__,t)>-1}var y3e=g3e,v3e=zT;function x3e(t,e){var r=this.__data__,n=v3e(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var b3e=x3e,w3e=n3e,_3e=d3e,j3e=p3e,S3e=y3e,N3e=b3e;function N0(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}N0.prototype.clear=w3e;N0.prototype.delete=_3e;N0.prototype.get=j3e;N0.prototype.has=S3e;N0.prototype.set=N3e;var HT=N0,A3e=hg,E3e=Cc,C3e=A3e(E3e,"Map"),T$=C3e,B7=t3e,k3e=HT,T3e=T$;function P3e(){this.size=0,this.__data__={hash:new B7,map:new(T3e||k3e),string:new B7}}var O3e=P3e;function I3e(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var R3e=I3e,M3e=R3e;function D3e(t,e){var r=t.__data__;return M3e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var WT=D3e,L3e=WT;function F3e(t){var e=L3e(this,t).delete(t);return this.size-=e?1:0,e}var $3e=F3e,B3e=WT;function U3e(t){return B3e(this,t).get(t)}var z3e=U3e,H3e=WT;function W3e(t){return H3e(this,t).has(t)}var V3e=W3e,q3e=WT;function G3e(t,e){var r=q3e(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var K3e=G3e,Y3e=O3e,X3e=$3e,Q3e=z3e,Z3e=V3e,J3e=K3e;function A0(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}A0.prototype.clear=Y3e;A0.prototype.delete=X3e;A0.prototype.get=Q3e;A0.prototype.has=Z3e;A0.prototype.set=J3e;var P$=A0,uae=P$,eFe="Expected a function";function O$(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(eFe);var r=function(){var n=arguments,s=e?e.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var o=t.apply(this,n);return r.cache=i.set(s,o)||i,o};return r.cache=new(O$.Cache||uae),r}O$.Cache=uae;var dae=O$;const tFe=qt(dae);var rFe=dae,nFe=500;function sFe(t){var e=rFe(t,function(n){return r.size===nFe&&r.clear(),n}),r=e.cache;return e}var iFe=sFe,aFe=iFe,oFe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lFe=/\\(\\)?/g,cFe=aFe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(oFe,function(r,n,s,i){e.push(s?i.replace(lFe,"$1"):n||r)}),e}),uFe=cFe;function dFe(t,e){for(var r=-1,n=t==null?0:t.length,s=Array(n);++r<n;)s[r]=e(t[r],r,t);return s}var I$=dFe,U7=nS,hFe=I$,fFe=Ji,pFe=_0,mFe=1/0,z7=U7?U7.prototype:void 0,H7=z7?z7.toString:void 0;function hae(t){if(typeof t=="string")return t;if(fFe(t))return hFe(t,hae)+"";if(pFe(t))return H7?H7.call(t):"";var e=t+"";return e=="0"&&1/t==-mFe?"-0":e}var gFe=hae,yFe=gFe;function vFe(t){return t==null?"":yFe(t)}var fae=vFe,xFe=Ji,bFe=E$,wFe=uFe,_Fe=fae;function jFe(t,e){return xFe(t)?t:bFe(t,e)?[t]:wFe(_Fe(t))}var pae=jFe,SFe=_0,NFe=1/0;function AFe(t){if(typeof t=="string"||SFe(t))return t;var e=t+"";return e=="0"&&1/t==-NFe?"-0":e}var VT=AFe,EFe=pae,CFe=VT;function kFe(t,e){e=EFe(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[CFe(e[r++])];return r&&r==n?t:void 0}var R$=kFe,TFe=R$;function PFe(t,e,r){var n=t==null?void 0:TFe(t,e);return n===void 0?r:n}var mae=PFe;const ol=qt(mae);function OFe(t){return t==null}var IFe=OFe;const Qt=qt(IFe);var RFe=ld,MFe=Ji,DFe=cd,LFe="[object String]";function FFe(t){return typeof t=="string"||!MFe(t)&&DFe(t)&&RFe(t)==LFe}var $Fe=FFe;const sS=qt($Fe);var gae={exports:{}},mr={};/**
 * @license React
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var M$=Symbol.for("react.element"),D$=Symbol.for("react.portal"),qT=Symbol.for("react.fragment"),GT=Symbol.for("react.strict_mode"),KT=Symbol.for("react.profiler"),YT=Symbol.for("react.provider"),XT=Symbol.for("react.context"),BFe=Symbol.for("react.server_context"),QT=Symbol.for("react.forward_ref"),ZT=Symbol.for("react.suspense"),JT=Symbol.for("react.suspense_list"),e2=Symbol.for("react.memo"),t2=Symbol.for("react.lazy"),UFe=Symbol.for("react.offscreen"),yae;yae=Symbol.for("react.module.reference");function No(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case M$:switch(t=t.type,t){case qT:case KT:case GT:case ZT:case JT:return t;default:switch(t=t&&t.$$typeof,t){case BFe:case XT:case QT:case t2:case e2:case YT:return t;default:return e}}case D$:return e}}}mr.ContextConsumer=XT;mr.ContextProvider=YT;mr.Element=M$;mr.ForwardRef=QT;mr.Fragment=qT;mr.Lazy=t2;mr.Memo=e2;mr.Portal=D$;mr.Profiler=KT;mr.StrictMode=GT;mr.Suspense=ZT;mr.SuspenseList=JT;mr.isAsyncMode=function(){return!1};mr.isConcurrentMode=function(){return!1};mr.isContextConsumer=function(t){return No(t)===XT};mr.isContextProvider=function(t){return No(t)===YT};mr.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===M$};mr.isForwardRef=function(t){return No(t)===QT};mr.isFragment=function(t){return No(t)===qT};mr.isLazy=function(t){return No(t)===t2};mr.isMemo=function(t){return No(t)===e2};mr.isPortal=function(t){return No(t)===D$};mr.isProfiler=function(t){return No(t)===KT};mr.isStrictMode=function(t){return No(t)===GT};mr.isSuspense=function(t){return No(t)===ZT};mr.isSuspenseList=function(t){return No(t)===JT};mr.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===qT||t===KT||t===GT||t===ZT||t===JT||t===UFe||typeof t=="object"&&t!==null&&(t.$$typeof===t2||t.$$typeof===e2||t.$$typeof===YT||t.$$typeof===XT||t.$$typeof===QT||t.$$typeof===yae||t.getModuleId!==void 0)};mr.typeOf=No;gae.exports=mr;var zFe=gae.exports,HFe=ld,WFe=cd,VFe="[object Number]";function qFe(t){return typeof t=="number"||WFe(t)&&HFe(t)==VFe}var vae=qFe;const GFe=qt(vae);var KFe=vae;function YFe(t){return KFe(t)&&t!=+t}var XFe=YFe;const iS=qt(XFe);var co=function(e){return e===0?0:e>0?1:-1},lp=function(e){return sS(e)&&e.indexOf("%")===e.length-1},tt=function(e){return GFe(e)&&!iS(e)},Kn=function(e){return tt(e)||sS(e)},QFe=0,r2=function(e){var r=++QFe;return"".concat(e||"").concat(r)},Ui=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!tt(e)&&!sS(e))return n;var i;if(lp(e)){var o=e.indexOf("%");i=r*parseFloat(e.slice(0,o))/100}else i=+e;return iS(i)&&(i=n),s&&i>r&&(i=r),i},$g=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},ZFe=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},s=0;s<r;s++)if(!n[e[s]])n[e[s]]=!0;else return!0;return!1},W7=function(e,r){return tt(e)&&tt(r)?function(n){return e+n*(r-e)}:function(){return r}};function D4(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):ol(n,e))===r})}function L4(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function F4(t){"@babel/helpers - typeof";return F4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F4(t)}var JFe=["viewBox","children"],e6e=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],V7=["points","pathLength"],LO={svg:JFe,polygon:V7,polyline:V7},L$=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],lC=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(S.isValidElement(e)&&(n=e.props),!j0(n))return null;var s={};return Object.keys(n).forEach(function(i){L$.includes(i)&&(s[i]=r||function(o){return n[i](n,o)})}),s},t6e=function(e,r,n){return function(s){return e(r,n,s),null}},n2=function(e,r,n){if(!j0(e)||F4(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(i){var o=e[i];L$.includes(i)&&typeof o=="function"&&(s||(s={}),s[i]=t6e(o,r,n))}),s},r6e=["children"],n6e=["children"];function q7(t,e){if(t==null)return{};var r=s6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function s6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var G7={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Lu=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},K7=null,FO=null,F$=function t(e){if(e===K7&&Array.isArray(FO))return FO;var r=[];return S.Children.forEach(e,function(n){Qt(n)||(zFe.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),FO=r,K7=e,r};function gc(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(s){return Lu(s)}):n=[Lu(e)],F$(t).forEach(function(s){var i=ol(s,"type.displayName")||ol(s,"type.name");n.indexOf(i)!==-1&&r.push(s)}),r}function eo(t,e){var r=gc(t,e);return r&&r[0]}var Y7=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,s=r.height;return!(!tt(n)||n<=0||!tt(s)||s<=0)},i6e=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],a6e=function(e){return e&&e.type&&sS(e.type)&&i6e.indexOf(e.type)>=0},o6e=function(e,r,n,s){var i,o=(i=LO==null?void 0:LO[s])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Ft(e)&&(s&&o.includes(r)||e6e.includes(r))||n&&L$.includes(r)},Lt=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(S.isValidElement(e)&&(s=e.props),!j0(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;o6e((l=s)===null||l===void 0?void 0:l[o],o,r,n)&&(i[o]=s[o])}),i},$4=function t(e,r){if(e===r)return!0;var n=S.Children.count(e);if(n!==S.Children.count(r))return!1;if(n===0)return!0;if(n===1)return X7(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var s=0;s<n;s++){var i=e[s],o=r[s];if(Array.isArray(i)||Array.isArray(o)){if(!t(i,o))return!1}else if(!X7(i,o))return!1}return!0},X7=function(e,r){if(Qt(e)&&Qt(r))return!0;if(!Qt(e)&&!Qt(r)){var n=e.props||{},s=n.children,i=q7(n,r6e),o=r.props||{},l=o.children,c=q7(o,n6e);return s&&l?L4(i,c)&&$4(s,l):!s&&!l?L4(i,c):!1}return!1},Q7=function(e,r){var n=[],s={};return F$(e).forEach(function(i,o){if(a6e(i))n.push(i);else if(i){var l=Lu(i.type),c=r[l]||{},u=c.handler,d=c.once;if(u&&(!d||!s[l])){var h=u(i,l,o);n.push(h),s[l]=!0}}}),n},l6e=function(e){var r=e&&e.type;return r&&G7[r]?G7[r]:null},c6e=function(e,r){return F$(r).indexOf(e)},u6e=["children","width","height","viewBox","className","style","title","desc"];function B4(){return B4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},B4.apply(this,arguments)}function d6e(t,e){if(t==null)return{};var r=h6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function h6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function U4(t){var e=t.children,r=t.width,n=t.height,s=t.viewBox,i=t.className,o=t.style,l=t.title,c=t.desc,u=d6e(t,u6e),d=s||{width:r,height:n,x:0,y:0},h=Jt("recharts-surface",i);return me.createElement("svg",B4({},Lt(u,!0,"svg"),{className:h,width:r,height:n,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),me.createElement("title",null,l),me.createElement("desc",null,c),e)}var f6e=["children","className"];function z4(){return z4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},z4.apply(this,arguments)}function p6e(t,e){if(t==null)return{};var r=m6e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function m6e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var mn=me.forwardRef(function(t,e){var r=t.children,n=t.className,s=p6e(t,f6e),i=Jt("recharts-layer",n);return me.createElement("g",z4({className:i},Lt(s,!0),{ref:e}),r)}),Fu=function(e,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i]};function g6e(t,e,r){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),r=r>s?s:r,r<0&&(r+=s),s=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(s);++n<s;)i[n]=t[n+e];return i}var y6e=g6e,v6e=y6e;function x6e(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:v6e(t,e,r)}var b6e=x6e,w6e="\\ud800-\\udfff",_6e="\\u0300-\\u036f",j6e="\\ufe20-\\ufe2f",S6e="\\u20d0-\\u20ff",N6e=_6e+j6e+S6e,A6e="\\ufe0e\\ufe0f",E6e="\\u200d",C6e=RegExp("["+E6e+w6e+N6e+A6e+"]");function k6e(t){return C6e.test(t)}var xae=k6e;function T6e(t){return t.split("")}var P6e=T6e,bae="\\ud800-\\udfff",O6e="\\u0300-\\u036f",I6e="\\ufe20-\\ufe2f",R6e="\\u20d0-\\u20ff",M6e=O6e+I6e+R6e,D6e="\\ufe0e\\ufe0f",L6e="["+bae+"]",H4="["+M6e+"]",W4="\\ud83c[\\udffb-\\udfff]",F6e="(?:"+H4+"|"+W4+")",wae="[^"+bae+"]",_ae="(?:\\ud83c[\\udde6-\\uddff]){2}",jae="[\\ud800-\\udbff][\\udc00-\\udfff]",$6e="\\u200d",Sae=F6e+"?",Nae="["+D6e+"]?",B6e="(?:"+$6e+"(?:"+[wae,_ae,jae].join("|")+")"+Nae+Sae+")*",U6e=Nae+Sae+B6e,z6e="(?:"+[wae+H4+"?",H4,_ae,jae,L6e].join("|")+")",H6e=RegExp(W4+"(?="+W4+")|"+z6e+U6e,"g");function W6e(t){return t.match(H6e)||[]}var V6e=W6e,q6e=P6e,G6e=xae,K6e=V6e;function Y6e(t){return G6e(t)?K6e(t):q6e(t)}var X6e=Y6e,Q6e=b6e,Z6e=xae,J6e=X6e,e$e=fae;function t$e(t){return function(e){e=e$e(e);var r=Z6e(e)?J6e(e):void 0,n=r?r[0]:e.charAt(0),s=r?Q6e(r,1).join(""):e.slice(1);return n[t]()+s}}var r$e=t$e,n$e=r$e,s$e=n$e("toUpperCase"),i$e=s$e;const s2=qt(i$e);function Cr(t){return function(){return t}}const Aae=Math.cos,cC=Math.sin,gl=Math.sqrt,uC=Math.PI,i2=2*uC,V4=Math.PI,q4=2*V4,Vf=1e-6,a$e=q4-Vf;function Eae(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function o$e(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Eae;const r=10**e;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*r)/r+n[s]}}class l$e{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Eae:o$e(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,s){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(e,r,n,s,i,o){this._append`C${+e},${+r},${+n},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(e,r,n,s,i){if(e=+e,r=+r,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=n-e,u=s-r,d=o-e,h=l-r,f=d*d+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(f>Vf)if(!(Math.abs(h*c-u*d)>Vf)||!i)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,g=s-l,m=c*c+u*u,v=p*p+g*g,y=Math.sqrt(m),x=Math.sqrt(f),b=i*Math.tan((V4-Math.acos((m+f-v)/(2*y*x)))/2),w=b/x,j=b/y;Math.abs(w-1)>Vf&&this._append`L${e+w*d},${r+w*h}`,this._append`A${i},${i},0,0,${+(h*p>d*g)},${this._x1=e+j*c},${this._y1=r+j*u}`}}arc(e,r,n,s,i,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(s),c=n*Math.sin(s),u=e+l,d=r+c,h=1^o,f=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Vf||Math.abs(this._y1-d)>Vf)&&this._append`L${u},${d}`,n&&(f<0&&(f=f%q4+q4),f>a$e?this._append`A${n},${n},0,1,${h},${e-l},${r-c}A${n},${n},0,1,${h},${this._x1=u},${this._y1=d}`:f>Vf&&this._append`A${n},${n},0,${+(f>=V4)},${h},${this._x1=e+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(e,r,n,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function $$(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new l$e(e)}function B$(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Cae(t){this._context=t}Cae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function a2(t){return new Cae(t)}function kae(t){return t[0]}function Tae(t){return t[1]}function Pae(t,e){var r=Cr(!0),n=null,s=a2,i=null,o=$$(l);t=typeof t=="function"?t:t===void 0?kae:Cr(t),e=typeof e=="function"?e:e===void 0?Tae:Cr(e);function l(c){var u,d=(c=B$(c)).length,h,f=!1,p;for(n==null&&(i=s(p=o())),u=0;u<=d;++u)!(u<d&&r(h=c[u],u,c))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+t(h,u,c),+e(h,u,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:Cr(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:Cr(+c),l):e},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Cr(!!c),l):r},l.curve=function(c){return arguments.length?(s=c,n!=null&&(i=s(n)),l):s},l.context=function(c){return arguments.length?(c==null?n=i=null:i=s(n=c),l):n},l}function xN(t,e,r){var n=null,s=Cr(!0),i=null,o=a2,l=null,c=$$(u);t=typeof t=="function"?t:t===void 0?kae:Cr(+t),e=typeof e=="function"?e:Cr(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?Tae:Cr(+r);function u(h){var f,p,g,m=(h=B$(h)).length,v,y=!1,x,b=new Array(m),w=new Array(m);for(i==null&&(l=o(x=c())),f=0;f<=m;++f){if(!(f<m&&s(v=h[f],f,h))===y)if(y=!y)p=f,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),g=f-1;g>=p;--g)l.point(b[g],w[g]);l.lineEnd(),l.areaEnd()}y&&(b[f]=+t(v,f,h),w[f]=+e(v,f,h),l.point(n?+n(v,f,h):b[f],r?+r(v,f,h):w[f]))}if(x)return l=null,x+""||null}function d(){return Pae().defined(s).curve(o).context(i)}return u.x=function(h){return arguments.length?(t=typeof h=="function"?h:Cr(+h),n=null,u):t},u.x0=function(h){return arguments.length?(t=typeof h=="function"?h:Cr(+h),u):t},u.x1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:Cr(+h),u):n},u.y=function(h){return arguments.length?(e=typeof h=="function"?h:Cr(+h),r=null,u):e},u.y0=function(h){return arguments.length?(e=typeof h=="function"?h:Cr(+h),u):e},u.y1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:Cr(+h),u):r},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(r)},u.lineX1=function(){return d().x(n).y(e)},u.defined=function(h){return arguments.length?(s=typeof h=="function"?h:Cr(!!h),u):s},u.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),u):o},u.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),u):i},u}class Oae{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function c$e(t){return new Oae(t,!0)}function u$e(t){return new Oae(t,!1)}const U$={draw(t,e){const r=gl(e/uC);t.moveTo(r,0),t.arc(0,0,r,0,i2)}},d$e={draw(t,e){const r=gl(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Iae=gl(1/3),h$e=Iae*2,f$e={draw(t,e){const r=gl(e/h$e),n=r*Iae;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},p$e={draw(t,e){const r=gl(e),n=-r/2;t.rect(n,n,r,r)}},m$e=.8908130915292852,Rae=cC(uC/10)/cC(7*uC/10),g$e=cC(i2/10)*Rae,y$e=-Aae(i2/10)*Rae,v$e={draw(t,e){const r=gl(e*m$e),n=g$e*r,s=y$e*r;t.moveTo(0,-r),t.lineTo(n,s);for(let i=1;i<5;++i){const o=i2*i/5,l=Aae(o),c=cC(o);t.lineTo(c*r,-l*r),t.lineTo(l*n-c*s,c*n+l*s)}t.closePath()}},$O=gl(3),x$e={draw(t,e){const r=-gl(e/($O*3));t.moveTo(0,r*2),t.lineTo(-$O*r,-r),t.lineTo($O*r,-r),t.closePath()}},Fa=-.5,$a=gl(3)/2,G4=1/gl(12),b$e=(G4/2+1)*3,w$e={draw(t,e){const r=gl(e/b$e),n=r/2,s=r*G4,i=n,o=r*G4+r,l=-i,c=o;t.moveTo(n,s),t.lineTo(i,o),t.lineTo(l,c),t.lineTo(Fa*n-$a*s,$a*n+Fa*s),t.lineTo(Fa*i-$a*o,$a*i+Fa*o),t.lineTo(Fa*l-$a*c,$a*l+Fa*c),t.lineTo(Fa*n+$a*s,Fa*s-$a*n),t.lineTo(Fa*i+$a*o,Fa*o-$a*i),t.lineTo(Fa*l+$a*c,Fa*c-$a*l),t.closePath()}};function _$e(t,e){let r=null,n=$$(s);t=typeof t=="function"?t:Cr(t||U$),e=typeof e=="function"?e:Cr(e===void 0?64:+e);function s(){let i;if(r||(r=i=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),i)return r=null,i+""||null}return s.type=function(i){return arguments.length?(t=typeof i=="function"?i:Cr(i),s):t},s.size=function(i){return arguments.length?(e=typeof i=="function"?i:Cr(+i),s):e},s.context=function(i){return arguments.length?(r=i??null,s):r},s}function dC(){}function hC(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Mae(t){this._context=t}Mae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:hC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:hC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function j$e(t){return new Mae(t)}function Dae(t){this._context=t}Dae.prototype={areaStart:dC,areaEnd:dC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:hC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function S$e(t){return new Dae(t)}function Lae(t){this._context=t}Lae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:hC(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function N$e(t){return new Lae(t)}function Fae(t){this._context=t}Fae.prototype={areaStart:dC,areaEnd:dC,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function A$e(t){return new Fae(t)}function Z7(t){return t<0?-1:1}function J7(t,e,r){var n=t._x1-t._x0,s=e-t._x1,i=(t._y1-t._y0)/(n||s<0&&-0),o=(r-t._y1)/(s||n<0&&-0),l=(i*s+o*n)/(n+s);return(Z7(i)+Z7(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function eW(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function BO(t,e,r){var n=t._x0,s=t._y0,i=t._x1,o=t._y1,l=(i-n)/3;t._context.bezierCurveTo(n+l,s+l*e,i-l,o-l*r,i,o)}function fC(t){this._context=t}fC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:BO(this,this._t0,eW(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,BO(this,eW(this,r=J7(this,t,e)),r);break;default:BO(this,this._t0,r=J7(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function $ae(t){this._context=new Bae(t)}($ae.prototype=Object.create(fC.prototype)).point=function(t,e){fC.prototype.point.call(this,e,t)};function Bae(t){this._context=t}Bae.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,s,i){this._context.bezierCurveTo(e,t,n,r,i,s)}};function E$e(t){return new fC(t)}function C$e(t){return new $ae(t)}function Uae(t){this._context=t}Uae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=tW(t),s=tW(e),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function tW(t){var e,r=t.length-1,n,s=new Array(r),i=new Array(r),o=new Array(r);for(s[0]=0,i[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)s[e]=1,i[e]=4,o[e]=4*t[e]+2*t[e+1];for(s[r-1]=2,i[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=s[e]/i[e-1],i[e]-=n,o[e]-=n*o[e-1];for(s[r-1]=o[r-1]/i[r-1],e=r-2;e>=0;--e)s[e]=(o[e]-s[e+1])/i[e];for(i[r-1]=(t[r]+s[r-1])/2,e=0;e<r-1;++e)i[e]=2*t[e+1]-s[e+1];return[s,i]}function k$e(t){return new Uae(t)}function o2(t,e){this._context=t,this._t=e}o2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function T$e(t){return new o2(t,.5)}function P$e(t){return new o2(t,0)}function O$e(t){return new o2(t,1)}function Ax(t,e){if((o=t.length)>1)for(var r=1,n,s,i=t[e[0]],o,l=i.length;r<o;++r)for(s=i,i=t[e[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(s[n][1])?s[n][0]:s[n][1]}function K4(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function I$e(t,e){return t[e]}function R$e(t){const e=[];return e.key=t,e}function M$e(){var t=Cr([]),e=K4,r=Ax,n=I$e;function s(i){var o=Array.from(t.apply(this,arguments),R$e),l,c=o.length,u=-1,d;for(const h of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+n(h,o[l].key,u,i)]).data=h;for(l=0,d=B$(e(o));l<c;++l)o[d[l]].index=l;return r(o,d),o}return s.keys=function(i){return arguments.length?(t=typeof i=="function"?i:Cr(Array.from(i)),s):t},s.value=function(i){return arguments.length?(n=typeof i=="function"?i:Cr(+i),s):n},s.order=function(i){return arguments.length?(e=i==null?K4:typeof i=="function"?i:Cr(Array.from(i)),s):e},s.offset=function(i){return arguments.length?(r=i??Ax,s):r},s}function D$e(t,e){if((n=t.length)>0){for(var r,n,s=0,i=t[0].length,o;s<i;++s){for(o=r=0;r<n;++r)o+=t[r][s][1]||0;if(o)for(r=0;r<n;++r)t[r][s][1]/=o}Ax(t,e)}}function L$e(t,e){if((s=t.length)>0){for(var r=0,n=t[e[0]],s,i=n.length;r<i;++r){for(var o=0,l=0;o<s;++o)l+=t[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}Ax(t,e)}}function F$e(t,e){if(!(!((o=t.length)>0)||!((i=(s=t[e[0]]).length)>0))){for(var r=0,n=1,s,i,o;n<i;++n){for(var l=0,c=0,u=0;l<o;++l){for(var d=t[e[l]],h=d[n][1]||0,f=d[n-1][1]||0,p=(h-f)/2,g=0;g<l;++g){var m=t[e[g]],v=m[n][1]||0,y=m[n-1][1]||0;p+=v-y}c+=h,u+=p*h}s[n-1][1]+=s[n-1][0]=r,c&&(r-=u/c)}s[n-1][1]+=s[n-1][0]=r,Ax(t,e)}}function l1(t){"@babel/helpers - typeof";return l1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l1(t)}var $$e=["type","size","sizeType"];function Y4(){return Y4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y4.apply(this,arguments)}function rW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function nW(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rW(Object(r),!0).forEach(function(n){B$e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function B$e(t,e,r){return e=U$e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function U$e(t){var e=z$e(t,"string");return l1(e)=="symbol"?e:e+""}function z$e(t,e){if(l1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(l1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function H$e(t,e){if(t==null)return{};var r=W$e(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function W$e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var zae={symbolCircle:U$,symbolCross:d$e,symbolDiamond:f$e,symbolSquare:p$e,symbolStar:v$e,symbolTriangle:x$e,symbolWye:w$e},V$e=Math.PI/180,q$e=function(e){var r="symbol".concat(s2(e));return zae[r]||U$},G$e=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var s=18*V$e;return 1.25*e*e*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},K$e=function(e,r){zae["symbol".concat(s2(e))]=r},z$=function(e){var r=e.type,n=r===void 0?"circle":r,s=e.size,i=s===void 0?64:s,o=e.sizeType,l=o===void 0?"area":o,c=H$e(e,$$e),u=nW(nW({},c),{},{type:n,size:i,sizeType:l}),d=function(){var v=q$e(n),y=_$e().type(v).size(G$e(i,l,n));return y()},h=u.className,f=u.cx,p=u.cy,g=Lt(u,!0);return f===+f&&p===+p&&i===+i?me.createElement("path",Y4({},g,{className:Jt("recharts-symbols",h),transform:"translate(".concat(f,", ").concat(p,")"),d:d()})):null};z$.registerSymbol=K$e;function Ex(t){"@babel/helpers - typeof";return Ex=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ex(t)}function X4(){return X4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},X4.apply(this,arguments)}function sW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Y$e(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sW(Object(r),!0).forEach(function(n){c1(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function X$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Q$e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wae(n.key),n)}}function Z$e(t,e,r){return e&&Q$e(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function J$e(t,e,r){return e=pC(e),e8e(t,Hae()?Reflect.construct(e,r||[],pC(t).constructor):e.apply(t,r))}function e8e(t,e){if(e&&(Ex(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return t8e(t)}function t8e(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Hae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hae=function(){return!!t})()}function pC(t){return pC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pC(t)}function r8e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Q4(t,e)}function Q4(t,e){return Q4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},Q4(t,e)}function c1(t,e,r){return e=Wae(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wae(t){var e=n8e(t,"string");return Ex(e)=="symbol"?e:e+""}function n8e(t,e){if(Ex(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ex(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ba=32,H$=function(t){function e(){return X$e(this,e),J$e(this,e,arguments)}return r8e(e,t),Z$e(e,[{key:"renderIcon",value:function(n){var s=this.props.inactiveColor,i=Ba/2,o=Ba/6,l=Ba/3,c=n.inactive?s:n.color;if(n.type==="plainline")return me.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:Ba,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return me.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
            H`).concat(Ba,"M").concat(2*l,",").concat(i,`
            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return me.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Ba/8,"h").concat(Ba,"v").concat(Ba*3/4,"h").concat(-Ba,"z"),className:"recharts-legend-icon"});if(me.isValidElement(n.legendIcon)){var u=Y$e({},n);return delete u.legendIcon,me.cloneElement(n.legendIcon,u)}return me.createElement(z$,{fill:c,cx:i,cy:i,size:Ba,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,s=this.props,i=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,u=s.inactiveColor,d={x:0,y:0,width:Ba,height:Ba},h={display:l==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,g){var m=p.formatter||c,v=Jt(c1(c1({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",p.inactive));if(p.type==="none")return null;var y=Ft(p.value)?null:p.value;Fu(!Ft(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var x=p.inactive?u:p.color;return me.createElement("li",X4({className:v,style:h,key:"legend-item-".concat(g)},n2(n.props,p,g)),me.createElement(U4,{width:o,height:o,viewBox:d,style:f},n.renderIcon(p)),me.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(y,p,g):y))})}},{key:"render",value:function(){var n=this.props,s=n.payload,i=n.layout,o=n.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return me.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(S.PureComponent);c1(H$,"displayName","Legend");c1(H$,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var s8e=HT;function i8e(){this.__data__=new s8e,this.size=0}var a8e=i8e;function o8e(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var l8e=o8e;function c8e(t){return this.__data__.get(t)}var u8e=c8e;function d8e(t){return this.__data__.has(t)}var h8e=d8e,f8e=HT,p8e=T$,m8e=P$,g8e=200;function y8e(t,e){var r=this.__data__;if(r instanceof f8e){var n=r.__data__;if(!p8e||n.length<g8e-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new m8e(n)}return r.set(t,e),this.size=r.size,this}var v8e=y8e,x8e=HT,b8e=a8e,w8e=l8e,_8e=u8e,j8e=h8e,S8e=v8e;function E0(t){var e=this.__data__=new x8e(t);this.size=e.size}E0.prototype.clear=b8e;E0.prototype.delete=w8e;E0.prototype.get=_8e;E0.prototype.has=j8e;E0.prototype.set=S8e;var Vae=E0,N8e="__lodash_hash_undefined__";function A8e(t){return this.__data__.set(t,N8e),this}var E8e=A8e;function C8e(t){return this.__data__.has(t)}var k8e=C8e,T8e=P$,P8e=E8e,O8e=k8e;function mC(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new T8e;++e<r;)this.add(t[e])}mC.prototype.add=mC.prototype.push=P8e;mC.prototype.has=O8e;var qae=mC;function I8e(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Gae=I8e;function R8e(t,e){return t.has(e)}var Kae=R8e,M8e=qae,D8e=Gae,L8e=Kae,F8e=1,$8e=2;function B8e(t,e,r,n,s,i){var o=r&F8e,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var u=i.get(t),d=i.get(e);if(u&&d)return u==e&&d==t;var h=-1,f=!0,p=r&$8e?new M8e:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var g=t[h],m=e[h];if(n)var v=o?n(m,g,h,e,t,i):n(g,m,h,t,e,i);if(v!==void 0){if(v)continue;f=!1;break}if(p){if(!D8e(e,function(y,x){if(!L8e(p,x)&&(g===y||s(g,y,r,n,i)))return p.push(x)})){f=!1;break}}else if(!(g===m||s(g,m,r,n,i))){f=!1;break}}return i.delete(t),i.delete(e),f}var Yae=B8e,U8e=Cc,z8e=U8e.Uint8Array,H8e=z8e;function W8e(t){var e=-1,r=Array(t.size);return t.forEach(function(n,s){r[++e]=[s,n]}),r}var V8e=W8e;function q8e(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var W$=q8e,iW=nS,aW=H8e,G8e=k$,K8e=Yae,Y8e=V8e,X8e=W$,Q8e=1,Z8e=2,J8e="[object Boolean]",eBe="[object Date]",tBe="[object Error]",rBe="[object Map]",nBe="[object Number]",sBe="[object RegExp]",iBe="[object Set]",aBe="[object String]",oBe="[object Symbol]",lBe="[object ArrayBuffer]",cBe="[object DataView]",oW=iW?iW.prototype:void 0,UO=oW?oW.valueOf:void 0;function uBe(t,e,r,n,s,i,o){switch(r){case cBe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case lBe:return!(t.byteLength!=e.byteLength||!i(new aW(t),new aW(e)));case J8e:case eBe:case nBe:return G8e(+t,+e);case tBe:return t.name==e.name&&t.message==e.message;case sBe:case aBe:return t==e+"";case rBe:var l=Y8e;case iBe:var c=n&Q8e;if(l||(l=X8e),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;n|=Z8e,o.set(t,e);var d=K8e(l(t),l(e),n,s,i,o);return o.delete(t),d;case oBe:if(UO)return UO.call(t)==UO.call(e)}return!1}var dBe=uBe;function hBe(t,e){for(var r=-1,n=e.length,s=t.length;++r<n;)t[s+r]=e[r];return t}var Xae=hBe,fBe=Xae,pBe=Ji;function mBe(t,e,r){var n=e(t);return pBe(t)?n:fBe(n,r(t))}var gBe=mBe;function yBe(t,e){for(var r=-1,n=t==null?0:t.length,s=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[s++]=o)}return i}var vBe=yBe;function xBe(){return[]}var bBe=xBe,wBe=vBe,_Be=bBe,jBe=Object.prototype,SBe=jBe.propertyIsEnumerable,lW=Object.getOwnPropertySymbols,NBe=lW?function(t){return t==null?[]:(t=Object(t),wBe(lW(t),function(e){return SBe.call(t,e)}))}:_Be,ABe=NBe;function EBe(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var CBe=EBe,kBe=ld,TBe=cd,PBe="[object Arguments]";function OBe(t){return TBe(t)&&kBe(t)==PBe}var IBe=OBe,cW=IBe,RBe=cd,Qae=Object.prototype,MBe=Qae.hasOwnProperty,DBe=Qae.propertyIsEnumerable,LBe=cW(function(){return arguments}())?cW:function(t){return RBe(t)&&MBe.call(t,"callee")&&!DBe.call(t,"callee")},V$=LBe,gC={exports:{}};function FBe(){return!1}var $Be=FBe;gC.exports;(function(t,e){var r=Cc,n=$Be,s=e&&!e.nodeType&&e,i=s&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===s,l=o?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;t.exports=u})(gC,gC.exports);var Zae=gC.exports,BBe=9007199254740991,UBe=/^(?:0|[1-9]\d*)$/;function zBe(t,e){var r=typeof t;return e=e??BBe,!!e&&(r=="number"||r!="symbol"&&UBe.test(t))&&t>-1&&t%1==0&&t<e}var q$=zBe,HBe=9007199254740991;function WBe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=HBe}var G$=WBe,VBe=ld,qBe=G$,GBe=cd,KBe="[object Arguments]",YBe="[object Array]",XBe="[object Boolean]",QBe="[object Date]",ZBe="[object Error]",JBe="[object Function]",eUe="[object Map]",tUe="[object Number]",rUe="[object Object]",nUe="[object RegExp]",sUe="[object Set]",iUe="[object String]",aUe="[object WeakMap]",oUe="[object ArrayBuffer]",lUe="[object DataView]",cUe="[object Float32Array]",uUe="[object Float64Array]",dUe="[object Int8Array]",hUe="[object Int16Array]",fUe="[object Int32Array]",pUe="[object Uint8Array]",mUe="[object Uint8ClampedArray]",gUe="[object Uint16Array]",yUe="[object Uint32Array]",Br={};Br[cUe]=Br[uUe]=Br[dUe]=Br[hUe]=Br[fUe]=Br[pUe]=Br[mUe]=Br[gUe]=Br[yUe]=!0;Br[KBe]=Br[YBe]=Br[oUe]=Br[XBe]=Br[lUe]=Br[QBe]=Br[ZBe]=Br[JBe]=Br[eUe]=Br[tUe]=Br[rUe]=Br[nUe]=Br[sUe]=Br[iUe]=Br[aUe]=!1;function vUe(t){return GBe(t)&&qBe(t.length)&&!!Br[VBe(t)]}var xUe=vUe;function bUe(t){return function(e){return t(e)}}var Jae=bUe,yC={exports:{}};yC.exports;(function(t,e){var r=oae,n=e&&!e.nodeType&&e,s=n&&!0&&t&&!t.nodeType&&t,i=s&&s.exports===n,o=i&&r.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=l})(yC,yC.exports);var wUe=yC.exports,_Ue=xUe,jUe=Jae,uW=wUe,dW=uW&&uW.isTypedArray,SUe=dW?jUe(dW):_Ue,eoe=SUe,NUe=CBe,AUe=V$,EUe=Ji,CUe=Zae,kUe=q$,TUe=eoe,PUe=Object.prototype,OUe=PUe.hasOwnProperty;function IUe(t,e){var r=EUe(t),n=!r&&AUe(t),s=!r&&!n&&CUe(t),i=!r&&!n&&!s&&TUe(t),o=r||n||s||i,l=o?NUe(t.length,String):[],c=l.length;for(var u in t)(e||OUe.call(t,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||kUe(u,c)))&&l.push(u);return l}var RUe=IUe,MUe=Object.prototype;function DUe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||MUe;return t===r}var LUe=DUe;function FUe(t,e){return function(r){return t(e(r))}}var toe=FUe,$Ue=toe,BUe=$Ue(Object.keys,Object),UUe=BUe,zUe=LUe,HUe=UUe,WUe=Object.prototype,VUe=WUe.hasOwnProperty;function qUe(t){if(!zUe(t))return HUe(t);var e=[];for(var r in Object(t))VUe.call(t,r)&&r!="constructor"&&e.push(r);return e}var GUe=qUe,KUe=C$,YUe=G$;function XUe(t){return t!=null&&YUe(t.length)&&!KUe(t)}var l2=XUe,QUe=RUe,ZUe=GUe,JUe=l2;function eze(t){return JUe(t)?QUe(t):ZUe(t)}var K$=eze,tze=gBe,rze=ABe,nze=K$;function sze(t){return tze(t,nze,rze)}var ize=sze,hW=ize,aze=1,oze=Object.prototype,lze=oze.hasOwnProperty;function cze(t,e,r,n,s,i){var o=r&aze,l=hW(t),c=l.length,u=hW(e),d=u.length;if(c!=d&&!o)return!1;for(var h=c;h--;){var f=l[h];if(!(o?f in e:lze.call(e,f)))return!1}var p=i.get(t),g=i.get(e);if(p&&g)return p==e&&g==t;var m=!0;i.set(t,e),i.set(e,t);for(var v=o;++h<c;){f=l[h];var y=t[f],x=e[f];if(n)var b=o?n(x,y,f,e,t,i):n(y,x,f,t,e,i);if(!(b===void 0?y===x||s(y,x,r,n,i):b)){m=!1;break}v||(v=f=="constructor")}if(m&&!v){var w=t.constructor,j=e.constructor;w!=j&&"constructor"in t&&"constructor"in e&&!(typeof w=="function"&&w instanceof w&&typeof j=="function"&&j instanceof j)&&(m=!1)}return i.delete(t),i.delete(e),m}var uze=cze,dze=hg,hze=Cc,fze=dze(hze,"DataView"),pze=fze,mze=hg,gze=Cc,yze=mze(gze,"Promise"),vze=yze,xze=hg,bze=Cc,wze=xze(bze,"Set"),roe=wze,_ze=hg,jze=Cc,Sze=_ze(jze,"WeakMap"),Nze=Sze,Z4=pze,J4=T$,eL=vze,tL=roe,rL=Nze,noe=ld,C0=cae,fW="[object Map]",Aze="[object Object]",pW="[object Promise]",mW="[object Set]",gW="[object WeakMap]",yW="[object DataView]",Eze=C0(Z4),Cze=C0(J4),kze=C0(eL),Tze=C0(tL),Pze=C0(rL),qf=noe;(Z4&&qf(new Z4(new ArrayBuffer(1)))!=yW||J4&&qf(new J4)!=fW||eL&&qf(eL.resolve())!=pW||tL&&qf(new tL)!=mW||rL&&qf(new rL)!=gW)&&(qf=function(t){var e=noe(t),r=e==Aze?t.constructor:void 0,n=r?C0(r):"";if(n)switch(n){case Eze:return yW;case Cze:return fW;case kze:return pW;case Tze:return mW;case Pze:return gW}return e});var Oze=qf,zO=Vae,Ize=Yae,Rze=dBe,Mze=uze,vW=Oze,xW=Ji,bW=Zae,Dze=eoe,Lze=1,wW="[object Arguments]",_W="[object Array]",bN="[object Object]",Fze=Object.prototype,jW=Fze.hasOwnProperty;function $ze(t,e,r,n,s,i){var o=xW(t),l=xW(e),c=o?_W:vW(t),u=l?_W:vW(e);c=c==wW?bN:c,u=u==wW?bN:u;var d=c==bN,h=u==bN,f=c==u;if(f&&bW(t)){if(!bW(e))return!1;o=!0,d=!1}if(f&&!d)return i||(i=new zO),o||Dze(t)?Ize(t,e,r,n,s,i):Rze(t,e,c,r,n,s,i);if(!(r&Lze)){var p=d&&jW.call(t,"__wrapped__"),g=h&&jW.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,v=g?e.value():e;return i||(i=new zO),s(m,v,r,n,i)}}return f?(i||(i=new zO),Mze(t,e,r,n,s,i)):!1}var Bze=$ze,Uze=Bze,SW=cd;function soe(t,e,r,n,s){return t===e?!0:t==null||e==null||!SW(t)&&!SW(e)?t!==t&&e!==e:Uze(t,e,r,n,soe,s)}var Y$=soe,zze=Vae,Hze=Y$,Wze=1,Vze=2;function qze(t,e,r,n){var s=r.length,i=s,o=!n;if(t==null)return!i;for(t=Object(t);s--;){var l=r[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<i;){l=r[s];var c=l[0],u=t[c],d=l[1];if(o&&l[2]){if(u===void 0&&!(c in t))return!1}else{var h=new zze;if(n)var f=n(u,d,c,t,e,h);if(!(f===void 0?Hze(d,u,Wze|Vze,n,h):f))return!1}}return!0}var Gze=qze,Kze=bf;function Yze(t){return t===t&&!Kze(t)}var ioe=Yze,Xze=ioe,Qze=K$;function Zze(t){for(var e=Qze(t),r=e.length;r--;){var n=e[r],s=t[n];e[r]=[n,s,Xze(s)]}return e}var Jze=Zze;function e9e(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var aoe=e9e,t9e=Gze,r9e=Jze,n9e=aoe;function s9e(t){var e=r9e(t);return e.length==1&&e[0][2]?n9e(e[0][0],e[0][1]):function(r){return r===t||t9e(r,t,e)}}var i9e=s9e;function a9e(t,e){return t!=null&&e in Object(t)}var o9e=a9e,l9e=pae,c9e=V$,u9e=Ji,d9e=q$,h9e=G$,f9e=VT;function p9e(t,e,r){e=l9e(e,t);for(var n=-1,s=e.length,i=!1;++n<s;){var o=f9e(e[n]);if(!(i=t!=null&&r(t,o)))break;t=t[o]}return i||++n!=s?i:(s=t==null?0:t.length,!!s&&h9e(s)&&d9e(o,s)&&(u9e(t)||c9e(t)))}var m9e=p9e,g9e=o9e,y9e=m9e;function v9e(t,e){return t!=null&&y9e(t,e,g9e)}var x9e=v9e,b9e=Y$,w9e=mae,_9e=x9e,j9e=E$,S9e=ioe,N9e=aoe,A9e=VT,E9e=1,C9e=2;function k9e(t,e){return j9e(t)&&S9e(e)?N9e(A9e(t),e):function(r){var n=w9e(r,t);return n===void 0&&n===e?_9e(r,t):b9e(e,n,E9e|C9e)}}var T9e=k9e;function P9e(t){return t}var k0=P9e;function O9e(t){return function(e){return e==null?void 0:e[t]}}var I9e=O9e,R9e=R$;function M9e(t){return function(e){return R9e(e,t)}}var D9e=M9e,L9e=I9e,F9e=D9e,$9e=E$,B9e=VT;function U9e(t){return $9e(t)?L9e(B9e(t)):F9e(t)}var z9e=U9e,H9e=i9e,W9e=T9e,V9e=k0,q9e=Ji,G9e=z9e;function K9e(t){return typeof t=="function"?t:t==null?V9e:typeof t=="object"?q9e(t)?W9e(t[0],t[1]):H9e(t):G9e(t)}var wf=K9e;function Y9e(t,e,r,n){for(var s=t.length,i=r+(n?1:-1);n?i--:++i<s;)if(e(t[i],i,t))return i;return-1}var X9e=Y9e;function Q9e(t){return t!==t}var Z9e=Q9e;function J9e(t,e,r){for(var n=r-1,s=t.length;++n<s;)if(t[n]===e)return n;return-1}var eHe=J9e,tHe=X9e,rHe=Z9e,nHe=eHe;function sHe(t,e,r){return e===e?nHe(t,e,r):tHe(t,rHe,r)}var iHe=sHe,aHe=iHe;function oHe(t,e){var r=t==null?0:t.length;return!!r&&aHe(t,e,0)>-1}var lHe=oHe;function cHe(t,e,r){for(var n=-1,s=t==null?0:t.length;++n<s;)if(r(e,t[n]))return!0;return!1}var uHe=cHe;function dHe(){}var hHe=dHe,HO=roe,fHe=hHe,pHe=W$,mHe=1/0,gHe=HO&&1/pHe(new HO([,-0]))[1]==mHe?function(t){return new HO(t)}:fHe,yHe=gHe,vHe=qae,xHe=lHe,bHe=uHe,wHe=Kae,_He=yHe,jHe=W$,SHe=200;function NHe(t,e,r){var n=-1,s=xHe,i=t.length,o=!0,l=[],c=l;if(r)o=!1,s=bHe;else if(i>=SHe){var u=e?null:_He(t);if(u)return jHe(u);o=!1,s=wHe,c=new vHe}else c=e?[]:l;e:for(;++n<i;){var d=t[n],h=e?e(d):d;if(d=r||d!==0?d:0,o&&h===h){for(var f=c.length;f--;)if(c[f]===h)continue e;e&&c.push(h),l.push(d)}else s(c,h,r)||(c!==l&&c.push(h),l.push(d))}return l}var AHe=NHe,EHe=wf,CHe=AHe;function kHe(t,e){return t&&t.length?CHe(t,EHe(e)):[]}var THe=kHe;const NW=qt(THe);function ooe(t,e,r){return e===!0?NW(t,r):Ft(e)?NW(t,e):t}function Cx(t){"@babel/helpers - typeof";return Cx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cx(t)}var PHe=["ref"];function AW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Ic(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AW(Object(r),!0).forEach(function(n){c2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function OHe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,coe(n.key),n)}}function IHe(t,e,r){return e&&EW(t.prototype,e),r&&EW(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RHe(t,e,r){return e=vC(e),MHe(t,loe()?Reflect.construct(e,r||[],vC(t).constructor):e.apply(t,r))}function MHe(t,e){if(e&&(Cx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DHe(t)}function DHe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function loe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(loe=function(){return!!t})()}function vC(t){return vC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vC(t)}function LHe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nL(t,e)}function nL(t,e){return nL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},nL(t,e)}function c2(t,e,r){return e=coe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function coe(t){var e=FHe(t,"string");return Cx(e)=="symbol"?e:e+""}function FHe(t,e){if(Cx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $He(t,e){if(t==null)return{};var r=BHe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function BHe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function UHe(t){return t.value}function zHe(t,e){if(me.isValidElement(t))return me.cloneElement(t,e);if(typeof t=="function")return me.createElement(t,e);e.ref;var r=$He(e,PHe);return me.createElement(H$,r)}var CW=1,Ly=function(t){function e(){var r;OHe(this,e);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=RHe(this,e,[].concat(s)),c2(r,"lastBoundingBox",{width:-1,height:-1}),r}return LHe(e,t),IHe(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>CW||Math.abs(s.height-this.lastBoundingBox.height)>CW)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,n&&n(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Ic({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,h,f;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();h={left:((u||0)-p.width)/2}}else h=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();f={top:((d||0)-g.height)/2}}else f=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Ic(Ic({},h),f)}},{key:"render",value:function(){var n=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,h=Ic(Ic({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return me.createElement("div",{className:"recharts-legend-wrapper",style:h,ref:function(p){n.wrapperNode=p}},zHe(i,Ic(Ic({},this.props),{},{payload:ooe(d,u,UHe)})))}}],[{key:"getWithHeight",value:function(n,s){var i=Ic(Ic({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&tt(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||s}:null}}])}(S.PureComponent);c2(Ly,"displayName","Legend");c2(Ly,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var kW=nS,HHe=V$,WHe=Ji,TW=kW?kW.isConcatSpreadable:void 0;function VHe(t){return WHe(t)||HHe(t)||!!(TW&&t&&t[TW])}var qHe=VHe,GHe=Xae,KHe=qHe;function uoe(t,e,r,n,s){var i=-1,o=t.length;for(r||(r=KHe),s||(s=[]);++i<o;){var l=t[i];e>0&&r(l)?e>1?uoe(l,e-1,r,n,s):GHe(s,l):n||(s[s.length]=l)}return s}var doe=uoe;function YHe(t){return function(e,r,n){for(var s=-1,i=Object(e),o=n(e),l=o.length;l--;){var c=o[t?l:++s];if(r(i[c],c,i)===!1)break}return e}}var XHe=YHe,QHe=XHe,ZHe=QHe(),JHe=ZHe,e7e=JHe,t7e=K$;function r7e(t,e){return t&&e7e(t,e,t7e)}var hoe=r7e,n7e=l2;function s7e(t,e){return function(r,n){if(r==null)return r;if(!n7e(r))return t(r,n);for(var s=r.length,i=e?s:-1,o=Object(r);(e?i--:++i<s)&&n(o[i],i,o)!==!1;);return r}}var i7e=s7e,a7e=hoe,o7e=i7e,l7e=o7e(a7e),X$=l7e,c7e=X$,u7e=l2;function d7e(t,e){var r=-1,n=u7e(t)?Array(t.length):[];return c7e(t,function(s,i,o){n[++r]=e(s,i,o)}),n}var foe=d7e;function h7e(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var f7e=h7e,PW=_0;function p7e(t,e){if(t!==e){var r=t!==void 0,n=t===null,s=t===t,i=PW(t),o=e!==void 0,l=e===null,c=e===e,u=PW(e);if(!l&&!u&&!i&&t>e||i&&o&&c&&!l&&!u||n&&o&&c||!r&&c||!s)return 1;if(!n&&!i&&!u&&t<e||u&&r&&s&&!n&&!i||l&&r&&s||!o&&s||!c)return-1}return 0}var m7e=p7e,g7e=m7e;function y7e(t,e,r){for(var n=-1,s=t.criteria,i=e.criteria,o=s.length,l=r.length;++n<o;){var c=g7e(s[n],i[n]);if(c){if(n>=l)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return t.index-e.index}var v7e=y7e,WO=I$,x7e=R$,b7e=wf,w7e=foe,_7e=f7e,j7e=Jae,S7e=v7e,N7e=k0,A7e=Ji;function E7e(t,e,r){e.length?e=WO(e,function(i){return A7e(i)?function(o){return x7e(o,i.length===1?i[0]:i)}:i}):e=[N7e];var n=-1;e=WO(e,j7e(b7e));var s=w7e(t,function(i,o,l){var c=WO(e,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return _7e(s,function(i,o){return S7e(i,o,r)})}var C7e=E7e;function k7e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var T7e=k7e,P7e=T7e,OW=Math.max;function O7e(t,e,r){return e=OW(e===void 0?t.length-1:e,0),function(){for(var n=arguments,s=-1,i=OW(n.length-e,0),o=Array(i);++s<i;)o[s]=n[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=n[s];return l[e]=r(o),P7e(t,this,l)}}var I7e=O7e;function R7e(t){return function(){return t}}var M7e=R7e,D7e=hg,L7e=function(){try{var t=D7e(Object,"defineProperty");return t({},"",{}),t}catch{}}(),poe=L7e,F7e=M7e,IW=poe,$7e=k0,B7e=IW?function(t,e){return IW(t,"toString",{configurable:!0,enumerable:!1,value:F7e(e),writable:!0})}:$7e,U7e=B7e,z7e=800,H7e=16,W7e=Date.now;function V7e(t){var e=0,r=0;return function(){var n=W7e(),s=H7e-(n-r);if(r=n,s>0){if(++e>=z7e)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var q7e=V7e,G7e=U7e,K7e=q7e,Y7e=K7e(G7e),X7e=Y7e,Q7e=k0,Z7e=I7e,J7e=X7e;function eWe(t,e){return J7e(Z7e(t,e,Q7e),t+"")}var tWe=eWe,rWe=k$,nWe=l2,sWe=q$,iWe=bf;function aWe(t,e,r){if(!iWe(r))return!1;var n=typeof e;return(n=="number"?nWe(r)&&sWe(e,r.length):n=="string"&&e in r)?rWe(r[e],t):!1}var u2=aWe,oWe=doe,lWe=C7e,cWe=tWe,RW=u2,uWe=cWe(function(t,e){if(t==null)return[];var r=e.length;return r>1&&RW(t,e[0],e[1])?e=[]:r>2&&RW(e[0],e[1],e[2])&&(e=[e[0]]),lWe(t,oWe(e,1),[])}),dWe=uWe;const Q$=qt(dWe);function u1(t){"@babel/helpers - typeof";return u1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u1(t)}function sL(){return sL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},sL.apply(this,arguments)}function hWe(t,e){return gWe(t)||mWe(t,e)||pWe(t,e)||fWe()}function fWe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pWe(t,e){if(t){if(typeof t=="string")return MW(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return MW(t,e)}}function MW(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function mWe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function gWe(t){if(Array.isArray(t))return t}function DW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function VO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?DW(Object(r),!0).forEach(function(n){yWe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):DW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yWe(t,e,r){return e=vWe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vWe(t){var e=xWe(t,"string");return u1(e)=="symbol"?e:e+""}function xWe(t,e){if(u1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(u1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bWe(t){return Array.isArray(t)&&Kn(t[0])&&Kn(t[1])?t.join(" ~ "):t}var wWe=function(e){var r=e.separator,n=r===void 0?" : ":r,s=e.contentStyle,i=s===void 0?{}:s,o=e.itemStyle,l=o===void 0?{}:o,c=e.labelStyle,u=c===void 0?{}:c,d=e.payload,h=e.formatter,f=e.itemSorter,p=e.wrapperClassName,g=e.labelClassName,m=e.label,v=e.labelFormatter,y=e.accessibilityLayer,x=y===void 0?!1:y,b=function(){if(d&&d.length){var I={padding:0,margin:0},q=(f?Q$(d,f):d).map(function(A,U){if(A.type==="none")return null;var K=VO({display:"block",paddingTop:4,paddingBottom:4,color:A.color||"#000"},l),G=A.formatter||h||bWe,Y=A.value,H=A.name,$=Y,L=H;if(G&&$!=null&&L!=null){var F=G(Y,H,A,U,d);if(Array.isArray(F)){var W=hWe(F,2);$=W[0],L=W[1]}else $=F}return me.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(U),style:K},Kn(L)?me.createElement("span",{className:"recharts-tooltip-item-name"},L):null,Kn(L)?me.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,me.createElement("span",{className:"recharts-tooltip-item-value"},$),me.createElement("span",{className:"recharts-tooltip-item-unit"},A.unit||""))});return me.createElement("ul",{className:"recharts-tooltip-item-list",style:I},q)}return null},w=VO({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),j=VO({margin:0},u),N=!Qt(m),C=N?m:"",k=Jt("recharts-default-tooltip",p),E=Jt("recharts-tooltip-label",g);N&&v&&d!==void 0&&d!==null&&(C=v(m,d));var M=x?{role:"status","aria-live":"assertive"}:{};return me.createElement("div",sL({className:k,style:w},M),me.createElement("p",{className:E,style:j},me.isValidElement(C)?C:"".concat(C)),b())};function d1(t){"@babel/helpers - typeof";return d1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d1(t)}function wN(t,e,r){return e=_We(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _We(t){var e=jWe(t,"string");return d1(e)=="symbol"?e:e+""}function jWe(t,e){if(d1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(d1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tb="recharts-tooltip-wrapper",SWe={visibility:"hidden"};function NWe(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return Jt(tb,wN(wN(wN(wN({},"".concat(tb,"-right"),tt(r)&&e&&tt(e.x)&&r>=e.x),"".concat(tb,"-left"),tt(r)&&e&&tt(e.x)&&r<e.x),"".concat(tb,"-bottom"),tt(n)&&e&&tt(e.y)&&n>=e.y),"".concat(tb,"-top"),tt(n)&&e&&tt(e.y)&&n<e.y))}function LW(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,s=t.offsetTopLeft,i=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(i&&tt(i[n]))return i[n];var d=r[n]-l-s,h=r[n]+s;if(e[n])return o[n]?d:h;if(o[n]){var f=d,p=c[n];return f<p?Math.max(h,c[n]):Math.max(d,c[n])}var g=h+l,m=c[n]+u;return g>m?Math.max(d,c[n]):Math.max(h,c[n])}function AWe(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function EWe(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,s=t.position,i=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,h;return o.height>0&&o.width>0&&r?(d=LW({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),h=LW({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=AWe({translateX:d,translateY:h,useTranslate3d:l})):u=SWe,{cssProperties:u,cssClasses:NWe({translateX:d,translateY:h,coordinate:r})}}function kx(t){"@babel/helpers - typeof";return kx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kx(t)}function FW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function $W(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?FW(Object(r),!0).forEach(function(n){aL(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function CWe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kWe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,goe(n.key),n)}}function TWe(t,e,r){return e&&kWe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function PWe(t,e,r){return e=xC(e),OWe(t,moe()?Reflect.construct(e,r||[],xC(t).constructor):e.apply(t,r))}function OWe(t,e){if(e&&(kx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IWe(t)}function IWe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function moe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(moe=function(){return!!t})()}function xC(t){return xC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xC(t)}function RWe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&iL(t,e)}function iL(t,e){return iL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},iL(t,e)}function aL(t,e,r){return e=goe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function goe(t){var e=MWe(t,"string");return kx(e)=="symbol"?e:e+""}function MWe(t,e){if(kx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(kx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var BW=1,DWe=function(t){function e(){var r;CWe(this,e);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=PWe(this,e,[].concat(s)),aL(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),aL(r,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return RWe(e,t),TWe(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>BW||Math.abs(n.height-this.state.lastBoundingBox.height)>BW)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,h=s.hasPayload,f=s.isAnimationActive,p=s.offset,g=s.position,m=s.reverseDirection,v=s.useTranslate3d,y=s.viewBox,x=s.wrapperStyle,b=EWe({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:y}),w=b.cssClasses,j=b.cssProperties,N=$W($W({transition:f&&i?"transform ".concat(l,"ms ").concat(c):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&h?"visible":"hidden",position:"absolute",top:0,left:0},x);return me.createElement("div",{tabIndex:-1,className:w,style:N,ref:function(k){n.wrapperNode=k}},u)}}])}(S.PureComponent),LWe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Im={isSsr:LWe(),get:function(e){return Im[e]},set:function(e,r){if(typeof e=="string")Im[e]=r;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(s){Im[s]=e[s]})}}};function Tx(t){"@babel/helpers - typeof";return Tx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tx(t)}function UW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function zW(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?UW(Object(r),!0).forEach(function(n){Z$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):UW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function FWe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $We(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,voe(n.key),n)}}function BWe(t,e,r){return e&&$We(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function UWe(t,e,r){return e=bC(e),zWe(t,yoe()?Reflect.construct(e,r||[],bC(t).constructor):e.apply(t,r))}function zWe(t,e){if(e&&(Tx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return HWe(t)}function HWe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yoe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yoe=function(){return!!t})()}function bC(t){return bC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},bC(t)}function WWe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oL(t,e)}function oL(t,e){return oL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},oL(t,e)}function Z$(t,e,r){return e=voe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function voe(t){var e=VWe(t,"string");return Tx(e)=="symbol"?e:e+""}function VWe(t,e){if(Tx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Tx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qWe(t){return t.dataKey}function GWe(t,e){return me.isValidElement(t)?me.cloneElement(t,e):typeof t=="function"?me.createElement(t,e):me.createElement(wWe,e)}var Vc=function(t){function e(){return FWe(this,e),UWe(this,e,arguments)}return WWe(e,t),BWe(e,[{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,d=s.coordinate,h=s.filterNull,f=s.isAnimationActive,p=s.offset,g=s.payload,m=s.payloadUniqBy,v=s.position,y=s.reverseDirection,x=s.useTranslate3d,b=s.viewBox,w=s.wrapperStyle,j=g??[];h&&j.length&&(j=ooe(g.filter(function(C){return C.value!=null&&(C.hide!==!0||n.props.includeHidden)}),m,qWe));var N=j.length>0;return me.createElement(DWe,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:f,active:i,coordinate:d,hasPayload:N,offset:p,position:v,reverseDirection:y,useTranslate3d:x,viewBox:b,wrapperStyle:w},GWe(u,zW(zW({},this.props),{},{payload:j})))}}])}(S.PureComponent);Z$(Vc,"displayName","Tooltip");Z$(Vc,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Im.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var KWe=Cc,YWe=function(){return KWe.Date.now()},XWe=YWe,QWe=/\s/;function ZWe(t){for(var e=t.length;e--&&QWe.test(t.charAt(e)););return e}var JWe=ZWe,eVe=JWe,tVe=/^\s+/;function rVe(t){return t&&t.slice(0,eVe(t)+1).replace(tVe,"")}var nVe=rVe,sVe=nVe,HW=bf,iVe=_0,WW=NaN,aVe=/^[-+]0x[0-9a-f]+$/i,oVe=/^0b[01]+$/i,lVe=/^0o[0-7]+$/i,cVe=parseInt;function uVe(t){if(typeof t=="number")return t;if(iVe(t))return WW;if(HW(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=HW(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=sVe(t);var r=oVe.test(t);return r||lVe.test(t)?cVe(t.slice(2),r?2:8):aVe.test(t)?WW:+t}var xoe=uVe,dVe=bf,qO=XWe,VW=xoe,hVe="Expected a function",fVe=Math.max,pVe=Math.min;function mVe(t,e,r){var n,s,i,o,l,c,u=0,d=!1,h=!1,f=!0;if(typeof t!="function")throw new TypeError(hVe);e=VW(e)||0,dVe(r)&&(d=!!r.leading,h="maxWait"in r,i=h?fVe(VW(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(N){var C=n,k=s;return n=s=void 0,u=N,o=t.apply(k,C),o}function g(N){return u=N,l=setTimeout(y,e),d?p(N):o}function m(N){var C=N-c,k=N-u,E=e-C;return h?pVe(E,i-k):E}function v(N){var C=N-c,k=N-u;return c===void 0||C>=e||C<0||h&&k>=i}function y(){var N=qO();if(v(N))return x(N);l=setTimeout(y,m(N))}function x(N){return l=void 0,f&&n?p(N):(n=s=void 0,o)}function b(){l!==void 0&&clearTimeout(l),u=0,n=c=s=l=void 0}function w(){return l===void 0?o:x(qO())}function j(){var N=qO(),C=v(N);if(n=arguments,s=this,c=N,C){if(l===void 0)return g(c);if(h)return clearTimeout(l),l=setTimeout(y,e),p(c)}return l===void 0&&(l=setTimeout(y,e)),o}return j.cancel=b,j.flush=w,j}var gVe=mVe,yVe=gVe,vVe=bf,xVe="Expected a function";function bVe(t,e,r){var n=!0,s=!0;if(typeof t!="function")throw new TypeError(xVe);return vVe(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),yVe(t,e,{leading:n,maxWait:e,trailing:s})}var wVe=bVe;const boe=qt(wVe);function h1(t){"@babel/helpers - typeof";return h1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h1(t)}function qW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function _N(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qW(Object(r),!0).forEach(function(n){_Ve(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _Ve(t,e,r){return e=jVe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jVe(t){var e=SVe(t,"string");return h1(e)=="symbol"?e:e+""}function SVe(t,e){if(h1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(h1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function NVe(t,e){return kVe(t)||CVe(t,e)||EVe(t,e)||AVe()}function AVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EVe(t,e){if(t){if(typeof t=="string")return GW(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GW(t,e)}}function GW(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function CVe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function kVe(t){if(Array.isArray(t))return t}var woe=S.forwardRef(function(t,e){var r=t.aspect,n=t.initialDimension,s=n===void 0?{width:-1,height:-1}:n,i=t.width,o=i===void 0?"100%":i,l=t.height,c=l===void 0?"100%":l,u=t.minWidth,d=u===void 0?0:u,h=t.minHeight,f=t.maxHeight,p=t.children,g=t.debounce,m=g===void 0?0:g,v=t.id,y=t.className,x=t.onResize,b=t.style,w=b===void 0?{}:b,j=S.useRef(null),N=S.useRef();N.current=x,S.useImperativeHandle(e,function(){return Object.defineProperty(j.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),j.current},configurable:!0})});var C=S.useState({containerWidth:s.width,containerHeight:s.height}),k=NVe(C,2),E=k[0],M=k[1],z=S.useCallback(function(q,A){M(function(U){var K=Math.round(q),G=Math.round(A);return U.containerWidth===K&&U.containerHeight===G?U:{containerWidth:K,containerHeight:G}})},[]);S.useEffect(function(){var q=function(H){var $,L=H[0].contentRect,F=L.width,W=L.height;z(F,W),($=N.current)===null||$===void 0||$.call(N,F,W)};m>0&&(q=boe(q,m,{trailing:!0,leading:!1}));var A=new ResizeObserver(q),U=j.current.getBoundingClientRect(),K=U.width,G=U.height;return z(K,G),A.observe(j.current),function(){A.disconnect()}},[z,m]);var I=S.useMemo(function(){var q=E.containerWidth,A=E.containerHeight;if(q<0||A<0)return null;Fu(lp(o)||lp(c),`The width(%s) and height(%s) are both fixed numbers,
       maybe you don't need to use a ResponsiveContainer.`,o,c),Fu(!r||r>0,"The aspect(%s) must be greater than zero.",r);var U=lp(o)?q:o,K=lp(c)?A:c;r&&r>0&&(U?K=U/r:K&&(U=K*r),f&&K>f&&(K=f)),Fu(U>0||K>0,`The width(%s) and height(%s) of chart should be greater than 0,
       please check the style of container, or the props width(%s) and height(%s),
       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
       height and width.`,U,K,o,c,d,h,r);var G=!Array.isArray(p)&&Lu(p.type).endsWith("Chart");return me.Children.map(p,function(Y){return me.isValidElement(Y)?S.cloneElement(Y,_N({width:U,height:K},G?{style:_N({height:"100%",width:"100%",maxHeight:K,maxWidth:U},Y.props.style)}:{})):Y})},[r,p,c,f,h,d,E,o]);return me.createElement("div",{id:v?"".concat(v):void 0,className:Jt("recharts-responsive-container",y),style:_N(_N({},w),{},{width:o,height:c,minWidth:d,minHeight:h,maxHeight:f}),ref:j},I)}),Px=function(e){return null};Px.displayName="Cell";function f1(t){"@babel/helpers - typeof";return f1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f1(t)}function KW(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function lL(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?KW(Object(r),!0).forEach(function(n){TVe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):KW(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TVe(t,e,r){return e=PVe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function PVe(t){var e=OVe(t,"string");return f1(e)=="symbol"?e:e+""}function OVe(t,e){if(f1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(f1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Og={widthCache:{},cacheCount:0},IVe=2e3,RVe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},YW="recharts_measurement_span";function MVe(t){var e=lL({},t);return Object.keys(e).forEach(function(r){e[r]||delete e[r]}),e}var XW=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Im.isSsr)return{width:0,height:0};var n=MVe(r),s=JSON.stringify({text:e,copyStyle:n});if(Og.widthCache[s])return Og.widthCache[s];try{var i=document.getElementById(YW);i||(i=document.createElement("span"),i.setAttribute("id",YW),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=lL(lL({},RVe),n);Object.assign(i.style,o),i.textContent="".concat(e);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Og.widthCache[s]=c,++Og.cacheCount>IVe&&(Og.cacheCount=0,Og.widthCache={}),c}catch{return{width:0,height:0}}},DVe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function p1(t){"@babel/helpers - typeof";return p1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p1(t)}function wC(t,e){return BVe(t)||$Ve(t,e)||FVe(t,e)||LVe()}function LVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FVe(t,e){if(t){if(typeof t=="string")return QW(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return QW(t,e)}}function QW(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $Ve(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function BVe(t){if(Array.isArray(t))return t}function UVe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ZW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,HVe(n.key),n)}}function zVe(t,e,r){return e&&ZW(t.prototype,e),r&&ZW(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function HVe(t){var e=WVe(t,"string");return p1(e)=="symbol"?e:e+""}function WVe(t,e){if(p1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(p1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var JW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,eV=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,VVe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,qVe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,_oe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},GVe=Object.keys(_oe),fy="NaN";function KVe(t,e){return t*_oe[e]}var jN=function(){function t(e,r){UVe(this,t),this.num=e,this.unit=r,this.num=e,this.unit=r,Number.isNaN(e)&&(this.unit=""),r!==""&&!VVe.test(r)&&(this.num=NaN,this.unit=""),GVe.includes(r)&&(this.num=KVe(e,r),this.unit="px")}return zVe(t,[{key:"add",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,s=(n=qVe.exec(r))!==null&&n!==void 0?n:[],i=wC(s,3),o=i[1],l=i[2];return new t(parseFloat(o),l??"")}}])}();function joe(t){if(t.includes(fy))return fy;for(var e=t;e.includes("*")||e.includes("/");){var r,n=(r=JW.exec(e))!==null&&r!==void 0?r:[],s=wC(n,4),i=s[1],o=s[2],l=s[3],c=jN.parse(i??""),u=jN.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return fy;e=e.replace(JW,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var h,f=(h=eV.exec(e))!==null&&h!==void 0?h:[],p=wC(f,4),g=p[1],m=p[2],v=p[3],y=jN.parse(g??""),x=jN.parse(v??""),b=m==="+"?y.add(x):y.subtract(x);if(b.isNaN())return fy;e=e.replace(eV,b.toString())}return e}var tV=/\(([^()]*)\)/;function YVe(t){for(var e=t;e.includes("(");){var r=tV.exec(e),n=wC(r,2),s=n[1];e=e.replace(tV,joe(s))}return e}function XVe(t){var e=t.replace(/\s+/g,"");return e=YVe(e),e=joe(e),e}function QVe(t){try{return XVe(t)}catch{return fy}}function GO(t){var e=QVe(t.slice(5,-1));return e===fy?"":e}var ZVe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],JVe=["dx","dy","angle","className","breakAll"];function cL(){return cL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},cL.apply(this,arguments)}function rV(t,e){if(t==null)return{};var r=eqe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function eqe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function nV(t,e){return sqe(t)||nqe(t,e)||rqe(t,e)||tqe()}function tqe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rqe(t,e){if(t){if(typeof t=="string")return sV(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sV(t,e)}}function sV(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nqe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function sqe(t){if(Array.isArray(t))return t}var Soe=/[ \f\n\r\t\v\u2028\u2029]+/,Noe=function(e){var r=e.children,n=e.breakAll,s=e.style;try{var i=[];Qt(r)||(n?i=r.toString().split(""):i=r.toString().split(Soe));var o=i.map(function(c){return{word:c,width:XW(c,s).width}}),l=n?0:XW(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},iqe=function(e,r,n,s,i){var o=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=tt(o),h=l,f=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return U.reduce(function(K,G){var Y=G.word,H=G.width,$=K[K.length-1];if($&&(s==null||i||$.width+H+n<Number(s)))$.words.push(Y),$.width+=H+n;else{var L={words:[Y],width:H};K.push(L)}return K},[])},p=f(r),g=function(U){return U.reduce(function(K,G){return K.width>G.width?K:G})};if(!d)return p;for(var m="…",v=function(U){var K=h.slice(0,U),G=Noe({breakAll:u,style:c,children:K+m}).wordsWithComputedWidth,Y=f(G),H=Y.length>o||g(Y).width>Number(s);return[H,Y]},y=0,x=h.length-1,b=0,w;y<=x&&b<=h.length-1;){var j=Math.floor((y+x)/2),N=j-1,C=v(N),k=nV(C,2),E=k[0],M=k[1],z=v(j),I=nV(z,1),q=I[0];if(!E&&!q&&(y=j+1),E&&q&&(x=j-1),!E&&q){w=M;break}b++}return w||p},iV=function(e){var r=Qt(e)?[]:e.toString().split(Soe);return[{words:r}]},aqe=function(e){var r=e.width,n=e.scaleToFit,s=e.children,i=e.style,o=e.breakAll,l=e.maxLines;if((r||n)&&!Im.isSsr){var c,u,d=Noe({breakAll:o,children:s,style:i});if(d){var h=d.wordsWithComputedWidth,f=d.spaceWidth;c=h,u=f}else return iV(s);return iqe({breakAll:o,children:s,maxLines:l,style:i},c,u,r,n)}return iV(s)},aV="#808080",Ox=function(e){var r=e.x,n=r===void 0?0:r,s=e.y,i=s===void 0?0:s,o=e.lineHeight,l=o===void 0?"1em":o,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,h=d===void 0?!1:d,f=e.textAnchor,p=f===void 0?"start":f,g=e.verticalAnchor,m=g===void 0?"end":g,v=e.fill,y=v===void 0?aV:v,x=rV(e,ZVe),b=S.useMemo(function(){return aqe({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:h,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,h,x.style,x.width]),w=x.dx,j=x.dy,N=x.angle,C=x.className,k=x.breakAll,E=rV(x,JVe);if(!Kn(n)||!Kn(i))return null;var M=n+(tt(w)?w:0),z=i+(tt(j)?j:0),I;switch(m){case"start":I=GO("calc(".concat(u,")"));break;case"middle":I=GO("calc(".concat((b.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:I=GO("calc(".concat(b.length-1," * -").concat(l,")"));break}var q=[];if(h){var A=b[0].width,U=x.width;q.push("scale(".concat((tt(U)?U/A:1)/A,")"))}return N&&q.push("rotate(".concat(N,", ").concat(M,", ").concat(z,")")),q.length&&(E.transform=q.join(" ")),me.createElement("text",cL({},Lt(E,!0),{x:M,y:z,className:Jt("recharts-text",C),textAnchor:p,fill:y.includes("url")?aV:y}),b.map(function(K,G){var Y=K.words.join(k?"":" ");return me.createElement("tspan",{x:M,dy:G===0?I:l,key:"".concat(Y,"-").concat(G)},Y)}))};function qh(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function oqe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function J$(t){let e,r,n;t.length!==2?(e=qh,r=(l,c)=>qh(t(l),c),n=(l,c)=>t(l)-c):(e=t===qh||t===oqe?t:lqe,r=t,n=t);function s(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;r(l[h],c)<0?u=h+1:d=h}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const h=u+d>>>1;r(l[h],c)<=0?u=h+1:d=h}while(u<d)}return u}function o(l,c,u=0,d=l.length){const h=s(l,c,u,d-1);return h>u&&n(l[h-1],c)>-n(l[h],c)?h-1:h}return{left:s,center:o,right:i}}function lqe(){return 0}function Aoe(t){return t===null?NaN:+t}function*cqe(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const uqe=J$(qh),aS=uqe.right;J$(Aoe).center;class oV extends Map{constructor(e,r=fqe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,s]of e)this.set(n,s)}get(e){return super.get(lV(this,e))}has(e){return super.has(lV(this,e))}set(e,r){return super.set(dqe(this,e),r)}delete(e){return super.delete(hqe(this,e))}}function lV({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function dqe({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function hqe({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function fqe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function pqe(t=qh){if(t===qh)return Eoe;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function Eoe(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const mqe=Math.sqrt(50),gqe=Math.sqrt(10),yqe=Math.sqrt(2);function _C(t,e,r){const n=(e-t)/Math.max(0,r),s=Math.floor(Math.log10(n)),i=n/Math.pow(10,s),o=i>=mqe?10:i>=gqe?5:i>=yqe?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(t*u),c=Math.round(e*u),l/u<t&&++l,c/u>e&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(t/u),c=Math.round(e/u),l*u<t&&++l,c*u>e&&--c),c<l&&.5<=r&&r<2?_C(t,e,r*2):[l,c,u]}function uL(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[s,i,o]=n?_C(e,t,r):_C(t,e,r);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(n)if(o<0)for(let u=0;u<l;++u)c[u]=(i-u)/-o;else for(let u=0;u<l;++u)c[u]=(i-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function dL(t,e,r){return e=+e,t=+t,r=+r,_C(t,e,r)[2]}function hL(t,e,r){e=+e,t=+t,r=+r;const n=e<t,s=n?dL(e,t,r):dL(t,e,r);return(n?-1:1)*(s<0?1/-s:s)}function cV(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function uV(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Coe(t,e,r=0,n=1/0,s){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(s=s===void 0?Eoe:pqe(s);n>r;){if(n-r>600){const c=n-r+1,u=e-r+1,d=Math.log(c),h=.5*Math.exp(2*d/3),f=.5*Math.sqrt(d*h*(c-h)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(e-u*h/c+f)),g=Math.min(n,Math.floor(e+(c-u)*h/c+f));Coe(t,e,p,g,s)}const i=t[e];let o=r,l=n;for(rb(t,r,e),s(t[n],i)>0&&rb(t,r,n);o<l;){for(rb(t,o,l),++o,--l;s(t[o],i)<0;)++o;for(;s(t[l],i)>0;)--l}s(t[r],i)===0?rb(t,r,l):(++l,rb(t,l,n)),l<=e&&(r=l+1),e<=l&&(n=l-1)}return t}function rb(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function vqe(t,e,r){if(t=Float64Array.from(cqe(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return uV(t);if(e>=1)return cV(t);var n,s=(n-1)*e,i=Math.floor(s),o=cV(Coe(t,i).subarray(0,i+1)),l=uV(t.subarray(i+1));return o+(l-o)*(s-i)}}function xqe(t,e,r=Aoe){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,s=(n-1)*e,i=Math.floor(s),o=+r(t[i],i,t),l=+r(t[i+1],i+1,t);return o+(l-o)*(s-i)}}function bqe(t,e,r){t=+t,e=+e,r=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+r;for(var n=-1,s=Math.max(0,Math.ceil((e-t)/r))|0,i=new Array(s);++n<s;)i[n]=t+n*r;return i}function Ao(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ud(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const fL=Symbol("implicit");function e8(){var t=new oV,e=[],r=[],n=fL;function s(i){let o=t.get(i);if(o===void 0){if(n!==fL)return n;t.set(i,o=e.push(i)-1)}return r[o%r.length]}return s.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new oV;for(const o of i)t.has(o)||t.set(o,e.push(o)-1);return s},s.range=function(i){return arguments.length?(r=Array.from(i),s):r.slice()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return e8(e,r).unknown(n)},Ao.apply(s,arguments),s}function m1(){var t=e8().unknown(void 0),e=t.domain,r=t.range,n=0,s=1,i,o,l=!1,c=0,u=0,d=.5;delete t.unknown;function h(){var f=e().length,p=s<n,g=p?s:n,m=p?n:s;i=(m-g)/Math.max(1,f-c+u*2),l&&(i=Math.floor(i)),g+=(m-g-i*(f-c))*d,o=i*(1-c),l&&(g=Math.round(g),o=Math.round(o));var v=bqe(f).map(function(y){return g+i*y});return r(p?v.reverse():v)}return t.domain=function(f){return arguments.length?(e(f),h()):e()},t.range=function(f){return arguments.length?([n,s]=f,n=+n,s=+s,h()):[n,s]},t.rangeRound=function(f){return[n,s]=f,n=+n,s=+s,l=!0,h()},t.bandwidth=function(){return o},t.step=function(){return i},t.round=function(f){return arguments.length?(l=!!f,h()):l},t.padding=function(f){return arguments.length?(c=Math.min(1,u=+f),h()):c},t.paddingInner=function(f){return arguments.length?(c=Math.min(1,f),h()):c},t.paddingOuter=function(f){return arguments.length?(u=+f,h()):u},t.align=function(f){return arguments.length?(d=Math.max(0,Math.min(1,f)),h()):d},t.copy=function(){return m1(e(),[n,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Ao.apply(h(),arguments)}function koe(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return koe(e())},t}function ww(){return koe(m1.apply(null,arguments).paddingInner(1))}function t8(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Toe(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function oS(){}var g1=.7,jC=1/g1,Fy="\\s*([+-]?\\d+)\\s*",y1="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wqe=/^#([0-9a-f]{3,8})$/,_qe=new RegExp(`^rgb\\(${Fy},${Fy},${Fy}\\)$`),jqe=new RegExp(`^rgb\\(${yc},${yc},${yc}\\)$`),Sqe=new RegExp(`^rgba\\(${Fy},${Fy},${Fy},${y1}\\)$`),Nqe=new RegExp(`^rgba\\(${yc},${yc},${yc},${y1}\\)$`),Aqe=new RegExp(`^hsl\\(${y1},${yc},${yc}\\)$`),Eqe=new RegExp(`^hsla\\(${y1},${yc},${yc},${y1}\\)$`),dV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};t8(oS,v1,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:hV,formatHex:hV,formatHex8:Cqe,formatHsl:kqe,formatRgb:fV,toString:fV});function hV(){return this.rgb().formatHex()}function Cqe(){return this.rgb().formatHex8()}function kqe(){return Poe(this).formatHsl()}function fV(){return this.rgb().formatRgb()}function v1(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=wqe.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?pV(e):r===3?new zi(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?SN(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?SN(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=_qe.exec(t))?new zi(e[1],e[2],e[3],1):(e=jqe.exec(t))?new zi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Sqe.exec(t))?SN(e[1],e[2],e[3],e[4]):(e=Nqe.exec(t))?SN(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Aqe.exec(t))?yV(e[1],e[2]/100,e[3]/100,1):(e=Eqe.exec(t))?yV(e[1],e[2]/100,e[3]/100,e[4]):dV.hasOwnProperty(t)?pV(dV[t]):t==="transparent"?new zi(NaN,NaN,NaN,0):null}function pV(t){return new zi(t>>16&255,t>>8&255,t&255,1)}function SN(t,e,r,n){return n<=0&&(t=e=r=NaN),new zi(t,e,r,n)}function Tqe(t){return t instanceof oS||(t=v1(t)),t?(t=t.rgb(),new zi(t.r,t.g,t.b,t.opacity)):new zi}function pL(t,e,r,n){return arguments.length===1?Tqe(t):new zi(t,e,r,n??1)}function zi(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}t8(zi,pL,Toe(oS,{brighter(t){return t=t==null?jC:Math.pow(jC,t),new zi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?g1:Math.pow(g1,t),new zi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new zi(Rm(this.r),Rm(this.g),Rm(this.b),SC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mV,formatHex:mV,formatHex8:Pqe,formatRgb:gV,toString:gV}));function mV(){return`#${cp(this.r)}${cp(this.g)}${cp(this.b)}`}function Pqe(){return`#${cp(this.r)}${cp(this.g)}${cp(this.b)}${cp((isNaN(this.opacity)?1:this.opacity)*255)}`}function gV(){const t=SC(this.opacity);return`${t===1?"rgb(":"rgba("}${Rm(this.r)}, ${Rm(this.g)}, ${Rm(this.b)}${t===1?")":`, ${t})`}`}function SC(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Rm(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function cp(t){return t=Rm(t),(t<16?"0":"")+t.toString(16)}function yV(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new el(t,e,r,n)}function Poe(t){if(t instanceof el)return new el(t.h,t.s,t.l,t.opacity);if(t instanceof oS||(t=v1(t)),!t)return new el;if(t instanceof el)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,s=Math.min(e,r,n),i=Math.max(e,r,n),o=NaN,l=i-s,c=(i+s)/2;return l?(e===i?o=(r-n)/l+(r<n)*6:r===i?o=(n-e)/l+2:o=(e-r)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new el(o,l,c,t.opacity)}function Oqe(t,e,r,n){return arguments.length===1?Poe(t):new el(t,e,r,n??1)}function el(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}t8(el,Oqe,Toe(oS,{brighter(t){return t=t==null?jC:Math.pow(jC,t),new el(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?g1:Math.pow(g1,t),new el(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,s=2*r-n;return new zi(KO(t>=240?t-240:t+120,s,n),KO(t,s,n),KO(t<120?t+240:t-120,s,n),this.opacity)},clamp(){return new el(vV(this.h),NN(this.s),NN(this.l),SC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=SC(this.opacity);return`${t===1?"hsl(":"hsla("}${vV(this.h)}, ${NN(this.s)*100}%, ${NN(this.l)*100}%${t===1?")":`, ${t})`}`}}));function vV(t){return t=(t||0)%360,t<0?t+360:t}function NN(t){return Math.max(0,Math.min(1,t||0))}function KO(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const r8=t=>()=>t;function Iqe(t,e){return function(r){return t+r*e}}function Rqe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function Mqe(t){return(t=+t)==1?Ooe:function(e,r){return r-e?Rqe(e,r,t):r8(isNaN(e)?r:e)}}function Ooe(t,e){var r=e-t;return r?Iqe(t,r):r8(isNaN(t)?e:t)}const xV=function t(e){var r=Mqe(e);function n(s,i){var o=r((s=pL(s)).r,(i=pL(i)).r),l=r(s.g,i.g),c=r(s.b,i.b),u=Ooe(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return n.gamma=t,n}(1);function Dqe(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),s;return function(i){for(s=0;s<r;++s)n[s]=t[s]*(1-i)+e[s]*i;return n}}function Lqe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Fqe(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,s=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)s[o]=T0(t[o],e[o]);for(;o<r;++o)i[o]=e[o];return function(l){for(o=0;o<n;++o)i[o]=s[o](l);return i}}function $qe(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function NC(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Bqe(t,e){var r={},n={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?r[s]=T0(t[s],e[s]):n[s]=e[s];return function(i){for(s in r)n[s]=r[s](i);return n}}var mL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,YO=new RegExp(mL.source,"g");function Uqe(t){return function(){return t}}function zqe(t){return function(e){return t(e)+""}}function Hqe(t,e){var r=mL.lastIndex=YO.lastIndex=0,n,s,i,o=-1,l=[],c=[];for(t=t+"",e=e+"";(n=mL.exec(t))&&(s=YO.exec(e));)(i=s.index)>r&&(i=e.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:NC(n,s)})),r=YO.lastIndex;return r<e.length&&(i=e.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?zqe(c[0].x):Uqe(e):(e=c.length,function(u){for(var d=0,h;d<e;++d)l[(h=c[d]).i]=h.x(u);return l.join("")})}function T0(t,e){var r=typeof e,n;return e==null||r==="boolean"?r8(e):(r==="number"?NC:r==="string"?(n=v1(e))?(e=n,xV):Hqe:e instanceof v1?xV:e instanceof Date?$qe:Lqe(e)?Dqe:Array.isArray(e)?Fqe:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Bqe:NC)(t,e)}function n8(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function Wqe(t,e){e===void 0&&(e=t,t=T0);for(var r=0,n=e.length-1,s=e[0],i=new Array(n<0?0:n);r<n;)i[r]=t(s,s=e[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[l](o-l)}}function Vqe(t){return function(){return t}}function AC(t){return+t}var bV=[0,1];function mi(t){return t}function gL(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:Vqe(isNaN(e)?NaN:.5)}function qqe(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function Gqe(t,e,r){var n=t[0],s=t[1],i=e[0],o=e[1];return s<n?(n=gL(s,n),i=r(o,i)):(n=gL(n,s),i=r(i,o)),function(l){return i(n(l))}}function Kqe(t,e,r){var n=Math.min(t.length,e.length)-1,s=new Array(n),i=new Array(n),o=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<n;)s[o]=gL(t[o],t[o+1]),i[o]=r(e[o],e[o+1]);return function(l){var c=aS(t,l,1,n)-1;return i[c](s[c](l))}}function lS(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function d2(){var t=bV,e=bV,r=T0,n,s,i,o=mi,l,c,u;function d(){var f=Math.min(t.length,e.length);return o!==mi&&(o=qqe(t[0],t[f-1])),l=f>2?Kqe:Gqe,c=u=null,h}function h(f){return f==null||isNaN(f=+f)?i:(c||(c=l(t.map(n),e,r)))(n(o(f)))}return h.invert=function(f){return o(s((u||(u=l(e,t.map(n),NC)))(f)))},h.domain=function(f){return arguments.length?(t=Array.from(f,AC),d()):t.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),d()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),r=n8,d()},h.clamp=function(f){return arguments.length?(o=f?!0:mi,d()):o!==mi},h.interpolate=function(f){return arguments.length?(r=f,d()):r},h.unknown=function(f){return arguments.length?(i=f,h):i},function(f,p){return n=f,s=p,d()}}function s8(){return d2()(mi,mi)}function Yqe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function EC(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Ix(t){return t=EC(Math.abs(t)),t?t[1]:NaN}function Xqe(t,e){return function(r,n){for(var s=r.length,i=[],o=0,l=t[0],c=0;s>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(s-=l,s+l)),!((c+=l+1)>n));)l=t[o=(o+1)%t.length];return i.reverse().join(e)}}function Qqe(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var Zqe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function x1(t){if(!(e=Zqe.exec(t)))throw new Error("invalid format: "+t);var e;return new i8({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}x1.prototype=i8.prototype;function i8(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}i8.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Jqe(t){e:for(var e=t.length,r=1,n=-1,s;r<e;++r)switch(t[r]){case".":n=s=r;break;case"0":n===0&&(n=r),s=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(s+1):t}var Ioe;function eGe(t,e){var r=EC(t,e);if(!r)return t+"";var n=r[0],s=r[1],i=s-(Ioe=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+EC(t,Math.max(0,e+i-1))[0]}function wV(t,e){var r=EC(t,e);if(!r)return t+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}const _V={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Yqe,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>wV(t*100,e),r:wV,s:eGe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function jV(t){return t}var SV=Array.prototype.map,NV=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tGe(t){var e=t.grouping===void 0||t.thousands===void 0?jV:Xqe(SV.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?jV:Qqe(SV.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(h){h=x1(h);var f=h.fill,p=h.align,g=h.sign,m=h.symbol,v=h.zero,y=h.width,x=h.comma,b=h.precision,w=h.trim,j=h.type;j==="n"?(x=!0,j="g"):_V[j]||(b===void 0&&(b=12),w=!0,j="g"),(v||f==="0"&&p==="=")&&(v=!0,f="0",p="=");var N=m==="$"?r:m==="#"&&/[boxX]/.test(j)?"0"+j.toLowerCase():"",C=m==="$"?n:/[%p]/.test(j)?o:"",k=_V[j],E=/[defgprs%]/.test(j);b=b===void 0?6:/[gprs]/.test(j)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function M(z){var I=N,q=C,A,U,K;if(j==="c")q=k(z)+q,z="";else{z=+z;var G=z<0||1/z<0;if(z=isNaN(z)?c:k(Math.abs(z),b),w&&(z=Jqe(z)),G&&+z==0&&g!=="+"&&(G=!1),I=(G?g==="("?g:l:g==="-"||g==="("?"":g)+I,q=(j==="s"?NV[8+Ioe/3]:"")+q+(G&&g==="("?")":""),E){for(A=-1,U=z.length;++A<U;)if(K=z.charCodeAt(A),48>K||K>57){q=(K===46?s+z.slice(A+1):z.slice(A))+q,z=z.slice(0,A);break}}}x&&!v&&(z=e(z,1/0));var Y=I.length+z.length+q.length,H=Y<y?new Array(y-Y+1).join(f):"";switch(x&&v&&(z=e(H+z,H.length?y-q.length:1/0),H=""),p){case"<":z=I+z+q+H;break;case"=":z=I+H+z+q;break;case"^":z=H.slice(0,Y=H.length>>1)+I+z+q+H.slice(Y);break;default:z=H+I+z+q;break}return i(z)}return M.toString=function(){return h+""},M}function d(h,f){var p=u((h=x1(h),h.type="f",h)),g=Math.max(-8,Math.min(8,Math.floor(Ix(f)/3)))*3,m=Math.pow(10,-g),v=NV[8+g/3];return function(y){return p(m*y)+v}}return{format:u,formatPrefix:d}}var AN,a8,Roe;rGe({thousands:",",grouping:[3],currency:["$",""]});function rGe(t){return AN=tGe(t),a8=AN.format,Roe=AN.formatPrefix,AN}function nGe(t){return Math.max(0,-Ix(Math.abs(t)))}function sGe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ix(e)/3)))*3-Ix(Math.abs(t)))}function iGe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ix(e)-Ix(t))+1}function Moe(t,e,r,n){var s=hL(t,e,r),i;switch(n=x1(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(i=sGe(s,o))&&(n.precision=i),Roe(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=iGe(s,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=nGe(s))&&(n.precision=i-(n.type==="%")*2);break}}return a8(n)}function _f(t){var e=t.domain;return t.ticks=function(r){var n=e();return uL(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var s=e();return Moe(s[0],s[s.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),s=0,i=n.length-1,o=n[s],l=n[i],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=s,s=i,i=u);d-- >0;){if(u=dL(o,l,r),u===c)return n[s]=o,n[i]=l,e(n);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function CC(){var t=s8();return t.copy=function(){return lS(t,CC())},Ao.apply(t,arguments),_f(t)}function Doe(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,AC),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return Doe(t).unknown(e)},t=arguments.length?Array.from(t,AC):[0,1],_f(r)}function Loe(t,e){t=t.slice();var r=0,n=t.length-1,s=t[r],i=t[n],o;return i<s&&(o=r,r=n,n=o,o=s,s=i,i=o),t[r]=e.floor(s),t[n]=e.ceil(i),t}function AV(t){return Math.log(t)}function EV(t){return Math.exp(t)}function aGe(t){return-Math.log(-t)}function oGe(t){return-Math.exp(-t)}function lGe(t){return isFinite(t)?+("1e"+t):t<0?0:t}function cGe(t){return t===10?lGe:t===Math.E?Math.exp:e=>Math.pow(t,e)}function uGe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function CV(t){return(e,r)=>-t(-e,r)}function o8(t){const e=t(AV,EV),r=e.domain;let n=10,s,i;function o(){return s=uGe(n),i=cGe(n),r()[0]<0?(s=CV(s),i=CV(i),t(aGe,oGe)):t(AV,EV),e}return e.base=function(l){return arguments.length?(n=+l,o()):n},e.domain=function(l){return arguments.length?(r(l),o()):r()},e.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const h=d<u;h&&([u,d]=[d,u]);let f=s(u),p=s(d),g,m;const v=l==null?10:+l;let y=[];if(!(n%1)&&p-f<v){if(f=Math.floor(f),p=Math.ceil(p),u>0){for(;f<=p;++f)for(g=1;g<n;++g)if(m=f<0?g/i(-f):g*i(f),!(m<u)){if(m>d)break;y.push(m)}}else for(;f<=p;++f)for(g=n-1;g>=1;--g)if(m=f>0?g/i(-f):g*i(f),!(m<u)){if(m>d)break;y.push(m)}y.length*2<v&&(y=uL(u,d,v))}else y=uL(f,p,Math.min(p-f,v)).map(i);return h?y.reverse():y},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=x1(c)).precision==null&&(c.trim=!0),c=a8(c)),l===1/0)return c;const u=Math.max(1,n*l/e.ticks().length);return d=>{let h=d/i(Math.round(s(d)));return h*n<n-.5&&(h*=n),h<=u?c(d):""}},e.nice=()=>r(Loe(r(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),e}function Foe(){const t=o8(d2()).domain([1,10]);return t.copy=()=>lS(t,Foe()).base(t.base()),Ao.apply(t,arguments),t}function kV(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function TV(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function l8(t){var e=1,r=t(kV(e),TV(e));return r.constant=function(n){return arguments.length?t(kV(e=+n),TV(e)):e},_f(r)}function $oe(){var t=l8(d2());return t.copy=function(){return lS(t,$oe()).constant(t.constant())},Ao.apply(t,arguments)}function PV(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function dGe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function hGe(t){return t<0?-t*t:t*t}function c8(t){var e=t(mi,mi),r=1;function n(){return r===1?t(mi,mi):r===.5?t(dGe,hGe):t(PV(r),PV(1/r))}return e.exponent=function(s){return arguments.length?(r=+s,n()):r},_f(e)}function u8(){var t=c8(d2());return t.copy=function(){return lS(t,u8()).exponent(t.exponent())},Ao.apply(t,arguments),t}function fGe(){return u8.apply(null,arguments).exponent(.5)}function OV(t){return Math.sign(t)*t*t}function pGe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Boe(){var t=s8(),e=[0,1],r=!1,n;function s(i){var o=pGe(t(i));return isNaN(o)?n:r?Math.round(o):o}return s.invert=function(i){return t.invert(OV(i))},s.domain=function(i){return arguments.length?(t.domain(i),s):t.domain()},s.range=function(i){return arguments.length?(t.range((e=Array.from(i,AC)).map(OV)),s):e.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(r=!!i,s):r},s.clamp=function(i){return arguments.length?(t.clamp(i),s):t.clamp()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return Boe(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},Ao.apply(s,arguments),_f(s)}function Uoe(){var t=[],e=[],r=[],n;function s(){var o=0,l=Math.max(1,e.length);for(r=new Array(l-1);++o<l;)r[o-1]=xqe(t,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:e[aS(r,o)]}return i.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:t[0],l<r.length?r[l]:t[t.length-1]]},i.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(qh),s()},i.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return Uoe().domain(t).range(e).unknown(n)},Ao.apply(i,arguments)}function zoe(){var t=0,e=1,r=1,n=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[aS(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*e-(c-r)*t)/(r+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(r=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[t,n[0]]:u>=r?[n[r-1],e]:[n[u-1],n[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return zoe().domain([t,e]).range(s).unknown(i)},Ao.apply(_f(o),arguments)}function Hoe(){var t=[.5],e=[0,1],r,n=1;function s(i){return i!=null&&i<=i?e[aS(t,i,0,n)]:r}return s.domain=function(i){return arguments.length?(t=Array.from(i),n=Math.min(t.length,e.length-1),s):t.slice()},s.range=function(i){return arguments.length?(e=Array.from(i),n=Math.min(t.length,e.length-1),s):e.slice()},s.invertExtent=function(i){var o=e.indexOf(i);return[t[o-1],t[o]]},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return Hoe().domain(t).range(e).unknown(r)},Ao.apply(s,arguments)}const XO=new Date,QO=new Date;function Qn(t,e,r,n){function s(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(t(i=new Date(+i)),i),s.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(e(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let u;do c.push(u=new Date(+i)),e(i,l),t(i);while(u<i&&i<o);return c},s.filter=i=>Qn(o=>{if(o>=o)for(;t(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!i(o););else for(;--l>=0;)for(;e(o,1),!i(o););}),r&&(s.count=(i,o)=>(XO.setTime(+i),QO.setTime(+o),t(XO),t(QO),Math.floor(r(XO,QO))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(n?o=>n(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const kC=Qn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);kC.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Qn(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):kC);kC.range;const Iu=1e3,uo=Iu*60,Ru=uo*60,Zu=Ru*24,d8=Zu*7,IV=Zu*30,ZO=Zu*365,up=Qn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Iu)},(t,e)=>(e-t)/Iu,t=>t.getUTCSeconds());up.range;const h8=Qn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Iu)},(t,e)=>{t.setTime(+t+e*uo)},(t,e)=>(e-t)/uo,t=>t.getMinutes());h8.range;const f8=Qn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*uo)},(t,e)=>(e-t)/uo,t=>t.getUTCMinutes());f8.range;const p8=Qn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Iu-t.getMinutes()*uo)},(t,e)=>{t.setTime(+t+e*Ru)},(t,e)=>(e-t)/Ru,t=>t.getHours());p8.range;const m8=Qn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Ru)},(t,e)=>(e-t)/Ru,t=>t.getUTCHours());m8.range;const cS=Qn(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*uo)/Zu,t=>t.getDate()-1);cS.range;const h2=Qn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Zu,t=>t.getUTCDate()-1);h2.range;const Woe=Qn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Zu,t=>Math.floor(t/Zu));Woe.range;function fg(t){return Qn(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*uo)/d8)}const f2=fg(0),TC=fg(1),mGe=fg(2),gGe=fg(3),Rx=fg(4),yGe=fg(5),vGe=fg(6);f2.range;TC.range;mGe.range;gGe.range;Rx.range;yGe.range;vGe.range;function pg(t){return Qn(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/d8)}const p2=pg(0),PC=pg(1),xGe=pg(2),bGe=pg(3),Mx=pg(4),wGe=pg(5),_Ge=pg(6);p2.range;PC.range;xGe.range;bGe.range;Mx.range;wGe.range;_Ge.range;const g8=Qn(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());g8.range;const y8=Qn(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());y8.range;const Ju=Qn(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ju.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Qn(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});Ju.range;const ed=Qn(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ed.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Qn(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});ed.range;function Voe(t,e,r,n,s,i){const o=[[up,1,Iu],[up,5,5*Iu],[up,15,15*Iu],[up,30,30*Iu],[i,1,uo],[i,5,5*uo],[i,15,15*uo],[i,30,30*uo],[s,1,Ru],[s,3,3*Ru],[s,6,6*Ru],[s,12,12*Ru],[n,1,Zu],[n,2,2*Zu],[r,1,d8],[e,1,IV],[e,3,3*IV],[t,1,ZO]];function l(u,d,h){const f=d<u;f&&([u,d]=[d,u]);const p=h&&typeof h.range=="function"?h:c(u,d,h),g=p?p.range(u,+d+1):[];return f?g.reverse():g}function c(u,d,h){const f=Math.abs(d-u)/h,p=J$(([,,v])=>v).right(o,f);if(p===o.length)return t.every(hL(u/ZO,d/ZO,h));if(p===0)return kC.every(Math.max(hL(u,d,h),1));const[g,m]=o[f/o[p-1][2]<o[p][2]/f?p-1:p];return g.every(m)}return[l,c]}const[jGe,SGe]=Voe(ed,y8,p2,Woe,m8,f8),[NGe,AGe]=Voe(Ju,g8,f2,cS,p8,h8);function JO(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function eI(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function nb(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function EGe(t){var e=t.dateTime,r=t.date,n=t.time,s=t.periods,i=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,u=sb(s),d=ib(s),h=sb(i),f=ib(i),p=sb(o),g=ib(o),m=sb(l),v=ib(l),y=sb(c),x=ib(c),b={a:G,A:Y,b:H,B:$,c:null,d:$V,e:$V,f:XGe,g:aKe,G:lKe,H:GGe,I:KGe,j:YGe,L:qoe,m:QGe,M:ZGe,p:L,q:F,Q:zV,s:HV,S:JGe,u:eKe,U:tKe,V:rKe,w:nKe,W:sKe,x:null,X:null,y:iKe,Y:oKe,Z:cKe,"%":UV},w={a:W,A:X,b:oe,B:le,c:null,d:BV,e:BV,f:fKe,g:jKe,G:NKe,H:uKe,I:dKe,j:hKe,L:Koe,m:pKe,M:mKe,p:B,q:R,Q:zV,s:HV,S:gKe,u:yKe,U:vKe,V:xKe,w:bKe,W:wKe,x:null,X:null,y:_Ke,Y:SKe,Z:AKe,"%":UV},j={a:M,A:z,b:I,B:q,c:A,d:LV,e:LV,f:HGe,g:DV,G:MV,H:FV,I:FV,j:$Ge,L:zGe,m:FGe,M:BGe,p:E,q:LGe,Q:VGe,s:qGe,S:UGe,u:OGe,U:IGe,V:RGe,w:PGe,W:MGe,x:U,X:K,y:DV,Y:MV,Z:DGe,"%":WGe};b.x=N(r,b),b.X=N(n,b),b.c=N(e,b),w.x=N(r,w),w.X=N(n,w),w.c=N(e,w);function N(ee,te){return function(Z){var J=[],he=-1,P=0,ie=ee.length,V,O,T;for(Z instanceof Date||(Z=new Date(+Z));++he<ie;)ee.charCodeAt(he)===37&&(J.push(ee.slice(P,he)),(O=RV[V=ee.charAt(++he)])!=null?V=ee.charAt(++he):O=V==="e"?" ":"0",(T=te[V])&&(V=T(Z,O)),J.push(V),P=he+1);return J.push(ee.slice(P,he)),J.join("")}}function C(ee,te){return function(Z){var J=nb(1900,void 0,1),he=k(J,ee,Z+="",0),P,ie;if(he!=Z.length)return null;if("Q"in J)return new Date(J.Q);if("s"in J)return new Date(J.s*1e3+("L"in J?J.L:0));if(te&&!("Z"in J)&&(J.Z=0),"p"in J&&(J.H=J.H%12+J.p*12),J.m===void 0&&(J.m="q"in J?J.q:0),"V"in J){if(J.V<1||J.V>53)return null;"w"in J||(J.w=1),"Z"in J?(P=eI(nb(J.y,0,1)),ie=P.getUTCDay(),P=ie>4||ie===0?PC.ceil(P):PC(P),P=h2.offset(P,(J.V-1)*7),J.y=P.getUTCFullYear(),J.m=P.getUTCMonth(),J.d=P.getUTCDate()+(J.w+6)%7):(P=JO(nb(J.y,0,1)),ie=P.getDay(),P=ie>4||ie===0?TC.ceil(P):TC(P),P=cS.offset(P,(J.V-1)*7),J.y=P.getFullYear(),J.m=P.getMonth(),J.d=P.getDate()+(J.w+6)%7)}else("W"in J||"U"in J)&&("w"in J||(J.w="u"in J?J.u%7:"W"in J?1:0),ie="Z"in J?eI(nb(J.y,0,1)).getUTCDay():JO(nb(J.y,0,1)).getDay(),J.m=0,J.d="W"in J?(J.w+6)%7+J.W*7-(ie+5)%7:J.w+J.U*7-(ie+6)%7);return"Z"in J?(J.H+=J.Z/100|0,J.M+=J.Z%100,eI(J)):JO(J)}}function k(ee,te,Z,J){for(var he=0,P=te.length,ie=Z.length,V,O;he<P;){if(J>=ie)return-1;if(V=te.charCodeAt(he++),V===37){if(V=te.charAt(he++),O=j[V in RV?te.charAt(he++):V],!O||(J=O(ee,Z,J))<0)return-1}else if(V!=Z.charCodeAt(J++))return-1}return J}function E(ee,te,Z){var J=u.exec(te.slice(Z));return J?(ee.p=d.get(J[0].toLowerCase()),Z+J[0].length):-1}function M(ee,te,Z){var J=p.exec(te.slice(Z));return J?(ee.w=g.get(J[0].toLowerCase()),Z+J[0].length):-1}function z(ee,te,Z){var J=h.exec(te.slice(Z));return J?(ee.w=f.get(J[0].toLowerCase()),Z+J[0].length):-1}function I(ee,te,Z){var J=y.exec(te.slice(Z));return J?(ee.m=x.get(J[0].toLowerCase()),Z+J[0].length):-1}function q(ee,te,Z){var J=m.exec(te.slice(Z));return J?(ee.m=v.get(J[0].toLowerCase()),Z+J[0].length):-1}function A(ee,te,Z){return k(ee,e,te,Z)}function U(ee,te,Z){return k(ee,r,te,Z)}function K(ee,te,Z){return k(ee,n,te,Z)}function G(ee){return o[ee.getDay()]}function Y(ee){return i[ee.getDay()]}function H(ee){return c[ee.getMonth()]}function $(ee){return l[ee.getMonth()]}function L(ee){return s[+(ee.getHours()>=12)]}function F(ee){return 1+~~(ee.getMonth()/3)}function W(ee){return o[ee.getUTCDay()]}function X(ee){return i[ee.getUTCDay()]}function oe(ee){return c[ee.getUTCMonth()]}function le(ee){return l[ee.getUTCMonth()]}function B(ee){return s[+(ee.getUTCHours()>=12)]}function R(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var te=N(ee+="",b);return te.toString=function(){return ee},te},parse:function(ee){var te=C(ee+="",!1);return te.toString=function(){return ee},te},utcFormat:function(ee){var te=N(ee+="",w);return te.toString=function(){return ee},te},utcParse:function(ee){var te=C(ee+="",!0);return te.toString=function(){return ee},te}}}var RV={"-":"",_:" ",0:"0"},ds=/^\s*\d+/,CGe=/^%/,kGe=/[\\^$*+?|[\]().{}]/g;function sr(t,e,r){var n=t<0?"-":"",s=(n?-t:t)+"",i=s.length;return n+(i<r?new Array(r-i+1).join(e)+s:s)}function TGe(t){return t.replace(kGe,"\\$&")}function sb(t){return new RegExp("^(?:"+t.map(TGe).join("|")+")","i")}function ib(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function PGe(t,e,r){var n=ds.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function OGe(t,e,r){var n=ds.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function IGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function RGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function MGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function MV(t,e,r){var n=ds.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function DV(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function DGe(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function LGe(t,e,r){var n=ds.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function FGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function LV(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $Ge(t,e,r){var n=ds.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function FV(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function BGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function UGe(t,e,r){var n=ds.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function zGe(t,e,r){var n=ds.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function HGe(t,e,r){var n=ds.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function WGe(t,e,r){var n=CGe.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function VGe(t,e,r){var n=ds.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function qGe(t,e,r){var n=ds.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function $V(t,e){return sr(t.getDate(),e,2)}function GGe(t,e){return sr(t.getHours(),e,2)}function KGe(t,e){return sr(t.getHours()%12||12,e,2)}function YGe(t,e){return sr(1+cS.count(Ju(t),t),e,3)}function qoe(t,e){return sr(t.getMilliseconds(),e,3)}function XGe(t,e){return qoe(t,e)+"000"}function QGe(t,e){return sr(t.getMonth()+1,e,2)}function ZGe(t,e){return sr(t.getMinutes(),e,2)}function JGe(t,e){return sr(t.getSeconds(),e,2)}function eKe(t){var e=t.getDay();return e===0?7:e}function tKe(t,e){return sr(f2.count(Ju(t)-1,t),e,2)}function Goe(t){var e=t.getDay();return e>=4||e===0?Rx(t):Rx.ceil(t)}function rKe(t,e){return t=Goe(t),sr(Rx.count(Ju(t),t)+(Ju(t).getDay()===4),e,2)}function nKe(t){return t.getDay()}function sKe(t,e){return sr(TC.count(Ju(t)-1,t),e,2)}function iKe(t,e){return sr(t.getFullYear()%100,e,2)}function aKe(t,e){return t=Goe(t),sr(t.getFullYear()%100,e,2)}function oKe(t,e){return sr(t.getFullYear()%1e4,e,4)}function lKe(t,e){var r=t.getDay();return t=r>=4||r===0?Rx(t):Rx.ceil(t),sr(t.getFullYear()%1e4,e,4)}function cKe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+sr(e/60|0,"0",2)+sr(e%60,"0",2)}function BV(t,e){return sr(t.getUTCDate(),e,2)}function uKe(t,e){return sr(t.getUTCHours(),e,2)}function dKe(t,e){return sr(t.getUTCHours()%12||12,e,2)}function hKe(t,e){return sr(1+h2.count(ed(t),t),e,3)}function Koe(t,e){return sr(t.getUTCMilliseconds(),e,3)}function fKe(t,e){return Koe(t,e)+"000"}function pKe(t,e){return sr(t.getUTCMonth()+1,e,2)}function mKe(t,e){return sr(t.getUTCMinutes(),e,2)}function gKe(t,e){return sr(t.getUTCSeconds(),e,2)}function yKe(t){var e=t.getUTCDay();return e===0?7:e}function vKe(t,e){return sr(p2.count(ed(t)-1,t),e,2)}function Yoe(t){var e=t.getUTCDay();return e>=4||e===0?Mx(t):Mx.ceil(t)}function xKe(t,e){return t=Yoe(t),sr(Mx.count(ed(t),t)+(ed(t).getUTCDay()===4),e,2)}function bKe(t){return t.getUTCDay()}function wKe(t,e){return sr(PC.count(ed(t)-1,t),e,2)}function _Ke(t,e){return sr(t.getUTCFullYear()%100,e,2)}function jKe(t,e){return t=Yoe(t),sr(t.getUTCFullYear()%100,e,2)}function SKe(t,e){return sr(t.getUTCFullYear()%1e4,e,4)}function NKe(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Mx(t):Mx.ceil(t),sr(t.getUTCFullYear()%1e4,e,4)}function AKe(){return"+0000"}function UV(){return"%"}function zV(t){return+t}function HV(t){return Math.floor(+t/1e3)}var Ig,Xoe,Qoe;EKe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function EKe(t){return Ig=EGe(t),Xoe=Ig.format,Ig.parse,Qoe=Ig.utcFormat,Ig.utcParse,Ig}function CKe(t){return new Date(t)}function kKe(t){return t instanceof Date?+t:+new Date(+t)}function v8(t,e,r,n,s,i,o,l,c,u){var d=s8(),h=d.invert,f=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),v=u("%I %p"),y=u("%a %d"),x=u("%b %d"),b=u("%B"),w=u("%Y");function j(N){return(c(N)<N?p:l(N)<N?g:o(N)<N?m:i(N)<N?v:n(N)<N?s(N)<N?y:x:r(N)<N?b:w)(N)}return d.invert=function(N){return new Date(h(N))},d.domain=function(N){return arguments.length?f(Array.from(N,kKe)):f().map(CKe)},d.ticks=function(N){var C=f();return t(C[0],C[C.length-1],N??10)},d.tickFormat=function(N,C){return C==null?j:u(C)},d.nice=function(N){var C=f();return(!N||typeof N.range!="function")&&(N=e(C[0],C[C.length-1],N??10)),N?f(Loe(C,N)):d},d.copy=function(){return lS(d,v8(t,e,r,n,s,i,o,l,c,u))},d}function TKe(){return Ao.apply(v8(NGe,AGe,Ju,g8,f2,cS,p8,h8,up,Xoe).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function PKe(){return Ao.apply(v8(jGe,SGe,ed,y8,p2,h2,m8,f8,up,Qoe).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function m2(){var t=0,e=1,r,n,s,i,o=mi,l=!1,c;function u(h){return h==null||isNaN(h=+h)?c:o(s===0?.5:(h=(i(h)-r)*s,l?Math.max(0,Math.min(1,h)):h))}u.domain=function(h){return arguments.length?([t,e]=h,r=i(t=+t),n=i(e=+e),s=r===n?0:1/(n-r),u):[t,e]},u.clamp=function(h){return arguments.length?(l=!!h,u):l},u.interpolator=function(h){return arguments.length?(o=h,u):o};function d(h){return function(f){var p,g;return arguments.length?([p,g]=f,o=h(p,g),u):[o(0),o(1)]}}return u.range=d(T0),u.rangeRound=d(n8),u.unknown=function(h){return arguments.length?(c=h,u):c},function(h){return i=h,r=h(t),n=h(e),s=r===n?0:1/(n-r),u}}function jf(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Zoe(){var t=_f(m2()(mi));return t.copy=function(){return jf(t,Zoe())},ud.apply(t,arguments)}function Joe(){var t=o8(m2()).domain([1,10]);return t.copy=function(){return jf(t,Joe()).base(t.base())},ud.apply(t,arguments)}function ele(){var t=l8(m2());return t.copy=function(){return jf(t,ele()).constant(t.constant())},ud.apply(t,arguments)}function x8(){var t=c8(m2());return t.copy=function(){return jf(t,x8()).exponent(t.exponent())},ud.apply(t,arguments)}function OKe(){return x8.apply(null,arguments).exponent(.5)}function tle(){var t=[],e=mi;function r(n){if(n!=null&&!isNaN(n=+n))return e((aS(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let s of n)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(qh),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,s)=>e(s/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(s,i)=>vqe(t,i/n))},r.copy=function(){return tle(e).domain(t)},ud.apply(r,arguments)}function g2(){var t=0,e=.5,r=1,n=1,s,i,o,l,c,u=mi,d,h=!1,f;function p(m){return isNaN(m=+m)?f:(m=.5+((m=+d(m))-i)*(n*m<n*i?l:c),u(h?Math.max(0,Math.min(1,m)):m))}p.domain=function(m){return arguments.length?([t,e,r]=m,s=d(t=+t),i=d(e=+e),o=d(r=+r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,p):[t,e,r]},p.clamp=function(m){return arguments.length?(h=!!m,p):h},p.interpolator=function(m){return arguments.length?(u=m,p):u};function g(m){return function(v){var y,x,b;return arguments.length?([y,x,b]=v,u=Wqe(m,[y,x,b]),p):[u(0),u(.5),u(1)]}}return p.range=g(T0),p.rangeRound=g(n8),p.unknown=function(m){return arguments.length?(f=m,p):f},function(m){return d=m,s=m(t),i=m(e),o=m(r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,p}}function rle(){var t=_f(g2()(mi));return t.copy=function(){return jf(t,rle())},ud.apply(t,arguments)}function nle(){var t=o8(g2()).domain([.1,1,10]);return t.copy=function(){return jf(t,nle()).base(t.base())},ud.apply(t,arguments)}function sle(){var t=l8(g2());return t.copy=function(){return jf(t,sle()).constant(t.constant())},ud.apply(t,arguments)}function b8(){var t=c8(g2());return t.copy=function(){return jf(t,b8()).exponent(t.exponent())},ud.apply(t,arguments)}function IKe(){return b8.apply(null,arguments).exponent(.5)}const WV=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:m1,scaleDiverging:rle,scaleDivergingLog:nle,scaleDivergingPow:b8,scaleDivergingSqrt:IKe,scaleDivergingSymlog:sle,scaleIdentity:Doe,scaleImplicit:fL,scaleLinear:CC,scaleLog:Foe,scaleOrdinal:e8,scalePoint:ww,scalePow:u8,scaleQuantile:Uoe,scaleQuantize:zoe,scaleRadial:Boe,scaleSequential:Zoe,scaleSequentialLog:Joe,scaleSequentialPow:x8,scaleSequentialQuantile:tle,scaleSequentialSqrt:OKe,scaleSequentialSymlog:ele,scaleSqrt:fGe,scaleSymlog:$oe,scaleThreshold:Hoe,scaleTime:TKe,scaleUtc:PKe,tickFormat:Moe},Symbol.toStringTag,{value:"Module"}));var RKe=_0;function MKe(t,e,r){for(var n=-1,s=t.length;++n<s;){var i=t[n],o=e(i);if(o!=null&&(l===void 0?o===o&&!RKe(o):r(o,l)))var l=o,c=i}return c}var y2=MKe;function DKe(t,e){return t>e}var ile=DKe,LKe=y2,FKe=ile,$Ke=k0;function BKe(t){return t&&t.length?LKe(t,$Ke,FKe):void 0}var UKe=BKe;const v2=qt(UKe);function zKe(t,e){return t<e}var ale=zKe,HKe=y2,WKe=ale,VKe=k0;function qKe(t){return t&&t.length?HKe(t,VKe,WKe):void 0}var GKe=qKe;const x2=qt(GKe);var KKe=I$,YKe=wf,XKe=foe,QKe=Ji;function ZKe(t,e){var r=QKe(t)?KKe:XKe;return r(t,YKe(e))}var JKe=ZKe,eYe=doe,tYe=JKe;function rYe(t,e){return eYe(tYe(t,e),1)}var nYe=rYe;const sYe=qt(nYe);var iYe=Y$;function aYe(t,e){return iYe(t,e)}var oYe=aYe;const w8=qt(oYe);var P0=1e9,lYe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},j8,Zr=!0,bo="[DecimalError] ",Mm=bo+"Invalid argument: ",_8=bo+"Exponent out of range: ",O0=Math.floor,Gf=Math.pow,cYe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Aa,ls=1e7,Ur=7,ole=9007199254740991,OC=O0(ole/Ur),ct={};ct.absoluteValue=ct.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};ct.comparedTo=ct.cmp=function(t){var e,r,n,s,i=this;if(t=new i.constructor(t),i.s!==t.s)return i.s||-t.s;if(i.e!==t.e)return i.e>t.e^i.s<0?1:-1;for(n=i.d.length,s=t.d.length,e=0,r=n<s?n:s;e<r;++e)if(i.d[e]!==t.d[e])return i.d[e]>t.d[e]^i.s<0?1:-1;return n===s?0:n>s^i.s<0?1:-1};ct.decimalPlaces=ct.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*Ur;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};ct.dividedBy=ct.div=function(t){return $u(this,new this.constructor(t))};ct.dividedToIntegerBy=ct.idiv=function(t){var e=this,r=e.constructor;return _r($u(e,new r(t),0,1),r.precision)};ct.equals=ct.eq=function(t){return!this.cmp(t)};ct.exponent=function(){return Mn(this)};ct.greaterThan=ct.gt=function(t){return this.cmp(t)>0};ct.greaterThanOrEqualTo=ct.gte=function(t){return this.cmp(t)>=0};ct.isInteger=ct.isint=function(){return this.e>this.d.length-2};ct.isNegative=ct.isneg=function(){return this.s<0};ct.isPositive=ct.ispos=function(){return this.s>0};ct.isZero=function(){return this.s===0};ct.lessThan=ct.lt=function(t){return this.cmp(t)<0};ct.lessThanOrEqualTo=ct.lte=function(t){return this.cmp(t)<1};ct.logarithm=ct.log=function(t){var e,r=this,n=r.constructor,s=n.precision,i=s+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(Aa))throw Error(bo+"NaN");if(r.s<1)throw Error(bo+(r.s?"NaN":"-Infinity"));return r.eq(Aa)?new n(0):(Zr=!1,e=$u(b1(r,i),b1(t,i),i),Zr=!0,_r(e,s))};ct.minus=ct.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?ule(e,t):lle(e,(t.s=-t.s,t))};ct.modulo=ct.mod=function(t){var e,r=this,n=r.constructor,s=n.precision;if(t=new n(t),!t.s)throw Error(bo+"NaN");return r.s?(Zr=!1,e=$u(r,t,0,1).times(t),Zr=!0,r.minus(e)):_r(new n(r),s)};ct.naturalExponential=ct.exp=function(){return cle(this)};ct.naturalLogarithm=ct.ln=function(){return b1(this)};ct.negated=ct.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};ct.plus=ct.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?lle(e,t):ule(e,(t.s=-t.s,t))};ct.precision=ct.sd=function(t){var e,r,n,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Mm+t);if(e=Mn(s)+1,n=s.d.length-1,r=n*Ur+1,n=s.d[n],n){for(;n%10==0;n/=10)r--;for(n=s.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};ct.squareRoot=ct.sqrt=function(){var t,e,r,n,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(bo+"NaN")}for(t=Mn(l),Zr=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=ac(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=O0((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new c(e)):n=new c(s.toString()),r=c.precision,s=o=r+3;;)if(i=n,n=i.plus($u(l,i,o+2)).times(.5),ac(i.d).slice(0,o)===(e=ac(n.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(_r(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(e!="9999")break;o+=4}return Zr=!0,_r(n,r)};ct.times=ct.mul=function(t){var e,r,n,s,i,o,l,c,u,d=this,h=d.constructor,f=d.d,p=(t=new h(t)).d;if(!d.s||!t.s)return new h(0);for(t.s*=d.s,r=d.e+t.e,c=f.length,u=p.length,c<u&&(i=f,f=p,p=i,o=c,c=u,u=o),i=[],o=c+u,n=o;n--;)i.push(0);for(n=u;--n>=0;){for(e=0,s=c+n;s>n;)l=i[s]+p[n]*f[s-n-1]+e,i[s--]=l%ls|0,e=l/ls|0;i[s]=(i[s]+e)%ls|0}for(;!i[--o];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,Zr?_r(t,h.precision):t};ct.toDecimalPlaces=ct.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(wc(t,0,P0),e===void 0?e=n.rounding:wc(e,0,8),_r(r,t+Mn(r)+1,e))};ct.toExponential=function(t,e){var r,n=this,s=n.constructor;return t===void 0?r=Ym(n,!0):(wc(t,0,P0),e===void 0?e=s.rounding:wc(e,0,8),n=_r(new s(n),t+1,e),r=Ym(n,!0,t+1)),r};ct.toFixed=function(t,e){var r,n,s=this,i=s.constructor;return t===void 0?Ym(s):(wc(t,0,P0),e===void 0?e=i.rounding:wc(e,0,8),n=_r(new i(s),t+Mn(s)+1,e),r=Ym(n.abs(),!1,t+Mn(n)+1),s.isneg()&&!s.isZero()?"-"+r:r)};ct.toInteger=ct.toint=function(){var t=this,e=t.constructor;return _r(new e(t),Mn(t)+1,e.rounding)};ct.toNumber=function(){return+this};ct.toPower=ct.pow=function(t){var e,r,n,s,i,o,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c(Aa);if(l=new c(l),!l.s){if(t.s<1)throw Error(bo+"Infinity");return l}if(l.eq(Aa))return l;if(n=c.precision,t.eq(Aa))return _r(l,n);if(e=t.e,r=t.d.length-1,o=e>=r,i=l.s,o){if((r=d<0?-d:d)<=ole){for(s=new c(Aa),e=Math.ceil(n/Ur+4),Zr=!1;r%2&&(s=s.times(l),qV(s.d,e)),r=O0(r/2),r!==0;)l=l.times(l),qV(l.d,e);return Zr=!0,t.s<0?new c(Aa).div(s):_r(s,n)}}else if(i<0)throw Error(bo+"NaN");return i=i<0&&t.d[Math.max(e,r)]&1?-1:1,l.s=1,Zr=!1,s=t.times(b1(l,n+u)),Zr=!0,s=cle(s),s.s=i,s};ct.toPrecision=function(t,e){var r,n,s=this,i=s.constructor;return t===void 0?(r=Mn(s),n=Ym(s,r<=i.toExpNeg||r>=i.toExpPos)):(wc(t,1,P0),e===void 0?e=i.rounding:wc(e,0,8),s=_r(new i(s),t,e),r=Mn(s),n=Ym(s,t<=r||r<=i.toExpNeg,t)),n};ct.toSignificantDigits=ct.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(wc(t,1,P0),e===void 0?e=n.rounding:wc(e,0,8)),_r(new n(r),t,e)};ct.toString=ct.valueOf=ct.val=ct.toJSON=ct[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Mn(t),r=t.constructor;return Ym(t,e<=r.toExpNeg||e>=r.toExpPos)};function lle(t,e){var r,n,s,i,o,l,c,u,d=t.constructor,h=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Zr?_r(e,h):e;if(c=t.d,u=e.d,o=t.e,s=e.e,c=c.slice(),i=o-s,i){for(i<0?(n=c,i=-i,l=u.length):(n=u,s=o,l=c.length),o=Math.ceil(h/Ur),l=o>l?o+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/ls|0,c[i]%=ls;for(r&&(c.unshift(r),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,Zr?_r(e,h):e}function wc(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Mm+t)}function ac(t){var e,r,n,s=t.length-1,i="",o=t[0];if(s>0){for(i+=o,e=1;e<s;e++)n=t[e]+"",r=Ur-n.length,r&&(i+=Cd(r)),i+=n;o=t[e],n=o+"",r=Ur-n.length,r&&(i+=Cd(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var $u=function(){function t(n,s){var i,o=0,l=n.length;for(n=n.slice();l--;)i=n[l]*s+o,n[l]=i%ls|0,o=i/ls|0;return o&&n.unshift(o),n}function e(n,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=s[l]){c=n[l]>s[l]?1:-1;break}return c}function r(n,s,i){for(var o=0;i--;)n[i]-=o,o=n[i]<s[i]?1:0,n[i]=o*ls+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,s,i,o){var l,c,u,d,h,f,p,g,m,v,y,x,b,w,j,N,C,k,E=n.constructor,M=n.s==s.s?1:-1,z=n.d,I=s.d;if(!n.s)return new E(n);if(!s.s)throw Error(bo+"Division by zero");for(c=n.e-s.e,C=I.length,j=z.length,p=new E(M),g=p.d=[],u=0;I[u]==(z[u]||0);)++u;if(I[u]>(z[u]||0)&&--c,i==null?x=i=E.precision:o?x=i+(Mn(n)-Mn(s))+1:x=i,x<0)return new E(0);if(x=x/Ur+2|0,u=0,C==1)for(d=0,I=I[0],x++;(u<j||d)&&x--;u++)b=d*ls+(z[u]||0),g[u]=b/I|0,d=b%I|0;else{for(d=ls/(I[0]+1)|0,d>1&&(I=t(I,d),z=t(z,d),C=I.length,j=z.length),w=C,m=z.slice(0,C),v=m.length;v<C;)m[v++]=0;k=I.slice(),k.unshift(0),N=I[0],I[1]>=ls/2&&++N;do d=0,l=e(I,m,C,v),l<0?(y=m[0],C!=v&&(y=y*ls+(m[1]||0)),d=y/N|0,d>1?(d>=ls&&(d=ls-1),h=t(I,d),f=h.length,v=m.length,l=e(h,m,f,v),l==1&&(d--,r(h,C<f?k:I,f))):(d==0&&(l=d=1),h=I.slice()),f=h.length,f<v&&h.unshift(0),r(m,h,v),l==-1&&(v=m.length,l=e(I,m,C,v),l<1&&(d++,r(m,C<v?k:I,v))),v=m.length):l===0&&(d++,m=[0]),g[u++]=d,l&&m[0]?m[v++]=z[w]||0:(m=[z[w]],v=1);while((w++<j||m[0]!==void 0)&&x--)}return g[0]||g.shift(),p.e=c,_r(p,o?i+Mn(p)+1:i)}}();function cle(t,e){var r,n,s,i,o,l,c=0,u=0,d=t.constructor,h=d.precision;if(Mn(t)>16)throw Error(_8+Mn(t));if(!t.s)return new d(Aa);for(e==null?(Zr=!1,l=h):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(n=Math.log(Gf(2,u))/Math.LN10*2+5|0,l+=n,r=s=i=new d(Aa),d.precision=l;;){if(s=_r(s.times(t),l),r=r.times(++c),o=i.plus($u(s,r,l)),ac(o.d).slice(0,l)===ac(i.d).slice(0,l)){for(;u--;)i=_r(i.times(i),l);return d.precision=h,e==null?(Zr=!0,_r(i,h)):i}i=o}}function Mn(t){for(var e=t.e*Ur,r=t.d[0];r>=10;r/=10)e++;return e}function tI(t,e,r){if(e>t.LN10.sd())throw Zr=!0,r&&(t.precision=r),Error(bo+"LN10 precision limit exceeded");return _r(new t(t.LN10),e)}function Cd(t){for(var e="";t--;)e+="0";return e}function b1(t,e){var r,n,s,i,o,l,c,u,d,h=1,f=10,p=t,g=p.d,m=p.constructor,v=m.precision;if(p.s<1)throw Error(bo+(p.s?"NaN":"-Infinity"));if(p.eq(Aa))return new m(0);if(e==null?(Zr=!1,u=v):u=e,p.eq(10))return e==null&&(Zr=!0),tI(m,u);if(u+=f,m.precision=u,r=ac(g),n=r.charAt(0),i=Mn(p),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(t),r=ac(p.d),n=r.charAt(0),h++;i=Mn(p),n>1?(p=new m("0."+r),i++):p=new m(n+"."+r.slice(1))}else return c=tI(m,u+2,v).times(i+""),p=b1(new m(n+"."+r.slice(1)),u-f).plus(c),m.precision=v,e==null?(Zr=!0,_r(p,v)):p;for(l=o=p=$u(p.minus(Aa),p.plus(Aa),u),d=_r(p.times(p),u),s=3;;){if(o=_r(o.times(d),u),c=l.plus($u(o,new m(s),u)),ac(c.d).slice(0,u)===ac(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(tI(m,u+2,v).times(i+""))),l=$u(l,new m(h),u),m.precision=v,e==null?(Zr=!0,_r(l,v)):l;l=c,s+=2}}function VV(t,e){var r,n,s;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(n,s),e){if(s-=n,r=r-n-1,t.e=O0(r/Ur),t.d=[],n=(r+1)%Ur,r<0&&(n+=Ur),n<s){for(n&&t.d.push(+e.slice(0,n)),s-=Ur;n<s;)t.d.push(+e.slice(n,n+=Ur));e=e.slice(n),n=Ur-e.length}else n-=s;for(;n--;)e+="0";if(t.d.push(+e),Zr&&(t.e>OC||t.e<-OC))throw Error(_8+r)}else t.s=0,t.e=0,t.d=[0];return t}function _r(t,e,r){var n,s,i,o,l,c,u,d,h=t.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(n=e-o,n<0)n+=Ur,s=e,u=h[d=0];else{if(d=Math.ceil((n+1)/Ur),i=h.length,d>=i)return t;for(u=i=h[d],o=1;i>=10;i/=10)o++;n%=Ur,s=n-Ur+o}if(r!==void 0&&(i=Gf(10,o-s-1),l=u/i%10|0,c=e<0||h[d+1]!==void 0||u%i,c=r<4?(l||c)&&(r==0||r==(t.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?s>0?u/Gf(10,o-s):0:h[d-1])%10&1||r==(t.s<0?8:7))),e<1||!h[0])return c?(i=Mn(t),h.length=1,e=e-i-1,h[0]=Gf(10,(Ur-e%Ur)%Ur),t.e=O0(-e/Ur)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(n==0?(h.length=d,i=1,d--):(h.length=d+1,i=Gf(10,Ur-n),h[d]=s>0?(u/Gf(10,o-s)%Gf(10,s)|0)*i:0),c)for(;;)if(d==0){(h[0]+=i)==ls&&(h[0]=1,++t.e);break}else{if(h[d]+=i,h[d]!=ls)break;h[d--]=0,i=1}for(n=h.length;h[--n]===0;)h.pop();if(Zr&&(t.e>OC||t.e<-OC))throw Error(_8+Mn(t));return t}function ule(t,e){var r,n,s,i,o,l,c,u,d,h,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),Zr?_r(e,p):e;if(c=t.d,h=e.d,n=e.e,u=t.e,c=c.slice(),o=u-n,o){for(d=o<0,d?(r=c,o=-o,l=h.length):(r=h,n=u,l=c.length),s=Math.max(Math.ceil(p/Ur),l)+2,o>s&&(o=s,r.length=1),r.reverse(),s=o;s--;)r.push(0);r.reverse()}else{for(s=c.length,l=h.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=h[s]){d=c[s]<h[s];break}o=0}for(d&&(r=c,c=h,h=r,e.s=-e.s),l=c.length,s=h.length-l;s>0;--s)c[l++]=0;for(s=h.length;s>o;){if(c[--s]<h[s]){for(i=s;i&&c[--i]===0;)c[i]=ls-1;--c[i],c[s]+=ls}c[s]-=h[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=n,Zr?_r(e,p):e):new f(0)}function Ym(t,e,r){var n,s=Mn(t),i=ac(t.d),o=i.length;return e?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+Cd(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Cd(-s-1)+i,r&&(n=r-o)>0&&(i+=Cd(n))):s>=o?(i+=Cd(s+1-o),r&&(n=r-s-1)>0&&(i=i+"."+Cd(n))):((n=s+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(s+1===o&&(i+="."),i+=Cd(n))),t.s<0?"-"+i:i}function qV(t,e){if(t.length>e)return t.length=e,!0}function dle(t){var e,r,n;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Mm+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return VV(o,i.toString())}else if(typeof i!="string")throw Error(Mm+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,cYe.test(i))VV(o,i);else throw Error(Mm+i)}if(s.prototype=ct,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=dle,s.config=s.set=uYe,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return s.config(t),s}function uYe(t){if(!t||typeof t!="object")throw Error(bo+"Object expected");var e,r,n,s=["precision",1,P0,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((n=t[r=s[e]])!==void 0)if(O0(n)===n&&n>=s[e+1]&&n<=s[e+2])this[r]=n;else throw Error(Mm+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Mm+r+": "+n);return this}var j8=dle(lYe);Aa=new j8(1);const vr=j8;function dYe(t){return mYe(t)||pYe(t)||fYe(t)||hYe()}function hYe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fYe(t,e){if(t){if(typeof t=="string")return yL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yL(t,e)}}function pYe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function mYe(t){if(Array.isArray(t))return yL(t)}function yL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var gYe=function(e){return e},hle={"@@functional/placeholder":!0},fle=function(e){return e===hle},GV=function(e){return function r(){return arguments.length===0||arguments.length===1&&fle(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},yYe=function t(e,r){return e===1?r:GV(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];var o=s.filter(function(l){return l!==hle}).length;return o>=e?r.apply(void 0,s):t(e-o,GV(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=s.map(function(h){return fle(h)?c.shift():h});return r.apply(void 0,dYe(d).concat(c))}))})},b2=function(e){return yYe(e.length,e)},vL=function(e,r){for(var n=[],s=e;s<r;++s)n[s-e]=s;return n},vYe=b2(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(r){return e[r]}).map(t)}),xYe=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r.length)return gYe;var s=r.reverse(),i=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},xL=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},ple=function(e){var r=null,n=null;return function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return r&&i.every(function(l,c){return l===r[c]})||(r=i,n=e.apply(void 0,i)),n}};function bYe(t){var e;return t===0?e=1:e=Math.floor(new vr(t).abs().log(10).toNumber())+1,e}function wYe(t,e,r){for(var n=new vr(t),s=0,i=[];n.lt(e)&&s<1e5;)i.push(n.toNumber()),n=n.add(r),s++;return i}var _Ye=b2(function(t,e,r){var n=+t,s=+e;return n+r*(s-n)}),jYe=b2(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),SYe=b2(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});const w2={rangeStep:wYe,getDigitCount:bYe,interpolateNumber:_Ye,uninterpolateNumber:jYe,uninterpolateTruncation:SYe};function bL(t){return EYe(t)||AYe(t)||mle(t)||NYe()}function NYe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AYe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function EYe(t){if(Array.isArray(t))return wL(t)}function w1(t,e){return TYe(t)||kYe(t,e)||mle(t,e)||CYe()}function CYe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mle(t,e){if(t){if(typeof t=="string")return wL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wL(t,e)}}function wL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kYe(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,s=!1,i=void 0;try{for(var o=t[Symbol.iterator](),l;!(n=(l=o.next()).done)&&(r.push(l.value),!(e&&r.length===e));n=!0);}catch(c){s=!0,i=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw i}}return r}}function TYe(t){if(Array.isArray(t))return t}function gle(t){var e=w1(t,2),r=e[0],n=e[1],s=r,i=n;return r>n&&(s=n,i=r),[s,i]}function yle(t,e,r){if(t.lte(0))return new vr(0);var n=w2.getDigitCount(t.toNumber()),s=new vr(10).pow(n),i=t.div(s),o=n!==1?.05:.1,l=new vr(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(s);return e?c:new vr(Math.ceil(c))}function PYe(t,e,r){var n=1,s=new vr(t);if(!s.isint()&&r){var i=Math.abs(t);i<1?(n=new vr(10).pow(w2.getDigitCount(t)-1),s=new vr(Math.floor(s.div(n).toNumber())).mul(n)):i>1&&(s=new vr(Math.floor(t)))}else t===0?s=new vr(Math.floor((e-1)/2)):r||(s=new vr(Math.floor(t)));var o=Math.floor((e-1)/2),l=xYe(vYe(function(c){return s.add(new vr(c-o).mul(n)).toNumber()}),vL);return l(0,e)}function vle(t,e,r,n){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new vr(0),tickMin:new vr(0),tickMax:new vr(0)};var i=yle(new vr(e).sub(t).div(r-1),n,s),o;t<=0&&e>=0?o=new vr(0):(o=new vr(t).add(e).div(2),o=o.sub(new vr(o).mod(i)));var l=Math.ceil(o.sub(t).div(i).toNumber()),c=Math.ceil(new vr(e).sub(o).div(i).toNumber()),u=l+c+1;return u>r?vle(t,e,r,n,s+1):(u<r&&(c=e>0?c+(r-u):c,l=e>0?l:l+(r-u)),{step:i,tickMin:o.sub(new vr(l).mul(i)),tickMax:o.add(new vr(c).mul(i))})}function OYe(t){var e=w1(t,2),r=e[0],n=e[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=gle([r,n]),c=w1(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var h=d===1/0?[u].concat(bL(vL(0,s-1).map(function(){return 1/0}))):[].concat(bL(vL(0,s-1).map(function(){return-1/0})),[d]);return r>n?xL(h):h}if(u===d)return PYe(u,s,i);var f=vle(u,d,o,i),p=f.step,g=f.tickMin,m=f.tickMax,v=w2.rangeStep(g,m.add(new vr(.1).mul(p)),p);return r>n?xL(v):v}function IYe(t,e){var r=w1(t,2),n=r[0],s=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=gle([n,s]),l=w1(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,s];if(c===u)return[c];var d=Math.max(e,2),h=yle(new vr(u).sub(c).div(d-1),i,0),f=[].concat(bL(w2.rangeStep(new vr(c),new vr(u).sub(new vr(.99).mul(h)),h)),[u]);return n>s?xL(f):f}var RYe=ple(OYe),MYe=ple(IYe),DYe="Invariant failed";function Dx(t,e){throw new Error(DYe)}var LYe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Lx(t){"@babel/helpers - typeof";return Lx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lx(t)}function IC(){return IC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},IC.apply(this,arguments)}function FYe(t,e){return zYe(t)||UYe(t,e)||BYe(t,e)||$Ye()}function $Ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BYe(t,e){if(t){if(typeof t=="string")return KV(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return KV(t,e)}}function KV(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function UYe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function zYe(t){if(Array.isArray(t))return t}function HYe(t,e){if(t==null)return{};var r=WYe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function WYe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function VYe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qYe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wle(n.key),n)}}function GYe(t,e,r){return e&&qYe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function KYe(t,e,r){return e=RC(e),YYe(t,xle()?Reflect.construct(e,r||[],RC(t).constructor):e.apply(t,r))}function YYe(t,e){if(e&&(Lx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XYe(t)}function XYe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xle=function(){return!!t})()}function RC(t){return RC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},RC(t)}function QYe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_L(t,e)}function _L(t,e){return _L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},_L(t,e)}function ble(t,e,r){return e=wle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wle(t){var e=ZYe(t,"string");return Lx(e)=="symbol"?e:e+""}function ZYe(t,e){if(Lx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Lx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var S8=function(t){function e(){return VYe(this,e),KYe(this,e,arguments)}return QYe(e,t),GYe(e,[{key:"render",value:function(){var n=this.props,s=n.offset,i=n.layout,o=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,d=n.xAxis,h=n.yAxis,f=HYe(n,LYe),p=Lt(f,!1);this.props.direction==="x"&&d.type!=="number"&&Dx();var g=c.map(function(m){var v=u(m,l),y=v.x,x=v.y,b=v.value,w=v.errorVal;if(!w)return null;var j=[],N,C;if(Array.isArray(w)){var k=FYe(w,2);N=k[0],C=k[1]}else N=C=w;if(i==="vertical"){var E=d.scale,M=x+s,z=M+o,I=M-o,q=E(b-N),A=E(b+C);j.push({x1:A,y1:z,x2:A,y2:I}),j.push({x1:q,y1:M,x2:A,y2:M}),j.push({x1:q,y1:z,x2:q,y2:I})}else if(i==="horizontal"){var U=h.scale,K=y+s,G=K-o,Y=K+o,H=U(b-N),$=U(b+C);j.push({x1:G,y1:$,x2:Y,y2:$}),j.push({x1:K,y1:H,x2:K,y2:$}),j.push({x1:G,y1:H,x2:Y,y2:H})}return me.createElement(mn,IC({className:"recharts-errorBar",key:"bar-".concat(j.map(function(L){return"".concat(L.x1,"-").concat(L.x2,"-").concat(L.y1,"-").concat(L.y2)}))},p),j.map(function(L){return me.createElement("line",IC({},L,{key:"line-".concat(L.x1,"-").concat(L.x2,"-").concat(L.y1,"-").concat(L.y2)}))}))});return me.createElement(mn,{className:"recharts-errorBars"},g)}}])}(me.Component);ble(S8,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});ble(S8,"displayName","ErrorBar");function _1(t){"@babel/helpers - typeof";return _1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_1(t)}function YV(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Rf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?YV(Object(r),!0).forEach(function(n){JYe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):YV(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JYe(t,e,r){return e=eXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eXe(t){var e=tXe(t,"string");return _1(e)=="symbol"?e:e+""}function tXe(t,e){if(_1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(_1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _le=function(e){var r=e.children,n=e.formattedGraphicalItems,s=e.legendWidth,i=e.legendContent,o=eo(r,Ly);if(!o)return null;var l=Ly.defaultProps,c=l!==void 0?Rf(Rf({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:i==="children"?u=(n||[]).reduce(function(d,h){var f=h.item,p=h.props,g=p.sectors||p.data||[];return d.concat(g.map(function(m){return{type:o.props.iconType||f.props.legendType,value:m.name,color:m.fill,payload:m}}))},[]):u=(n||[]).map(function(d){var h=d.item,f=h.type.defaultProps,p=f!==void 0?Rf(Rf({},f),h.props):{},g=p.dataKey,m=p.name,v=p.legendType,y=p.hide;return{inactive:y,dataKey:g,type:c.iconType||v||"square",color:N8(h),value:m||g,payload:p}}),Rf(Rf(Rf({},c),Ly.getWithHeight(o,s)),{},{payload:u,item:o})};function j1(t){"@babel/helpers - typeof";return j1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j1(t)}function XV(t){return iXe(t)||sXe(t)||nXe(t)||rXe()}function rXe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nXe(t,e){if(t){if(typeof t=="string")return jL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jL(t,e)}}function sXe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function iXe(t){if(Array.isArray(t))return jL(t)}function jL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function QV(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function hn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?QV(Object(r),!0).forEach(function(n){$y(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):QV(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $y(t,e,r){return e=aXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function aXe(t){var e=oXe(t,"string");return j1(e)=="symbol"?e:e+""}function oXe(t,e){if(j1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(j1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ea(t,e,r){return Qt(t)||Qt(e)?r:Kn(e)?ol(t,e,r):Ft(e)?e(t):r}function _w(t,e,r,n){var s=sYe(t,function(l){return Ea(l,e)});if(r==="number"){var i=s.filter(function(l){return tt(l)||parseFloat(l)});return i.length?[x2(i),v2(i)]:[1/0,-1/0]}var o=n?s.filter(function(l){return!Qt(l)}):s;return o.map(function(l){return Kn(l)||l instanceof Date?l:""})}var lXe=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u<l;u++){var d=u>0?s[u-1].coordinate:s[l-1].coordinate,h=s[u].coordinate,f=u>=l-1?s[0].coordinate:s[u+1].coordinate,p=void 0;if(co(h-d)!==co(f-h)){var g=[];if(co(f-h)===co(c[1]-c[0])){p=f;var m=h+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var v=f+c[1]-c[0];g[0]=Math.min(h,(v+h)/2),g[1]=Math.max(h,(v+h)/2)}var y=[Math.min(h,(p+h)/2),Math.max(h,(p+h)/2)];if(e>y[0]&&e<=y[1]||e>=g[0]&&e<=g[1]){o=s[u].index;break}}else{var x=Math.min(d,f),b=Math.max(d,f);if(e>(x+h)/2&&e<=(b+h)/2){o=s[u].index;break}}}else for(var w=0;w<l;w++)if(w===0&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w>0&&w<l-1&&e>(n[w].coordinate+n[w-1].coordinate)/2&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w===l-1&&e>(n[w].coordinate+n[w-1].coordinate)/2){o=n[w].index;break}return o},N8=function(e){var r,n=e,s=n.type.displayName,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?hn(hn({},e.type.defaultProps),e.props):e.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},cXe=function(e){var r=e.barSize,n=e.totalSize,s=e.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var d=i[l[c]].stackGroups,h=Object.keys(d),f=0,p=h.length;f<p;f++){var g=d[h[f]],m=g.items,v=g.cateAxisId,y=m.filter(function(C){return Lu(C.type).indexOf("Bar")>=0});if(y&&y.length){var x=y[0].type.defaultProps,b=x!==void 0?hn(hn({},x),y[0].props):y[0].props,w=b.barSize,j=b[v];o[j]||(o[j]=[]);var N=Qt(w)?r:w;o[j].push({item:y[0],stackList:y.slice(1),barSize:Qt(N)?void 0:Ui(N,n,0)})}}return o},uXe=function(e){var r=e.barGap,n=e.barCategoryGap,s=e.bandSize,i=e.sizeList,o=i===void 0?[]:i,l=e.maxBarSize,c=o.length;if(c<1)return null;var u=Ui(r,s,0,!0),d,h=[];if(o[0].barSize===+o[0].barSize){var f=!1,p=s/c,g=o.reduce(function(w,j){return w+j.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&p>0&&(f=!0,p*=.9,g=c*p);var m=(s-g)/2>>0,v={offset:m-u,size:0};d=o.reduce(function(w,j){var N={item:j.item,position:{offset:v.offset+v.size+u,size:f?p:j.barSize}},C=[].concat(XV(w),[N]);return v=C[C.length-1].position,j.stackList&&j.stackList.length&&j.stackList.forEach(function(k){C.push({item:k,position:v})}),C},h)}else{var y=Ui(n,s,0,!0);s-2*y-(c-1)*u<=0&&(u=0);var x=(s-2*y-(c-1)*u)/c;x>1&&(x>>=0);var b=l===+l?Math.min(x,l):x;d=o.reduce(function(w,j,N){var C=[].concat(XV(w),[{item:j.item,position:{offset:y+(x+u)*N+(x-b)/2,size:b}}]);return j.stackList&&j.stackList.length&&j.stackList.forEach(function(k){C.push({item:k,position:C[C.length-1].position})}),C},h)}return d},dXe=function(e,r,n,s){var i=n.children,o=n.width,l=n.margin,c=o-(l.left||0)-(l.right||0),u=_le({children:i,legendWidth:c});if(u){var d=s||{},h=d.width,f=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&tt(e[p]))return hn(hn({},e),{},$y({},p,e[p]+(h||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&tt(e[g]))return hn(hn({},e),{},$y({},g,e[g]+(f||0)))}return e},hXe=function(e,r,n){return Qt(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},jle=function(e,r,n,s,i){var o=r.props.children,l=gc(o,S8).filter(function(u){return hXe(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var h=Ea(d,n);if(Qt(h))return u;var f=Array.isArray(h)?[x2(h),v2(h)]:[h,h],p=c.reduce(function(g,m){var v=Ea(d,m,0),y=f[0]-Math.abs(Array.isArray(v)?v[0]:v),x=f[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(y,g[0]),Math.max(x,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},fXe=function(e,r,n,s,i){var o=r.map(function(l){return jle(e,l,n,i,s)}).filter(function(l){return!Qt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},Sle=function(e,r,n,s,i){var o=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&jle(e,c,u,s)||_w(e,u,n,i)});if(n==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,h=u.length;d<h;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},Nle=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},Cb=function(e,r,n){if(!e)return null;var s=e.scale,i=e.duplicateDomain,o=e.type,l=e.range,c=e.realScaleType==="scaleBand"?s.bandwidth()/2:2,u=(r||n)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(u=e.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?co(l[0]-l[1])*2*u:u,r&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(h){var f=i?i.indexOf(h):h;return{coordinate:s(f)+u,value:h,offset:u}});return d.filter(function(h){return!iS(h.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(h,f){return{coordinate:s(h)+u,value:h,index:f,offset:u}}):s.ticks&&!n?s.ticks(e.tickCount).map(function(h){return{coordinate:s(h)+u,value:h,offset:u}}):s.domain().map(function(h,f){return{coordinate:s(h)+u,value:i?i[h]:h,index:f,offset:u}})},rI=new WeakMap,EN=function(e,r){if(typeof r!="function")return e;rI.has(e)||rI.set(e,new WeakMap);var n=rI.get(e);if(n.has(r))return n.get(r);var s=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,s),s},pXe=function(e,r,n){var s=e.scale,i=e.type,o=e.layout,l=e.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:m1(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:CC(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:ww(),realScaleType:"point"}:i==="category"?{scale:m1(),realScaleType:"band"}:{scale:CC(),realScaleType:"linear"};if(sS(s)){var c="scale".concat(s2(s));return{scale:(WV[c]||ww)(),realScaleType:WV[c]?c:"point"}}return Ft(s)?{scale:s}:{scale:ww(),realScaleType:"point"}},ZV=1e-4,mXe=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,s=e.range(),i=Math.min(s[0],s[1])-ZV,o=Math.max(s[0],s[1])+ZV,l=e(r[0]),c=e(r[n-1]);(l<i||l>o||c<i||c>o)&&e.domain([r[0],r[n-1]])}},gXe=function(e){var r=e.length;if(!(r<=0))for(var n=0,s=e[0].length;n<s;++n)for(var i=0,o=0,l=0;l<r;++l){var c=iS(e[l][n][1])?e[l][n][0]:e[l][n][1];c>=0?(e[l][n][0]=i,e[l][n][1]=i+c,i=e[l][n][1]):(e[l][n][0]=o,e[l][n][1]=o+c,o=e[l][n][1])}},yXe=function(e){var r=e.length;if(!(r<=0))for(var n=0,s=e[0].length;n<s;++n)for(var i=0,o=0;o<r;++o){var l=iS(e[o][n][1])?e[o][n][0]:e[o][n][1];l>=0?(e[o][n][0]=i,e[o][n][1]=i+l,i=e[o][n][1]):(e[o][n][0]=0,e[o][n][1]=0)}},vXe={sign:gXe,expand:D$e,none:Ax,silhouette:L$e,wiggle:F$e,positive:yXe},xXe=function(e,r,n){var s=r.map(function(l){return l.props.dataKey}),i=vXe[n],o=M$e().keys(s).value(function(l,c){return+Ea(l,c,0)}).order(K4).offset(i);return o(e)},bXe=function(e,r,n,s,i,o){if(!e)return null;var l=o?r.reverse():r,c={},u=l.reduce(function(h,f){var p,g=(p=f.type)!==null&&p!==void 0&&p.defaultProps?hn(hn({},f.type.defaultProps),f.props):f.props,m=g.stackId,v=g.hide;if(v)return h;var y=g[n],x=h[y]||{hasStack:!1,stackGroups:{}};if(Kn(m)){var b=x.stackGroups[m]||{numericAxisId:n,cateAxisId:s,items:[]};b.items.push(f),x.hasStack=!0,x.stackGroups[m]=b}else x.stackGroups[r2("_stackId_")]={numericAxisId:n,cateAxisId:s,items:[f]};return hn(hn({},h),{},$y({},y,x))},c),d={};return Object.keys(u).reduce(function(h,f){var p=u[f];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,v){var y=p.stackGroups[v];return hn(hn({},m),{},$y({},v,{numericAxisId:n,cateAxisId:s,items:y.items,stackedData:xXe(e,y.items,i)}))},g)}return hn(hn({},h),{},$y({},f,p))},d)},wXe=function(e,r){var n=r.realScaleType,s=r.type,i=r.tickCount,o=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=RYe(u,i,l);return e.domain([x2(d),v2(d)]),{niceTicks:d}}if(i&&s==="number"){var h=e.domain(),f=MYe(h,i,l);return{niceTicks:f}}return null},_Xe=function(e,r){var n,s=(n=e.type)!==null&&n!==void 0&&n.defaultProps?hn(hn({},e.type.defaultProps),e.props):e.props,i=s.stackId;if(Kn(i)){var o=r[i];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},jXe=function(e){return e.reduce(function(r,n){return[x2(n.concat([r[0]]).filter(tt)),v2(n.concat([r[1]]).filter(tt))]},[1/0,-1/0])},Ale=function(e,r,n){return Object.keys(e).reduce(function(s,i){var o=e[i],l=o.stackedData,c=l.reduce(function(u,d){var h=jXe(d.slice(r,n+1));return[Math.min(u[0],h[0]),Math.max(u[1],h[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},JV=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,eq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,SL=function(e,r,n){if(Ft(e))return e(r,n);if(!Array.isArray(e))return r;var s=[];if(tt(e[0]))s[0]=n?e[0]:Math.min(e[0],r[0]);else if(JV.test(e[0])){var i=+JV.exec(e[0])[1];s[0]=r[0]-i}else Ft(e[0])?s[0]=e[0](r[0]):s[0]=r[0];if(tt(e[1]))s[1]=n?e[1]:Math.max(e[1],r[1]);else if(eq.test(e[1])){var o=+eq.exec(e[1])[1];s[1]=r[1]+o}else Ft(e[1])?s[1]=e[1](r[1]):s[1]=r[1];return s},NL=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var s=e.scale.bandwidth();if(!n||s>0)return s}if(e&&r&&r.length>=2){for(var i=Q$(r,function(h){return h.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var u=i[l],d=i[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},tq=function(e,r,n){return!e||!e.length||w8(e,ol(n,"type.defaultProps.domain"))?r:e},SXe=function(e,r){var n=e.type.defaultProps?hn(hn({},e.type.defaultProps),e.props):e.props,s=n.dataKey,i=n.name,o=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,d=n.hide;return hn(hn({},Lt(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:i||s,color:N8(e),value:Ea(r,s),type:c,payload:r,chartType:u,hide:d})};function S1(t){"@babel/helpers - typeof";return S1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S1(t)}function rq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function qc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rq(Object(r),!0).forEach(function(n){Ele(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ele(t,e,r){return e=NXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NXe(t){var e=AXe(t,"string");return S1(e)=="symbol"?e:e+""}function AXe(t,e){if(S1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(S1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EXe(t,e){return PXe(t)||TXe(t,e)||kXe(t,e)||CXe()}function CXe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kXe(t,e){if(t){if(typeof t=="string")return nq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nq(t,e)}}function nq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function TXe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function PXe(t){if(Array.isArray(t))return t}var MC=Math.PI/180,OXe=function(e){return e*180/Math.PI},Or=function(e,r,n,s){return{x:e+Math.cos(-MC*s)*n,y:r+Math.sin(-MC*s)*n}},Cle=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},IXe=function(e,r,n,s,i){var o=e.width,l=e.height,c=e.startAngle,u=e.endAngle,d=Ui(e.cx,o,o/2),h=Ui(e.cy,l,l/2),f=Cle(o,l,n),p=Ui(e.innerRadius,f,0),g=Ui(e.outerRadius,f,f*.8),m=Object.keys(r);return m.reduce(function(v,y){var x=r[y],b=x.domain,w=x.reversed,j;if(Qt(x.range))s==="angleAxis"?j=[c,u]:s==="radiusAxis"&&(j=[p,g]),w&&(j=[j[1],j[0]]);else{j=x.range;var N=j,C=EXe(N,2);c=C[0],u=C[1]}var k=pXe(x,i),E=k.realScaleType,M=k.scale;M.domain(b).range(j),mXe(M);var z=wXe(M,qc(qc({},x),{},{realScaleType:E})),I=qc(qc(qc({},x),z),{},{range:j,radius:g,realScaleType:E,scale:M,cx:d,cy:h,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return qc(qc({},v),{},Ele({},y,I))},{})},RXe=function(e,r){var n=e.x,s=e.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(s-o,2))},MXe=function(e,r){var n=e.x,s=e.y,i=r.cx,o=r.cy,l=RXe({x:n,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(n-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:OXe(u),angleInRadian:u}},DXe=function(e){var r=e.startAngle,n=e.endAngle,s=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(s,i);return{startAngle:r-o*360,endAngle:n-o*360}},LXe=function(e,r){var n=r.startAngle,s=r.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(i,o);return e+l*360},sq=function(e,r){var n=e.x,s=e.y,i=MXe({x:n,y:s},r),o=i.radius,l=i.angle,c=r.innerRadius,u=r.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=DXe(r),h=d.startAngle,f=d.endAngle,p=l,g;if(h<=f){for(;p>f;)p-=360;for(;p<h;)p+=360;g=p>=h&&p<=f}else{for(;p>h;)p-=360;for(;p<f;)p+=360;g=p>=f&&p<=h}return g?qc(qc({},r),{},{radius:o,angle:LXe(p,r)}):null},kle=function(e){return!S.isValidElement(e)&&!Ft(e)&&typeof e!="boolean"?e.className:""};function N1(t){"@babel/helpers - typeof";return N1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N1(t)}var FXe=["offset"];function $Xe(t){return HXe(t)||zXe(t)||UXe(t)||BXe()}function BXe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UXe(t,e){if(t){if(typeof t=="string")return AL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return AL(t,e)}}function zXe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function HXe(t){if(Array.isArray(t))return AL(t)}function AL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function WXe(t,e){if(t==null)return{};var r=VXe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function VXe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function iq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Fn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?iq(Object(r),!0).forEach(function(n){qXe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):iq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qXe(t,e,r){return e=GXe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GXe(t){var e=KXe(t,"string");return N1(e)=="symbol"?e:e+""}function KXe(t,e){if(N1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(N1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A1(){return A1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},A1.apply(this,arguments)}var YXe=function(e){var r=e.value,n=e.formatter,s=Qt(e.children)?r:e.children;return Ft(n)?n(s):s},XXe=function(e,r){var n=co(r-e),s=Math.min(Math.abs(r-e),360);return n*s},QXe=function(e,r,n){var s=e.position,i=e.viewBox,o=e.offset,l=e.className,c=i,u=c.cx,d=c.cy,h=c.innerRadius,f=c.outerRadius,p=c.startAngle,g=c.endAngle,m=c.clockWise,v=(h+f)/2,y=XXe(p,g),x=y>=0?1:-1,b,w;s==="insideStart"?(b=p+x*o,w=m):s==="insideEnd"?(b=g-x*o,w=!m):s==="end"&&(b=g+x*o,w=m),w=y<=0?w:!w;var j=Or(u,d,v,b),N=Or(u,d,v,b+(w?1:-1)*359),C="M".concat(j.x,",").concat(j.y,`
    A`).concat(v,",").concat(v,",0,1,").concat(w?0:1,`,
    `).concat(N.x,",").concat(N.y),k=Qt(e.id)?r2("recharts-radial-line-"):e.id;return me.createElement("text",A1({},n,{dominantBaseline:"central",className:Jt("recharts-radial-bar-label",l)}),me.createElement("defs",null,me.createElement("path",{id:k,d:C})),me.createElement("textPath",{xlinkHref:"#".concat(k)},r))},ZXe=function(e){var r=e.viewBox,n=e.offset,s=e.position,i=r,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,h=i.endAngle,f=(d+h)/2;if(s==="outside"){var p=Or(o,l,u+n,f),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+u)/2,y=Or(o,l,v,f),x=y.x,b=y.y;return{x,y:b,textAnchor:"middle",verticalAnchor:"middle"}},JXe=function(e){var r=e.viewBox,n=e.parentViewBox,s=e.offset,i=e.position,o=r,l=o.x,c=o.y,u=o.width,d=o.height,h=d>=0?1:-1,f=h*s,p=h>0?"end":"start",g=h>0?"start":"end",m=u>=0?1:-1,v=m*s,y=m>0?"end":"start",x=m>0?"start":"end";if(i==="top"){var b={x:l+u/2,y:c-h*s,textAnchor:"middle",verticalAnchor:p};return Fn(Fn({},b),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var w={x:l+u/2,y:c+d+f,textAnchor:"middle",verticalAnchor:g};return Fn(Fn({},w),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var j={x:l-v,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return Fn(Fn({},j),n?{width:Math.max(j.x-n.x,0),height:d}:{})}if(i==="right"){var N={x:l+u+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return Fn(Fn({},N),n?{width:Math.max(n.x+n.width-N.x,0),height:d}:{})}var C=n?{width:u,height:d}:{};return i==="insideLeft"?Fn({x:l+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},C):i==="insideRight"?Fn({x:l+u-v,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},C):i==="insideTop"?Fn({x:l+u/2,y:c+f,textAnchor:"middle",verticalAnchor:g},C):i==="insideBottom"?Fn({x:l+u/2,y:c+d-f,textAnchor:"middle",verticalAnchor:p},C):i==="insideTopLeft"?Fn({x:l+v,y:c+f,textAnchor:x,verticalAnchor:g},C):i==="insideTopRight"?Fn({x:l+u-v,y:c+f,textAnchor:y,verticalAnchor:g},C):i==="insideBottomLeft"?Fn({x:l+v,y:c+d-f,textAnchor:x,verticalAnchor:p},C):i==="insideBottomRight"?Fn({x:l+u-v,y:c+d-f,textAnchor:y,verticalAnchor:p},C):j0(i)&&(tt(i.x)||lp(i.x))&&(tt(i.y)||lp(i.y))?Fn({x:l+Ui(i.x,u),y:c+Ui(i.y,d),textAnchor:"end",verticalAnchor:"end"},C):Fn({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},C)},eQe=function(e){return"cx"in e&&tt(e.cx)};function js(t){var e=t.offset,r=e===void 0?5:e,n=WXe(t,FXe),s=Fn({offset:r},n),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,h=d===void 0?"":d,f=s.textBreakAll;if(!i||Qt(l)&&Qt(c)&&!S.isValidElement(u)&&!Ft(u))return null;if(S.isValidElement(u))return S.cloneElement(u,s);var p;if(Ft(u)){if(p=S.createElement(u,s),S.isValidElement(p))return p}else p=YXe(s);var g=eQe(i),m=Lt(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return QXe(s,p,m);var v=g?ZXe(s):JXe(s);return me.createElement(Ox,A1({className:Jt("recharts-label",h)},m,v,{breakAll:f}),p)}js.displayName="Label";var Tle=function(e){var r=e.cx,n=e.cy,s=e.angle,i=e.startAngle,o=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,h=e.x,f=e.y,p=e.top,g=e.left,m=e.width,v=e.height,y=e.clockWise,x=e.labelViewBox;if(x)return x;if(tt(m)&&tt(v)){if(tt(h)&&tt(f))return{x:h,y:f,width:m,height:v};if(tt(p)&&tt(g))return{x:p,y:g,width:m,height:v}}return tt(h)&&tt(f)?{x:h,y:f,width:0,height:0}:tt(r)&&tt(n)?{cx:r,cy:n,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:y}:e.viewBox?e.viewBox:{}},tQe=function(e,r){return e?e===!0?me.createElement(js,{key:"label-implicit",viewBox:r}):Kn(e)?me.createElement(js,{key:"label-implicit",viewBox:r,value:e}):S.isValidElement(e)?e.type===js?S.cloneElement(e,{key:"label-implicit",viewBox:r}):me.createElement(js,{key:"label-implicit",content:e,viewBox:r}):Ft(e)?me.createElement(js,{key:"label-implicit",content:e,viewBox:r}):j0(e)?me.createElement(js,A1({viewBox:r},e,{key:"label-implicit"})):null:null},rQe=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,i=Tle(e),o=gc(s,js).map(function(c,u){return S.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return o;var l=tQe(e.label,r||i);return[l].concat($Xe(o))};js.parseViewBox=Tle;js.renderCallByParent=rQe;function nQe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var sQe=nQe;const iQe=qt(sQe);function E1(t){"@babel/helpers - typeof";return E1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E1(t)}var aQe=["valueAccessor"],oQe=["data","dataKey","clockWise","id","textBreakAll"];function lQe(t){return hQe(t)||dQe(t)||uQe(t)||cQe()}function cQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uQe(t,e){if(t){if(typeof t=="string")return EL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return EL(t,e)}}function dQe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function hQe(t){if(Array.isArray(t))return EL(t)}function EL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function DC(){return DC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},DC.apply(this,arguments)}function aq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function oq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aq(Object(r),!0).forEach(function(n){fQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function fQe(t,e,r){return e=pQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pQe(t){var e=mQe(t,"string");return E1(e)=="symbol"?e:e+""}function mQe(t,e){if(E1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(E1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lq(t,e){if(t==null)return{};var r=gQe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gQe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var yQe=function(e){return Array.isArray(e.value)?iQe(e.value):e.value};function Dm(t){var e=t.valueAccessor,r=e===void 0?yQe:e,n=lq(t,aQe),s=n.data,i=n.dataKey,o=n.clockWise,l=n.id,c=n.textBreakAll,u=lq(n,oQe);return!s||!s.length?null:me.createElement(mn,{className:"recharts-label-list"},s.map(function(d,h){var f=Qt(i)?r(d,h):Ea(d&&d.payload,i),p=Qt(l)?{}:{id:"".concat(l,"-").concat(h)};return me.createElement(js,DC({},Lt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:f,textBreakAll:c,viewBox:js.parseViewBox(Qt(o)?d:oq(oq({},d),{},{clockWise:o})),key:"label-".concat(h),index:h}))}))}Dm.displayName="LabelList";function vQe(t,e){return t?t===!0?me.createElement(Dm,{key:"labelList-implicit",data:e}):me.isValidElement(t)||Ft(t)?me.createElement(Dm,{key:"labelList-implicit",data:e,content:t}):j0(t)?me.createElement(Dm,DC({data:e},t,{key:"labelList-implicit"})):null:null}function xQe(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,s=gc(n,Dm).map(function(o,l){return S.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!r)return s;var i=vQe(t.label,e);return[i].concat(lQe(s))}Dm.renderCallByParent=xQe;function C1(t){"@babel/helpers - typeof";return C1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C1(t)}function CL(){return CL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},CL.apply(this,arguments)}function cq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function uq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cq(Object(r),!0).forEach(function(n){bQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bQe(t,e,r){return e=wQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wQe(t){var e=_Qe(t,"string");return C1(e)=="symbol"?e:e+""}function _Qe(t,e){if(C1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(C1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jQe=function(e,r){var n=co(r-e),s=Math.min(Math.abs(r-e),359.999);return n*s},CN=function(e){var r=e.cx,n=e.cy,s=e.radius,i=e.angle,o=e.sign,l=e.isExternal,c=e.cornerRadius,u=e.cornerIsExternal,d=c*(l?1:-1)+s,h=Math.asin(c/d)/MC,f=u?i:i+o*h,p=Or(r,n,d,f),g=Or(r,n,s,f),m=u?i-o*h:i,v=Or(r,n,d*Math.cos(h*MC),m);return{center:p,circleTangency:g,lineTangency:v,theta:h}},Ple=function(e){var r=e.cx,n=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.startAngle,l=e.endAngle,c=jQe(o,l),u=o+c,d=Or(r,n,i,o),h=Or(r,n,i,u),f="M ".concat(d.x,",").concat(d.y,`
    A `).concat(i,",").concat(i,`,0,
    `).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
    `).concat(h.x,",").concat(h.y,`
  `);if(s>0){var p=Or(r,n,s,o),g=Or(r,n,s,u);f+="L ".concat(g.x,",").concat(g.y,`
            A `).concat(s,",").concat(s,`,0,
            `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
            `).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(r,",").concat(n," Z");return f},SQe=function(e){var r=e.cx,n=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,h=co(d-u),f=CN({cx:r,cy:n,radius:i,angle:u,sign:h,cornerRadius:o,cornerIsExternal:c}),p=f.circleTangency,g=f.lineTangency,m=f.theta,v=CN({cx:r,cy:n,radius:i,angle:d,sign:-h,cornerRadius:o,cornerIsExternal:c}),y=v.circleTangency,x=v.lineTangency,b=v.theta,w=c?Math.abs(u-d):Math.abs(u-d)-m-b;if(w<0)return l?"M ".concat(g.x,",").concat(g.y,`
        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
      `):Ple({cx:r,cy:n,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var j="M ".concat(g.x,",").concat(g.y,`
    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(p.x,",").concat(p.y,`
    A`).concat(i,",").concat(i,",0,").concat(+(w>180),",").concat(+(h<0),",").concat(y.x,",").concat(y.y,`
    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(x.x,",").concat(x.y,`
  `);if(s>0){var N=CN({cx:r,cy:n,radius:s,angle:u,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),C=N.circleTangency,k=N.lineTangency,E=N.theta,M=CN({cx:r,cy:n,radius:s,angle:d,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),z=M.circleTangency,I=M.lineTangency,q=M.theta,A=c?Math.abs(u-d):Math.abs(u-d)-E-q;if(A<0&&o===0)return"".concat(j,"L").concat(r,",").concat(n,"Z");j+="L".concat(I.x,",").concat(I.y,`
      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(z.x,",").concat(z.y,`
      A`).concat(s,",").concat(s,",0,").concat(+(A>180),",").concat(+(h>0),",").concat(C.x,",").concat(C.y,`
      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(k.x,",").concat(k.y,"Z")}else j+="L".concat(r,",").concat(n,"Z");return j},NQe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Ole=function(e){var r=uq(uq({},NQe),e),n=r.cx,s=r.cy,i=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,h=r.endAngle,f=r.className;if(o<i||d===h)return null;var p=Jt("recharts-sector",f),g=o-i,m=Ui(l,g,0,!0),v;return m>0&&Math.abs(d-h)<360?v=SQe({cx:n,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:h}):v=Ple({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:h}),me.createElement("path",CL({},Lt(r,!0),{className:p,d:v,role:"img"}))};function k1(t){"@babel/helpers - typeof";return k1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k1(t)}function kL(){return kL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kL.apply(this,arguments)}function dq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function hq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dq(Object(r),!0).forEach(function(n){AQe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function AQe(t,e,r){return e=EQe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function EQe(t){var e=CQe(t,"string");return k1(e)=="symbol"?e:e+""}function CQe(t,e){if(k1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(k1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var fq={curveBasisClosed:S$e,curveBasisOpen:N$e,curveBasis:j$e,curveBumpX:c$e,curveBumpY:u$e,curveLinearClosed:A$e,curveLinear:a2,curveMonotoneX:E$e,curveMonotoneY:C$e,curveNatural:k$e,curveStep:T$e,curveStepAfter:O$e,curveStepBefore:P$e},kN=function(e){return e.x===+e.x&&e.y===+e.y},ab=function(e){return e.x},ob=function(e){return e.y},kQe=function(e,r){if(Ft(e))return e;var n="curve".concat(s2(e));return(n==="curveMonotone"||n==="curveBump")&&r?fq["".concat(n).concat(r==="vertical"?"Y":"X")]:fq[n]||a2},TQe=function(e){var r=e.type,n=r===void 0?"linear":r,s=e.points,i=s===void 0?[]:s,o=e.baseLine,l=e.layout,c=e.connectNulls,u=c===void 0?!1:c,d=kQe(n,l),h=u?i.filter(function(m){return kN(m)}):i,f;if(Array.isArray(o)){var p=u?o.filter(function(m){return kN(m)}):o,g=h.map(function(m,v){return hq(hq({},m),{},{base:p[v]})});return l==="vertical"?f=xN().y(ob).x1(ab).x0(function(m){return m.base.x}):f=xN().x(ab).y1(ob).y0(function(m){return m.base.y}),f.defined(kN).curve(d),f(g)}return l==="vertical"&&tt(o)?f=xN().y(ob).x1(ab).x0(o):tt(o)?f=xN().x(ab).y1(ob).y0(o):f=Pae().x(ab).y(ob),f.defined(kN).curve(d),f(h)},TL=function(e){var r=e.className,n=e.points,s=e.path,i=e.pathRef;if((!n||!n.length)&&!s)return null;var o=n&&n.length?TQe(e):s;return S.createElement("path",kL({},Lt(e,!1),lC(e),{className:Jt("recharts-curve",r),d:o,ref:i}))},Ile={exports:{}},PQe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",OQe=PQe,IQe=OQe;function Rle(){}function Mle(){}Mle.resetWarningCache=Rle;var RQe=function(){function t(n,s,i,o,l,c){if(c!==IQe){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Mle,resetWarningCache:Rle};return r.PropTypes=r,r};Ile.exports=RQe();var MQe=Ile.exports;const cr=qt(MQe);var DQe=Object.getOwnPropertyNames,LQe=Object.getOwnPropertySymbols,FQe=Object.prototype.hasOwnProperty;function pq(t,e){return function(n,s,i){return t(n,s,i)&&e(n,s,i)}}function TN(t){return function(r,n,s){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,s);var i=s.cache,o=i.get(r),l=i.get(n);if(o&&l)return o===n&&l===r;i.set(r,n),i.set(n,r);var c=t(r,n,s);return i.delete(r),i.delete(n),c}}function mq(t){return DQe(t).concat(LQe(t))}var $Qe=Object.hasOwn||function(t,e){return FQe.call(t,e)};function mg(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var BQe="__v",UQe="__o",zQe="_owner",gq=Object.getOwnPropertyDescriptor,yq=Object.keys;function HQe(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function WQe(t,e){return mg(t.getTime(),e.getTime())}function VQe(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function qQe(t,e){return t===e}function vq(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var s=new Array(n),i=t.entries(),o,l,c=0;(o=i.next())&&!o.done;){for(var u=e.entries(),d=!1,h=0;(l=u.next())&&!l.done;){if(s[h]){h++;continue}var f=o.value,p=l.value;if(r.equals(f[0],p[0],c,h,t,e,r)&&r.equals(f[1],p[1],f[0],p[0],t,e,r)){d=s[h]=!0;break}h++}if(!d)return!1;c++}return!0}var GQe=mg;function KQe(t,e,r){var n=yq(t),s=n.length;if(yq(e).length!==s)return!1;for(;s-- >0;)if(!Dle(t,e,r,n[s]))return!1;return!0}function lb(t,e,r){var n=mq(t),s=n.length;if(mq(e).length!==s)return!1;for(var i,o,l;s-- >0;)if(i=n[s],!Dle(t,e,r,i)||(o=gq(t,i),l=gq(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function YQe(t,e){return mg(t.valueOf(),e.valueOf())}function XQe(t,e){return t.source===e.source&&t.flags===e.flags}function xq(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var s=new Array(n),i=t.values(),o,l;(o=i.next())&&!o.done;){for(var c=e.values(),u=!1,d=0;(l=c.next())&&!l.done;){if(!s[d]&&r.equals(o.value,l.value,o.value,l.value,t,e,r)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function QQe(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function ZQe(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Dle(t,e,r,n){return(n===zQe||n===UQe||n===BQe)&&(t.$$typeof||e.$$typeof)?!0:$Qe(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var JQe="[object Arguments]",eZe="[object Boolean]",tZe="[object Date]",rZe="[object Error]",nZe="[object Map]",sZe="[object Number]",iZe="[object Object]",aZe="[object RegExp]",oZe="[object Set]",lZe="[object String]",cZe="[object URL]",uZe=Array.isArray,bq=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,wq=Object.assign,dZe=Object.prototype.toString.call.bind(Object.prototype.toString);function hZe(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,s=t.areFunctionsEqual,i=t.areMapsEqual,o=t.areNumbersEqual,l=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,d=t.areSetsEqual,h=t.areTypedArraysEqual,f=t.areUrlsEqual;return function(g,m,v){if(g===m)return!0;if(g==null||m==null)return!1;var y=typeof g;if(y!==typeof m)return!1;if(y!=="object")return y==="number"?o(g,m,v):y==="function"?s(g,m,v):!1;var x=g.constructor;if(x!==m.constructor)return!1;if(x===Object)return l(g,m,v);if(uZe(g))return e(g,m,v);if(bq!=null&&bq(g))return h(g,m,v);if(x===Date)return r(g,m,v);if(x===RegExp)return u(g,m,v);if(x===Map)return i(g,m,v);if(x===Set)return d(g,m,v);var b=dZe(g);return b===tZe?r(g,m,v):b===aZe?u(g,m,v):b===nZe?i(g,m,v):b===oZe?d(g,m,v):b===iZe?typeof g.then!="function"&&typeof m.then!="function"&&l(g,m,v):b===cZe?f(g,m,v):b===rZe?n(g,m,v):b===JQe?l(g,m,v):b===eZe||b===sZe||b===lZe?c(g,m,v):!1}}function fZe(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,s={areArraysEqual:n?lb:HQe,areDatesEqual:WQe,areErrorsEqual:VQe,areFunctionsEqual:qQe,areMapsEqual:n?pq(vq,lb):vq,areNumbersEqual:GQe,areObjectsEqual:n?lb:KQe,arePrimitiveWrappersEqual:YQe,areRegExpsEqual:XQe,areSetsEqual:n?pq(xq,lb):xq,areTypedArraysEqual:n?lb:QQe,areUrlsEqual:ZQe};if(r&&(s=wq({},s,r(s))),e){var i=TN(s.areArraysEqual),o=TN(s.areMapsEqual),l=TN(s.areObjectsEqual),c=TN(s.areSetsEqual);s=wq({},s,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function pZe(t){return function(e,r,n,s,i,o,l){return t(e,r,l)}}function mZe(t){var e=t.circular,r=t.comparator,n=t.createState,s=t.equals,i=t.strict;if(n)return function(c,u){var d=n(),h=d.cache,f=h===void 0?e?new WeakMap:void 0:h,p=d.meta;return r(c,u,{cache:f,equals:s,meta:p,strict:i})};if(e)return function(c,u){return r(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:i})};var o={cache:void 0,equals:s,meta:void 0,strict:i};return function(c,u){return r(c,u,o)}}var gZe=Sf();Sf({strict:!0});Sf({circular:!0});Sf({circular:!0,strict:!0});Sf({createInternalComparator:function(){return mg}});Sf({strict:!0,createInternalComparator:function(){return mg}});Sf({circular:!0,createInternalComparator:function(){return mg}});Sf({circular:!0,createInternalComparator:function(){return mg},strict:!0});function Sf(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,s=t.createState,i=t.strict,o=i===void 0?!1:i,l=fZe(t),c=hZe(l),u=n?n(c):pZe(c);return mZe({circular:r,comparator:c,createState:s,equals:u,strict:o})}function yZe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function _q(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function s(i){r<0&&(r=i),i-r>e?(t(i),r=-1):yZe(s)};requestAnimationFrame(n)}function PL(t){"@babel/helpers - typeof";return PL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},PL(t)}function vZe(t){return _Ze(t)||wZe(t)||bZe(t)||xZe()}function xZe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bZe(t,e){if(t){if(typeof t=="string")return jq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jq(t,e)}}function jq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wZe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _Ze(t){if(Array.isArray(t))return t}function jZe(){var t={},e=function(){return null},r=!1,n=function s(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var o=i,l=vZe(o),c=l[0],u=l.slice(1);if(typeof c=="number"){_q(s.bind(null,u),c);return}s(c),_q(s.bind(null,u));return}PL(i)==="object"&&(t=i,e(t)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,n(i)},subscribe:function(i){return e=i,function(){e=function(){return null}}}}}function T1(t){"@babel/helpers - typeof";return T1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T1(t)}function Sq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Nq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sq(Object(r),!0).forEach(function(n){Lle(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Lle(t,e,r){return e=SZe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SZe(t){var e=NZe(t,"string");return T1(e)==="symbol"?e:String(e)}function NZe(t,e){if(T1(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(T1(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var AZe=function(e,r){return[Object.keys(e),Object.keys(r)].reduce(function(n,s){return n.filter(function(i){return s.includes(i)})})},EZe=function(e){return e},CZe=function(e){return e.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},jw=function(e,r){return Object.keys(r).reduce(function(n,s){return Nq(Nq({},n),{},Lle({},s,e(s,r[s])))},{})},Aq=function(e,r,n){return e.map(function(s){return"".concat(CZe(s)," ").concat(r,"ms ").concat(n)}).join(",")};function kZe(t,e){return OZe(t)||PZe(t,e)||Fle(t,e)||TZe()}function TZe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PZe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function OZe(t){if(Array.isArray(t))return t}function IZe(t){return DZe(t)||MZe(t)||Fle(t)||RZe()}function RZe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fle(t,e){if(t){if(typeof t=="string")return OL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return OL(t,e)}}function MZe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function DZe(t){if(Array.isArray(t))return OL(t)}function OL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var LC=1e-4,$le=function(e,r){return[0,3*e,3*r-6*e,3*e-3*r+1]},Ble=function(e,r){return e.map(function(n,s){return n*Math.pow(r,s)}).reduce(function(n,s){return n+s})},Eq=function(e,r){return function(n){var s=$le(e,r);return Ble(s,n)}},LZe=function(e,r){return function(n){var s=$le(e,r),i=[].concat(IZe(s.map(function(o,l){return o*l}).slice(1)),[0]);return Ble(i,n)}},Cq=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var s=r[0],i=r[1],o=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":s=0,i=0,o=1,l=1;break;case"ease":s=.25,i=.1,o=.25,l=1;break;case"ease-in":s=.42,i=0,o=1,l=1;break;case"ease-out":s=.42,i=0,o=.58,l=1;break;case"ease-in-out":s=0,i=0,o=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),d=kZe(u,4);s=d[0],i=d[1],o=d[2],l=d[3]}}}var h=Eq(s,o),f=Eq(i,l),p=LZe(s,o),g=function(y){return y>1?1:y<0?0:y},m=function(y){for(var x=y>1?1:y,b=x,w=0;w<8;++w){var j=h(b)-x,N=p(b);if(Math.abs(j-x)<LC||N<LC)return f(b);b=g(b-j/N)}return f(b)};return m.isStepper=!1,m},FZe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,s=e.damping,i=s===void 0?8:s,o=e.dt,l=o===void 0?17:o,c=function(d,h,f){var p=-(d-h)*n,g=f*i,m=f+(p-g)*l/1e3,v=f*l/1e3+d;return Math.abs(v-h)<LC&&Math.abs(m)<LC?[h,0]:[v,m]};return c.isStepper=!0,c.dt=l,c},$Ze=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var s=r[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Cq(s);case"spring":return FZe();default:if(s.split("(")[0]==="cubic-bezier")return Cq(s)}return typeof s=="function"?s:null};function P1(t){"@babel/helpers - typeof";return P1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P1(t)}function kq(t){return zZe(t)||UZe(t)||Ule(t)||BZe()}function BZe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UZe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zZe(t){if(Array.isArray(t))return RL(t)}function Tq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function vs(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tq(Object(r),!0).forEach(function(n){IL(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function IL(t,e,r){return e=HZe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function HZe(t){var e=WZe(t,"string");return P1(e)==="symbol"?e:String(e)}function WZe(t,e){if(P1(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(P1(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function VZe(t,e){return KZe(t)||GZe(t,e)||Ule(t,e)||qZe()}function qZe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ule(t,e){if(t){if(typeof t=="string")return RL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return RL(t,e)}}function RL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function GZe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function KZe(t){if(Array.isArray(t))return t}var FC=function(e,r,n){return e+(r-e)*n},ML=function(e){var r=e.from,n=e.to;return r!==n},YZe=function t(e,r,n){var s=jw(function(i,o){if(ML(o)){var l=e(o.from,o.to,o.velocity),c=VZe(l,2),u=c[0],d=c[1];return vs(vs({},o),{},{from:u,velocity:d})}return o},r);return n<1?jw(function(i,o){return ML(o)?vs(vs({},o),{},{velocity:FC(o.velocity,s[i].velocity,n),from:FC(o.from,s[i].from,n)}):o},r):t(e,s,n-1)};const XZe=function(t,e,r,n,s){var i=AZe(t,e),o=i.reduce(function(v,y){return vs(vs({},v),{},IL({},y,[t[y],e[y]]))},{}),l=i.reduce(function(v,y){return vs(vs({},v),{},IL({},y,{from:t[y],velocity:0,to:e[y]}))},{}),c=-1,u,d,h=function(){return null},f=function(){return jw(function(y,x){return x.from},l)},p=function(){return!Object.values(l).filter(ML).length},g=function(y){u||(u=y);var x=y-u,b=x/r.dt;l=YZe(r,l,b),s(vs(vs(vs({},t),e),f())),u=y,p()||(c=requestAnimationFrame(h))},m=function(y){d||(d=y);var x=(y-d)/n,b=jw(function(j,N){return FC.apply(void 0,kq(N).concat([r(x)]))},o);if(s(vs(vs(vs({},t),e),b)),x<1)c=requestAnimationFrame(h);else{var w=jw(function(j,N){return FC.apply(void 0,kq(N).concat([r(1)]))},o);s(vs(vs(vs({},t),e),w))}};return h=r.isStepper?g:m,function(){return requestAnimationFrame(h),function(){cancelAnimationFrame(c)}}};function Fx(t){"@babel/helpers - typeof";return Fx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fx(t)}var QZe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function ZZe(t,e){if(t==null)return{};var r=JZe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JZe(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function nI(t){return nJe(t)||rJe(t)||tJe(t)||eJe()}function eJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tJe(t,e){if(t){if(typeof t=="string")return DL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return DL(t,e)}}function rJe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nJe(t){if(Array.isArray(t))return DL(t)}function DL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Pq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function To(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pq(Object(r),!0).forEach(function(n){kb(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function kb(t,e,r){return e=zle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sJe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iJe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,zle(n.key),n)}}function aJe(t,e,r){return e&&iJe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function zle(t){var e=oJe(t,"string");return Fx(e)==="symbol"?e:String(e)}function oJe(t,e){if(Fx(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Fx(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lJe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&LL(t,e)}function LL(t,e){return LL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},LL(t,e)}function cJe(t){var e=uJe();return function(){var n=$C(t),s;if(e){var i=$C(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return FL(this,s)}}function FL(t,e){if(e&&(Fx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $L(t)}function $L(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uJe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function $C(t){return $C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$C(t)}var rf=function(t){lJe(r,t);var e=cJe(r);function r(n,s){var i;sJe(this,r),i=e.call(this,n,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,h=o.steps,f=o.children,p=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind($L(i)),i.changeStyle=i.changeStyle.bind($L(i)),!l||p<=0)return i.state={style:{}},typeof f=="function"&&(i.state={style:d}),FL(i);if(h&&h.length)i.state={style:h[0].style};else if(u){if(typeof f=="function")return i.state={style:u},FL(i);i.state={style:c?kb({},c,u):u}}else i.state={style:{}};return i}return aJe(r,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,h=i.from,f=this.state.style;if(l){if(!o){var p={style:c?kb({},c,d):d};this.state&&f&&(c&&f[c]!==d||!c&&f!==d)&&this.setState(p);return}if(!(gZe(s.to,d)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?h:s.to;if(this.state&&f){var v={style:c?kb({},c,m):m};(c&&f[c]!==m||!c&&f!==m)&&this.setState(v)}this.runAnimation(To(To({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,h=s.onAnimationEnd,f=s.onAnimationStart,p=XZe(o,l,$Ze(u),c,this.changeStyle),g=function(){i.stopJSAnimation=p()};this.manager.start([f,d,g,c,h])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,h=u.duration,f=h===void 0?0:h,p=function(m,v,y){if(y===0)return m;var x=v.duration,b=v.easing,w=b===void 0?"ease":b,j=v.style,N=v.properties,C=v.onAnimationEnd,k=y>0?o[y-1]:v,E=N||Object.keys(j);if(typeof w=="function"||w==="spring")return[].concat(nI(m),[i.runJSAnimation.bind(i,{from:k.style,to:j,duration:x,easing:w}),x]);var M=Aq(E,x,w),z=To(To(To({},k.style),j),{},{transition:M});return[].concat(nI(m),[z,x,C]).filter(EZe)};return this.manager.start([c].concat(nI(o.reduce(p,[d,Math.max(f,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=jZe());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,h=s.onAnimationEnd,f=s.steps,p=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(s);return}if(f.length>1){this.runStepAnimation(s);return}var m=l?kb({},l,c):c,v=Aq(Object.keys(m),o,u);g.start([d,i,To(To({},m),{},{transition:v}),o,h])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=ZZe(s,QZe),u=S.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var h=function(p){var g=p.props,m=g.style,v=m===void 0?{}:m,y=g.className,x=S.cloneElement(p,To(To({},c),{},{style:To(To({},v),d),className:y}));return x};return u===1?h(S.Children.only(i)):me.createElement("div",null,S.Children.map(i,function(f){return h(f)}))}}]),r}(S.PureComponent);rf.displayName="Animate";rf.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};rf.propTypes={from:cr.oneOfType([cr.object,cr.string]),to:cr.oneOfType([cr.object,cr.string]),attributeName:cr.string,duration:cr.number,begin:cr.number,easing:cr.oneOfType([cr.string,cr.func]),steps:cr.arrayOf(cr.shape({duration:cr.number.isRequired,style:cr.object.isRequired,easing:cr.oneOfType([cr.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),cr.func]),properties:cr.arrayOf("string"),onAnimationEnd:cr.func})),children:cr.oneOfType([cr.node,cr.func]),isActive:cr.bool,canBegin:cr.bool,onAnimationEnd:cr.func,shouldReAnimate:cr.bool,onAnimationStart:cr.func,onAnimationReStart:cr.func};function O1(t){"@babel/helpers - typeof";return O1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O1(t)}function BC(){return BC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},BC.apply(this,arguments)}function dJe(t,e){return mJe(t)||pJe(t,e)||fJe(t,e)||hJe()}function hJe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fJe(t,e){if(t){if(typeof t=="string")return Oq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oq(t,e)}}function Oq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pJe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function mJe(t){if(Array.isArray(t))return t}function Iq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Rq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Iq(Object(r),!0).forEach(function(n){gJe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Iq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gJe(t,e,r){return e=yJe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yJe(t){var e=vJe(t,"string");return O1(e)=="symbol"?e:e+""}function vJe(t,e){if(O1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(O1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mq=function(e,r,n,s,i){var o=Math.min(Math.abs(n)/2,Math.abs(s)/2),l=s>=0?1:-1,c=n>=0?1:-1,u=s>=0&&n>=0||s<0&&n<0?1:0,d;if(o>0&&i instanceof Array){for(var h=[0,0,0,0],f=0,p=4;f<p;f++)h[f]=i[f]>o?o:i[f];d="M".concat(e,",").concat(r+l*h[0]),h[0]>0&&(d+="A ".concat(h[0],",").concat(h[0],",0,0,").concat(u,",").concat(e+c*h[0],",").concat(r)),d+="L ".concat(e+n-c*h[1],",").concat(r),h[1]>0&&(d+="A ".concat(h[1],",").concat(h[1],",0,0,").concat(u,`,
        `).concat(e+n,",").concat(r+l*h[1])),d+="L ".concat(e+n,",").concat(r+s-l*h[2]),h[2]>0&&(d+="A ".concat(h[2],",").concat(h[2],",0,0,").concat(u,`,
        `).concat(e+n-c*h[2],",").concat(r+s)),d+="L ".concat(e+c*h[3],",").concat(r+s),h[3]>0&&(d+="A ".concat(h[3],",").concat(h[3],",0,0,").concat(u,`,
        `).concat(e,",").concat(r+s-l*h[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);d="M ".concat(e,",").concat(r+l*g,`
            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+c*g,",").concat(r,`
            L `).concat(e+n-c*g,",").concat(r,`
            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+n,",").concat(r+l*g,`
            L `).concat(e+n,",").concat(r+s-l*g,`
            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+n-c*g,",").concat(r+s,`
            L `).concat(e+c*g,",").concat(r+s,`
            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e,",").concat(r+s-l*g," Z")}else d="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(s," h ").concat(-n," Z");return d},xJe=function(e,r){if(!e||!r)return!1;var n=e.x,s=e.y,i=r.x,o=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),h=Math.min(o,o+c),f=Math.max(o,o+c);return n>=u&&n<=d&&s>=h&&s<=f}return!1},bJe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},A8=function(e){var r=Rq(Rq({},bJe),e),n=S.useRef(),s=S.useState(-1),i=dJe(s,2),o=i[0],l=i[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&l(w)}catch{}},[]);var c=r.x,u=r.y,d=r.width,h=r.height,f=r.radius,p=r.className,g=r.animationEasing,m=r.animationDuration,v=r.animationBegin,y=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||h!==+h||d===0||h===0)return null;var b=Jt("recharts-rectangle",p);return x?me.createElement(rf,{canBegin:o>0,from:{width:d,height:h,x:c,y:u},to:{width:d,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:x},function(w){var j=w.width,N=w.height,C=w.x,k=w.y;return me.createElement(rf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,isActive:y,easing:g},me.createElement("path",BC({},Lt(r,!0),{className:b,d:Mq(C,k,j,N,f),ref:n})))}):me.createElement("path",BC({},Lt(r,!0),{className:b,d:Mq(c,u,d,h,f)}))},wJe=["points","className","baseLinePoints","connectNulls"];function py(){return py=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},py.apply(this,arguments)}function _Je(t,e){if(t==null)return{};var r=jJe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jJe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Dq(t){return EJe(t)||AJe(t)||NJe(t)||SJe()}function SJe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NJe(t,e){if(t){if(typeof t=="string")return BL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return BL(t,e)}}function AJe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function EJe(t){if(Array.isArray(t))return BL(t)}function BL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Lq=function(e){return e&&e.x===+e.x&&e.y===+e.y},CJe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return e.forEach(function(n){Lq(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Lq(e[0])&&r[r.length-1].push(e[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Sw=function(e,r){var n=CJe(e);r&&(n=[n.reduce(function(i,o){return[].concat(Dq(i),Dq(o))},[])]);var s=n.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return n.length===1?"".concat(s,"Z"):s},kJe=function(e,r,n){var s=Sw(e,n);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Sw(r.reverse(),n).slice(1))},TJe=function(e){var r=e.points,n=e.className,s=e.baseLinePoints,i=e.connectNulls,o=_Je(e,wJe);if(!r||!r.length)return null;var l=Jt("recharts-polygon",n);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=kJe(r,s,i);return me.createElement("g",{className:l},me.createElement("path",py({},Lt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?me.createElement("path",py({},Lt(o,!0),{fill:"none",d:Sw(r,i)})):null,c?me.createElement("path",py({},Lt(o,!0),{fill:"none",d:Sw(s,i)})):null)}var d=Sw(r,i);return me.createElement("path",py({},Lt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function UL(){return UL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},UL.apply(this,arguments)}var E8=function(e){var r=e.cx,n=e.cy,s=e.r,i=e.className,o=Jt("recharts-dot",i);return r===+r&&n===+n&&s===+s?S.createElement("circle",UL({},Lt(e,!1),lC(e),{className:o,cx:r,cy:n,r:s})):null};function I1(t){"@babel/helpers - typeof";return I1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I1(t)}var PJe=["x","y","top","left","width","height","className"];function zL(){return zL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},zL.apply(this,arguments)}function Fq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function OJe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fq(Object(r),!0).forEach(function(n){IJe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function IJe(t,e,r){return e=RJe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function RJe(t){var e=MJe(t,"string");return I1(e)=="symbol"?e:e+""}function MJe(t,e){if(I1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(I1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DJe(t,e){if(t==null)return{};var r=LJe(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function LJe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var FJe=function(e,r,n,s,i,o){return"M".concat(e,",").concat(i,"v").concat(s,"M").concat(o,",").concat(r,"h").concat(n)},$Je=function(e){var r=e.x,n=r===void 0?0:r,s=e.y,i=s===void 0?0:s,o=e.top,l=o===void 0?0:o,c=e.left,u=c===void 0?0:c,d=e.width,h=d===void 0?0:d,f=e.height,p=f===void 0?0:f,g=e.className,m=DJe(e,PJe),v=OJe({x:n,y:i,top:l,left:u,width:h,height:p},m);return!tt(n)||!tt(i)||!tt(h)||!tt(p)||!tt(l)||!tt(u)?null:me.createElement("path",zL({},Lt(v,!0),{className:Jt("recharts-cross",g),d:FJe(n,i,h,p,l,u)}))},BJe=y2,UJe=ile,zJe=wf;function HJe(t,e){return t&&t.length?BJe(t,zJe(e),UJe):void 0}var WJe=HJe;const VJe=qt(WJe);var qJe=y2,GJe=wf,KJe=ale;function YJe(t,e){return t&&t.length?qJe(t,GJe(e),KJe):void 0}var XJe=YJe;const QJe=qt(XJe);var ZJe=["cx","cy","angle","ticks","axisLine"],JJe=["ticks","tick","angle","tickFormatter","stroke"];function $x(t){"@babel/helpers - typeof";return $x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$x(t)}function Nw(){return Nw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Nw.apply(this,arguments)}function $q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Mf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$q(Object(r),!0).forEach(function(n){_2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$q(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bq(t,e){if(t==null)return{};var r=eet(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function eet(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function tet(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Uq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wle(n.key),n)}}function ret(t,e,r){return e&&Uq(t.prototype,e),r&&Uq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function net(t,e,r){return e=UC(e),set(t,Hle()?Reflect.construct(e,r||[],UC(t).constructor):e.apply(t,r))}function set(t,e){if(e&&($x(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iet(t)}function iet(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Hle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hle=function(){return!!t})()}function UC(t){return UC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},UC(t)}function aet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&HL(t,e)}function HL(t,e){return HL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},HL(t,e)}function _2(t,e,r){return e=Wle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wle(t){var e=oet(t,"string");return $x(e)=="symbol"?e:e+""}function oet(t,e){if($x(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if($x(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var j2=function(t){function e(){return tet(this,e),net(this,e,arguments)}return aet(e,t),ret(e,[{key:"getTickValueCoord",value:function(n){var s=n.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return Or(l,c,s,o)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,s;switch(n){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=VJe(l,function(d){return d.coordinate||0}),u=QJe(l,function(d){return d.coordinate||0});return{cx:s,cy:i,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=n.axisLine,u=Bq(n,ZJe),d=l.reduce(function(g,m){return[Math.min(g[0],m.coordinate),Math.max(g[1],m.coordinate)]},[1/0,-1/0]),h=Or(s,i,d[0],o),f=Or(s,i,d[1],o),p=Mf(Mf(Mf({},Lt(u,!1)),{},{fill:"none"},Lt(c,!1)),{},{x1:h.x,y1:h.y,x2:f.x,y2:f.y});return me.createElement("line",Nw({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var n=this,s=this.props,i=s.ticks,o=s.tick,l=s.angle,c=s.tickFormatter,u=s.stroke,d=Bq(s,JJe),h=this.getTickTextAnchor(),f=Lt(d,!1),p=Lt(o,!1),g=i.map(function(m,v){var y=n.getTickValueCoord(m),x=Mf(Mf(Mf(Mf({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(y.x,", ").concat(y.y,")")},f),{},{stroke:"none",fill:u},p),{},{index:v},y),{},{payload:m});return me.createElement(mn,Nw({className:Jt("recharts-polar-radius-axis-tick",kle(o)),key:"tick-".concat(m.coordinate)},n2(n.props,m,v)),e.renderTickItem(o,x,c?c(m.value,v):m.value))});return me.createElement(mn,{className:"recharts-polar-radius-axis-ticks"},g)}},{key:"render",value:function(){var n=this.props,s=n.ticks,i=n.axisLine,o=n.tick;return!s||!s.length?null:me.createElement(mn,{className:Jt("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),js.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,s,i){var o;return me.isValidElement(n)?o=me.cloneElement(n,s):Ft(n)?o=n(s):o=me.createElement(Ox,Nw({},s,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(S.PureComponent);_2(j2,"displayName","PolarRadiusAxis");_2(j2,"axisType","radiusAxis");_2(j2,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Bx(t){"@babel/helpers - typeof";return Bx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bx(t)}function Jf(){return Jf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Jf.apply(this,arguments)}function zq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Df(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zq(Object(r),!0).forEach(function(n){S2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function cet(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qle(n.key),n)}}function uet(t,e,r){return e&&Hq(t.prototype,e),r&&Hq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function det(t,e,r){return e=zC(e),het(t,Vle()?Reflect.construct(e,r||[],zC(t).constructor):e.apply(t,r))}function het(t,e){if(e&&(Bx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fet(t)}function fet(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Vle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vle=function(){return!!t})()}function zC(t){return zC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zC(t)}function pet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&WL(t,e)}function WL(t,e){return WL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},WL(t,e)}function S2(t,e,r){return e=qle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qle(t){var e=met(t,"string");return Bx(e)=="symbol"?e:e+""}function met(t,e){if(Bx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var get=Math.PI/180,Wq=1e-5,N2=function(t){function e(){return cet(this,e),det(this,e,arguments)}return pet(e,t),uet(e,[{key:"getTickLineCoord",value:function(n){var s=this.props,i=s.cx,o=s.cy,l=s.radius,c=s.orientation,u=s.tickSize,d=u||8,h=Or(i,o,l,n.coordinate),f=Or(i,o,l+(c==="inner"?-1:1)*d,n.coordinate);return{x1:h.x,y1:h.y,x2:f.x,y2:f.y}}},{key:"getTickTextAnchor",value:function(n){var s=this.props.orientation,i=Math.cos(-n.coordinate*get),o;return i>Wq?o=s==="outer"?"start":"end":i<-Wq?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,s=n.cx,i=n.cy,o=n.radius,l=n.axisLine,c=n.axisLineType,u=Df(Df({},Lt(this.props,!1)),{},{fill:"none"},Lt(l,!1));if(c==="circle")return me.createElement(E8,Jf({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,h=d.map(function(f){return Or(s,i,o,f.coordinate)});return me.createElement(TJe,Jf({className:"recharts-polar-angle-axis-line"},u,{points:h}))}},{key:"renderTicks",value:function(){var n=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=Lt(this.props,!1),h=Lt(o,!1),f=Df(Df({},d),{},{fill:"none"},Lt(l,!1)),p=i.map(function(g,m){var v=n.getTickLineCoord(g),y=n.getTickTextAnchor(g),x=Df(Df(Df({textAnchor:y},d),{},{stroke:"none",fill:u},h),{},{index:m,payload:g,x:v.x2,y:v.y2});return me.createElement(mn,Jf({className:Jt("recharts-polar-angle-axis-tick",kle(o)),key:"tick-".concat(g.coordinate)},n2(n.props,g,m)),l&&me.createElement("line",Jf({className:"recharts-polar-angle-axis-tick-line"},f,v)),o&&e.renderTickItem(o,x,c?c(g.value,m):g.value))});return me.createElement(mn,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,s=n.ticks,i=n.radius,o=n.axisLine;return i<=0||!s||!s.length?null:me.createElement(mn,{className:Jt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,s,i){var o;return me.isValidElement(n)?o=me.cloneElement(n,s):Ft(n)?o=n(s):o=me.createElement(Ox,Jf({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(S.PureComponent);S2(N2,"displayName","PolarAngleAxis");S2(N2,"axisType","angleAxis");S2(N2,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var yet=toe,vet=yet(Object.getPrototypeOf,Object),xet=vet,bet=ld,wet=xet,_et=cd,jet="[object Object]",Net=Function.prototype,Aet=Object.prototype,Gle=Net.toString,Eet=Aet.hasOwnProperty,Cet=Gle.call(Object);function ket(t){if(!_et(t)||bet(t)!=jet)return!1;var e=wet(t);if(e===null)return!0;var r=Eet.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Gle.call(r)==Cet}var Tet=ket;const Pet=qt(Tet);var Oet=ld,Iet=cd,Ret="[object Boolean]";function Met(t){return t===!0||t===!1||Iet(t)&&Oet(t)==Ret}var Det=Met;const Let=qt(Det);function R1(t){"@babel/helpers - typeof";return R1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R1(t)}function HC(){return HC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},HC.apply(this,arguments)}function Fet(t,e){return zet(t)||Uet(t,e)||Bet(t,e)||$et()}function $et(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bet(t,e){if(t){if(typeof t=="string")return Vq(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vq(t,e)}}function Vq(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Uet(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function zet(t){if(Array.isArray(t))return t}function qq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Gq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qq(Object(r),!0).forEach(function(n){Het(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Het(t,e,r){return e=Wet(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wet(t){var e=Vet(t,"string");return R1(e)=="symbol"?e:e+""}function Vet(t,e){if(R1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(R1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Kq=function(e,r,n,s,i){var o=n-s,l;return l="M ".concat(e,",").concat(r),l+="L ".concat(e+n,",").concat(r),l+="L ".concat(e+n-o/2,",").concat(r+i),l+="L ".concat(e+n-o/2-s,",").concat(r+i),l+="L ".concat(e,",").concat(r," Z"),l},qet={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Get=function(e){var r=Gq(Gq({},qet),e),n=S.useRef(),s=S.useState(-1),i=Fet(s,2),o=i[0],l=i[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var b=n.current.getTotalLength();b&&l(b)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,h=r.lowerWidth,f=r.height,p=r.className,g=r.animationEasing,m=r.animationDuration,v=r.animationBegin,y=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||h!==+h||f!==+f||d===0&&h===0||f===0)return null;var x=Jt("recharts-trapezoid",p);return y?me.createElement(rf,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:f,x:c,y:u},to:{upperWidth:d,lowerWidth:h,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:y},function(b){var w=b.upperWidth,j=b.lowerWidth,N=b.height,C=b.x,k=b.y;return me.createElement(rf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,easing:g},me.createElement("path",HC({},Lt(r,!0),{className:x,d:Kq(C,k,w,j,N),ref:n})))}):me.createElement("g",null,me.createElement("path",HC({},Lt(r,!0),{className:x,d:Kq(c,u,d,h,f)})))},Ket=["option","shapeType","propTransformer","activeClassName","isActive"];function M1(t){"@babel/helpers - typeof";return M1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M1(t)}function Yet(t,e){if(t==null)return{};var r=Xet(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Xet(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Yq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function WC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Yq(Object(r),!0).forEach(function(n){Qet(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Qet(t,e,r){return e=Zet(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zet(t){var e=Jet(t,"string");return M1(e)=="symbol"?e:e+""}function Jet(t,e){if(M1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(M1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ett(t,e){return WC(WC({},e),t)}function ttt(t,e){return t==="symbols"}function Xq(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return me.createElement(A8,r);case"trapezoid":return me.createElement(Get,r);case"sector":return me.createElement(Ole,r);case"symbols":if(ttt(e))return me.createElement(z$,r);break;default:return null}}function rtt(t){return S.isValidElement(t)?t.props:t}function ntt(t){var e=t.option,r=t.shapeType,n=t.propTransformer,s=n===void 0?ett:n,i=t.activeClassName,o=i===void 0?"recharts-active-shape":i,l=t.isActive,c=Yet(t,Ket),u;if(S.isValidElement(e))u=S.cloneElement(e,WC(WC({},c),rtt(e)));else if(Ft(e))u=e(c);else if(Pet(e)&&!Let(e)){var d=s(e,c);u=me.createElement(Xq,{shapeType:r,elementProps:d})}else{var h=c;u=me.createElement(Xq,{shapeType:r,elementProps:h})}return l?me.createElement(mn,{className:o},u):u}function A2(t,e){return e!=null&&"trapezoids"in t.props}function E2(t,e){return e!=null&&"sectors"in t.props}function D1(t,e){return e!=null&&"points"in t.props}function stt(t,e){var r,n,s=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,i=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return s&&i}function itt(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function att(t,e){var r=t.x===e.x,n=t.y===e.y,s=t.z===e.z;return r&&n&&s}function ott(t,e){var r;return A2(t,e)?r=stt:E2(t,e)?r=itt:D1(t,e)&&(r=att),r}function ltt(t,e){var r;return A2(t,e)?r="trapezoids":E2(t,e)?r="sectors":D1(t,e)&&(r="points"),r}function ctt(t,e){if(A2(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(E2(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return D1(t,e)?e.payload:{}}function utt(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,s=ltt(r,e),i=ctt(r,e),o=n.filter(function(c,u){var d=w8(i,c),h=r.props[s].filter(function(g){var m=ott(r,e);return m(g,e)}),f=r.props[s].indexOf(h[h.length-1]),p=u===f;return d&&p}),l=n.indexOf(o[o.length-1]);return l}var EA;function Ux(t){"@babel/helpers - typeof";return Ux=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ux(t)}function my(){return my=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},my.apply(this,arguments)}function Qq(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Er(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Qq(Object(r),!0).forEach(function(n){io(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qq(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dtt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yle(n.key),n)}}function htt(t,e,r){return e&&Zq(t.prototype,e),r&&Zq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ftt(t,e,r){return e=VC(e),ptt(t,Kle()?Reflect.construct(e,r||[],VC(t).constructor):e.apply(t,r))}function ptt(t,e){if(e&&(Ux(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mtt(t)}function mtt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Kle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kle=function(){return!!t})()}function VC(t){return VC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},VC(t)}function gtt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&VL(t,e)}function VL(t,e){return VL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},VL(t,e)}function io(t,e,r){return e=Yle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yle(t){var e=ytt(t,"string");return Ux(e)=="symbol"?e:e+""}function ytt(t,e){if(Ux(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ux(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kc=function(t){function e(r){var n;return dtt(this,e),n=ftt(this,e,[r]),io(n,"pieRef",null),io(n,"sectorRefs",[]),io(n,"id",r2("recharts-pie-")),io(n,"handleAnimationEnd",function(){var s=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ft(s)&&s()}),io(n,"handleAnimationStart",function(){var s=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ft(s)&&s()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return gtt(e,t),htt(e,[{key:"isActiveIndex",value:function(n){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(n)!==-1:n===s}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,u=i.valueKey,d=Lt(this.props,!1),h=Lt(o,!1),f=Lt(l,!1),p=o&&o.offsetRadius||20,g=n.map(function(m,v){var y=(m.startAngle+m.endAngle)/2,x=Or(m.cx,m.cy,m.outerRadius+p,y),b=Er(Er(Er(Er({},d),m),{},{stroke:"none"},h),{},{index:v,textAnchor:e.getTextAnchor(x.x,m.cx)},x),w=Er(Er(Er(Er({},d),m),{},{fill:"none",stroke:m.fill},f),{},{index:v,points:[Or(m.cx,m.cy,m.outerRadius,y),x]}),j=c;return Qt(c)&&Qt(u)?j="value":Qt(c)&&(j=u),me.createElement(mn,{key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(v)},l&&e.renderLabelLineItem(l,w,"line"),e.renderLabelItem(o,b,Ea(m,j)))});return me.createElement(mn,{className:"recharts-pie-labels"},g)}},{key:"renderSectorsStatically",value:function(n){var s=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return n.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&n.length!==1)return null;var h=s.isActiveIndex(d),f=c&&s.hasActiveIndex()?c:null,p=h?o:f,g=Er(Er({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return me.createElement(mn,my({ref:function(v){v&&!s.sectorRefs.includes(v)&&s.sectorRefs.push(v)},tabIndex:-1,className:"recharts-pie-sector"},n2(s.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),me.createElement(ntt,my({option:p,isActive:h,shapeType:"sector"},g)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,s=this.props,i=s.sectors,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,u=s.animationEasing,d=s.animationId,h=this.state,f=h.prevSectors,p=h.prevIsAnimationActive;return me.createElement(rf,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var m=g.t,v=[],y=i&&i[0],x=y.startAngle;return i.forEach(function(b,w){var j=f&&f[w],N=w>0?ol(b,"paddingAngle",0):0;if(j){var C=W7(j.endAngle-j.startAngle,b.endAngle-b.startAngle),k=Er(Er({},b),{},{startAngle:x+N,endAngle:x+C(m)+N});v.push(k),x=k.endAngle}else{var E=b.endAngle,M=b.startAngle,z=W7(0,E-M),I=z(m),q=Er(Er({},b),{},{startAngle:x+N,endAngle:x+I+N});v.push(q),x=q.endAngle}}),me.createElement(mn,null,n.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(n){var s=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,s=n.sectors,i=n.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!w8(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,h=s.innerRadius,f=s.outerRadius,p=s.isAnimationActive,g=this.state.isAnimationFinished;if(i||!o||!o.length||!tt(u)||!tt(d)||!tt(h)||!tt(f))return null;var m=Jt("recharts-pie",l);return me.createElement(mn,{tabIndex:this.props.rootTabIndex,className:m,ref:function(y){n.pieRef=y}},this.renderSectors(),c&&this.renderLabels(o),js.renderCallByParent(this.props,null,!1),(!p||g)&&Dm.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,s){return s.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==s.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:n.sectors!==s.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,s){return n>s?"start":n<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,s,i){if(me.isValidElement(n))return me.cloneElement(n,s);if(Ft(n))return n(s);var o=Jt("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return me.createElement(TL,my({},s,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(n,s,i){if(me.isValidElement(n))return me.cloneElement(n,s);var o=i;if(Ft(n)&&(o=n(s),me.isValidElement(o)))return o;var l=Jt("recharts-pie-label-text",typeof n!="boolean"&&!Ft(n)?n.className:"");return me.createElement(Ox,my({},s,{alignmentBaseline:"middle",className:l}),o)}}])}(S.PureComponent);EA=kc;io(kc,"displayName","Pie");io(kc,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Im.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});io(kc,"parseDeltaAngle",function(t,e){var r=co(e-t),n=Math.min(Math.abs(e-t),360);return r*n});io(kc,"getRealPieData",function(t){var e=t.data,r=t.children,n=Lt(t,!1),s=gc(r,Px);return e&&e.length?e.map(function(i,o){return Er(Er(Er({payload:i},n),i),s&&s[o]&&s[o].props)}):s&&s.length?s.map(function(i){return Er(Er({},n),i.props)}):[]});io(kc,"parseCoordinateOfPie",function(t,e){var r=e.top,n=e.left,s=e.width,i=e.height,o=Cle(s,i),l=n+Ui(t.cx,s,s/2),c=r+Ui(t.cy,i,i/2),u=Ui(t.innerRadius,o,0),d=Ui(t.outerRadius,o,o*.8),h=t.maxRadius||Math.sqrt(s*s+i*i)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:h}});io(kc,"getComposedData",function(t){var e=t.item,r=t.offset,n=e.type.defaultProps!==void 0?Er(Er({},e.type.defaultProps),e.props):e.props,s=EA.getRealPieData(n);if(!s||!s.length)return null;var i=n.cornerRadius,o=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,h=n.valueKey,f=n.tooltipType,p=Math.abs(n.minAngle),g=EA.parseCoordinateOfPie(n,r),m=EA.parseDeltaAngle(o,l),v=Math.abs(m),y=u;Qt(u)&&Qt(h)?(Fu(!1,`Use "dataKey" to specify the value of pie,
      the props "valueKey" will be deprecated in 1.1.0`),y="value"):Qt(u)&&(Fu(!1,`Use "dataKey" to specify the value of pie,
      the props "valueKey" will be deprecated in 1.1.0`),y=h);var x=s.filter(function(k){return Ea(k,y,0)!==0}).length,b=(v>=360?x:x-1)*c,w=v-x*p-b,j=s.reduce(function(k,E){var M=Ea(E,y,0);return k+(tt(M)?M:0)},0),N;if(j>0){var C;N=s.map(function(k,E){var M=Ea(k,y,0),z=Ea(k,d,E),I=(tt(M)?M:0)/j,q;E?q=C.endAngle+co(m)*c*(M!==0?1:0):q=o;var A=q+co(m)*((M!==0?p:0)+I*w),U=(q+A)/2,K=(g.innerRadius+g.outerRadius)/2,G=[{name:z,value:M,payload:k,dataKey:y,type:f}],Y=Or(g.cx,g.cy,K,U);return C=Er(Er(Er({percent:I,cornerRadius:i,name:z,tooltipPayload:G,midAngle:U,middleRadius:K,tooltipPosition:Y},k),g),{},{value:Ea(k,y),startAngle:q,endAngle:A,payload:k,paddingAngle:co(m)*c}),C})}return Er(Er({},g),{},{sectors:N,data:s})});var vtt=Math.ceil,xtt=Math.max;function btt(t,e,r,n){for(var s=-1,i=xtt(vtt((e-t)/(r||1)),0),o=Array(i);i--;)o[n?i:++s]=t,t+=r;return o}var wtt=btt,_tt=xoe,Jq=1/0,jtt=17976931348623157e292;function Stt(t){if(!t)return t===0?t:0;if(t=_tt(t),t===Jq||t===-Jq){var e=t<0?-1:1;return e*jtt}return t===t?t:0}var Ntt=Stt,Att=wtt,Ett=u2,sI=Ntt;function Ctt(t){return function(e,r,n){return n&&typeof n!="number"&&Ett(e,r,n)&&(r=n=void 0),e=sI(e),r===void 0?(r=e,e=0):r=sI(r),n=n===void 0?e<r?1:-1:sI(n),Att(e,r,n,t)}}var ktt=Ctt,Ttt=ktt,Ptt=Ttt(),Ott=Ptt;const qC=qt(Ott);function L1(t){"@babel/helpers - typeof";return L1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L1(t)}function eG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function tG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?eG(Object(r),!0).forEach(function(n){Xle(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):eG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Xle(t,e,r){return e=Itt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Itt(t){var e=Rtt(t,"string");return L1(e)=="symbol"?e:e+""}function Rtt(t,e){if(L1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(L1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mtt=["Webkit","Moz","O","ms"],Dtt=function(e,r){var n=e.replace(/(\w)/,function(i){return i.toUpperCase()}),s=Mtt.reduce(function(i,o){return tG(tG({},i),{},Xle({},o+n,r))},{});return s[e]=r,s};function zx(t){"@babel/helpers - typeof";return zx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zx(t)}function GC(){return GC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},GC.apply(this,arguments)}function rG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function iI(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rG(Object(r),!0).forEach(function(n){ia(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ltt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zle(n.key),n)}}function Ftt(t,e,r){return e&&nG(t.prototype,e),r&&nG(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $tt(t,e,r){return e=KC(e),Btt(t,Qle()?Reflect.construct(e,r||[],KC(t).constructor):e.apply(t,r))}function Btt(t,e){if(e&&(zx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Utt(t)}function Utt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qle(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qle=function(){return!!t})()}function KC(t){return KC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},KC(t)}function ztt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qL(t,e)}function qL(t,e){return qL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},qL(t,e)}function ia(t,e,r){return e=Zle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zle(t){var e=Htt(t,"string");return zx(e)=="symbol"?e:e+""}function Htt(t,e){if(zx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(zx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Wtt=function(e){var r=e.data,n=e.startIndex,s=e.endIndex,i=e.x,o=e.width,l=e.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=ww().domain(qC(0,c)).range([i,i+o-l]),d=u.domain().map(function(h){return u(h)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(s),scale:u,scaleValues:d}},sG=function(e){return e.changedTouches&&!!e.changedTouches.length},Hx=function(t){function e(r){var n;return Ltt(this,e),n=$tt(this,e,[r]),ia(n,"handleDrag",function(s){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(s):n.state.isSlideMoving&&n.handleSlideDrag(s)}),ia(n,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&n.handleDrag(s.changedTouches[0])}),ia(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=n.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),n.detachDragEndListener()}),ia(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),ia(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),ia(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),ia(n,"handleSlideDragStart",function(s){var i=sG(s)?s.changedTouches[0]:s;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return ztt(e,t),Ftt(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var s=n.startX,i=n.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,h=Math.min(s,i),f=Math.max(s,i),p=e.getIndexInRange(o,h),g=e.getIndexInRange(o,f);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(n){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=Ea(i[n],l,n);return Ft(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,h=c.travellerWidth,f=c.startIndex,p=c.endIndex,g=c.onChange,m=n.pageX-i;m>0?m=Math.min(m,u+d-h-l,u+d-h-o):m<0&&(m=Math.max(m,u-o,u-l));var v=this.getIndex({startX:o+m,endX:l+m});(v.startIndex!==f||v.endIndex!==p)&&g&&g(v),this.setState({startX:o+m,endX:l+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,s){var i=sG(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,h=d.x,f=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,v=d.data,y={startX:this.state.startX,endX:this.state.endX},x=n.pageX-i;x>0?x=Math.min(x,h+f-p-u):x<0&&(x=Math.max(x,h-u)),y[o]=u+x;var b=this.getIndex(y),w=b.startIndex,j=b.endIndex,N=function(){var k=v.length-1;return o==="startX"&&(l>c?w%m===0:j%m===0)||l<c&&j===k||o==="endX"&&(l>c?j%m===0:w%m===0)||l>c&&j===k};this.setState(ia(ia({},o,u+x),"brushMoveStartX",n.pageX),function(){g&&N()&&g(b)})}},{key:"handleTravellerMoveKeyboard",value:function(n,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],h=l.indexOf(d);if(h!==-1){var f=h+n;if(!(f===-1||f>=l.length)){var p=l[f];s==="startX"&&p>=u||s==="endX"&&p<=c||this.setState(ia({},s,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.fill,u=n.stroke;return me.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,h=S.Children.only(u);return h?me.cloneElement(h,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,h=c.height,f=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,v=c.endIndex,y=Math.max(n,this.props.x),x=iI(iI({},Lt(this.props,!1)),{},{x:y,y:u,width:d,height:h}),b=p||"Min value: ".concat((i=g[m])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[v])===null||o===void 0?void 0:o.name);return me.createElement(mn,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(j){["ArrowLeft","ArrowRight"].includes(j.key)&&(j.preventDefault(),j.stopPropagation(),l.handleTravellerMoveKeyboard(j.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(f,x))}},{key:"renderSlide",value:function(n,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(n,s)+u,h=Math.max(Math.abs(s-n)-u,0);return me.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:h,height:l})}},{key:"renderText",value:function(){var n=this.props,s=n.startIndex,i=n.endIndex,o=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,h=d.startX,f=d.endX,p=5,g={pointerEvents:"none",fill:u};return me.createElement(mn,{className:"recharts-brush-texts"},me.createElement(Ox,GC({textAnchor:"end",verticalAnchor:"middle",x:Math.min(h,f)-p,y:o+l/2},g),this.getTextOfTick(s)),me.createElement(Ox,GC({textAnchor:"start",verticalAnchor:"middle",x:Math.max(h,f)+c+p,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,s=n.data,i=n.className,o=n.children,l=n.x,c=n.y,u=n.width,d=n.height,h=n.alwaysShowText,f=this.state,p=f.startX,g=f.endX,m=f.isTextActive,v=f.isSlideMoving,y=f.isTravellerMoving,x=f.isTravellerFocused;if(!s||!s.length||!tt(l)||!tt(c)||!tt(u)||!tt(d)||u<=0||d<=0)return null;var b=Jt("recharts-brush",i),w=me.Children.count(o)===1,j=Dtt("userSelect","none");return me.createElement(mn,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:j},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||v||y||x||h)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var s=n.x,i=n.y,o=n.width,l=n.height,c=n.stroke,u=Math.floor(i+l/2)-1;return me.createElement(me.Fragment,null,me.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),me.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),me.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,s){var i;return me.isValidElement(n)?i=me.cloneElement(n,s):Ft(n)?i=n(s):i=e.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(n,s){var i=n.data,o=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,h=n.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return iI({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?Wtt({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:h}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var f=s.scale.domain().map(function(p){return s.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(n.startIndex),endX:s.scale(n.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(n,s){for(var i=n.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);n[c]>s?l=c:o=c}return s>=n[l]?l:o}}])}(S.PureComponent);ia(Hx,"displayName","Brush");ia(Hx,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Vtt=X$;function qtt(t,e){var r;return Vtt(t,function(n,s,i){return r=e(n,s,i),!r}),!!r}var Gtt=qtt,Ktt=Gae,Ytt=wf,Xtt=Gtt,Qtt=Ji,Ztt=u2;function Jtt(t,e,r){var n=Qtt(t)?Ktt:Xtt;return r&&Ztt(t,e,r)&&(e=void 0),n(t,Ytt(e))}var ert=Jtt;const trt=qt(ert);var vc=function(e,r){var n=e.alwaysShow,s=e.ifOverflow;return n&&(s="extendDomain"),s===r},iG=poe;function rrt(t,e,r){e=="__proto__"&&iG?iG(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var nrt=rrt,srt=nrt,irt=hoe,art=wf;function ort(t,e){var r={};return e=art(e),irt(t,function(n,s,i){srt(r,s,e(n,s,i))}),r}var lrt=ort;const crt=qt(lrt);function urt(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var drt=urt,hrt=X$;function frt(t,e){var r=!0;return hrt(t,function(n,s,i){return r=!!e(n,s,i),r}),r}var prt=frt,mrt=drt,grt=prt,yrt=wf,vrt=Ji,xrt=u2;function brt(t,e,r){var n=vrt(t)?mrt:grt;return r&&xrt(t,e,r)&&(e=void 0),n(t,yrt(e))}var wrt=brt;const _rt=qt(wrt);function F1(t){"@babel/helpers - typeof";return F1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F1(t)}function jrt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aG(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Jle(n.key),n)}}function Srt(t,e,r){return e&&aG(t.prototype,e),r&&aG(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function PN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oG(Object(r),!0).forEach(function(n){C8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function C8(t,e,r){return e=Jle(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jle(t){var e=Nrt(t,"string");return F1(e)=="symbol"?e:e+""}function Nrt(t,e){if(F1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(F1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ece=function(e,r){var n=e.x,s=e.y,i=r.x,o=r.y;return{x:Math.min(n,i),y:Math.min(s,o),width:Math.abs(i-n),height:Math.abs(o-s)}},Art=function(e){var r=e.x1,n=e.y1,s=e.x2,i=e.y2;return ece({x:r,y:n},{x:s,y:i})},tce=function(){function t(e){jrt(this,t),this.scale=e}return Srt(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),s=n[0],i=n[n.length-1];return s<=i?r>=s&&r<=i:r>=i&&r<=s}}],[{key:"create",value:function(r){return new t(r)}}])}();C8(tce,"EPS",1e-4);var k8=function(e){var r=Object.keys(e).reduce(function(n,s){return PN(PN({},n),{},C8({},s,tce.create(e[s])))},{});return PN(PN({},r),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return crt(s,function(c,u){return r[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return _rt(s,function(i,o){return r[o].isInRange(i)})}})},Ert=tFe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),rce=S.createContext(void 0),nce=S.createContext(void 0),sce=S.createContext(void 0),Crt=S.createContext({}),ice=S.createContext(void 0),krt=S.createContext(0),Trt=S.createContext(0),lG=function(e){var r=e.state,n=r.xAxisMap,s=r.yAxisMap,i=r.offset,o=e.clipPathId,l=e.children,c=e.width,u=e.height,d=Ert(i);return me.createElement(rce.Provider,{value:n},me.createElement(nce.Provider,{value:s},me.createElement(Crt.Provider,{value:i},me.createElement(sce.Provider,{value:d},me.createElement(ice.Provider,{value:o},me.createElement(krt.Provider,{value:u},me.createElement(Trt.Provider,{value:c},l)))))))},Prt=function(){return S.useContext(ice)},Ort=function(e){var r=S.useContext(rce);r==null&&Dx();var n=r[e];return n==null&&Dx(),n},Irt=function(e){var r=S.useContext(nce);r==null&&Dx();var n=r[e];return n==null&&Dx(),n},Rrt=function(){var e=S.useContext(sce);return e};function Wx(t){"@babel/helpers - typeof";return Wx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wx(t)}function Mrt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Drt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oce(n.key),n)}}function Lrt(t,e,r){return e&&Drt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Frt(t,e,r){return e=YC(e),$rt(t,ace()?Reflect.construct(e,r||[],YC(t).constructor):e.apply(t,r))}function $rt(t,e){if(e&&(Wx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Brt(t)}function Brt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ace(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ace=function(){return!!t})()}function YC(t){return YC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},YC(t)}function Urt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&GL(t,e)}function GL(t,e){return GL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},GL(t,e)}function cG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function uG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cG(Object(r),!0).forEach(function(n){T8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function T8(t,e,r){return e=oce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oce(t){var e=zrt(t,"string");return Wx(e)=="symbol"?e:e+""}function zrt(t,e){if(Wx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hrt(t,e){return Grt(t)||qrt(t,e)||Vrt(t,e)||Wrt()}function Wrt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vrt(t,e){if(t){if(typeof t=="string")return dG(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dG(t,e)}}function dG(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function qrt(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Grt(t){if(Array.isArray(t))return t}function KL(){return KL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},KL.apply(this,arguments)}var Krt=function(e,r){var n;return me.isValidElement(e)?n=me.cloneElement(e,r):Ft(e)?n=e(r):n=me.createElement("line",KL({},r,{className:"recharts-reference-line-line"})),n},Yrt=function(e,r,n,s,i,o,l,c,u){var d=i.x,h=i.y,f=i.width,p=i.height;if(n){var g=u.y,m=e.y.apply(g,{position:o});if(vc(u,"discard")&&!e.y.isInRange(m))return null;var v=[{x:d+f,y:m},{x:d,y:m}];return c==="left"?v.reverse():v}if(r){var y=u.x,x=e.x.apply(y,{position:o});if(vc(u,"discard")&&!e.x.isInRange(x))return null;var b=[{x,y:h+p},{x,y:h}];return l==="top"?b.reverse():b}if(s){var w=u.segment,j=w.map(function(N){return e.apply(N,{position:o})});return vc(u,"discard")&&trt(j,function(N){return!e.isInRange(N)})?null:j}return null};function Xrt(t){var e=t.x,r=t.y,n=t.segment,s=t.xAxisId,i=t.yAxisId,o=t.shape,l=t.className,c=t.alwaysShow,u=Prt(),d=Ort(s),h=Irt(i),f=Rrt();if(!u||!f)return null;Fu(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=k8({x:d.scale,y:h.scale}),g=Kn(e),m=Kn(r),v=n&&n.length===2,y=Yrt(p,g,m,v,f,t.position,d.orientation,h.orientation,t);if(!y)return null;var x=Hrt(y,2),b=x[0],w=b.x,j=b.y,N=x[1],C=N.x,k=N.y,E=vc(t,"hidden")?"url(#".concat(u,")"):void 0,M=uG(uG({clipPath:E},Lt(t,!0)),{},{x1:w,y1:j,x2:C,y2:k});return me.createElement(mn,{className:Jt("recharts-reference-line",l)},Krt(o,M),js.renderCallByParent(t,Art({x1:w,y1:j,x2:C,y2:k})))}var P8=function(t){function e(){return Mrt(this,e),Frt(this,e,arguments)}return Urt(e,t),Lrt(e,[{key:"render",value:function(){return me.createElement(Xrt,this.props)}}])}(me.Component);T8(P8,"displayName","ReferenceLine");T8(P8,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function YL(){return YL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},YL.apply(this,arguments)}function Vx(t){"@babel/helpers - typeof";return Vx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vx(t)}function hG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function fG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hG(Object(r),!0).forEach(function(n){C2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Qrt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zrt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cce(n.key),n)}}function Jrt(t,e,r){return e&&Zrt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ent(t,e,r){return e=XC(e),tnt(t,lce()?Reflect.construct(e,r||[],XC(t).constructor):e.apply(t,r))}function tnt(t,e){if(e&&(Vx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rnt(t)}function rnt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lce=function(){return!!t})()}function XC(t){return XC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},XC(t)}function nnt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&XL(t,e)}function XL(t,e){return XL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},XL(t,e)}function C2(t,e,r){return e=cce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cce(t){var e=snt(t,"string");return Vx(e)=="symbol"?e:e+""}function snt(t,e){if(Vx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var int=function(e){var r=e.x,n=e.y,s=e.xAxis,i=e.yAxis,o=k8({x:s.scale,y:i.scale}),l=o.apply({x:r,y:n},{bandAware:!0});return vc(e,"discard")&&!o.isInRange(l)?null:l},k2=function(t){function e(){return Qrt(this,e),ent(this,e,arguments)}return nnt(e,t),Jrt(e,[{key:"render",value:function(){var n=this.props,s=n.x,i=n.y,o=n.r,l=n.alwaysShow,c=n.clipPathId,u=Kn(s),d=Kn(i);if(Fu(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var h=int(this.props);if(!h)return null;var f=h.x,p=h.y,g=this.props,m=g.shape,v=g.className,y=vc(this.props,"hidden")?"url(#".concat(c,")"):void 0,x=fG(fG({clipPath:y},Lt(this.props,!0)),{},{cx:f,cy:p});return me.createElement(mn,{className:Jt("recharts-reference-dot",v)},e.renderDot(m,x),js.renderCallByParent(this.props,{x:f-o,y:p-o,width:2*o,height:2*o}))}}])}(me.Component);C2(k2,"displayName","ReferenceDot");C2(k2,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});C2(k2,"renderDot",function(t,e){var r;return me.isValidElement(t)?r=me.cloneElement(t,e):Ft(t)?r=t(e):r=me.createElement(E8,YL({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function QL(){return QL=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},QL.apply(this,arguments)}function qx(t){"@babel/helpers - typeof";return qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qx(t)}function pG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function mG(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pG(Object(r),!0).forEach(function(n){T2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ant(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ont(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,dce(n.key),n)}}function lnt(t,e,r){return e&&ont(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function cnt(t,e,r){return e=QC(e),unt(t,uce()?Reflect.construct(e,r||[],QC(t).constructor):e.apply(t,r))}function unt(t,e){if(e&&(qx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dnt(t)}function dnt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uce=function(){return!!t})()}function QC(t){return QC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},QC(t)}function hnt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ZL(t,e)}function ZL(t,e){return ZL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},ZL(t,e)}function T2(t,e,r){return e=dce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dce(t){var e=fnt(t,"string");return qx(e)=="symbol"?e:e+""}function fnt(t,e){if(qx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pnt=function(e,r,n,s,i){var o=i.x1,l=i.x2,c=i.y1,u=i.y2,d=i.xAxis,h=i.yAxis;if(!d||!h)return null;var f=k8({x:d.scale,y:h.scale}),p={x:e?f.x.apply(o,{position:"start"}):f.x.rangeMin,y:n?f.y.apply(c,{position:"start"}):f.y.rangeMin},g={x:r?f.x.apply(l,{position:"end"}):f.x.rangeMax,y:s?f.y.apply(u,{position:"end"}):f.y.rangeMax};return vc(i,"discard")&&(!f.isInRange(p)||!f.isInRange(g))?null:ece(p,g)},P2=function(t){function e(){return ant(this,e),cnt(this,e,arguments)}return hnt(e,t),lnt(e,[{key:"render",value:function(){var n=this.props,s=n.x1,i=n.x2,o=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,d=n.clipPathId;Fu(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=Kn(s),f=Kn(i),p=Kn(o),g=Kn(l),m=this.props.shape;if(!h&&!f&&!p&&!g&&!m)return null;var v=pnt(h,f,p,g,this.props);if(!v&&!m)return null;var y=vc(this.props,"hidden")?"url(#".concat(d,")"):void 0;return me.createElement(mn,{className:Jt("recharts-reference-area",c)},e.renderRect(m,mG(mG({clipPath:y},Lt(this.props,!0)),v)),js.renderCallByParent(this.props,v))}}])}(me.Component);T2(P2,"displayName","ReferenceArea");T2(P2,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});T2(P2,"renderRect",function(t,e){var r;return me.isValidElement(t)?r=me.cloneElement(t,e):Ft(t)?r=t(e):r=me.createElement(A8,QL({},e,{className:"recharts-reference-area-rect"})),r});function gG(t){return vnt(t)||ynt(t)||gnt(t)||mnt()}function mnt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gnt(t,e){if(t){if(typeof t=="string")return JL(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return JL(t,e)}}function ynt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vnt(t){if(Array.isArray(t))return JL(t)}function JL(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var e5=function(e,r,n,s,i){var o=gc(e,P8),l=gc(e,k2),c=[].concat(gG(o),gG(l)),u=gc(e,P2),d="".concat(s,"Id"),h=s[0],f=r;if(c.length&&(f=c.reduce(function(m,v){if(v.props[d]===n&&vc(v.props,"extendDomain")&&tt(v.props[h])){var y=v.props[h];return[Math.min(m[0],y),Math.max(m[1],y)]}return m},f)),u.length){var p="".concat(h,"1"),g="".concat(h,"2");f=u.reduce(function(m,v){if(v.props[d]===n&&vc(v.props,"extendDomain")&&tt(v.props[p])&&tt(v.props[g])){var y=v.props[p],x=v.props[g];return[Math.min(m[0],y,x),Math.max(m[1],y,x)]}return m},f)}return i&&i.length&&(f=i.reduce(function(m,v){return tt(v)?[Math.min(m[0],v),Math.max(m[1],v)]:m},f)),f},hce={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,h||c,f),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],p]:c._events[g].push(p):(c._events[g]=p,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)e.call(d,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,g=new Array(p);f<p;f++)g[f]=h[f].fn;return g},l.prototype.listenerCount=function(u){var d=r?r+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,p,g){var m=r?r+u:u;if(!this._events[m])return!1;var v=this._events[m],y=arguments.length,x,b;if(v.fn){switch(v.once&&this.removeListener(u,v.fn,void 0,!0),y){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,d),!0;case 3:return v.fn.call(v.context,d,h),!0;case 4:return v.fn.call(v.context,d,h,f),!0;case 5:return v.fn.call(v.context,d,h,f,p),!0;case 6:return v.fn.call(v.context,d,h,f,p,g),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];v.fn.apply(v.context,x)}else{var w=v.length,j;for(b=0;b<w;b++)switch(v[b].once&&this.removeListener(u,v[b].fn,void 0,!0),y){case 1:v[b].fn.call(v[b].context);break;case 2:v[b].fn.call(v[b].context,d);break;case 3:v[b].fn.call(v[b].context,d,h);break;case 4:v[b].fn.call(v[b].context,d,h,f);break;default:if(!x)for(j=1,x=new Array(y-1);j<y;j++)x[j-1]=arguments[j];v[b].fn.apply(v[b].context,x)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!f||g.once)&&(!h||g.context===h)&&o(this,p);else{for(var m=0,v=[],y=g.length;m<y;m++)(g[m].fn!==d||f&&!g[m].once||h&&g[m].context!==h)&&v.push(g[m]);v.length?this._events[p]=v.length===1?v[0]:v:o(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&o(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,t.exports=l})(hce);var xnt=hce.exports;const bnt=qt(xnt);var aI=new bnt,oI="recharts.syncMouseEvents";function $1(t){"@babel/helpers - typeof";return $1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$1(t)}function wnt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fce(n.key),n)}}function jnt(t,e,r){return e&&_nt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lI(t,e,r){return e=fce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fce(t){var e=Snt(t,"string");return $1(e)=="symbol"?e:e+""}function Snt(t,e){if($1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if($1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Nnt=function(){function t(){wnt(this,t),lI(this,"activeIndex",0),lI(this,"coordinateList",[]),lI(this,"layout","horizontal")}return jnt(t,[{key:"setDetails",value:function(r){var n,s=r.coordinateList,i=s===void 0?null:s,o=r.container,l=o===void 0?null:o,c=r.layout,u=c===void 0?null:c,d=r.offset,h=d===void 0?null:d,f=r.mouseHandlerCallback,p=f===void 0?null:f;this.coordinateList=(n=i??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=h??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),i=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,h=i+c+u,f=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:h,pageY:f})}}}])}();function Ant(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],s=t==null?void 0:t[1];if(n&&s&&tt(n)&&tt(s))return!0}return!1}function Ent(t,e,r,n){var s=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-s:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-s,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function pce(t){var e=t.cx,r=t.cy,n=t.radius,s=t.startAngle,i=t.endAngle,o=Or(e,r,n,s),l=Or(e,r,n,i);return{points:[o,l],cx:e,cy:r,radius:n,startAngle:s,endAngle:i}}function Cnt(t,e,r){var n,s,i,o;if(t==="horizontal")n=e.x,i=n,s=r.top,o=r.top+r.height;else if(t==="vertical")s=e.y,o=s,n=r.left,i=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var l=e.cx,c=e.cy,u=e.innerRadius,d=e.outerRadius,h=e.angle,f=Or(l,c,u,h),p=Or(l,c,d,h);n=f.x,s=f.y,i=p.x,o=p.y}else return pce(e);return[{x:n,y:s},{x:i,y:o}]}function B1(t){"@babel/helpers - typeof";return B1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B1(t)}function yG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ON(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yG(Object(r),!0).forEach(function(n){knt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function knt(t,e,r){return e=Tnt(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tnt(t){var e=Pnt(t,"string");return B1(e)=="symbol"?e:e+""}function Pnt(t,e){if(B1(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(B1(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ont(t){var e,r,n=t.element,s=t.tooltipEventType,i=t.isActive,o=t.activeCoordinate,l=t.activePayload,c=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,h=t.layout,f=t.chartName,p=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!i||!o||f!=="ScatterChart"&&s!=="axis")return null;var g,m=TL;if(f==="ScatterChart")g=o,m=$Je;else if(f==="BarChart")g=Ent(h,o,c,d),m=A8;else if(h==="radial"){var v=pce(o),y=v.cx,x=v.cy,b=v.radius,w=v.startAngle,j=v.endAngle;g={cx:y,cy:x,startAngle:w,endAngle:j,innerRadius:b,outerRadius:b},m=Ole}else g={points:Cnt(h,o,c)},m=TL;var N=ON(ON(ON(ON({stroke:"#ccc",pointerEvents:"none"},c),g),Lt(p,!1)),{},{payload:l,payloadIndex:u,className:Jt("recharts-tooltip-cursor",p.className)});return S.isValidElement(p)?S.cloneElement(p,N):S.createElement(m,N)}var Int=["item"],Rnt=["children","className","width","height","style","compact","title","desc"];function Gx(t){"@babel/helpers - typeof";return Gx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gx(t)}function gy(){return gy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gy.apply(this,arguments)}function vG(t,e){return Lnt(t)||Dnt(t,e)||gce(t,e)||Mnt()}function Mnt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dnt(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Lnt(t){if(Array.isArray(t))return t}function xG(t,e){if(t==null)return{};var r=Fnt(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Fnt(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function $nt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bnt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yce(n.key),n)}}function Unt(t,e,r){return e&&Bnt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function znt(t,e,r){return e=ZC(e),Hnt(t,mce()?Reflect.construct(e,r||[],ZC(t).constructor):e.apply(t,r))}function Hnt(t,e){if(e&&(Gx(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wnt(t)}function Wnt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mce=function(){return!!t})()}function ZC(t){return ZC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ZC(t)}function Vnt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&t5(t,e)}function t5(t,e){return t5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},t5(t,e)}function Kx(t){return Knt(t)||Gnt(t)||gce(t)||qnt()}function qnt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gce(t,e){if(t){if(typeof t=="string")return r5(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return r5(t,e)}}function Gnt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Knt(t){if(Array.isArray(t))return r5(t)}function r5(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function bG(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bG(Object(r),!0).forEach(function(n){bt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bG(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bt(t,e,r){return e=yce(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yce(t){var e=Ynt(t,"string");return Gx(e)=="symbol"?e:e+""}function Ynt(t,e){if(Gx(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Gx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xnt={xAxis:["bottom","top"],yAxis:["left","right"]},Qnt={width:"100%",height:"100%"},vce={x:0,y:0};function IN(t){return t}var Znt=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Jnt=function(e,r,n,s){var i=r.find(function(d){return d&&d.index===n});if(i){if(e==="horizontal")return{x:i.coordinate,y:s.y};if(e==="vertical")return{x:s.x,y:i.coordinate};if(e==="centric"){var o=i.coordinate,l=s.radius;return ke(ke(ke({},s),Or(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=s.angle;return ke(ke(ke({},s),Or(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return vce},O2=function(e,r){var n=r.graphicalItems,s=r.dataStartIndex,i=r.dataEndIndex,o=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(Kx(l),Kx(u)):l},[]);return o.length>0?o:e&&e.length&&tt(s)&&tt(i)?e.slice(s,i+1):[]};function xce(t){return t==="number"?[0,"auto"]:void 0}var n5=function(e,r,n,s){var i=e.graphicalItems,o=e.tooltipAxis,l=O2(r,e);return n<0||!i||!i.length||n>=l.length?null:i.reduce(function(c,u){var d,h=(d=u.props.data)!==null&&d!==void 0?d:r;h&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(h=h.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var p=h===void 0?l:h;f=D4(p,o.dataKey,s)}else f=h&&h[n]||l[n];return f?[].concat(Kx(c),[SXe(u,f)]):c},[])},wG=function(e,r,n,s){var i=s||{x:e.chartX,y:e.chartY},o=Znt(i,n),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=lXe(o,l,u,c);if(d>=0&&u){var h=u[d]&&u[d].value,f=n5(e,r,d,h),p=Jnt(n,l,d,i);return{activeTooltipIndex:d,activeLabel:h,activePayload:f,activeCoordinate:p}}return null},est=function(e,r){var n=r.axes,s=r.graphicalItems,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,h=e.children,f=e.stackOffset,p=Nle(d,i);return n.reduce(function(g,m){var v,y=m.type.defaultProps!==void 0?ke(ke({},m.type.defaultProps),m.props):m.props,x=y.type,b=y.dataKey,w=y.allowDataOverflow,j=y.allowDuplicatedCategory,N=y.scale,C=y.ticks,k=y.includeHidden,E=y[o];if(g[E])return g;var M=O2(e.data,{graphicalItems:s.filter(function(F){var W,X=o in F.props?F.props[o]:(W=F.type.defaultProps)===null||W===void 0?void 0:W[o];return X===E}),dataStartIndex:c,dataEndIndex:u}),z=M.length,I,q,A;Ant(y.domain,w,x)&&(I=SL(y.domain,null,w),p&&(x==="number"||N!=="auto")&&(A=_w(M,b,"category")));var U=xce(x);if(!I||I.length===0){var K,G=(K=y.domain)!==null&&K!==void 0?K:U;if(b){if(I=_w(M,b,x),x==="category"&&p){var Y=ZFe(I);j&&Y?(q=I,I=qC(0,z)):j||(I=tq(G,I,m).reduce(function(F,W){return F.indexOf(W)>=0?F:[].concat(Kx(F),[W])},[]))}else if(x==="category")j?I=I.filter(function(F){return F!==""&&!Qt(F)}):I=tq(G,I,m).reduce(function(F,W){return F.indexOf(W)>=0||W===""||Qt(W)?F:[].concat(Kx(F),[W])},[]);else if(x==="number"){var H=fXe(M,s.filter(function(F){var W,X,oe=o in F.props?F.props[o]:(W=F.type.defaultProps)===null||W===void 0?void 0:W[o],le="hide"in F.props?F.props.hide:(X=F.type.defaultProps)===null||X===void 0?void 0:X.hide;return oe===E&&(k||!le)}),b,i,d);H&&(I=H)}p&&(x==="number"||N!=="auto")&&(A=_w(M,b,"category"))}else p?I=qC(0,z):l&&l[E]&&l[E].hasStack&&x==="number"?I=f==="expand"?[0,1]:Ale(l[E].stackGroups,c,u):I=Sle(M,s.filter(function(F){var W=o in F.props?F.props[o]:F.type.defaultProps[o],X="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return W===E&&(k||!X)}),x,d,!0);if(x==="number")I=e5(h,I,E,i,C),G&&(I=SL(G,I,w));else if(x==="category"&&G){var $=G,L=I.every(function(F){return $.indexOf(F)>=0});L&&(I=$)}}return ke(ke({},g),{},bt({},E,ke(ke({},y),{},{axisType:i,domain:I,categoricalDomain:A,duplicateDomain:q,originalDomain:(v=y.domain)!==null&&v!==void 0?v:U,isCategorical:p,layout:d})))},{})},tst=function(e,r){var n=r.graphicalItems,s=r.Axis,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.layout,h=e.children,f=O2(e.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=f.length,g=Nle(d,i),m=-1;return n.reduce(function(v,y){var x=y.type.defaultProps!==void 0?ke(ke({},y.type.defaultProps),y.props):y.props,b=x[o],w=xce("number");if(!v[b]){m++;var j;return g?j=qC(0,p):l&&l[b]&&l[b].hasStack?(j=Ale(l[b].stackGroups,c,u),j=e5(h,j,b,i)):(j=SL(w,Sle(f,n.filter(function(N){var C,k,E=o in N.props?N.props[o]:(C=N.type.defaultProps)===null||C===void 0?void 0:C[o],M="hide"in N.props?N.props.hide:(k=N.type.defaultProps)===null||k===void 0?void 0:k.hide;return E===b&&!M}),"number",d),s.defaultProps.allowDataOverflow),j=e5(h,j,b,i)),ke(ke({},v),{},bt({},b,ke(ke({axisType:i},s.defaultProps),{},{hide:!0,orientation:ol(Xnt,"".concat(i,".").concat(m%2),null),domain:j,originalDomain:w,isCategorical:g,layout:d})))}return v},{})},rst=function(e,r){var n=r.axisType,s=n===void 0?"xAxis":n,i=r.AxisComp,o=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=e.children,h="".concat(s,"Id"),f=gc(d,i),p={};return f&&f.length?p=est(e,{axes:f,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=tst(e,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},nst=function(e){var r=$g(e),n=Cb(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:Q$(n,function(s){return s.coordinate}),tooltipAxis:r,tooltipAxisBandSize:NL(r,n)}},_G=function(e){var r=e.children,n=e.defaultShowTooltip,s=eo(r,Hx),i=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},sst=function(e){return!e||!e.length?!1:e.some(function(r){var n=Lu(r&&r.type);return n&&n.indexOf("Bar")>=0})},jG=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},ist=function(e,r){var n=e.props,s=e.graphicalItems,i=e.xAxisMap,o=i===void 0?{}:i,l=e.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,h=n.children,f=n.margin||{},p=eo(h,Hx),g=eo(h,Ly),m=Object.keys(c).reduce(function(j,N){var C=c[N],k=C.orientation;return!C.mirror&&!C.hide?ke(ke({},j),{},bt({},k,j[k]+C.width)):j},{left:f.left||0,right:f.right||0}),v=Object.keys(o).reduce(function(j,N){var C=o[N],k=C.orientation;return!C.mirror&&!C.hide?ke(ke({},j),{},bt({},k,ol(j,"".concat(k))+C.height)):j},{top:f.top||0,bottom:f.bottom||0}),y=ke(ke({},v),m),x=y.bottom;p&&(y.bottom+=p.props.height||Hx.defaultProps.height),g&&r&&(y=dXe(y,s,n,r));var b=u-y.left-y.right,w=d-y.top-y.bottom;return ke(ke({brushBottom:x},y),{},{width:Math.max(b,0),height:Math.max(w,0)})},ast=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},ost=function(e){var r=e.chartName,n=e.GraphicalChild,s=e.defaultTooltipEventType,i=s===void 0?"axis":s,o=e.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,h=e.defaultProps,f=function(y,x){var b=x.graphicalItems,w=x.stackGroups,j=x.offset,N=x.updateId,C=x.dataStartIndex,k=x.dataEndIndex,E=y.barSize,M=y.layout,z=y.barGap,I=y.barCategoryGap,q=y.maxBarSize,A=jG(M),U=A.numericAxisName,K=A.cateAxisName,G=sst(b),Y=[];return b.forEach(function(H,$){var L=O2(y.data,{graphicalItems:[H],dataStartIndex:C,dataEndIndex:k}),F=H.type.defaultProps!==void 0?ke(ke({},H.type.defaultProps),H.props):H.props,W=F.dataKey,X=F.maxBarSize,oe=F["".concat(U,"Id")],le=F["".concat(K,"Id")],B={},R=c.reduce(function(ue,re){var pe=x["".concat(re.axisType,"Map")],xe=F["".concat(re.axisType,"Id")];pe&&pe[xe]||re.axisType==="zAxis"||Dx();var ye=pe[xe];return ke(ke({},ue),{},bt(bt({},re.axisType,ye),"".concat(re.axisType,"Ticks"),Cb(ye)))},B),ee=R[K],te=R["".concat(K,"Ticks")],Z=w&&w[oe]&&w[oe].hasStack&&_Xe(H,w[oe].stackGroups),J=Lu(H.type).indexOf("Bar")>=0,he=NL(ee,te),P=[],ie=G&&cXe({barSize:E,stackGroups:w,totalSize:ast(R,K)});if(J){var V,O,T=Qt(X)?q:X,D=(V=(O=NL(ee,te,!0))!==null&&O!==void 0?O:T)!==null&&V!==void 0?V:0;P=uXe({barGap:z,barCategoryGap:I,bandSize:D!==he?D:he,sizeList:ie[le],maxBarSize:T}),D!==he&&(P=P.map(function(ue){return ke(ke({},ue),{},{position:ke(ke({},ue.position),{},{offset:ue.position.offset-D/2})})}))}var ne=H&&H.type&&H.type.getComposedData;ne&&Y.push({props:ke(ke({},ne(ke(ke({},R),{},{displayedData:L,props:y,dataKey:W,item:H,bandSize:he,barPosition:P,offset:j,stackedData:Z,layout:M,dataStartIndex:C,dataEndIndex:k}))),{},bt(bt(bt({key:H.key||"item-".concat($)},U,R[U]),K,R[K]),"animationId",N)),childIndex:c6e(H,y.children),item:H})}),Y},p=function(y,x){var b=y.props,w=y.dataStartIndex,j=y.dataEndIndex,N=y.updateId;if(!Y7({props:b}))return null;var C=b.children,k=b.layout,E=b.stackOffset,M=b.data,z=b.reverseStackOrder,I=jG(k),q=I.numericAxisName,A=I.cateAxisName,U=gc(C,n),K=bXe(M,U,"".concat(q,"Id"),"".concat(A,"Id"),E,z),G=c.reduce(function(F,W){var X="".concat(W.axisType,"Map");return ke(ke({},F),{},bt({},X,rst(b,ke(ke({},W),{},{graphicalItems:U,stackGroups:W.axisType===q&&K,dataStartIndex:w,dataEndIndex:j}))))},{}),Y=ist(ke(ke({},G),{},{props:b,graphicalItems:U}),x==null?void 0:x.legendBBox);Object.keys(G).forEach(function(F){G[F]=d(b,G[F],Y,F.replace("Map",""),r)});var H=G["".concat(A,"Map")],$=nst(H),L=f(b,ke(ke({},G),{},{dataStartIndex:w,dataEndIndex:j,updateId:N,graphicalItems:U,stackGroups:K,offset:Y}));return ke(ke({formattedGraphicalItems:L,graphicalItems:U,offset:Y,stackGroups:K},$),G)},g=function(v){function y(x){var b,w,j;return $nt(this,y),j=znt(this,y,[x]),bt(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),bt(j,"accessibilityManager",new Nnt),bt(j,"handleLegendBBoxUpdate",function(N){if(N){var C=j.state,k=C.dataStartIndex,E=C.dataEndIndex,M=C.updateId;j.setState(ke({legendBBox:N},p({props:j.props,dataStartIndex:k,dataEndIndex:E,updateId:M},ke(ke({},j.state),{},{legendBBox:N}))))}}),bt(j,"handleReceiveSyncEvent",function(N,C,k){if(j.props.syncId===N){if(k===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(C)}}),bt(j,"handleBrushChange",function(N){var C=N.startIndex,k=N.endIndex;if(C!==j.state.dataStartIndex||k!==j.state.dataEndIndex){var E=j.state.updateId;j.setState(function(){return ke({dataStartIndex:C,dataEndIndex:k},p({props:j.props,dataStartIndex:C,dataEndIndex:k,updateId:E},j.state))}),j.triggerSyncEvent({dataStartIndex:C,dataEndIndex:k})}}),bt(j,"handleMouseEnter",function(N){var C=j.getMouseInfo(N);if(C){var k=ke(ke({},C),{},{isTooltipActive:!0});j.setState(k),j.triggerSyncEvent(k);var E=j.props.onMouseEnter;Ft(E)&&E(k,N)}}),bt(j,"triggeredAfterMouseMove",function(N){var C=j.getMouseInfo(N),k=C?ke(ke({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(k),j.triggerSyncEvent(k);var E=j.props.onMouseMove;Ft(E)&&E(k,N)}),bt(j,"handleItemMouseEnter",function(N){j.setState(function(){return{isTooltipActive:!0,activeItem:N,activePayload:N.tooltipPayload,activeCoordinate:N.tooltipPosition||{x:N.cx,y:N.cy}}})}),bt(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),bt(j,"handleMouseMove",function(N){N.persist(),j.throttleTriggeredAfterMouseMove(N)}),bt(j,"handleMouseLeave",function(N){j.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};j.setState(C),j.triggerSyncEvent(C);var k=j.props.onMouseLeave;Ft(k)&&k(C,N)}),bt(j,"handleOuterEvent",function(N){var C=l6e(N),k=ol(j.props,"".concat(C));if(C&&Ft(k)){var E,M;/.*touch.*/i.test(C)?M=j.getMouseInfo(N.changedTouches[0]):M=j.getMouseInfo(N),k((E=M)!==null&&E!==void 0?E:{},N)}}),bt(j,"handleClick",function(N){var C=j.getMouseInfo(N);if(C){var k=ke(ke({},C),{},{isTooltipActive:!0});j.setState(k),j.triggerSyncEvent(k);var E=j.props.onClick;Ft(E)&&E(k,N)}}),bt(j,"handleMouseDown",function(N){var C=j.props.onMouseDown;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleMouseUp",function(N){var C=j.props.onMouseUp;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleTouchMove",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(N.changedTouches[0])}),bt(j,"handleTouchStart",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseDown(N.changedTouches[0])}),bt(j,"handleTouchEnd",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseUp(N.changedTouches[0])}),bt(j,"handleDoubleClick",function(N){var C=j.props.onDoubleClick;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"handleContextMenu",function(N){var C=j.props.onContextMenu;if(Ft(C)){var k=j.getMouseInfo(N);C(k,N)}}),bt(j,"triggerSyncEvent",function(N){j.props.syncId!==void 0&&aI.emit(oI,j.props.syncId,N,j.eventEmitterSymbol)}),bt(j,"applySyncEvent",function(N){var C=j.props,k=C.layout,E=C.syncMethod,M=j.state.updateId,z=N.dataStartIndex,I=N.dataEndIndex;if(N.dataStartIndex!==void 0||N.dataEndIndex!==void 0)j.setState(ke({dataStartIndex:z,dataEndIndex:I},p({props:j.props,dataStartIndex:z,dataEndIndex:I,updateId:M},j.state)));else if(N.activeTooltipIndex!==void 0){var q=N.chartX,A=N.chartY,U=N.activeTooltipIndex,K=j.state,G=K.offset,Y=K.tooltipTicks;if(!G)return;if(typeof E=="function")U=E(Y,N);else if(E==="value"){U=-1;for(var H=0;H<Y.length;H++)if(Y[H].value===N.activeLabel){U=H;break}}var $=ke(ke({},G),{},{x:G.left,y:G.top}),L=Math.min(q,$.x+$.width),F=Math.min(A,$.y+$.height),W=Y[U]&&Y[U].value,X=n5(j.state,j.props.data,U),oe=Y[U]?{x:k==="horizontal"?Y[U].coordinate:L,y:k==="horizontal"?F:Y[U].coordinate}:vce;j.setState(ke(ke({},N),{},{activeLabel:W,activeCoordinate:oe,activePayload:X,activeTooltipIndex:U}))}else j.setState(N)}),bt(j,"renderCursor",function(N){var C,k=j.state,E=k.isTooltipActive,M=k.activeCoordinate,z=k.activePayload,I=k.offset,q=k.activeTooltipIndex,A=k.tooltipAxisBandSize,U=j.getTooltipEventType(),K=(C=N.props.active)!==null&&C!==void 0?C:E,G=j.props.layout,Y=N.key||"_recharts-cursor";return me.createElement(Ont,{key:Y,activeCoordinate:M,activePayload:z,activeTooltipIndex:q,chartName:r,element:N,isActive:K,layout:G,offset:I,tooltipAxisBandSize:A,tooltipEventType:U})}),bt(j,"renderPolarAxis",function(N,C,k){var E=ol(N,"type.axisType"),M=ol(j.state,"".concat(E,"Map")),z=N.type.defaultProps,I=z!==void 0?ke(ke({},z),N.props):N.props,q=M&&M[I["".concat(E,"Id")]];return S.cloneElement(N,ke(ke({},q),{},{className:Jt(E,q.className),key:N.key||"".concat(C,"-").concat(k),ticks:Cb(q,!0)}))}),bt(j,"renderPolarGrid",function(N){var C=N.props,k=C.radialLines,E=C.polarAngles,M=C.polarRadius,z=j.state,I=z.radiusAxisMap,q=z.angleAxisMap,A=$g(I),U=$g(q),K=U.cx,G=U.cy,Y=U.innerRadius,H=U.outerRadius;return S.cloneElement(N,{polarAngles:Array.isArray(E)?E:Cb(U,!0).map(function($){return $.coordinate}),polarRadius:Array.isArray(M)?M:Cb(A,!0).map(function($){return $.coordinate}),cx:K,cy:G,innerRadius:Y,outerRadius:H,key:N.key||"polar-grid",radialLines:k})}),bt(j,"renderLegend",function(){var N=j.state.formattedGraphicalItems,C=j.props,k=C.children,E=C.width,M=C.height,z=j.props.margin||{},I=E-(z.left||0)-(z.right||0),q=_le({children:k,formattedGraphicalItems:N,legendWidth:I,legendContent:u});if(!q)return null;var A=q.item,U=xG(q,Int);return S.cloneElement(A,ke(ke({},U),{},{chartWidth:E,chartHeight:M,margin:z,onBBoxUpdate:j.handleLegendBBoxUpdate}))}),bt(j,"renderTooltip",function(){var N,C=j.props,k=C.children,E=C.accessibilityLayer,M=eo(k,Vc);if(!M)return null;var z=j.state,I=z.isTooltipActive,q=z.activeCoordinate,A=z.activePayload,U=z.activeLabel,K=z.offset,G=(N=M.props.active)!==null&&N!==void 0?N:I;return S.cloneElement(M,{viewBox:ke(ke({},K),{},{x:K.left,y:K.top}),active:G,label:U,payload:G?A:[],coordinate:q,accessibilityLayer:E})}),bt(j,"renderBrush",function(N){var C=j.props,k=C.margin,E=C.data,M=j.state,z=M.offset,I=M.dataStartIndex,q=M.dataEndIndex,A=M.updateId;return S.cloneElement(N,{key:N.key||"_recharts-brush",onChange:EN(j.handleBrushChange,N.props.onChange),data:E,x:tt(N.props.x)?N.props.x:z.left,y:tt(N.props.y)?N.props.y:z.top+z.height+z.brushBottom-(k.bottom||0),width:tt(N.props.width)?N.props.width:z.width,startIndex:I,endIndex:q,updateId:"brush-".concat(A)})}),bt(j,"renderReferenceElement",function(N,C,k){if(!N)return null;var E=j,M=E.clipPathId,z=j.state,I=z.xAxisMap,q=z.yAxisMap,A=z.offset,U=N.type.defaultProps||{},K=N.props,G=K.xAxisId,Y=G===void 0?U.xAxisId:G,H=K.yAxisId,$=H===void 0?U.yAxisId:H;return S.cloneElement(N,{key:N.key||"".concat(C,"-").concat(k),xAxis:I[Y],yAxis:q[$],viewBox:{x:A.left,y:A.top,width:A.width,height:A.height},clipPathId:M})}),bt(j,"renderActivePoints",function(N){var C=N.item,k=N.activePoint,E=N.basePoint,M=N.childIndex,z=N.isRange,I=[],q=C.props.key,A=C.item.type.defaultProps!==void 0?ke(ke({},C.item.type.defaultProps),C.item.props):C.item.props,U=A.activeDot,K=A.dataKey,G=ke(ke({index:M,dataKey:K,cx:k.x,cy:k.y,r:4,fill:N8(C.item),strokeWidth:2,stroke:"#fff",payload:k.payload,value:k.value},Lt(U,!1)),lC(U));return I.push(y.renderActiveDot(U,G,"".concat(q,"-activePoint-").concat(M))),E?I.push(y.renderActiveDot(U,ke(ke({},G),{},{cx:E.x,cy:E.y}),"".concat(q,"-basePoint-").concat(M))):z&&I.push(null),I}),bt(j,"renderGraphicChild",function(N,C,k){var E=j.filterFormatItem(N,C,k);if(!E)return null;var M=j.getTooltipEventType(),z=j.state,I=z.isTooltipActive,q=z.tooltipAxis,A=z.activeTooltipIndex,U=z.activeLabel,K=j.props.children,G=eo(K,Vc),Y=E.props,H=Y.points,$=Y.isRange,L=Y.baseLine,F=E.item.type.defaultProps!==void 0?ke(ke({},E.item.type.defaultProps),E.item.props):E.item.props,W=F.activeDot,X=F.hide,oe=F.activeBar,le=F.activeShape,B=!!(!X&&I&&G&&(W||oe||le)),R={};M!=="axis"&&G&&G.props.trigger==="click"?R={onClick:EN(j.handleItemMouseEnter,N.props.onClick)}:M!=="axis"&&(R={onMouseLeave:EN(j.handleItemMouseLeave,N.props.onMouseLeave),onMouseEnter:EN(j.handleItemMouseEnter,N.props.onMouseEnter)});var ee=S.cloneElement(N,ke(ke({},E.props),R));function te(re){return typeof q.dataKey=="function"?q.dataKey(re.payload):null}if(B)if(A>=0){var Z,J;if(q.dataKey&&!q.allowDuplicatedCategory){var he=typeof q.dataKey=="function"?te:"payload.".concat(q.dataKey.toString());Z=D4(H,he,U),J=$&&L&&D4(L,he,U)}else Z=H==null?void 0:H[A],J=$&&L&&L[A];if(le||oe){var P=N.props.activeIndex!==void 0?N.props.activeIndex:A;return[S.cloneElement(N,ke(ke(ke({},E.props),R),{},{activeIndex:P})),null,null]}if(!Qt(Z))return[ee].concat(Kx(j.renderActivePoints({item:E,activePoint:Z,basePoint:J,childIndex:A,isRange:$})))}else{var ie,V=(ie=j.getItemByXY(j.state.activeCoordinate))!==null&&ie!==void 0?ie:{graphicalItem:ee},O=V.graphicalItem,T=O.item,D=T===void 0?N:T,ne=O.childIndex,ue=ke(ke(ke({},E.props),R),{},{activeIndex:ne});return[S.cloneElement(D,ue),null,null]}return $?[ee,null,null]:[ee,null]}),bt(j,"renderCustomized",function(N,C,k){return S.cloneElement(N,ke(ke({key:"recharts-customized-".concat(k)},j.props),j.state))}),bt(j,"renderMap",{CartesianGrid:{handler:IN,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:IN},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:IN},YAxis:{handler:IN},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((b=x.id)!==null&&b!==void 0?b:r2("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=boe(j.triggeredAfterMouseMove,(w=x.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return Vnt(y,v),Unt(y,[{key:"componentDidMount",value:function(){var b,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,w=b.children,j=b.data,N=b.height,C=b.layout,k=eo(w,Vc);if(k){var E=k.props.defaultIndex;if(!(typeof E!="number"||E<0||E>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[E]&&this.state.tooltipTicks[E].value,z=n5(this.state,j,E,M),I=this.state.tooltipTicks[E].coordinate,q=(this.state.offset.top+N)/2,A=C==="horizontal",U=A?{x:I,y:q}:{y:I,x:q},K=this.state.formattedGraphicalItems.find(function(Y){var H=Y.item;return H.type.name==="Scatter"});K&&(U=ke(ke({},U),K.props.points[E].tooltipPosition),z=K.props.points[E].tooltipPayload);var G={activeTooltipIndex:E,isTooltipActive:!0,activeLabel:M,activePayload:z,activeCoordinate:U};this.setState(G),this.renderCursor(k),this.accessibilityManager.setIndex(E)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var j,N;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0}})}return null}},{key:"componentDidUpdate",value:function(b){$4([eo(b.children,Vc)],[eo(this.props.children,Vc)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=eo(this.props.children,Vc);if(b&&typeof b.props.shared=="boolean"){var w=b.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),N=DVe(j),C={chartX:Math.round(b.pageX-N.left),chartY:Math.round(b.pageY-N.top)},k=j.width/w.offsetWidth||1,E=this.inRange(C.chartX,C.chartY,k);if(!E)return null;var M=this.state,z=M.xAxisMap,I=M.yAxisMap,q=this.getTooltipEventType(),A=wG(this.state,this.props.data,this.props.layout,E);if(q!=="axis"&&z&&I){var U=$g(z).scale,K=$g(I).scale,G=U&&U.invert?U.invert(C.chartX):null,Y=K&&K.invert?K.invert(C.chartY):null;return ke(ke({},C),{},{xValue:G,yValue:Y},A)}return A?ke(ke({},C),A):null}},{key:"inRange",value:function(b,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,N=this.props.layout,C=b/j,k=w/j;if(N==="horizontal"||N==="vertical"){var E=this.state.offset,M=C>=E.left&&C<=E.left+E.width&&k>=E.top&&k<=E.top+E.height;return M?{x:C,y:k}:null}var z=this.state,I=z.angleAxisMap,q=z.radiusAxisMap;if(I&&q){var A=$g(I);return sq({x:C,y:k},A)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,w=this.getTooltipEventType(),j=eo(b,Vc),N={};j&&w==="axis"&&(j.props.trigger==="click"?N={onClick:this.handleClick}:N={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var C=lC(this.props,this.handleOuterEvent);return ke(ke({},C),N)}},{key:"addListener",value:function(){aI.on(oI,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){aI.removeListener(oI,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,w,j){for(var N=this.state.formattedGraphicalItems,C=0,k=N.length;C<k;C++){var E=N[C];if(E.item===b||E.props.key===b.key||w===Lu(E.item.type)&&j===E.childIndex)return E}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,w=this.state.offset,j=w.left,N=w.top,C=w.height,k=w.width;return me.createElement("defs",null,me.createElement("clipPath",{id:b},me.createElement("rect",{x:j,y:N,height:C,width:k})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(w,j){var N=vG(j,2),C=N[0],k=N[1];return ke(ke({},w),{},bt({},C,k.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(w,j){var N=vG(j,2),C=N[0],k=N[1];return ke(ke({},w),{},bt({},C,k.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(b){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(b){var w=this.state,j=w.formattedGraphicalItems,N=w.activeItem;if(j&&j.length)for(var C=0,k=j.length;C<k;C++){var E=j[C],M=E.props,z=E.item,I=z.type.defaultProps!==void 0?ke(ke({},z.type.defaultProps),z.props):z.props,q=Lu(z.type);if(q==="Bar"){var A=(M.data||[]).find(function(Y){return xJe(b,Y)});if(A)return{graphicalItem:E,payload:A}}else if(q==="RadialBar"){var U=(M.data||[]).find(function(Y){return sq(b,Y)});if(U)return{graphicalItem:E,payload:U}}else if(A2(E,N)||E2(E,N)||D1(E,N)){var K=utt({graphicalItem:E,activeTooltipItem:N,itemData:I.data}),G=I.activeIndex===void 0?K:I.activeIndex;return{graphicalItem:ke(ke({},E),{},{childIndex:G}),payload:D1(E,N)?I.data[K]:E.props.data[K]}}}return null}},{key:"render",value:function(){var b=this;if(!Y7(this))return null;var w=this.props,j=w.children,N=w.className,C=w.width,k=w.height,E=w.style,M=w.compact,z=w.title,I=w.desc,q=xG(w,Rnt),A=Lt(q,!1);if(M)return me.createElement(lG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},me.createElement(U4,gy({},A,{width:C,height:k,title:z,desc:I}),this.renderClipPath(),Q7(j,this.renderMap)));if(this.props.accessibilityLayer){var U,K;A.tabIndex=(U=this.props.tabIndex)!==null&&U!==void 0?U:0,A.role=(K=this.props.role)!==null&&K!==void 0?K:"application",A.onKeyDown=function(Y){b.accessibilityManager.keyboardEvent(Y)},A.onFocus=function(){b.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return me.createElement(lG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},me.createElement("div",gy({className:Jt("recharts-wrapper",N),style:ke({position:"relative",cursor:"default",width:C,height:k},E)},G,{ref:function(H){b.container=H}}),me.createElement(U4,gy({},A,{width:C,height:k,title:z,desc:I,style:Qnt}),this.renderClipPath(),Q7(j,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(S.Component);bt(g,"displayName",r),bt(g,"defaultProps",ke({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},h)),bt(g,"getDerivedStateFromProps",function(v,y){var x=v.dataKey,b=v.data,w=v.children,j=v.width,N=v.height,C=v.layout,k=v.stackOffset,E=v.margin,M=y.dataStartIndex,z=y.dataEndIndex;if(y.updateId===void 0){var I=_G(v);return ke(ke(ke({},I),{},{updateId:0},p(ke(ke({props:v},I),{},{updateId:0}),y)),{},{prevDataKey:x,prevData:b,prevWidth:j,prevHeight:N,prevLayout:C,prevStackOffset:k,prevMargin:E,prevChildren:w})}if(x!==y.prevDataKey||b!==y.prevData||j!==y.prevWidth||N!==y.prevHeight||C!==y.prevLayout||k!==y.prevStackOffset||!L4(E,y.prevMargin)){var q=_G(v),A={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},U=ke(ke({},wG(y,b,C)),{},{updateId:y.updateId+1}),K=ke(ke(ke({},q),A),U);return ke(ke(ke({},K),p(ke({props:v},K),y)),{},{prevDataKey:x,prevData:b,prevWidth:j,prevHeight:N,prevLayout:C,prevStackOffset:k,prevMargin:E,prevChildren:w})}if(!$4(w,y.prevChildren)){var G,Y,H,$,L=eo(w,Hx),F=L&&(G=(Y=L.props)===null||Y===void 0?void 0:Y.startIndex)!==null&&G!==void 0?G:M,W=L&&(H=($=L.props)===null||$===void 0?void 0:$.endIndex)!==null&&H!==void 0?H:z,X=F!==M||W!==z,oe=!Qt(b),le=oe&&!X?y.updateId:y.updateId+1;return ke(ke({updateId:le},p(ke(ke({props:v},y),{},{updateId:le,dataStartIndex:F,dataEndIndex:W}),y)),{},{prevChildren:w,dataStartIndex:F,dataEndIndex:W})}return null}),bt(g,"renderActiveDot",function(v,y,x){var b;return S.isValidElement(v)?b=S.cloneElement(v,y):Ft(v)?b=v(y):b=me.createElement(E8,y),me.createElement(mn,{className:"recharts-active-dot",key:x},b)});var m=S.forwardRef(function(y,x){return me.createElement(g,gy({},y,{ref:x}))});return m.displayName=g.displayName,m},bce=ost({chartName:"PieChart",GraphicalChild:kc,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:N2},{axisType:"radiusAxis",AxisComp:j2}],formatAxisMap:IXe,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function lst(){const{studentPoints:t}=Pt(),e=(t==null?void 0:t.remaining)||0,r=(t==null?void 0:t.total)||0,n=r>0?e/r*100:0,s=[{name:"remaining",value:n},{name:"used",value:Math.max(0,100-n)}],o=(l=>l>=50?"hsl(var(--success))":l>=25?"hsl(var(--warning))":"hsl(var(--destructive))")(n);return a.jsx(Me,{className:"astro-card h-full overflow-hidden",children:a.jsxs($e,{className:"py-4 px-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Student Points"}),n<25&&a.jsxs("div",{className:"flex items-center gap-1 text-destructive",children:[a.jsx(l0e,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs font-medium",children:"Low"})]})]}),a.jsxs("div",{className:"relative h-[140px]",children:[a.jsx(woe,{width:"100%",height:"100%",children:a.jsxs(bce,{children:[a.jsx("defs",{children:a.jsxs("filter",{id:"glow-sp",children:[a.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),a.jsxs("feMerge",{children:[a.jsx("feMergeNode",{in:"coloredBlur"}),a.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),a.jsxs(kc,{data:s,cx:"50%",cy:"50%",innerRadius:45,outerRadius:60,startAngle:90,endAngle:-270,paddingAngle:2,dataKey:"value",strokeWidth:0,filter:n>=50?"url(#glow-sp)":void 0,children:[a.jsx(Px,{fill:o}),a.jsx(Px,{fill:"hsl(var(--muted))"})]})]})}),a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("span",{className:"text-3xl font-bold text-foreground",children:[Math.round(n),"%"]})})]}),a.jsx("div",{className:"text-center mt-1",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(n),"% of ",r.toLocaleString()," SP remaining"]})})]})})}function cst({stats:t}){const e=wr(),r=[{label:"Create Coding",icon:MJ,onClick:()=>e("/qualitative/kodieren"),variant:"outline"},{label:"Create Analysis",icon:vx,onClick:()=>e("/qualitative/auswertung"),variant:"outline"},{label:"Show Codebook Grid",icon:Fxe,onClick:()=>e("/qualitative/kodierbogen-grid"),variant:"outline"}],n=[];((t==null?void 0:t.total_documents)||0)===0&&n.push({label:"Upload Literature",icon:Qh,onClick:()=>e("/my-documents"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_theories)||0)===0&&n.push({label:"Generate Theory",icon:xi,onClick:()=>e("/theory-builder"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_summaries)||0)===0&&n.push({label:"Create Summary",icon:Ir,onClick:()=>e("/new-summary"),variant:"outline"}),!(t!=null&&t.active_thesis_id)&&((t==null?void 0:t.total_theses)||0)===0&&n.push({label:"Create Thesis",icon:xi,onClick:()=>e("/thesis-manager"),variant:"default"}),((t==null?void 0:t.total_documents)||0)>0&&((t==null?void 0:t.total_methods)||0)===0&&n.push({label:"Create Methodology",icon:IE,onClick:()=>e("/methods-approach"),variant:"outline"});const s=n.slice(0,3);return a.jsxs(Me,{className:"h-full",children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"flex items-center gap-2 text-base",children:"Quick Actions"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("div",{className:"space-y-2",children:r.map((i,o)=>a.jsxs(ve,{variant:i.variant,size:"sm",className:"w-full justify-start",onClick:i.onClick,children:[a.jsx(i.icon,{className:"h-4 w-4 mr-2"}),i.label]},o))})}),s.length>0&&a.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Suggested"}),a.jsx("div",{className:"space-y-2",children:s.map((i,o)=>a.jsxs(ve,{variant:i.variant,size:"sm",className:"w-full justify-start",onClick:i.onClick,children:[a.jsx(i.icon,{className:"h-4 w-4 mr-2"}),i.label]},o))})]})]})]})}function wce(){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx(Me,{className:"lg:col-span-2 astro-card",children:a.jsxs("div",{className:"flex items-center gap-6 p-6",children:[a.jsx(ir,{className:"h-20 w-20 rounded-full"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(ir,{className:"h-4 w-24"}),a.jsx(ir,{className:"h-8 w-48"}),a.jsx(ir,{className:"h-6 w-64"})]})]})}),a.jsx(Me,{className:"astro-card",children:a.jsxs($e,{className:"py-4 px-4",children:[a.jsx(ir,{className:"h-4 w-24 mb-2"}),a.jsx("div",{className:"flex items-center justify-center h-[140px]",children:a.jsx(ir,{className:"h-[120px] w-[120px] rounded-full"})}),a.jsx(ir,{className:"h-4 w-32 mx-auto mt-1"})]})})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[1,2,3].map(t=>a.jsx(Me,{className:"astro-card",children:a.jsxs($e,{className:"py-3 px-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(ir,{className:"h-7 w-7 rounded-lg"}),a.jsx(ir,{className:"h-4 w-20"})]}),a.jsx("div",{className:"flex items-center justify-center h-[70px]",children:a.jsx(ir,{className:"h-16 w-32 rounded-t-full"})})]})},t))}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-32"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsx(ir,{className:"h-12 w-full"}),a.jsx(ir,{className:"h-4 w-3/4"})]})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-40"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsx(ir,{className:"h-12 w-full"}),a.jsx(ir,{className:"h-4 w-3/4"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-36"})}),a.jsx($e,{className:"space-y-3",children:a.jsxs("div",{className:"flex justify-between",children:[a.jsx(ir,{className:"h-10 w-16"}),a.jsx(ir,{className:"h-10 w-16"}),a.jsx(ir,{className:"h-10 w-16"})]})})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-44"})}),a.jsx($e,{className:"space-y-3",children:a.jsxs("div",{className:"flex justify-between",children:[a.jsx(ir,{className:"h-10 w-16"}),a.jsx(ir,{className:"h-10 w-16"}),a.jsx(ir,{className:"h-10 w-16"})]})})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-32"})}),a.jsx($e,{children:a.jsx(ir,{className:"h-16 w-full"})})]}),a.jsxs(Me,{className:"astro-card",children:[a.jsx(qe,{children:a.jsx(ir,{className:"h-6 w-28"})}),a.jsxs($e,{className:"space-y-2",children:[a.jsx(ir,{className:"h-10 w-full"}),a.jsx(ir,{className:"h-10 w-full"})]})]})]})]})}const SG=["Focus is key.","Let's make some progress.","Action time.","You've got this.","Great to see you working.","Keep the momentum.","Power through.","Another productive day.","Let's dive in.","Good work day ahead.","Onward and upward."];function ust({stats:t}){const{researchProfile:e}=Pt(),[r,n]=S.useState(null),s=(e==null?void 0:e.nickname)||"Researcher",i=t==null?void 0:t.active_thesis_title;S.useEffect(()=>{(async()=>{const u=await Iy(e==null?void 0:e.avatar_url);n(u)})()},[e==null?void 0:e.avatar_url]);const o=S.useMemo(()=>SG[Math.floor(Math.random()*SG.length)],[]),l=s.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2);return a.jsxs("div",{className:"flex items-center gap-6 p-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-primary via-primary/60 to-primary/30 rounded-full blur-sm opacity-60"}),a.jsxs(NT,{className:"relative h-20 w-20 ring-4 ring-primary/20 ring-offset-2 ring-offset-background",children:[a.jsx(AT,{src:r||void 0,alt:s,className:"object-cover"}),a.jsx(ET,{className:"bg-gradient-to-br from-primary/20 to-primary/5 text-primary text-2xl font-bold",children:l||"R"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(jo,{className:"w-5 h-5 text-primary/70"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide",children:"Welcome back"})]}),a.jsx("h2",{className:"text-3xl font-bold text-foreground",children:s}),i?a.jsxs("div",{className:"mt-1 space-y-1",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.jsx("span",{children:"Working on "}),a.jsx("span",{className:"font-medium text-foreground",children:i})]}),a.jsx("p",{className:"text-muted-foreground/70 italic mt-2 my-[22px] text-sm",children:o})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"Ready to start your research journey?"})]})]})}function dst({stats:t}){const e=(t==null?void 0:t.active_thesis_progress)??0,r=t==null?void 0:t.active_thesis_title,n=l=>l<=25?"The start is made.":l<=50?"Well on your way! Keep the pace.":l<=75?"Halfway done and you're great!":"The final stretch is on. Almost there!",s=[{name:"completed",value:e},{name:"remaining",value:Math.max(0,100-e)}],i=l=>l>=75?"hsl(var(--success))":l>=50?"hsl(var(--warning))":l>=25?"hsl(var(--primary))":"hsl(var(--muted-foreground))";if(!r)return a.jsx(Me,{className:"astro-card h-full",children:a.jsxs($e,{className:"flex flex-col items-center justify-center h-full py-8",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mb-4",children:a.jsx(DJ,{className:"w-8 h-8 text-muted-foreground"})}),a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No active thesis yet"}),a.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to track progress"})]})});const o=i(e);return a.jsx(Me,{className:"astro-card h-full overflow-hidden",children:a.jsxs($e,{className:"py-4 px-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Thesis Progress"}),e>=50&&a.jsxs("div",{className:"flex items-center gap-1 text-success",children:[a.jsx(c0e,{className:"w-3 h-3"}),a.jsx("span",{className:"text-xs font-medium",children:"On track"})]})]}),a.jsxs("div",{className:"relative h-[140px]",children:[a.jsx(woe,{width:"100%",height:"100%",children:a.jsxs(bce,{children:[a.jsx("defs",{children:a.jsxs("filter",{id:"glow",children:[a.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),a.jsxs("feMerge",{children:[a.jsx("feMergeNode",{in:"coloredBlur"}),a.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),a.jsxs(kc,{data:s,cx:"50%",cy:"50%",innerRadius:45,outerRadius:60,startAngle:90,endAngle:-270,paddingAngle:2,dataKey:"value",strokeWidth:0,filter:e>=50?"url(#glow)":void 0,children:[a.jsx(Px,{fill:o}),a.jsx(Px,{fill:"hsl(var(--muted))"})]})]})}),a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:a.jsxs("span",{className:"text-4xl font-bold text-foreground",children:[Math.round(e),"%"]})})]}),a.jsx("p",{className:"text-muted-foreground text-center mt-2 italic text-sm",children:n(e)})]})})}const RN=({title:t,currentValue:e,targetValue:r,excellentThreshold:n,icon:s,progressColor:i="hsl(var(--primary))",className:o})=>{const l=S.useRef(null),c=fLe(l,{once:!0,margin:"-20%"}),{progressPercentage:u,circumference:d,strokeDashoffset:h}=S.useMemo(()=>{const g=2*Math.PI*45,m=Math.min(Math.max(e/r*100,0),100),v=g*(1-m/100);return{progressPercentage:Math.round(m),circumference:g,strokeDashoffset:v}},[e,r]),f=n&&e>=n;return a.jsx(Me,{ref:l,className:Oe("astro-card",o),children:a.jsx($e,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"relative h-20 w-20 flex-shrink-0",children:[a.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",role:"img","aria-label":`Progress: ${u}%`,children:a.jsxs("g",{transform:"rotate(-90, 50, 50)",children:[a.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"transparent",stroke:"hsl(var(--muted))",strokeWidth:"8"}),a.jsx(Jo.circle,{cx:"50",cy:"50",r:"45",fill:"transparent",stroke:i,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:d,initial:{strokeDashoffset:d},animate:c?{strokeDashoffset:h}:{},transition:{duration:1.2,ease:"easeOut"}})]})}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(s,{className:"h-6 w-6",style:{color:i}})})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsxs("span",{className:"text-2xl font-bold text-foreground",children:[e,a.jsxs("span",{className:"text-sm font-normal text-muted-foreground ml-1",children:["/ ",r]})]}),a.jsx("span",{className:"text-sm text-muted-foreground truncate",children:t}),f&&a.jsx("span",{className:"text-xs font-medium mt-1",style:{color:i},children:"✓ Excellent"})]})]})})})};function hst(){const{stats:t,loading:e}=CIe(),{userProfile:r}=Pt();return e?a.jsx(wce,{}):a.jsxs("div",{className:"space-y-6 animate-fade-in",children:[(r==null?void 0:r.plan)==="free"&&a.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-xl p-4 mb-6 flex items-start gap-3",children:[a.jsx(jo,{className:"h-5 w-5 text-amber-600 mt-0.5 shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-amber-900 dark:text-amber-200",children:"Welcome to Academly Beta! 🎉"}),a.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-300 mt-1",children:"As a beta tester, we've credited your account with 2,000 Student Points — enough to explore all features. Your honest feedback helps us build something great."}),a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-2",children:"Beta period · Free access · No credit card needed"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 lg:gap-6",children:[a.jsx(Me,{className:"astro-card animate-slide-up",style:{animationDelay:"0ms"},children:a.jsx(ust,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"50ms"},children:a.jsx(lst,{})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"100ms"},children:a.jsx(dst,{stats:t})})]}),a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"100ms"},children:a.jsx(RN,{currentValue:(t==null?void 0:t.total_documents)??0,targetValue:5,excellentThreshold:7,title:"Documents",icon:Ir,progressColor:"hsl(var(--primary))"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"150ms"},children:a.jsx(RN,{currentValue:(t==null?void 0:t.total_theories)??0,targetValue:4,excellentThreshold:7,title:"Theory Blocks",icon:xi,progressColor:"hsl(142, 76%, 41%)"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"200ms"},children:a.jsx(RN,{currentValue:(t==null?void 0:t.total_methods)??0,targetValue:4,excellentThreshold:7,title:"Methodologies",icon:$J,progressColor:"hsl(270, 70%, 60%)"})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"250ms"},children:a.jsx(RN,{currentValue:(t==null?void 0:t.total_interviews)??0,targetValue:5,excellentThreshold:8,title:"Interviews",icon:qJ,progressColor:"hsl(38, 92%, 50%)"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"250ms"},children:a.jsx(gLe,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"300ms"},children:a.jsx(yLe,{stats:t})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6",children:[a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"350ms"},children:a.jsx(cst,{stats:t})}),a.jsx("div",{className:"animate-slide-up",style:{animationDelay:"400ms"},children:a.jsx(vLe,{stats:t})})]})]})}const Be=S.forwardRef(({className:t,type:e,...r},n)=>a.jsx("input",{type:e,className:Oe("flex h-11 w-full rounded-lg border border-input bg-background","px-4 py-2.5 text-sm text-foreground","shadow-theme-xs","placeholder:text-muted-foreground","focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10","disabled:cursor-not-allowed disabled:opacity-50","dark:border-gray-800 dark:bg-gray-900 dark:text-white",t),ref:n,...r}));Be.displayName="Input";var fst="Label",_ce=S.forwardRef((t,e)=>a.jsx(et.label,{...t,ref:e,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));_ce.displayName=fst;var jce=_ce;const pst=id("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=S.forwardRef(({className:t,...e},r)=>a.jsx(jce,{ref:r,className:Oe(pst(),t),...e}));_e.displayName=jce.displayName;function O8(t){const e=S.useRef({value:t,previous:t});return S.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var mst=[" ","Enter","ArrowUp","ArrowDown"],gst=[" ","Enter"],Xm="Select",[I2,R2,yst]=Tj(Xm),[I0,xyt]=Ln(Xm,[yst,ff]),M2=ff(),[vst,Nf]=I0(Xm),[xst,bst]=I0(Xm),Sce=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:f,required:p,form:g}=t,m=M2(e),[v,y]=S.useState(null),[x,b]=S.useState(null),[w,j]=S.useState(!1),N=lg(u),[C,k]=Ps({prop:n,defaultProp:s??!1,onChange:i,caller:Xm}),[E,M]=Ps({prop:o,defaultProp:l,onChange:c,caller:Xm}),z=S.useRef(null),I=v?g||!!v.closest("form"):!0,[q,A]=S.useState(new Set),U=Array.from(q).map(K=>K.props.value).join(";");return a.jsx(iT,{...m,children:a.jsxs(vst,{required:p,scope:e,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:j,contentId:Gi(),value:E,onValueChange:M,open:C,onOpenChange:k,dir:N,triggerPointerDownPosRef:z,disabled:f,children:[a.jsx(I2.Provider,{scope:e,children:a.jsx(xst,{scope:t.__scopeSelect,onNativeOptionAdd:S.useCallback(K=>{A(G=>new Set(G).add(K))},[]),onNativeOptionRemove:S.useCallback(K=>{A(G=>{const Y=new Set(G);return Y.delete(K),Y})},[]),children:r})}),I?a.jsxs(Kce,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:E,onChange:K=>M(K.target.value),disabled:f,form:g,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(q)]},U):null]})})};Sce.displayName=Xm;var Nce="SelectTrigger",Ace=S.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,i=M2(r),o=Nf(Nce,r),l=o.disabled||n,c=jt(e,o.onTriggerChange),u=R2(r),d=S.useRef("touch"),[h,f,p]=Xce(m=>{const v=u().filter(b=>!b.disabled),y=v.find(b=>b.value===o.value),x=Qce(v,m,y);x!==void 0&&o.onValueChange(x.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(Mj,{asChild:!0,...i,children:a.jsx(et.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Yce(o.value)?"":void 0,...s,ref:c,onClick:ze(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:ze(s.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ze(s.onKeyDown,m=>{const v=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(v&&m.key===" ")&&mst.includes(m.key)&&(g(),m.preventDefault())})})})});Ace.displayName=Nce;var Ece="SelectValue",Cce=S.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:o="",...l}=t,c=Nf(Ece,r),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=jt(e,c.onValueNodeChange);return gn(()=>{u(d)},[u,d]),a.jsx(et.span,{...l,ref:h,style:{pointerEvents:"none"},children:Yce(c.value)?a.jsx(a.Fragment,{children:o}):i})});Cce.displayName=Ece;var wst="SelectIcon",kce=S.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return a.jsx(et.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});kce.displayName=wst;var _st="SelectPortal",Tce=t=>a.jsx(n0,{asChild:!0,...t});Tce.displayName=_st;var Qm="SelectContent",Pce=S.forwardRef((t,e)=>{const r=Nf(Qm,t.__scopeSelect),[n,s]=S.useState();if(gn(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?Nc.createPortal(a.jsx(Oce,{scope:t.__scopeSelect,children:a.jsx(I2.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),i):null}return a.jsx(Ice,{...t,ref:e})});Pce.displayName=Qm;var Ro=10,[Oce,Af]=I0(Qm),jst="SelectContentImpl",Sst=Xh("SelectContent.RemoveScroll"),Ice=S.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v,...y}=t,x=Nf(Qm,r),[b,w]=S.useState(null),[j,N]=S.useState(null),C=jt(e,B=>w(B)),[k,E]=S.useState(null),[M,z]=S.useState(null),I=R2(r),[q,A]=S.useState(!1),U=S.useRef(!1);S.useEffect(()=>{if(b)return bT(b)},[b]),xT();const K=S.useCallback(B=>{const[R,...ee]=I().map(J=>J.ref.current),[te]=ee.slice(-1),Z=document.activeElement;for(const J of B)if(J===Z||(J==null||J.scrollIntoView({block:"nearest"}),J===R&&j&&(j.scrollTop=0),J===te&&j&&(j.scrollTop=j.scrollHeight),J==null||J.focus(),document.activeElement!==Z))return},[I,j]),G=S.useCallback(()=>K([k,b]),[K,k,b]);S.useEffect(()=>{q&&G()},[q,G]);const{onOpenChange:Y,triggerPointerDownPosRef:H}=x;S.useEffect(()=>{if(b){let B={x:0,y:0};const R=te=>{var Z,J;B={x:Math.abs(Math.round(te.pageX)-(((Z=H.current)==null?void 0:Z.x)??0)),y:Math.abs(Math.round(te.pageY)-(((J=H.current)==null?void 0:J.y)??0))}},ee=te=>{B.x<=10&&B.y<=10?te.preventDefault():b.contains(te.target)||Y(!1),document.removeEventListener("pointermove",R),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",ee,{capture:!0})}}},[b,Y,H]),S.useEffect(()=>{const B=()=>Y(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[Y]);const[$,L]=Xce(B=>{const R=I().filter(Z=>!Z.disabled),ee=R.find(Z=>Z.ref.current===document.activeElement),te=Qce(R,B,ee);te&&setTimeout(()=>te.ref.current.focus())}),F=S.useCallback((B,R,ee)=>{const te=!U.current&&!ee;(x.value!==void 0&&x.value===R||te)&&(E(B),te&&(U.current=!0))},[x.value]),W=S.useCallback(()=>b==null?void 0:b.focus(),[b]),X=S.useCallback((B,R,ee)=>{const te=!U.current&&!ee;(x.value!==void 0&&x.value===R||te)&&z(B)},[x.value]),oe=n==="popper"?s5:Rce,le=oe===s5?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return a.jsx(Oce,{scope:r,content:b,viewport:j,onViewportChange:N,itemRefCallback:F,selectedItem:k,onItemLeave:W,itemTextRefCallback:X,focusSelectedItem:G,selectedItemText:M,position:n,isPositioned:q,searchRef:$,children:a.jsx(zj,{as:Sst,allowPinchZoom:!0,children:a.jsx(Bj,{asChild:!0,trapped:x.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:ze(s,B=>{var R;(R=x.trigger)==null||R.focus({preventScroll:!0}),B.preventDefault()}),children:a.jsx(ag,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(oe,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:B=>B.preventDefault(),...y,...le,onPlaced:()=>A(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ze(y.onKeyDown,B=>{const R=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!R&&B.key.length===1&&L(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let te=I().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(B.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const Z=B.target,J=te.indexOf(Z);te=te.slice(J+1)}setTimeout(()=>K(te)),B.preventDefault()}})})})})})})});Ice.displayName=jst;var Nst="SelectItemAlignedPosition",Rce=S.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,i=Nf(Qm,r),o=Af(Qm,r),[l,c]=S.useState(null),[u,d]=S.useState(null),h=jt(e,C=>d(C)),f=R2(r),p=S.useRef(!1),g=S.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=o,b=S.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&v&&y){const C=i.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),E=i.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(i.dir!=="rtl"){const Z=M.left-k.left,J=E.left-Z,he=C.left-J,P=C.width+he,ie=Math.max(P,k.width),V=window.innerWidth-Ro,O=r4(J,[Ro,Math.max(Ro,V-ie)]);l.style.minWidth=P+"px",l.style.left=O+"px"}else{const Z=k.right-M.right,J=window.innerWidth-E.right-Z,he=window.innerWidth-C.right-J,P=C.width+he,ie=Math.max(P,k.width),V=window.innerWidth-Ro,O=r4(J,[Ro,Math.max(Ro,V-ie)]);l.style.minWidth=P+"px",l.style.right=O+"px"}const z=f(),I=window.innerHeight-Ro*2,q=m.scrollHeight,A=window.getComputedStyle(u),U=parseInt(A.borderTopWidth,10),K=parseInt(A.paddingTop,10),G=parseInt(A.borderBottomWidth,10),Y=parseInt(A.paddingBottom,10),H=U+K+q+Y+G,$=Math.min(v.offsetHeight*5,H),L=window.getComputedStyle(m),F=parseInt(L.paddingTop,10),W=parseInt(L.paddingBottom,10),X=C.top+C.height/2-Ro,oe=I-X,le=v.offsetHeight/2,B=v.offsetTop+le,R=U+K+B,ee=H-R;if(R<=X){const Z=z.length>0&&v===z[z.length-1].ref.current;l.style.bottom="0px";const J=u.clientHeight-m.offsetTop-m.offsetHeight,he=Math.max(oe,le+(Z?W:0)+J+G),P=R+he;l.style.height=P+"px"}else{const Z=z.length>0&&v===z[0].ref.current;l.style.top="0px";const he=Math.max(X,U+m.offsetTop+(Z?F:0)+le)+ee;l.style.height=he+"px",m.scrollTop=R-X+m.offsetTop}l.style.margin=`${Ro}px 0`,l.style.minHeight=$+"px",l.style.maxHeight=I+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,l,u,m,v,y,i.dir,n]);gn(()=>b(),[b]);const[w,j]=S.useState();gn(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const N=S.useCallback(C=>{C&&g.current===!0&&(b(),x==null||x(),g.current=!1)},[b,x]);return a.jsx(Est,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:a.jsx(et.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Rce.displayName=Nst;var Ast="SelectPopperPosition",s5=S.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Ro,...i}=t,o=M2(r);return a.jsx(aT,{...o,...i,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});s5.displayName=Ast;var[Est,I8]=I0(Qm,{}),i5="SelectViewport",Mce=S.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,i=Af(i5,r),o=I8(i5,r),l=jt(e,i.onViewportChange),c=S.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),a.jsx(I2.Slot,{scope:r,children:a.jsx(et.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ze(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Ro*2,m=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),y=Math.max(m,v);if(y<g){const x=y+p,b=Math.min(g,x),w=x-b;h.style.height=b+"px",h.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Mce.displayName=i5;var Dce="SelectGroup",[Cst,kst]=I0(Dce),Tst=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Gi();return a.jsx(Cst,{scope:r,id:s,children:a.jsx(et.div,{role:"group","aria-labelledby":s,...n,ref:e})})});Tst.displayName=Dce;var Lce="SelectLabel",Fce=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=kst(Lce,r);return a.jsx(et.div,{id:s.id,...n,ref:e})});Fce.displayName=Lce;var JC="SelectItem",[Pst,$ce]=I0(JC),Bce=S.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...o}=t,l=Nf(JC,r),c=Af(JC,r),u=l.value===n,[d,h]=S.useState(i??""),[f,p]=S.useState(!1),g=jt(e,x=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,x,n,s)}),m=Gi(),v=S.useRef("touch"),y=()=>{s||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Pst,{scope:r,value:n,disabled:s,textId:m,isSelected:u,onItemTextChange:S.useCallback(x=>{h(b=>b||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(I2.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:a.jsx(et.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:ze(o.onFocus,()=>p(!0)),onBlur:ze(o.onBlur,()=>p(!1)),onClick:ze(o.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:ze(o.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:ze(o.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:ze(o.onPointerMove,x=>{var b;v.current=x.pointerType,s?(b=c.onItemLeave)==null||b.call(c):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ze(o.onPointerLeave,x=>{var b;x.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ze(o.onKeyDown,x=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&x.key===" "||(gst.includes(x.key)&&y(),x.key===" "&&x.preventDefault())})})})})});Bce.displayName=JC;var Tb="SelectItemText",Uce=S.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...i}=t,o=Nf(Tb,r),l=Af(Tb,r),c=$ce(Tb,r),u=bst(Tb,r),[d,h]=S.useState(null),f=jt(e,y=>h(y),c.onItemTextChange,y=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,y,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=S.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=u;return gn(()=>(m(g),()=>v(g)),[m,v,g]),a.jsxs(a.Fragment,{children:[a.jsx(et.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Nc.createPortal(i.children,o.valueNode):null]})});Uce.displayName=Tb;var zce="SelectItemIndicator",Hce=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return $ce(zce,r).isSelected?a.jsx(et.span,{"aria-hidden":!0,...n,ref:e}):null});Hce.displayName=zce;var a5="SelectScrollUpButton",Wce=S.forwardRef((t,e)=>{const r=Af(a5,t.__scopeSelect),n=I8(a5,t.__scopeSelect),[s,i]=S.useState(!1),o=jt(e,n.onScrollButtonChange);return gn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(qce,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Wce.displayName=a5;var o5="SelectScrollDownButton",Vce=S.forwardRef((t,e)=>{const r=Af(o5,t.__scopeSelect),n=I8(o5,t.__scopeSelect),[s,i]=S.useState(!1),o=jt(e,n.onScrollButtonChange);return gn(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(qce,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Vce.displayName=o5;var qce=S.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,i=Af("SelectScrollButton",r),o=S.useRef(null),l=R2(r),c=S.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return S.useEffect(()=>()=>c(),[c]),gn(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(et.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:ze(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ze(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ze(s.onPointerLeave,()=>{c()})})}),Ost="SelectSeparator",Gce=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return a.jsx(et.div,{"aria-hidden":!0,...n,ref:e})});Gce.displayName=Ost;var l5="SelectArrow",Ist=S.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=M2(r),i=Nf(l5,r),o=Af(l5,r);return i.open&&o.position==="popper"?a.jsx(oT,{...s,...n,ref:e}):null});Ist.displayName=l5;var Rst="SelectBubbleInput",Kce=S.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{const s=S.useRef(null),i=jt(n,s),o=O8(e);return S.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(et.select,{...r,style:{...dJ,...r.style},ref:i,defaultValue:e})});Kce.displayName=Rst;function Yce(t){return t===""||t===void 0}function Xce(t){const e=pn(t),r=S.useRef(""),n=S.useRef(0),s=S.useCallback(o=>{const l=r.current+o;e(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=S.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function Qce(t,e,r){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=Mst(t,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Mst(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Dst=Sce,Zce=Ace,Lst=Cce,Fst=kce,$st=Tce,Jce=Pce,Bst=Mce,eue=Fce,tue=Bce,Ust=Uce,zst=Hce,rue=Wce,nue=Vce,sue=Gce;const it=Dst,at=Lst,rt=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(Zce,{ref:n,className:Oe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,a.jsx(Fst,{asChild:!0,children:a.jsx(ad,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=Zce.displayName;const iue=S.forwardRef(({className:t,...e},r)=>a.jsx(rue,{ref:r,className:Oe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(RJ,{className:"h-4 w-4"})}));iue.displayName=rue.displayName;const aue=S.forwardRef(({className:t,...e},r)=>a.jsx(nue,{ref:r,className:Oe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(ad,{className:"h-4 w-4"})}));aue.displayName=nue.displayName;const nt=S.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>a.jsx($st,{children:a.jsxs(Jce,{ref:s,className:Oe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[a.jsx(iue,{}),a.jsx(Bst,{className:Oe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aue,{})]})}));nt.displayName=Jce.displayName;const Hst=S.forwardRef(({className:t,...e},r)=>a.jsx(eue,{ref:r,className:Oe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Hst.displayName=eue.displayName;const Te=S.forwardRef(({className:t,children:e,...r},n)=>a.jsxs(tue,{ref:n,className:Oe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(zst,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),a.jsx(Ust,{children:e})]}));Te.displayName=tue.displayName;const Wst=S.forwardRef(({className:t,...e},r)=>a.jsx(sue,{ref:r,className:Oe("-mx-1 my-1 h-px bg-muted",t),...e}));Wst.displayName=sue.displayName;const oue=({currentAvatarUrl:t,onSelectPublic:e,onUploadCustom:r,disabled:n})=>{const[s,i]=S.useState(!1),[o,l]=S.useState(!1),[c,u]=S.useState(null),[d,h]=S.useState([]),[f,p]=S.useState(!0),g=S.useRef(null),{toast:m}=vn();S.useEffect(()=>{(async()=>{const w=await Iy(t);u(w)})()},[t]),S.useEffect(()=>{(async()=>{p(!0);try{const{data:w,error:j}=await be.storage.from("avatars-public").list("",{limit:20});if(j){console.error("Error loading public avatars:",j);return}if(w){const N=w.filter(C=>C.name.match(/\.(png|jpg|jpeg|webp|svg)$/i)).map(C=>({name:C.name,url:`https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/avatars-public/${C.name}`}));h(N)}}catch(w){console.error("Error loading public avatars:",w)}finally{p(!1)}})()},[]);const v=async b=>{var N;const w=(N=b.target.files)==null?void 0:N[0];if(!w)return;if(!w.type.startsWith("image/")){m({title:"Error",description:"Please select an image file",variant:"destructive"});return}if(w.size>2*1024*1024){m({title:"Error",description:"File is too large. Maximum 2MB allowed.",variant:"destructive"});return}const j=new FileReader;j.onloadend=()=>{u(j.result)},j.readAsDataURL(w),i(!0);try{await r(w),m({title:"Success",description:"Avatar uploaded successfully"})}catch(C){console.error("Avatar upload error:",C),m({title:"Error",description:"Failed to upload avatar",variant:"destructive"});const k=await Iy(t);u(k)}finally{i(!1)}},y=async b=>{if(!(n||o)){l(!0),u(b.url);try{await e(b.url),m({title:"Success",description:"Avatar selected successfully"})}catch(w){console.error("Avatar selection error:",w),m({title:"Error",description:"Failed to select avatar",variant:"destructive"});const j=await Iy(t);u(j)}finally{l(!1)}}},x=b=>t===b||c===b;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("div",{className:"relative w-40 h-40 rounded-full overflow-hidden bg-muted cursor-pointer group flex-shrink-0",onClick:()=>{var b;return!n&&((b=g.current)==null?void 0:b.click())},children:[c?a.jsx("img",{src:c,alt:"Avatar",className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center",children:a.jsx(Ij,{className:"w-20 h-20 text-muted-foreground"})}),!n&&a.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s?a.jsx(Et,{className:"w-8 h-8 text-white animate-spin"}):a.jsx(Qh,{className:"w-8 h-8 text-white"})})]}),a.jsx("input",{ref:g,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:v,className:"hidden",disabled:n||s}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"Profile Picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose a default avatar or upload your own (max 2MB)"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Or choose a default avatar"}),f?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Et,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):d.length>0?a.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-5",children:d.map(b=>a.jsxs("button",{onClick:()=>y(b),disabled:n||o||s,className:Oe("relative w-24 h-24 rounded-full overflow-hidden border-2 transition-all","hover:scale-105 hover:border-primary focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",x(b.url)?"border-primary ring-2 ring-primary ring-offset-2":"border-border hover:border-primary/50"),children:[a.jsx("img",{src:b.url,alt:b.name,className:"w-full h-full object-cover"}),x(b.url)&&a.jsx("div",{className:"absolute inset-0 bg-primary/20 flex items-center justify-center",children:a.jsx(Gs,{className:"w-8 h-8 text-primary"})})]},b.name))}):a.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No default avatars available"})]})]})},Vst=["Germany","Austria","Switzerland","United States","United Kingdom","France","Spain","Italy","Netherlands","Belgium","Poland","Sweden","Norway","Denmark","Finland","Australia","Canada","Other"],qst=[{value:"bachelor",label:"Bachelor"},{value:"master",label:"Master"},{value:"phd",label:"PhD / Doctorate"},{value:"postdoc",label:"Postdoc"},{value:"other",label:"Other"}],Gst=["Business & Economics","Computer Science","Education","Engineering","Health Sciences","Humanities","Law","Natural Sciences","Psychology","Social Sciences","Other"],Kst=[{value:"quantitative",label:"Quantitative"},{value:"qualitative",label:"Qualitative"},{value:"mixed",label:"Mixed Methods"}],Yst=[{value:"de",label:"Deutsch"},{value:"en",label:"English"},{value:"fr",label:"Français"},{value:"es",label:"Español"},{value:"it",label:"Italiano"}];function MN({label:t,tooltip:e,required:r}){return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs(_e,{className:"text-foreground font-medium",children:[t,r&&a.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),a.jsx(Si,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),a.jsx(Vt,{side:"top",className:"max-w-[250px] text-xs",children:e})]})})]})}function Xst({open:t,onComplete:e}){const{user:r,updateResearchProfile:n,uploadAvatar:s,selectPublicAvatar:i,researchProfile:o}=Pt(),[l,c]=S.useState(!1),[u,d]=S.useState((o==null?void 0:o.nickname)||""),[h,f]=S.useState((o==null?void 0:o.study_country)||""),[p,g]=S.useState((o==null?void 0:o.degree_type)||null),[m,v]=S.useState((o==null?void 0:o.discipline)||""),[y,x]=S.useState((o==null?void 0:o.university)||""),[b,w]=S.useState((o==null?void 0:o.methodology)||null),[j,N]=S.useState((o==null?void 0:o.preferred_language)||"de"),C=async z=>{await i(z)},k=async z=>await s(z),E=async()=>{if(!u.trim()){Fe.error("Please enter a nickname");return}c(!0);try{await n({nickname:u.trim(),study_country:h||null,degree_type:p,discipline:m||null,university:y||null,methodology:b,preferred_language:j}),Fe.success("Profile saved! Welcome to Academly."),e()}catch(z){console.error("Error saving profile:",z),Fe.error("Failed to save profile. Please try again.")}finally{c(!1)}},M=async()=>{c(!0);try{await n({preferred_language:"de"}),e()}catch(z){console.error("Error creating minimal profile:",z),e()}finally{c(!1)}};return a.jsx(Vr,{open:t,onOpenChange:()=>{},children:a.jsxs(Rr,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto",onPointerDownOutside:z=>z.preventDefault(),onEscapeKeyDown:z=>z.preventDefault(),children:[a.jsxs(Mr,{className:"text-center pb-2",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:a.jsx(jo,{className:"w-6 h-6 text-primary"})}),a.jsx(Dr,{className:"text-xl",children:"Welcome to Academly!"}),a.jsx(g0,{children:"Tell us a bit about yourself to personalize your experience."})]}),a.jsxs("div",{className:"space-y-5 py-4",children:[a.jsx(oue,{currentAvatarUrl:(o==null?void 0:o.avatar_url)||null,onSelectPublic:C,onUploadCustom:k}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{className:"text-foreground font-medium",children:["Nickname ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Be,{value:u,onChange:z=>d(z.target.value),placeholder:"How should we call you?",className:"h-10"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(MN,{label:"Study Country",tooltip:"Helps us tailor language support and citation styles for your region in future updates."}),a.jsxs(it,{value:h,onValueChange:f,children:[a.jsx(rt,{className:"h-10",children:a.jsx(at,{placeholder:"Select your country"})}),a.jsx(nt,{children:Vst.map(z=>a.jsx(Te,{value:z,children:z},z))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(MN,{label:"Degree Type",tooltip:"Helps us customize academic requirements and formatting options."}),a.jsxs(it,{value:p||"",onValueChange:z=>g(z),children:[a.jsx(rt,{className:"h-10",children:a.jsx(at,{placeholder:"Select your degree"})}),a.jsx(nt,{children:qst.map(z=>a.jsx(Te,{value:z.value||"",children:z.label},z.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(MN,{label:"Discipline",tooltip:"Enables discipline-specific citation styles and terminology suggestions."}),a.jsxs(it,{value:m,onValueChange:v,children:[a.jsx(rt,{className:"h-10",children:a.jsx(at,{placeholder:"Select your field"})}),a.jsx(nt,{children:Gst.map(z=>a.jsx(Te,{value:z,children:z},z))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{className:"text-foreground font-medium",children:"University"}),a.jsx(Be,{value:y,onChange:z=>x(z.target.value),placeholder:"Your university name",className:"h-10"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{className:"text-foreground font-medium",children:"Research Methodology"}),a.jsxs(it,{value:b||"",onValueChange:z=>w(z),children:[a.jsx(rt,{className:"h-10",children:a.jsx(at,{placeholder:"Select methodology"})}),a.jsx(nt,{children:Kst.map(z=>a.jsx(Te,{value:z.value||"",children:z.label},z.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(MN,{label:"Preferred Language",tooltip:"We'll prioritize adding features and translations in your preferred language."}),a.jsxs(it,{value:j,onValueChange:z=>N(z),children:[a.jsx(rt,{className:"h-10",children:a.jsx(at,{placeholder:"Select language"})}),a.jsx(nt,{children:Yst.map(z=>a.jsx(Te,{value:z.value,children:z.label},z.value))})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[a.jsx(ve,{onClick:E,disabled:l||!u.trim(),className:"w-full h-11 rounded-full",children:l?"Saving...":"Save & Continue"}),a.jsx("button",{type:"button",onClick:M,disabled:l,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})]})]})})}const Qst=()=>{const{user:t,loading:e,researchProfile:r}=Pt(),n=wr(),[s,i]=S.useState(!1);S.useEffect(()=>{!t&&!e&&n("/login")},[t,e,n]),S.useEffect(()=>{if(t&&!e){const l=!r||!r.nickname;i(l)}else i(!1)},[t,e,r]);const o=()=>{i(!1)};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx(wce,{})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsx(hst,{}),a.jsx(Xst,{open:s,onComplete:o})]}):null},Os=()=>{const{user:t}=Pt(),[e,r]=S.useState(!1),n="https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/logo_new.png",s=[{label:"Features",href:"/#features"},{label:"Team",href:"/team"},{label:"Blog",href:"/blog"},{label:"Pricing",href:"/pricing"},{label:"Docs",href:"https://docs.academly.ai/",external:!0},{label:"Waitlist",href:"/waitlist"}],i=[{label:"Topic Ideas",subtitle:"Find your research angle",href:"/topic-ideas",icon:hf},{label:"Literature Keywords",subtitle:"Discover relevant sources",href:"/literature-search",icon:al}];return a.jsxs("header",{className:"absolute inset-x-0 top-0 z-50",children:[a.jsxs("nav",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-5 lg:px-12",children:[a.jsx(mt,{to:"/",className:"flex items-center gap-2",children:a.jsx("img",{src:n,alt:"Academly.ai",className:"h-9 w-auto"})}),a.jsxs("div",{className:"hidden lg:flex lg:items-center lg:gap-8",children:[a.jsx(mt,{to:"/#features",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Features"}),a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-1 text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:["Demo",a.jsx(ad,{className:"h-3.5 w-3.5 transition-transform group-hover:rotate-180"})]}),a.jsx("div",{className:"invisible absolute left-1/2 top-full z-50 w-72 -translate-x-1/2 pt-3 opacity-0 transition-all duration-150 group-hover:visible group-hover:opacity-100",children:a.jsx("div",{className:"rounded-xl border border-border bg-background p-2 shadow-lg",children:i.map(o=>{const l=o.icon;return a.jsxs(mt,{to:o.href,className:"flex items-start gap-3 rounded-lg p-3 transition-colors hover:bg-muted",children:[a.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(l,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:o.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:o.subtitle})]})]},o.href)})})})]}),s.slice(1).map(o=>o.external?a.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:o.label},o.href):a.jsx(mt,{to:o.href,className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:o.label},o.href))]}),a.jsx("div",{className:"hidden lg:flex lg:items-center lg:gap-4",children:t?a.jsx(ve,{asChild:!0,className:"rounded-full px-6",children:a.jsx(mt,{to:"/dashboard",children:"Dashboard"})}):a.jsxs(a.Fragment,{children:[a.jsx(mt,{to:"/login",className:"text-sm font-medium text-foreground/80 transition-colors hover:text-foreground",children:"Login"}),a.jsx(ve,{asChild:!0,className:"rounded-full px-6","data-umami-event":"cta-signup-click","data-umami-event-location":"header-desktop",children:a.jsx(mt,{to:"/login?mode=signup",children:"Get Started"})})]})}),a.jsx("div",{className:"flex items-center gap-3 lg:hidden",children:a.jsx("button",{onClick:()=>r(!e),className:"flex h-10 w-10 items-center justify-center rounded-lg text-foreground/80 hover:bg-muted",children:e?a.jsx(Rs,{className:"h-5 w-5"}):a.jsx(LF,{className:"h-5 w-5"})})})]}),e&&a.jsx("div",{className:"lg:hidden",children:a.jsxs("div",{className:"border-t border-border bg-background/95 backdrop-blur-lg px-6 py-4 space-y-4",children:[a.jsx(mt,{to:"/#features",className:"block text-sm font-medium text-foreground/80 hover:text-foreground",onClick:()=>r(!1),children:"Features"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Demo"}),i.map(o=>{const l=o.icon;return a.jsxs(mt,{to:o.href,className:"flex items-start gap-3 rounded-lg p-2 -mx-2 hover:bg-muted",onClick:()=>r(!1),children:[a.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(l,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:o.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:o.subtitle})]})]},o.href)})]}),s.slice(1).map(o=>o.external?a.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"block text-sm font-medium text-foreground/80 hover:text-foreground",onClick:()=>r(!1),children:o.label},o.href):a.jsx(mt,{to:o.href,className:"block text-sm font-medium text-foreground/80 hover:text-foreground",onClick:()=>r(!1),children:o.label},o.href)),a.jsx("div",{className:"pt-4 border-t border-border",children:t?a.jsx(ve,{asChild:!0,className:"w-full rounded-full",children:a.jsx(mt,{to:"/dashboard",children:"Dashboard"})}):a.jsxs("div",{className:"space-y-3",children:[a.jsx(mt,{to:"/login",className:"block text-sm font-medium text-foreground/80 hover:text-foreground",onClick:()=>r(!1),children:"Login"}),a.jsx(ve,{asChild:!0,className:"w-full rounded-full","data-umami-event":"cta-signup-click","data-umami-event-location":"header-mobile",children:a.jsx(mt,{to:"/login?mode=signup",children:"Get Started"})})]})})]})})]})},Zst="/assets/logo-icon-FLGou0Tt.png",Jst=()=>a.jsxs("div",{className:"relative",id:"home",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{children:a.jsx("div",{className:"relative pt-36 ml-auto",children:a.jsxs("div",{className:"max-w-3xl text-center mx-auto",children:[a.jsxs("h1",{className:"text-foreground text-balance font-bold text-5xl md:text-6xl xl:text-7xl",children:["Your Thesis",a.jsx("br",{}),a.jsx("span",{className:"text-primary",children:"Half the Time."})]}),a.jsx("div",{className:"flex justify-center my-10",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 blur-3xl bg-primary/30 rounded-full scale-150"}),a.jsx("img",{src:Zst,alt:"Academly.ai Logo",className:"relative w-36 h-36 md:w-48 md:h-48 object-contain drop-shadow-2xl animate-fade-in"})]})}),a.jsx("p",{className:"mt-8 text-muted-foreground text-lg",children:"From literature review to final chapter, structure your Bachelor or Master thesis with AI that only cites your own sources. No hallucinations. No invented references."}),a.jsxs("div",{className:"mt-16 flex flex-wrap justify-center gap-y-4 gap-x-6",children:[a.jsx(mt,{to:"/login?mode=signup",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary-foreground",children:"Get Started"})}),a.jsx(mt,{to:"/how-it-works",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:border before:border-transparent before:bg-primary/10 before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 dark:before:border-gray-700 dark:before:bg-gray-800 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary dark:text-white",children:"How it Works"})})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6 px-4 py-2.5 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-700 rounded-full max-w-fit mx-auto",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse shrink-0"}),a.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300 text-center",children:["Beta — completely free. New accounts get ",a.jsx("strong",{children:"2,000 credits"}),"to explore all features.",a.jsx("a",{href:"https://discord.gg/YFHAZY8d9",target:"_blank",className:"underline font-semibold hover:text-amber-900 ml-1",children:"Share feedback on Discord →"})]})]}),a.jsxs("div",{className:"hidden py-8 mt-16 border-y border-border sm:flex justify-between",children:[a.jsxs("div",{className:"text-left",children:[a.jsx("h6",{className:"text-lg font-semibold text-foreground",children:"Structure Chapters in Minutes"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Not hours, with AI assistance"})]}),a.jsxs("div",{className:"text-left",children:[a.jsx("h6",{className:"text-lg font-semibold text-foreground",children:"Source-Based Writing"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"All content based on your sources"})]}),a.jsxs("div",{className:"text-left",children:[a.jsx("h6",{className:"text-lg font-semibold text-foreground",children:"Structured Drafts"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Theory, Methods, Discussion"})]})]})]})})})]}),NG="Burnout in Remote Work Environments",cI="Burnout in remote work environments has emerged as a critical concern in contemporary organizational research (Maslach & Jackson, 1981, p. 99). The Maslach Burnout Inventory (MBI) identifies three core dimensions: emotional exhaustion, depersonalization, and reduced personal accomplishment. Remote work conditions have been shown to significantly amplify emotional exhaustion due to the blurring of work-life boundaries (Meyer et al., 2022, p. 45). Furthermore, the absence of social interaction in remote settings contributes to increased depersonalization among employees (Meyer et al., 2022, p. 47).",eit=80,tit=18,rit=1500,AG=500,nit=1e3,EG=500,sit=4e3,iit=600,ait=[{text:"The Maslach Burnout Inventory (MBI) has become the leading measure of burnout, encompassing emotional exhaustion, depersonalization, and personal accomplishment.",cite:"(Maslach & Jackson, 1981, p. 99)"},{text:"Remote work environments create unique stressors that significantly contribute to emotional exhaustion, particularly through the erosion of work-life boundaries.",cite:"(Meyer et al., 2022, p. 45)"}],oit=()=>{const[t,e]=S.useState(""),[r,n]=S.useState(""),[s,i]=S.useState(!1),[o,l]=S.useState(0),[c,u]=S.useState(!1),d=S.useRef([]);S.useEffect(()=>{let f=!1;const p=(m,v)=>{const y=setTimeout(()=>{f||m()},v);d.current.push(y)},g=()=>{f||(u(!1),e(""),n(""),i(!1),l(0),p(()=>{let m=0;const v=()=>{f||(m+=1,e(NG.slice(0,m)),m<NG.length?p(v,eit):(i(!0),p(()=>i(!1),AG),p(()=>{let y=0;const x=()=>{f||(y+=1,n(cI.slice(0,y)),y<cI.length?p(x,tit):p(()=>{l(1),p(()=>l(2),EG),p(()=>{u(!0),p(g,iit)},EG+sit)},nit))};x()},AG)))};v()},rit))};return g(),()=>{f=!0,d.current.forEach(clearTimeout),d.current=[]}},[]);const h=[{name:"leseprobe_burnout_2021.pdf",pages:24,selected:!1},{name:"maslach_burnout_inventory.pdf",pages:18,selected:!0},{name:"meyer_remote_work_2022.pdf",pages:12,selected:!0}];return a.jsx("section",{className:"py-12",children:a.jsxs(Wr,{children:[a.jsx("p",{className:"text-center text-muted-foreground text-sm uppercase tracking-wider mb-3",children:"Theory & Background"}),a.jsxs("h3",{className:"text-center text-2xl font-bold text-foreground mb-10",children:["Generate your theory chapter",a.jsx("br",{}),"from your own sources"]}),a.jsxs("div",{className:"max-w-5xl mx-auto rounded-2xl border border-border bg-card shadow-lg overflow-hidden",children:[a.jsxs("div",{className:`grid grid-cols-1 md:grid-cols-5 transition-opacity duration-500 ${c?"opacity-0":"opacity-100"}`,children:[a.jsxs("div",{className:"md:col-span-2 bg-muted/30 p-6 md:border-r border-border space-y-5",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Paragraph Configuration"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-foreground mb-2",children:["Select Documents ",a.jsx("span",{className:"text-primary",children:"*"})]}),a.jsx("div",{className:"space-y-1.5",children:h.map(f=>a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[a.jsx("span",{className:`flex-shrink-0 h-4 w-4 rounded-full border-2 ${f.selected?"bg-primary border-primary":"border-muted-foreground/40"}`}),a.jsx(Ir,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:f.name}),a.jsxs("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:["(",f.pages," pages)"]})]},f.name))}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:"2 of 3 selected"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-2",children:"Page Selection"}),a.jsx("div",{className:"space-y-1.5",children:[{name:"maslach_burnout_inventory...",from:95,to:105,total:18,count:"10p"},{name:"meyer_remote_work_2022...",from:40,to:48,total:12,count:"8p"}].map(f=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("span",{className:"flex-1 truncate",children:f.name}),a.jsx("span",{className:"text-muted-foreground",children:"p."}),a.jsx("span",{className:"rounded border border-border bg-background px-2 py-0.5 w-10 text-center",children:f.from}),a.jsx("span",{className:"text-muted-foreground",children:"-"}),a.jsx("span",{className:"rounded border border-border bg-background px-2 py-0.5 w-10 text-center",children:f.to}),a.jsxs("span",{className:"text-muted-foreground",children:["/ ",f.total]}),a.jsx("span",{className:"text-primary font-medium ml-1",children:f.count})]},f.name))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-foreground mb-2",children:["Topic / Research Question ",a.jsx("span",{className:"text-primary",children:"*"})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 min-h-[48px] text-sm text-foreground",children:[t,a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary align-middle ml-0.5 animate-pulse"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-medium text-foreground mb-1",children:"Mode"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground flex items-center justify-between",children:["Short (300 Tokens)",a.jsx("span",{className:"text-muted-foreground",children:"▾"})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-medium text-foreground mb-1",children:"Citation Style"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground flex items-center justify-between",children:["APA7",a.jsx("span",{className:"text-muted-foreground",children:"▾"})]})]})]}),a.jsx("div",{className:`w-full rounded-lg bg-primary text-primary-foreground text-sm font-medium py-2.5 text-center transition-transform ${s?"scale-105 shadow-lg shadow-primary/30":"scale-100"}`,children:"Generate Paragraph"})]}),a.jsxs("div",{className:"md:col-span-3 bg-card p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Result"}),a.jsx("span",{className:"text-xs rounded-full bg-muted border border-border px-3 py-1 text-muted-foreground",children:"Live Preview"})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-bold text-foreground text-lg",children:"Theory & Background"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[a.jsx("span",{className:"text-[11px] rounded-md bg-primary/10 text-primary px-2 py-0.5",children:"maslach_burnout_inventory.pdf"}),a.jsx("span",{className:"text-[11px] rounded-md bg-primary/10 text-primary px-2 py-0.5",children:"meyer_remote_work_2022.pdf"})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:"Short | APA7 | 9/5/2026"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:"Generated Text"}),a.jsx("div",{className:"rounded-xl border border-border bg-background p-4 min-h-[180px]",children:a.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[r,r.length>0&&r.length<cI.length&&a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary align-middle ml-0.5 animate-pulse"})]})})]}),o>0&&a.jsxs("div",{className:"animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Original Quotes"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Original Language"}),a.jsx("div",{className:"w-8 h-4 rounded-full bg-primary/30 relative",children:a.jsx("div",{className:"absolute right-0.5 top-0.5 w-3 h-3 rounded-full bg-primary"})})]})]}),a.jsx("div",{className:"space-y-2",children:ait.slice(0,o).map((f,p)=>a.jsxs("div",{className:"border-l-4 border-primary bg-muted/40 rounded-r-lg p-3 animate-fade-in",children:[a.jsxs("p",{className:"text-xs italic text-foreground leading-relaxed",children:['"',f.text,'"']}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:f.cite})]},p))})]})]})]}),a.jsxs("div",{className:"border-t border-border px-6 py-5 text-center bg-muted/30",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"This is what Academly generates from your PDFs"}),a.jsx(ve,{asChild:!0,className:"rounded-full px-6",children:a.jsxs(mt,{to:"/login",children:["Try it with your own sources",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})]})]})})},CG="AI in Education",lit=80,cit=1e3,uit=500,dit=400,hit=5e3,fit=600,pit=[{title:"Burnout in Remote Work Environments",questions:["How does remote work contribute to emotional exhaustion among employees?","What role does work-life balance play in preventing burnout?"],method:"Mixed-methods approach combining quantitative surveys with qualitative interviews to assess burnout levels in remote settings.",relevance:"Understanding burnout in remote settings is critical for organizational health and employee wellbeing in the post-pandemic era.",sources:[{text:"Maslach, C. & Jackson, S.E. (1981). The measurement of experienced burnout.",doi:"10.1002/job.4030020205"},{text:"Meyer, B. et al. (2022). Remote work and stress.",doi:"10.1007/s11528-022-00731-4"}]},{title:"AI-Driven Personalized Learning in Higher Education",questions:["How can AI algorithms adapt learning paths to individual student needs?","What impact does personalized learning have on academic performance?"],method:"Comparative analysis of traditional teaching versus AI-driven personalization using case studies from three universities.",relevance:"AI personalization has the potential to revolutionize higher education by addressing diverse learning styles and improving outcomes.",sources:[{text:"Holmes, W. et al. (2019). Artificial Intelligence in Education.",doi:"10.1007/s11528-019-00422-5"},{text:"Baker, R.S. (2016). Big data and education.",doi:"10.1007/s11528-016-0104-0"}]}],mit=()=>{const[t,e]=S.useState(""),[r,n]=S.useState(!1),[s,i]=S.useState(0),[o,l]=S.useState(!1);return S.useEffect(()=>{let c=[],u=[],d=!1;const h=()=>{d||(e(""),n(!1),i(0),l(!1),c.push(setTimeout(()=>{let f=0;const p=setInterval(()=>{f++,e(CG.slice(0,f)),f>=CG.length&&(clearInterval(p),c.push(setTimeout(()=>{n(!0),c.push(setTimeout(()=>n(!1),uit)),c.push(setTimeout(()=>{i(1),c.push(setTimeout(()=>i(2),dit)),c.push(setTimeout(()=>{l(!0),c.push(setTimeout(h,fit))},hit))},500))},200)))},lit);u.push(p)},cit)))};return h(),()=>{d=!0,c.forEach(clearTimeout),u.forEach(clearInterval)}},[]),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[a.jsx("p",{className:"text-center text-muted-foreground text-sm uppercase tracking-wider mb-4",children:"Topic exploration"}),a.jsx("h3",{className:"text-center text-2xl font-bold text-foreground mb-10",children:"Find your perfect research topic"}),a.jsxs("div",{className:`transition-opacity duration-500 ${o?"opacity-0":"opacity-100"}`,children:[a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6 mb-8",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-5",children:[a.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:a.jsx(hf,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-foreground",children:"Generate Topic Suggestions"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your basic idea and receive structured suggestions"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-10 gap-4 mb-4",children:[a.jsxs("div",{className:"md:col-span-7",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Working Title / Topic Idea"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground min-h-[40px] flex items-center",children:[t,a.jsx("span",{className:"inline-block w-[2px] h-4 bg-primary ml-0.5 animate-pulse"})]})]}),a.jsxs("div",{className:"md:col-span-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Output Language"}),a.jsxs("div",{className:"rounded-lg border border-border bg-background p-1 flex text-xs",children:[a.jsx("div",{className:"flex-1 text-center py-1.5 rounded text-muted-foreground",children:"DE"}),a.jsx("div",{className:"flex-1 text-center py-1.5 rounded bg-primary text-primary-foreground font-medium",children:"EN"})]})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-xs font-medium text-foreground mb-1.5",children:"Description / Context"}),a.jsx("div",{className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-muted-foreground min-h-[72px]",children:"Describe program, scope, methodology, context..."})]}),a.jsx("div",{className:`w-full rounded-lg bg-primary text-primary-foreground text-sm font-medium py-2.5 text-center transition-transform ${r?"scale-[1.02] shadow-lg shadow-primary/30":"scale-100"}`,children:"Generate Suggestions"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:pit.map((c,u)=>a.jsxs("div",{className:`rounded-xl border border-border bg-card shadow-sm p-5 transition-opacity duration-500 ${s>u?"opacity-100":"opacity-0"}`,children:[a.jsx("h4",{className:"font-bold text-lg text-foreground mb-4",children:c.title}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Research Questions"}),a.jsx("ul",{className:"text-sm text-foreground space-y-1 list-disc list-inside",children:c.questions.map(d=>a.jsx("li",{children:d},d))})]}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Method"}),a.jsx("p",{className:"text-sm text-foreground",children:c.method})]}),a.jsxs("div",{className:"mb-3",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Relevance"}),a.jsx("p",{className:"text-sm text-foreground",children:c.relevance})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"font-semibold text-sm text-primary mb-1",children:"Initial Sources"}),a.jsx("ul",{className:"space-y-1",children:c.sources.map(d=>a.jsxs("li",{className:"text-xs text-muted-foreground",children:[d.text,a.jsx("br",{}),a.jsxs("span",{className:"text-[11px]",children:["DOI: ",d.doi]})]},d.doi))})]}),a.jsx(ve,{variant:"outline",className:"w-full opacity-50 cursor-not-allowed",disabled:!0,children:"Select"})]},c.title))})]})]})})},uI=[{icon:RE,title:"AI Writing Suite",description:"Generate complete thesis chapters with AI — Theory & Background, Methods & Approach, Discussion, and Conclusion.",bullets:["Source-based academic writing","German & English support","Direct import into your thesis chapters"]},{icon:vx,title:"Qualitative Analysis",description:"Complete Mayring qualitative content analysis workflow — from interview upload to findings.",bullets:["Codebook & category management","Interview coding interface","Auto-generated category conclusions","Findings flow directly into Discussion & Conclusion"]},{icon:Wm,title:"AI Thesis Supervisor",description:"Your personal AI supervisor that knows your thesis and gives proactive feedback.",bullets:["Answers questions about your specific work","Flags incomplete or weak chapters","Available 24/7"]},{icon:a0,title:"Citation & Source Management",description:"Manage all your sources, citations and references in one place.",bullets:["Automatic citation formatting","PDF upload & text extraction","Page selector for precise source use"]}],git=()=>a.jsx("div",{id:"features",className:"py-16 lg:py-24",children:a.jsxs(Wr,{children:[a.jsxs("div",{className:"md:w-2/3 lg:w-1/2",children:[a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6 text-warning",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4.5a.75.75 0 01.721.544l.813 2.846a3.75 3.75 0 002.576 2.576l2.846.813a.75.75 0 010 1.442l-2.846.813a3.75 3.75 0 00-2.576 2.576l-.813 2.846a.75.75 0 01-1.442 0l-.813-2.846a3.75 3.75 0 00-2.576-2.576l-2.846-.813a.75.75 0 010-1.442l2.846-.813A3.75 3.75 0 007.466 7.89l.813-2.846A.75.75 0 019 4.5zM18 1.5a.75.75 0 01.728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 010 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 01-1.456 0l-.258-1.036a2.625 2.625 0 00-1.91-1.91l-1.036-.258a.75.75 0 010-1.456l1.036-.258a2.625 2.625 0 001.91-1.91l.258-1.036A.75.75 0 0118 1.5zM16.5 15a.75.75 0 01.712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 010 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 01-1.422 0l-.395-1.183a1.5 1.5 0 00-.948-.948l-1.183-.395a.75.75 0 010-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0116.5 15z",clipRule:"evenodd"})}),a.jsx("h2",{className:"my-8 text-2xl font-bold text-foreground md:text-4xl",children:"Why Academly.ai?"}),a.jsx("p",{className:"text-muted-foreground",children:"Your complete thesis companion. From initial research to final submission - we help you structure, write, and cite every chapter."})]}),a.jsx("div",{className:"mt-16 grid divide-x divide-y divide-border overflow-hidden rounded-3xl border border-border text-muted-foreground sm:grid-cols-2 lg:grid-cols-3 lg:divide-y-0 xl:grid-cols-4",children:uI.map((t,e)=>a.jsx("div",{className:`group relative bg-card transition hover:z-[1] hover:shadow-2xl hover:shadow-gray-600/10 ${e===uI.length-1?"bg-muted":""}`,children:a.jsxs("div",{className:`relative space-y-8 py-12 p-8 ${e===uI.length-1?"transition duration-300 group-hover:bg-card":""}`,children:[a.jsx(t.icon,{className:"w-12 h-12 text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xl font-semibold text-foreground transition group-hover:text-primary",children:t.title}),a.jsx("p",{className:"text-muted-foreground",children:t.description}),t.bullets&&a.jsx("ul",{className:"text-sm text-muted-foreground space-y-1 mt-2",children:t.bullets.map((r,n)=>a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"text-primary mt-0.5",children:"•"}),r]},n))})]})]})},e))}),a.jsxs("div",{className:"mt-24 max-w-3xl mx-auto",children:[a.jsx("p",{className:"text-center text-xs font-semibold uppercase tracking-widest text-primary mb-3",children:"Why Academly"}),a.jsx("h3",{className:"text-center text-2xl md:text-3xl font-bold text-foreground mb-10",children:"Not just another AI chatbot"}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"rounded-2xl bg-primary p-7 text-primary-foreground",children:[a.jsx("p",{className:"font-bold text-lg mb-6",children:"Academly"}),a.jsx("ul",{className:"space-y-3",children:["Citations only from your uploaded PDFs","Every page number is verified","Full Mayring qualitative workflow","Structured thesis chapters"].map(t=>a.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[a.jsx(Gs,{className:"w-4 h-4 mt-0.5 shrink-0 opacity-90"}),a.jsx("span",{children:t})]},t))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card p-7",children:[a.jsx("p",{className:"font-bold text-lg text-muted-foreground mb-6",children:"ChatGPT"}),a.jsx("ul",{className:"space-y-3",children:["Generates plausible but invented citations","No page number verification","No qualitative analysis workflow","Generic writing without structure"].map(t=>a.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[a.jsx(Rs,{className:"w-4 h-4 mt-0.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground",children:t})]},t))})]})]})]})]})}),kG=[{icon:Qh,number:"01",title:"Upload Sources",position:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",delay:"0ms"},{icon:al,number:"02",title:"Find Your Angle",position:"top-1/2 right-0 translate-x-1/2 -translate-y-1/2",delay:"300ms"},{icon:jo,number:"03",title:"AI Suggestions",position:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2",delay:"600ms"},{icon:BJ,number:"04",title:"Write Your Words",position:"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",delay:"900ms"}],yit=()=>a.jsx("div",{id:"solution",className:"py-16 lg:py-24",children:a.jsx(Wr,{children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-16 items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"How Academly actually works"}),a.jsx("p",{className:"text-lg text-muted-foreground mb-8",children:"AI structures your research — you remain the author."}),a.jsx("p",{className:"text-sm text-muted-foreground border-l-2 border-primary/30 pl-4 mb-6",children:"All AI outputs are working drafts. You review, cite correctly, and submit your own work."}),a.jsx(mt,{to:"/how-it-works",className:"text-primary font-semibold text-sm hover:underline",children:"See it in action →"}),a.jsx("div",{className:"md:hidden mt-8 space-y-4",children:kG.map((t,e)=>{const r=t.icon;return a.jsxs("div",{className:"flex items-center gap-4 rounded-xl bg-card border border-border shadow-sm p-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 border border-primary/30 flex items-center justify-center flex-shrink-0",children:a.jsx(r,{className:"w-5 h-5 text-primary"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:t.number}),a.jsx("div",{className:"text-sm font-semibold text-foreground",children:t.title})]})]},e)})})]}),a.jsx("div",{className:"hidden md:block",children:a.jsxs("div",{className:"relative aspect-square w-full max-w-[520px] mx-auto flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-[10%] rounded-full bg-primary/5 blur-2xl"}),a.jsx("div",{className:"absolute inset-[7.5%] rounded-full border border-dashed border-border"}),a.jsxs("div",{className:"relative z-20 w-32 h-32 rounded-full bg-card shadow-2xl shadow-primary/20 border border-border flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 animate-pulse"}),a.jsx(s0e,{className:"w-10 h-10 text-primary relative z-10",fill:"currentColor"})]}),kG.map((t,e)=>{const r=t.icon,n=["top-0 left-1/2 -translate-x-1/2 -translate-y-4","right-0 top-1/2 translate-x-4 -translate-y-1/2","bottom-0 left-1/2 -translate-x-1/2 translate-y-4","left-0 top-1/2 -translate-x-4 -translate-y-1/2"];return a.jsx("div",{className:`absolute z-30 ${n[e]} opacity-0`,style:{animation:`fade-in 0.5s ease-out ${t.delay} forwards`},children:a.jsxs("div",{className:"bg-card rounded-[2rem] px-6 py-5 shadow-xl shadow-foreground/5 border border-border flex flex-col items-center gap-1.5 min-w-[160px]",children:[a.jsx(r,{className:"w-6 h-6 text-primary"}),a.jsx("span",{className:"text-[10px] uppercase tracking-widest font-bold text-primary/60",children:t.number}),a.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.title})]})},e)}),a.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[a.jsx("div",{className:"absolute top-[16%] right-[16%] text-muted-foreground/40",children:a.jsx("svg",{className:"w-6 h-6 rotate-45",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M9 5l7 7-7 7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("div",{className:"absolute bottom-[16%] right-[16%] text-muted-foreground/40",children:a.jsx("svg",{className:"w-6 h-6 rotate-[135deg]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M9 5l7 7-7 7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("div",{className:"absolute bottom-[16%] left-[16%] text-muted-foreground/40",children:a.jsx("svg",{className:"w-6 h-6 rotate-[225deg]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M9 5l7 7-7 7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsx("div",{className:"absolute top-[16%] left-[16%] text-muted-foreground/40",children:a.jsx("svg",{className:"w-6 h-6 rotate-[315deg]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M9 5l7 7-7 7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})})]})})}),vit=id("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success-50 text-success-600 dark:bg-success-500/20 dark:text-success-400",warning:"border-transparent bg-warning-50 text-warning-600 dark:bg-warning-500/20 dark:text-warning-400",error:"border-transparent bg-error-50 text-error-600 dark:bg-error-500/20 dark:text-error-400"}},defaultVariants:{variant:"default"}});function gt({className:t,variant:e,...r}){return a.jsx("div",{className:Oe(vit({variant:e}),t),...r})}const TG=[{quarter:"Q3 2025",title:"Core Platform",description:"Dashboard, Document Library, PDF Upload, Text Extractor, Page Selector",icon:a.jsx(dc,{className:"h-4 w-4"})},{quarter:"Q4 2025",title:"Writing Suite",description:"Topic Explorer (Ideas, Outline, Keywords), Theory & Background, Methods & Approach, Discussion Generator",icon:a.jsx(dc,{className:"h-4 w-4"})},{quarter:"Q1 2026",title:"Analysis & Completion",description:"Qualitative Analysis (Full Mayring workflow), Citation Manager, Conclusion Generator, AI Thesis Supervisor",icon:a.jsx(dc,{className:"h-4 w-4"})}],dI=[{key:"student-hub",label:"Student Hub",icon:a.jsx(qJ,{className:"h-4 w-4"}),timeline:[{quarter:"Q1 2026",title:"Development",description:"Building user exchange and community chat features."},{quarter:"Q1 2026",title:"Beta Testing",description:"Early adopters test collaboration and resource sharing."},{quarter:"Q2 2026",title:"Fully Integrated",description:"Student Hub launches with matching and community tools."}],items:[{title:"Community Chat & Exchange",description:"Connect with fellow students, share experiences and get peer feedback on your research.",status:"planned",why:"Collaboration accelerates learning."},{title:"Resource Sharing",description:"Share and discover literature, templates, and research resources within your discipline.",status:"planned",why:"Great research builds on shared knowledge."},{title:"Project Matching",description:"Find study partners and collaborators matched by discipline and research interests.",status:"exploring",why:"The right team makes all the difference."}]},{key:"transcription",label:"Transcription",icon:a.jsx(Yxe,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Development",description:"Core audio/video transcription engine for interviews."},{quarter:"Q2 2026",title:"Beta Multilanguage",description:"Testing German, English and additional language support."},{quarter:"Q3 2026",title:"Fully Integrated",description:"Seamless transcription pipeline for all users."}],items:[{title:"Audio/Video Transcription",description:"Automatically transcribe interview recordings into structured text for analysis.",status:"planned",why:"Saves hours of manual transcription work."},{title:"Multilanguage Support",description:"Full platform support for German, English and additional languages.",status:"planned",why:"Research is global — your tools should be too."}]},{key:"quantitative-module",label:"Quantitative Module",icon:a.jsx(vx,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Exploring Modular Design",description:"Defining the architecture for pluggable analysis modules."},{quarter:"Q2 2026",title:"Data Visualization",description:"Developing charts, boxplots and visual analysis tools."},{quarter:"Q3 2026",title:"Beta Testing",description:"Validating statistical workflows with early testers."},{quarter:"Q3 2026",title:"Going Live",description:"Full quantitative analysis module available to all users."}],items:[{title:"Quantitative Analysis",description:"Statistical analysis tools for survey data, experiments, and quantitative research methods.",status:"exploring",why:"Complete your methodology toolkit."},{title:"Data Visualization",description:"Generate charts, boxplots, and graphs directly from your research data.",status:"exploring",why:"Visual evidence strengthens your thesis."},{title:"Automated Insights",description:"AI-assisted pattern detection and key findings from your datasets.",status:"exploring",why:"Discover what your data is telling you."}]},{key:"citations",label:"Citation Styles",icon:a.jsx(a0,{className:"h-4 w-4"}),timeline:[{quarter:"Q2 2026",title:"Development",description:"Implementing MLA, Chicago, Harvard and Vancouver parsers."},{quarter:"Q2 2026",title:"Beta Testing",description:"Testing citation accuracy across multiple style guides."},{quarter:"Q3 2026",title:"Shipping",description:"All new citation styles available for every user."}],items:[{title:"MLA & Chicago",description:"Support for MLA 9th edition and Chicago (Notes & Bibliography + Author-Date).",status:"planned",why:"Essential for humanities and social sciences."},{title:"Harvard & Vancouver",description:"Harvard referencing and Vancouver (numbered) citation styles.",status:"planned",why:"Required by many European and medical universities."},{title:"IEEE",description:"IEEE citation format for engineering and computer science papers.",status:"planned",why:"Standard in technical disciplines."}]}],xit={done:{label:"Done",variant:"success"},planned:{label:"Planned",variant:"default"},exploring:{label:"Exploring",variant:"warning"}},bit=({milestones:t})=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden md:block relative mb-10",children:[a.jsx("div",{className:"absolute top-4 left-0 right-0 h-0.5 bg-border"}),a.jsx("div",{className:"grid gap-8 relative",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map((e,r)=>a.jsxs(Jo.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3,delay:r*.1},className:"flex flex-col items-center text-center",children:[a.jsx("div",{className:"relative z-10 mb-3 flex h-8 w-8 items-center justify-center rounded-full bg-muted border border-border text-muted-foreground shadow-sm",children:a.jsx(sz,{className:"h-3.5 w-3.5"})}),a.jsx(gt,{variant:"default",className:"mb-1 text-[10px]",children:e.quarter}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 max-w-[180px] leading-relaxed",children:e.description})]},r))})]}),a.jsxs("div",{className:"md:hidden space-y-4 relative pl-7 mb-8",children:[a.jsx("div",{className:"absolute left-[13px] top-0 bottom-0 w-0.5 bg-border"}),t.map((e,r)=>a.jsxs(Jo.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.3,delay:r*.08},className:"relative",children:[a.jsx("div",{className:"absolute -left-7 top-0.5 z-10 flex h-6 w-6 items-center justify-center rounded-full bg-muted border border-border text-muted-foreground",children:a.jsx(sz,{className:"h-3 w-3"})}),a.jsx(gt,{variant:"default",className:"mb-0.5 text-[10px]",children:e.quarter}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.description})]},r))]})]}),wit=()=>{const[t,e]=S.useState(dI[0].key),r=dI.find(n=>n.key===t);return a.jsx("section",{id:"roadmap",className:"py-20 sm:py-28 bg-muted/30",children:a.jsxs(Wr,{children:[a.jsxs(Jo.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5},className:"text-center mb-16",children:[a.jsx(gt,{variant:"secondary",className:"mb-4",children:"Roadmap"}),a.jsx("h2",{className:"text-3xl sm:text-4xl font-bold tracking-tight text-foreground mb-4",children:"Building the Future of Academic Writing"}),a.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto text-lg",children:"Academly assists your research process — you remain the author. This roadmap shows planned features and may evolve based on community feedback."})]}),a.jsxs("div",{className:"mb-20",children:[a.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground mb-8 text-center",children:"What we've shipped"}),a.jsxs("div",{className:"hidden md:block relative",children:[a.jsx("div",{className:"absolute top-5 left-0 right-0 h-0.5 bg-border"}),a.jsx("div",{className:"grid grid-cols-3 gap-8 relative",children:TG.map((n,s)=>a.jsxs(Jo.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.4,delay:s*.15},className:"flex flex-col items-center text-center",children:[a.jsx("div",{className:"relative z-10 mb-4 flex h-10 w-10 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/20",children:n.icon}),a.jsx(gt,{variant:"success",className:"mb-2",children:n.quarter}),a.jsx("p",{className:"font-semibold text-foreground mb-1",children:n.title}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.description})]},n.quarter))})]}),a.jsxs("div",{className:"md:hidden space-y-6 relative pl-8",children:[a.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-0.5 bg-border"}),TG.map((n,s)=>a.jsxs(Jo.div,{initial:{opacity:0,x:-10},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{duration:.4,delay:s*.1},className:"relative",children:[a.jsx("div",{className:"absolute -left-8 top-1 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/20",children:n.icon}),a.jsx(gt,{variant:"success",className:"mb-1",children:n.quarter}),a.jsx("p",{className:"font-semibold text-foreground",children:n.title}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},n.quarter))]})]}),a.jsxs("div",{children:[a.jsxs(Jo.div,{initial:{opacity:0,y:16},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.4},className:"text-center mb-8",children:[a.jsx("h3",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-foreground mb-2",children:"What's Next"}),a.jsx("p",{className:"text-muted-foreground max-w-xl mx-auto",children:"Explore the development tracks we're working on — select a track to see details and timelines."})]}),a.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2 mb-10",children:dI.map(n=>a.jsxs("button",{onClick:()=>e(n.key),className:`inline-flex items-center gap-2 rounded-full px-4 py-2 text-sm font-medium transition-all duration-200 ${t===n.key?"bg-primary text-primary-foreground shadow-md shadow-primary/20":"bg-card border border-border/50 text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[n.icon,n.label]},n.key))}),a.jsxs(Jo.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3},children:[r.timeline&&a.jsx(bit,{milestones:r.timeline}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:r.items.map((n,s)=>{const i=xit[n.status];return a.jsx(Me,{className:"flex flex-col",children:a.jsxs($e,{className:"pt-6 flex flex-col flex-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[a.jsx("h4",{className:"font-semibold text-foreground leading-snug",children:n.title}),a.jsx(gt,{variant:i.variant,className:"shrink-0",children:i.label})]}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-3 flex-1",children:n.description}),a.jsxs("p",{className:"text-xs text-muted-foreground/70 flex items-start gap-1.5",children:[a.jsx(hf,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),n.why]})]})},s)})})]},t)]})]})})},_it=()=>a.jsxs("div",{className:"relative py-16 lg:py-24",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 h-max w-full m-auto grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{children:a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex items-center justify-center -space-x-2",children:[a.jsx("img",{loading:"lazy",src:"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100&h=100&fit=crop&crop=face",alt:"user",className:"h-8 w-8 rounded-full object-cover ring-2 ring-background"}),a.jsx("img",{loading:"lazy",src:"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&h=100&fit=crop&crop=face",alt:"user",className:"h-12 w-12 rounded-full object-cover ring-2 ring-background"}),a.jsx("img",{loading:"lazy",src:"https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=100&h=100&fit=crop&crop=face",alt:"user",className:"z-10 h-16 w-16 rounded-full object-cover ring-2 ring-background"}),a.jsx("img",{loading:"lazy",src:"https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=100&h=100&fit=crop&crop=face",alt:"user",className:"relative h-12 w-12 rounded-full object-cover ring-2 ring-background"}),a.jsx("img",{loading:"lazy",src:"https://images.unsplash.com/photo-1544005313-94ddf0286df2?w=100&h=100&fit=crop&crop=face",alt:"user",className:"h-8 w-8 rounded-full object-cover ring-2 ring-background"})]}),a.jsxs("div",{className:"mt-6 m-auto space-y-6 md:w-8/12 lg:w-7/12",children:[a.jsx("h2",{className:"text-center text-4xl font-bold text-foreground md:text-5xl",children:"Ready to Write Your Thesis?"}),a.jsx("p",{className:"text-center text-xl text-muted-foreground",children:"Start your Thesis today. for free."}),a.jsxs("div",{className:"flex flex-wrap justify-center gap-6",children:[a.jsx(mt,{to:"/login?mode=signup",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary-foreground",children:"Sign Up Free"})}),a.jsx(mt,{to:"/pricing",className:"relative flex h-12 w-full items-center justify-center px-8 before:absolute before:inset-0 before:rounded-full before:border before:border-transparent before:bg-primary/10 before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 dark:before:border-gray-700 dark:before:bg-gray-800 sm:w-max",children:a.jsx("span",{className:"relative text-base font-semibold text-primary dark:text-white",children:"View Pricing"})})]})]})]})})]}),ea=({title:t,description:e,canonical:r,ogImage:n="https://academly.ai/og-image.png",jsonLd:s,noIndex:i=!1})=>a.jsxs(jve,{children:[a.jsx("title",{children:t}),a.jsx("meta",{name:"description",content:e}),a.jsx("link",{rel:"canonical",href:r}),i?a.jsx("meta",{name:"robots",content:"noindex, nofollow"}):a.jsx("meta",{name:"robots",content:"index, follow"}),a.jsx("meta",{property:"og:title",content:t}),a.jsx("meta",{property:"og:description",content:e}),a.jsx("meta",{property:"og:url",content:r}),a.jsx("meta",{property:"og:type",content:"website"}),a.jsx("meta",{property:"og:image",content:n}),a.jsx("meta",{property:"og:site_name",content:"Academly.ai"}),a.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),a.jsx("meta",{name:"twitter:title",content:t}),a.jsx("meta",{name:"twitter:description",content:e}),a.jsx("meta",{name:"twitter:image",content:n}),s&&a.jsx("script",{type:"application/ld+json",children:JSON.stringify(s)})]}),jit=[{"@context":"https://schema.org","@type":"Organization",name:"Academly.ai",url:"https://academly.ai",logo:"https://academly.ai/og-image.png",sameAs:[]},{"@context":"https://schema.org","@type":"SoftwareApplication",name:"Academly.ai",applicationCategory:"EducationalApplication",operatingSystem:"Web",description:"Complete AI-powered thesis writing platform. From topic exploration to final chapters - structure, write, and cite your academic work with confidence.",url:"https://academly.ai",offers:{"@type":"Offer",price:"0",priceCurrency:"USD"}}],Sit=()=>{const[t,e]=S.useState(!0);return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Academly.ai - Your Complete Thesis Writing Platform",description:"AI-powered thesis writing platform for Bachelor and Master students. Generate Theory, Methodology and Discussion sections with real citations from your own PDFs. APA7, Harvard, MLA supported.",canonical:"https://academly.ai/",jsonLd:jit}),a.jsx(Os,{}),a.jsxs("main",{children:[a.jsx(Jst,{}),a.jsx(oit,{}),a.jsx(mit,{}),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[a.jsx("p",{className:"text-center text-muted-foreground text-sm uppercase tracking-wider mb-6",children:"See Academly in action"}),a.jsxs("div",{className:"relative rounded-2xl overflow-hidden shadow-2xl group",children:[a.jsx("video",{src:"/hero.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,"aria-label":"Academly platform demo",className:"w-full"}),a.jsxs("div",{className:"absolute inset-0 flex items-end justify-between p-4 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:()=>{const r=document.querySelector("video");r&&(r.muted=!r.muted,e(r.muted))},className:"bg-black/50 text-white rounded-full p-2","aria-label":t?"Unmute":"Mute",children:t?a.jsx(d0e,{size:20}):a.jsx(u0e,{size:20})}),a.jsx("button",{onClick:()=>{const r=document.querySelector("video");r&&r.requestFullscreen()},className:"bg-black/50 text-white rounded-full p-2","aria-label":"Fullscreen",children:a.jsx(Vxe,{size:20})})]})]}),a.jsx("h2",{className:"sr-only",children:"See Academly in Action"})]})}),a.jsx(git,{}),a.jsx(yit,{}),a.jsxs("section",{className:"py-16 text-center",children:[a.jsx("p",{className:"text-muted-foreground text-lg",children:"Beta since may 2026"}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mt-2 mb-6",children:"We are building Academly with you - not just for you."}),a.jsx(ve,{asChild:!0,className:"rounded-full px-8",children:a.jsx(mt,{to:"/login",children:"Try the beta for free"})})]}),a.jsx(wit,{}),a.jsx(_it,{})]}),a.jsx(bi,{})]})};function lue(){const{user:t,userProfile:e}=Pt(),[r,n]=S.useState(!1);return{loading:r,createCheckoutSession:async l=>{if(!t){Fe.error("Please log in to subscribe");return}n(!0);try{const{data:c,error:u}=await Ar.functions.invoke("create-checkout-session",{body:{plan:l}});if(u)throw u;if(c!=null&&c.url)window.location.href=c.url;else throw new Error("No checkout URL received")}catch(c){console.error("Checkout error:",c),Fe.error(c.message||"Failed to create checkout session")}finally{n(!1)}},openCustomerPortal:async l=>{if(!t){Fe.error("Please log in to manage subscription");return}n(!0);try{const{data:c,error:u}=await Ar.functions.invoke("create-customer-portal",{body:{targetPlan:l}});if(u)throw u;if(c!=null&&c.url)window.location.href=c.url;else throw new Error("No portal URL received")}catch(c){console.error("Portal error:",c),Fe.error(c.message||"Failed to open customer portal")}finally{n(!1)}},getSubscriptionStatus:()=>e?{plan:e.plan,status:e.subscription_status,endsAt:e.subscription_ends_at,isActive:e.subscription_status==="active",hasSubscription:!!e.stripe_subscription_id}:null}}const Nit=!1,Ait=250,Eit=[{id:"free",name:"Free",originalPrice:null,price:"0",discount:null,points:"60",description:"Perfect for getting started",features:["60 Student Points on signup","PDF upload up to 5 MB","Basic summaries","Automatic citations"],popular:!1,launchOffer:!1,enabled:!0},{id:"pro",name:"Pro",originalPrice:"24.99",price:"15.99",discount:36,points:"2,000",description:"Ideal for active researchers",features:["2,000 Student Points per month","PDF upload up to 50 MB","Advanced summaries","Methodology Builder","Theory Builder","Discussion Builder","Qualitative Analysis","Export to multiple formats"],popular:!0,launchOffer:!0,enabled:!0},{id:"author",name:"Author",originalPrice:"39.99",price:"24.99",discount:37,points:"4,000",description:"For students & professionals",features:["4,000 Student Points per month","PDF upload up to 50 MB","All Pro features","AI-powered text blocks","Collaboration features","Custom citation styles"],popular:!1,launchOffer:!0,enabled:!0},{id:"lifetime",name:"Lifetime",originalPrice:null,price:"199",discount:null,points:"4,000",description:"One-time payment, lifetime access",features:["4,000 Student Points (renew monthly)","Lifetime access to all features","All Author features included","No monthly payments ever","Future feature updates included"],popular:!1,launchOffer:!1,isLifetime:!0,enabled:Nit}],Cit=Eit.filter(t=>t.enabled!==!1),kit={"@context":"https://schema.org","@type":"WebPage",name:"Pricing - AI Academic Writing Plans",description:"Simple, transparent pricing for AI thesis writing. Free tier available.",url:"https://academly.ai/pricing"},Tit=()=>{const t=wr(),{user:e,userProfile:r,loading:n}=Pt(),{createCheckoutSession:s,openCustomerPortal:i,loading:o}=lue(),[l,c]=S.useState(null),u=(r==null?void 0:r.plan)||"free",d=(r==null?void 0:r.subscription_status)==="active";S.useEffect(()=>{(async()=>{const{data:m,error:v}=await Ar.rpc("get_lifetime_sold_count");!v&&m!==null&&c(m)})()},[]),S.useEffect(()=>{typeof window<"u"&&window.umami&&window.umami.track("pricing-page-view")},[]);const h=async g=>{if(g==="free"){t(e?"/dashboard":"/login");return}if(!e){t("/login");return}if(g==="lifetime"){await s(g);return}if(u===g&&d){await i();return}if(d){await i(g);return}await s(g)},f=g=>g==="free"?e?"Current Plan":"Get Started":g==="lifetime"?u==="lifetime"?"Current Plan":"Buy Lifetime Access":e?u===g&&d?"Manage Plan":d?"Change Plan":"Subscribe Now":"Start Trial",p=g=>g==="lifetime"&&u==="lifetime"||g==="free"&&(u==="free"||u==="starter")&&!d?!0:u===g&&d;return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Pricing - AI Academic Writing Plans | Academly",description:"Simple, transparent pricing for AI thesis writing. Free tier available. Generate theory sections, methodology chapters, and more with real citations.",canonical:"https://academly.ai/pricing",jsonLd:kit}),a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-20 overflow-visible",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 -bottom-[600px] grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20 pointer-events-none overflow-visible",children:[a.jsx("div",{className:"blur-[106px] h-[400px] bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-[300px] bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:["Simple, Transparent",a.jsx("span",{className:"text-primary",children:" Pricing"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Choose the plan that fits your research needs. No hidden fees, cancel anytime."})]})})]}),a.jsx("section",{className:"relative py-20 overflow-visible",children:a.jsxs(Wr,{className:"max-w-screen-xl",children:[a.jsx("div",{className:"grid md:grid-cols-2 xl:grid-cols-4 gap-8",children:Cit.map(g=>a.jsxs("div",{className:`relative rounded-3xl p-8 transition-all duration-300 hover:shadow-2xl ${g.popular?"bg-primary text-primary-foreground scale-105 shadow-2xl":g.isLifetime?"bg-card border-2 border-purple-500 ring-2 ring-purple-500/20 hover:ring-purple-500/40 shadow-lg shadow-purple-500/10":"bg-card border border-border hover:border-primary/50"}`,children:[a.jsxs("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 flex gap-2",children:[g.popular&&a.jsx("span",{className:"bg-orange-500 text-white text-sm font-medium px-4 py-1 rounded-full whitespace-nowrap",children:"Most Popular"}),g.isLifetime&&a.jsxs("span",{className:"bg-gradient-to-r from-purple-600 to-violet-500 text-white text-sm font-medium px-4 py-1 rounded-full whitespace-nowrap flex items-center gap-1.5",children:[a.jsx(s0,{className:"h-3.5 w-3.5"}),"Limited Offer"]})]}),g.launchOffer&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsxs("span",{className:"bg-gradient-to-r from-amber-500 to-orange-500 text-white text-xs font-bold px-3 py-1 rounded-full flex items-center gap-1",children:[a.jsx(jo,{className:"h-3 w-3"}),"-",g.discount,"%"]})}),g.isLifetime&&l!==null&&a.jsx("div",{className:"absolute -top-3 right-4",children:a.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300 text-xs font-bold px-3 py-1 rounded-full",children:[l,"/",Ait," sold"]})}),a.jsxs("div",{className:"text-center mb-8 mt-2",children:[a.jsx("h3",{className:`text-2xl font-bold mb-2 ${g.popular?"":"text-foreground"}`,children:g.name}),a.jsx("p",{className:`text-sm mb-4 ${g.popular?"text-primary-foreground/80":"text-muted-foreground"}`,children:g.description}),a.jsxs("div",{className:"mb-2",children:[g.originalPrice&&a.jsxs("span",{className:`text-lg line-through ${g.popular?"text-primary-foreground/50":"text-muted-foreground"}`,children:["$",g.originalPrice]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-4xl font-bold",children:["$",g.price]}),g.id!=="free"&&!g.isLifetime&&a.jsx("span",{className:g.popular?"text-primary-foreground/80":"text-muted-foreground",children:"/month"})]})]}),a.jsx("p",{className:`text-sm ${g.popular?"text-primary-foreground/80":"text-muted-foreground"}`,children:g.isLifetime?"4,000 Student Points (renew monthly)":g.id!=="free"?`${g.points} Student Points per month`:`${g.points} Student Points`})]}),a.jsx("ul",{className:"space-y-4 mb-8",children:g.features.map((m,v)=>a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx(pl,{className:`h-5 w-5 flex-shrink-0 mt-0.5 ${g.popular?"text-primary-foreground":"text-primary"}`}),a.jsx("span",{className:`text-sm ${g.popular?"":"text-muted-foreground"}`,children:m})]},v))}),a.jsx(ve,{onClick:()=>h(g.id),disabled:o||n||p(g.id),className:`w-full rounded-full h-12 text-base font-semibold ${g.popular?"bg-white text-primary hover:bg-white/90":""}`,variant:g.popular?"secondary":"default","data-umami-event":"pricing-plan-click","data-umami-event-plan":g.id,children:o?a.jsx(Et,{className:"h-4 w-4 animate-spin"}):p(g.id)?"Current Plan":f(g.id)})]},g.name))}),a.jsxs("div",{className:"text-center mt-16",children:[a.jsx("p",{className:"text-muted-foreground mb-4"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Need a custom plan?"," ",a.jsx("a",{href:"mailto:contact@academly.ai",className:"text-primary hover:underline",children:"Contact us"})]})]})]})}),a.jsx(bi,{})]})};var R8={};(function t(e,r,n,s){var i=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!e.OffscreenCanvas)return!1;try{var $=new OffscreenCanvas(1,1),L=$.getContext("2d");L.fillRect(0,0,1,1);var F=$.transferToImageBitmap();L.createPattern(F,"no-repeat")}catch{return!1}return!0}();function c(){}function u($){var L=r.exports.Promise,F=L!==void 0?L:e.Promise;return typeof F=="function"?new F($):($(c,c),null)}var d=function($,L){return{transform:function(F){if($)return F;if(L.has(F))return L.get(F);var W=new OffscreenCanvas(F.width,F.height),X=W.getContext("2d");return X.drawImage(F,0,0),L.set(F,W),W},clear:function(){L.clear()}}}(l,new Map),h=function(){var $=Math.floor(16.666666666666668),L,F,W={},X=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(L=function(oe){var le=Math.random();return W[le]=requestAnimationFrame(function B(R){X===R||X+$-1<R?(X=R,delete W[le],oe()):W[le]=requestAnimationFrame(B)}),le},F=function(oe){W[oe]&&cancelAnimationFrame(W[oe])}):(L=function(oe){return setTimeout(oe,$)},F=function(oe){return clearTimeout(oe)}),{frame:L,cancel:F}}(),f=function(){var $,L,F={};function W(X){function oe(le,B){X.postMessage({options:le||{},callback:B})}X.init=function(B){var R=B.transferControlToOffscreen();X.postMessage({canvas:R},[R])},X.fire=function(B,R,ee){if(L)return oe(B,null),L;var te=Math.random().toString(36).slice(2);return L=u(function(Z){function J(he){he.data.callback===te&&(delete F[te],X.removeEventListener("message",J),L=null,d.clear(),ee(),Z())}X.addEventListener("message",J),oe(B,te),F[te]=J.bind(null,{data:{callback:te}})}),L},X.reset=function(){X.postMessage({reset:!0});for(var B in F)F[B](),delete F[B]}}return function(){if($)return $;if(!n&&i){var X=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {","  if (msg.data.options) {","    CONFETTI(msg.data.options).then(function () {","      if (msg.data.callback) {","        postMessage({ callback: msg.data.callback });","      }","    });","  } else if (msg.data.reset) {","    CONFETTI && CONFETTI.reset();","  } else if (msg.data.resize) {","    SIZE.width = msg.data.resize.width;","    SIZE.height = msg.data.resize.height;","  } else if (msg.data.canvas) {","    SIZE.width = msg.data.canvas.width;","    SIZE.height = msg.data.canvas.height;","    CONFETTI = module.exports.create(msg.data.canvas);","  }","}"].join(`
`);try{$=new Worker(URL.createObjectURL(new Blob([X])))}catch(oe){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",oe),null}W($)}return $}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function g($,L){return L?L($):$}function m($){return $!=null}function v($,L,F){return g($&&m($[L])?$[L]:p[L],F)}function y($){return $<0?0:Math.floor($)}function x($,L){return Math.floor(Math.random()*(L-$))+$}function b($){return parseInt($,16)}function w($){return $.map(j)}function j($){var L=String($).replace(/[^0-9a-f]/gi,"");return L.length<6&&(L=L[0]+L[0]+L[1]+L[1]+L[2]+L[2]),{r:b(L.substring(0,2)),g:b(L.substring(2,4)),b:b(L.substring(4,6))}}function N($){var L=v($,"origin",Object);return L.x=v(L,"x",Number),L.y=v(L,"y",Number),L}function C($){$.width=document.documentElement.clientWidth,$.height=document.documentElement.clientHeight}function k($){var L=$.getBoundingClientRect();$.width=L.width,$.height=L.height}function E($){var L=document.createElement("canvas");return L.style.position="fixed",L.style.top="0px",L.style.left="0px",L.style.pointerEvents="none",L.style.zIndex=$,L}function M($,L,F,W,X,oe,le,B,R){$.save(),$.translate(L,F),$.rotate(oe),$.scale(W,X),$.arc(0,0,1,le,B,R),$.restore()}function z($){var L=$.angle*(Math.PI/180),F=$.spread*(Math.PI/180);return{x:$.x,y:$.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:$.startVelocity*.5+Math.random()*$.startVelocity,angle2D:-L+(.5*F-Math.random()*F),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:$.color,shape:$.shape,tick:0,totalTicks:$.ticks,decay:$.decay,drift:$.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:$.gravity*3,ovalScalar:.6,scalar:$.scalar,flat:$.flat}}function I($,L){L.x+=Math.cos(L.angle2D)*L.velocity+L.drift,L.y+=Math.sin(L.angle2D)*L.velocity+L.gravity,L.velocity*=L.decay,L.flat?(L.wobble=0,L.wobbleX=L.x+10*L.scalar,L.wobbleY=L.y+10*L.scalar,L.tiltSin=0,L.tiltCos=0,L.random=1):(L.wobble+=L.wobbleSpeed,L.wobbleX=L.x+10*L.scalar*Math.cos(L.wobble),L.wobbleY=L.y+10*L.scalar*Math.sin(L.wobble),L.tiltAngle+=.1,L.tiltSin=Math.sin(L.tiltAngle),L.tiltCos=Math.cos(L.tiltAngle),L.random=Math.random()+2);var F=L.tick++/L.totalTicks,W=L.x+L.random*L.tiltCos,X=L.y+L.random*L.tiltSin,oe=L.wobbleX+L.random*L.tiltCos,le=L.wobbleY+L.random*L.tiltSin;if($.fillStyle="rgba("+L.color.r+", "+L.color.g+", "+L.color.b+", "+(1-F)+")",$.beginPath(),o&&L.shape.type==="path"&&typeof L.shape.path=="string"&&Array.isArray(L.shape.matrix))$.fill(G(L.shape.path,L.shape.matrix,L.x,L.y,Math.abs(oe-W)*.1,Math.abs(le-X)*.1,Math.PI/10*L.wobble));else if(L.shape.type==="bitmap"){var B=Math.PI/10*L.wobble,R=Math.abs(oe-W)*.1,ee=Math.abs(le-X)*.1,te=L.shape.bitmap.width*L.scalar,Z=L.shape.bitmap.height*L.scalar,J=new DOMMatrix([Math.cos(B)*R,Math.sin(B)*R,-Math.sin(B)*ee,Math.cos(B)*ee,L.x,L.y]);J.multiplySelf(new DOMMatrix(L.shape.matrix));var he=$.createPattern(d.transform(L.shape.bitmap),"no-repeat");he.setTransform(J),$.globalAlpha=1-F,$.fillStyle=he,$.fillRect(L.x-te/2,L.y-Z/2,te,Z),$.globalAlpha=1}else if(L.shape==="circle")$.ellipse?$.ellipse(L.x,L.y,Math.abs(oe-W)*L.ovalScalar,Math.abs(le-X)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI):M($,L.x,L.y,Math.abs(oe-W)*L.ovalScalar,Math.abs(le-X)*L.ovalScalar,Math.PI/10*L.wobble,0,2*Math.PI);else if(L.shape==="star")for(var P=Math.PI/2*3,ie=4*L.scalar,V=8*L.scalar,O=L.x,T=L.y,D=5,ne=Math.PI/D;D--;)O=L.x+Math.cos(P)*V,T=L.y+Math.sin(P)*V,$.lineTo(O,T),P+=ne,O=L.x+Math.cos(P)*ie,T=L.y+Math.sin(P)*ie,$.lineTo(O,T),P+=ne;else $.moveTo(Math.floor(L.x),Math.floor(L.y)),$.lineTo(Math.floor(L.wobbleX),Math.floor(X)),$.lineTo(Math.floor(oe),Math.floor(le)),$.lineTo(Math.floor(W),Math.floor(L.wobbleY));return $.closePath(),$.fill(),L.tick<L.totalTicks}function q($,L,F,W,X){var oe=L.slice(),le=$.getContext("2d"),B,R,ee=u(function(te){function Z(){B=R=null,le.clearRect(0,0,W.width,W.height),d.clear(),X(),te()}function J(){n&&!(W.width===s.width&&W.height===s.height)&&(W.width=$.width=s.width,W.height=$.height=s.height),!W.width&&!W.height&&(F($),W.width=$.width,W.height=$.height),le.clearRect(0,0,W.width,W.height),oe=oe.filter(function(he){return I(le,he)}),oe.length?B=h.frame(J):Z()}B=h.frame(J),R=Z});return{addFettis:function(te){return oe=oe.concat(te),ee},canvas:$,promise:ee,reset:function(){B&&h.cancel(B),R&&R()}}}function A($,L){var F=!$,W=!!v(L||{},"resize"),X=!1,oe=v(L,"disableForReducedMotion",Boolean),le=i&&!!v(L||{},"useWorker"),B=le?f():null,R=F?C:k,ee=$&&B?!!$.__confetti_initialized:!1,te=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,Z;function J(P,ie,V){for(var O=v(P,"particleCount",y),T=v(P,"angle",Number),D=v(P,"spread",Number),ne=v(P,"startVelocity",Number),ue=v(P,"decay",Number),re=v(P,"gravity",Number),pe=v(P,"drift",Number),xe=v(P,"colors",w),ye=v(P,"ticks",Number),ae=v(P,"shapes"),de=v(P,"scalar"),ge=!!v(P,"flat"),we=N(P),je=O,Se=[],Ue=$.width*we.x,Ae=$.height*we.y;je--;)Se.push(z({x:Ue,y:Ae,angle:T,spread:D,startVelocity:ne,color:xe[je%xe.length],shape:ae[x(0,ae.length)],ticks:ye,decay:ue,gravity:re,drift:pe,scalar:de,flat:ge}));return Z?Z.addFettis(Se):(Z=q($,Se,R,ie,V),Z.promise)}function he(P){var ie=oe||v(P,"disableForReducedMotion",Boolean),V=v(P,"zIndex",Number);if(ie&&te)return u(function(ne){ne()});F&&Z?$=Z.canvas:F&&!$&&($=E(V),document.body.appendChild($)),W&&!ee&&R($);var O={width:$.width,height:$.height};B&&!ee&&B.init($),ee=!0,B&&($.__confetti_initialized=!0);function T(){if(B){var ne={getBoundingClientRect:function(){if(!F)return $.getBoundingClientRect()}};R(ne),B.postMessage({resize:{width:ne.width,height:ne.height}});return}O.width=O.height=null}function D(){Z=null,W&&(X=!1,e.removeEventListener("resize",T)),F&&$&&(document.body.contains($)&&document.body.removeChild($),$=null,ee=!1)}return W&&!X&&(X=!0,e.addEventListener("resize",T,!1)),B?B.fire(P,O,D):J(P,O,D)}return he.reset=function(){B&&B.reset(),Z&&Z.reset()},he}var U;function K(){return U||(U=A(null,{useWorker:!0,resize:!0})),U}function G($,L,F,W,X,oe,le){var B=new Path2D($),R=new Path2D;R.addPath(B,new DOMMatrix(L));var ee=new Path2D;return ee.addPath(R,new DOMMatrix([Math.cos(le)*X,Math.sin(le)*X,-Math.sin(le)*oe,Math.cos(le)*oe,F,W])),ee}function Y($){if(!o)throw new Error("path confetti are not supported in this browser");var L,F;typeof $=="string"?L=$:(L=$.path,F=$.matrix);var W=new Path2D(L),X=document.createElement("canvas"),oe=X.getContext("2d");if(!F){for(var le=1e3,B=le,R=le,ee=0,te=0,Z,J,he=0;he<le;he+=2)for(var P=0;P<le;P+=2)oe.isPointInPath(W,he,P,"nonzero")&&(B=Math.min(B,he),R=Math.min(R,P),ee=Math.max(ee,he),te=Math.max(te,P));Z=ee-B,J=te-R;var ie=10,V=Math.min(ie/Z,ie/J);F=[V,0,0,V,-Math.round(Z/2+B)*V,-Math.round(J/2+R)*V]}return{type:"path",path:L,matrix:F}}function H($){var L,F=1,W="#000000",X='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof $=="string"?L=$:(L=$.text,F="scalar"in $?$.scalar:F,X="fontFamily"in $?$.fontFamily:X,W="color"in $?$.color:W);var oe=10*F,le=""+oe+"px "+X,B=new OffscreenCanvas(oe,oe),R=B.getContext("2d");R.font=le;var ee=R.measureText(L),te=Math.ceil(ee.actualBoundingBoxRight+ee.actualBoundingBoxLeft),Z=Math.ceil(ee.actualBoundingBoxAscent+ee.actualBoundingBoxDescent),J=2,he=ee.actualBoundingBoxLeft+J,P=ee.actualBoundingBoxAscent+J;te+=J+J,Z+=J+J,B=new OffscreenCanvas(te,Z),R=B.getContext("2d"),R.font=le,R.fillStyle=W,R.fillText(L,he,P);var ie=1/F;return{type:"bitmap",bitmap:B.transferToImageBitmap(),matrix:[ie,0,0,ie,-te*ie/2,-Z*ie/2]}}r.exports=function(){return K().apply(this,arguments)},r.exports.reset=function(){K().reset()},r.exports.create=A,r.exports.shapeFromPath=Y,r.exports.shapeFromText=H})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),R8,!1);const Pit=R8.exports;R8.exports.create;const PG={pro:"Pro",author:"Author",lifetime:"Lifetime"},Oit=()=>{const{userProfile:t,refreshProfile:e}=Pt(),[r]=Dj(),n=r.get("upgraded")==="true",[s,i]=S.useState(n),[o,l]=S.useState(0),c=S.useMemo(()=>{const d=t==null?void 0:t.plan;return d&&PG[d]?PG[d]:"Premium"},[t==null?void 0:t.plan]);S.useEffect(()=>{if(!n||!s)return;if(o>=10){i(!1);return}const d=setTimeout(async()=>{await(e==null?void 0:e()),l(h=>h+1)},1500);return()=>clearTimeout(d)},[n,s,o,e]),S.useEffect(()=>{s||Pit({particleCount:100,spread:70,origin:{y:.6}})},[s]),S.useEffect(()=>{n&&(t!=null&&t.plan)&&t.plan!=="pro"&&i(!1)},[t==null?void 0:t.plan,n]);const u=a.jsx(ea,{title:"Subscription Confirmed | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/subscription/success",noIndex:!0});return s?a.jsxs("div",{className:"min-h-screen bg-background",children:[u,a.jsx(Os,{}),a.jsx("section",{className:"relative pt-32 pb-20",children:a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(Et,{className:"h-10 w-10 text-primary animate-spin"})}),a.jsx("h1",{className:"text-3xl font-bold text-foreground mb-4",children:"Finalizing your upgrade..."}),a.jsx("p",{className:"text-muted-foreground",children:"Just a moment while we activate your new plan."})]})})}),a.jsx(bi,{})]}):a.jsxs("div",{className:"min-h-screen bg-background",children:[u,a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-20",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(pl,{className:"h-10 w-10 text-primary"})}),a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-4",children:["Welcome to ",a.jsx("span",{className:"text-primary",children:c}),"!"]}),a.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your subscription is now active. You have full access to all premium features."}),a.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 mb-8",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[a.jsx(jo,{className:"h-5 w-5 text-primary"}),a.jsx("span",{className:"font-semibold",children:"Your Student Points have been credited"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Check your dashboard to see your updated balance."})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ve,{asChild:!0,size:"lg",className:"rounded-full",children:a.jsx(mt,{to:"/dashboard",children:"Go to Dashboard"})}),a.jsx(ve,{asChild:!0,variant:"outline",size:"lg",className:"rounded-full",children:a.jsx(mt,{to:"/summary",children:"Create Your First Summary"})})]})]})})]}),a.jsx(bi,{})]})},Iit=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Checkout Cancelled | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/subscription/cancel",noIndex:!0}),a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-20",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-muted/50 via-transparent to-transparent"}),a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[a.jsx("div",{className:"w-20 h-20 bg-muted rounded-full flex items-center justify-center mx-auto mb-6",children:a.jsx(Cxe,{className:"h-10 w-10 text-muted-foreground"})}),a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-4",children:"Checkout Cancelled"}),a.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"No worries! Your checkout was cancelled and you haven't been charged."}),a.jsx("div",{className:"bg-card border border-border rounded-2xl p-6 mb-8",children:a.jsx("p",{className:"text-muted-foreground",children:"If you have any questions or need help choosing the right plan, feel free to reach out to our support team."})}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ve,{asChild:!0,size:"lg",className:"rounded-full",children:a.jsxs(mt,{to:"/pricing",children:[a.jsx(_xe,{className:"mr-2 h-4 w-4"}),"Back to Pricing"]})}),a.jsx(ve,{asChild:!0,variant:"outline",size:"lg",className:"rounded-full",children:a.jsx(mt,{to:"/dashboard",children:"Go to Dashboard"})})]})]})})]}),a.jsx(bi,{})]}),Rit=[{icon:Ir,title:"Thesis Builder",description:"Generate structured thesis sections with AI assistance. Create introduction, theory, methodology, and conclusion chapters with proper academic citations.",highlights:["Auto-generate chapter structures","Proper citation formatting (APA, Harvard, etc.)","Word count tracking & deadlines","Export to Word/PDF"],color:"bg-blue-500/10 text-blue-500 dark:bg-blue-500/20"},{icon:IE,title:"Methodology Builder",description:"Design your research methodology with AI-powered suggestions. Get guidance on research design, data collection, and analysis methods.",highlights:["Research design templates","Method justification assistance","Sample size recommendations","Validity & reliability checks"],color:"bg-purple-500/10 text-purple-500 dark:bg-purple-500/20"},{icon:xi,title:"Theory Builder",description:"Build your theoretical framework systematically. Extract and organize key concepts from your literature sources.",highlights:["Concept extraction from PDFs","Framework visualization","Literature synthesis","Gap analysis"],color:"bg-emerald-500/10 text-emerald-500 dark:bg-emerald-500/20"},{icon:Kxe,title:"Qualitative Analysis",description:"Powerful tools for qualitative research. Code interviews, build codebooks, and analyze themes across your data.",highlights:["Interview transcription","Codebook management","Theme extraction","Cross-case analysis"],color:"bg-orange-500/10 text-orange-500 dark:bg-orange-500/20"}],Mit=[{step:"01",icon:Qh,title:"Upload Your Documents",description:"Simply drag and drop your PDFs. We support academic papers, textbooks, and research documents up to 100MB."},{step:"02",icon:jo,title:"AI Analysis",description:"Our AI analyzes your documents, extracting key information, citations, and relevant content for your research."},{step:"03",icon:fo,title:"Export & Integrate",description:"Download your summaries, citations, and generated content in various formats ready for your thesis."}],Dit={"@context":"https://schema.org","@type":"WebPage",name:"How It Works - AI Thesis Writing Assistant",description:"Learn how Academly helps you structure academic papers with AI assistance. Upload PDFs, organize sources, and create properly cited drafts.",url:"https://academly.ai/how-it-works"},Lit=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"How It Works - AI Thesis Writing Assistant | Academly",description:"Upload academic PDFs, let AI help you identify key information with page numbers, structure theory and methodology sections with proper citations. Simple 3-step workflow.",canonical:"https://academly.ai/how-it-works",jsonLd:Dit}),a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-32 overflow-visible",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-primary/3 to-transparent pointer-events-none"}),a.jsx("div",{className:"absolute -bottom-32 left-0 right-0 h-64 bg-gradient-to-b from-primary/3 to-transparent pointer-events-none"}),a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl pointer-events-none"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl pointer-events-none"}),a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:["Your Complete",a.jsx("span",{className:"text-primary",children:" Research Toolkit"})]}),a.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"From literature review to final thesis, Academly provides all the tools you need to succeed in academic research."})]})})]}),a.jsx("section",{className:"py-20",children:a.jsxs(Wr,{children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Powerful Features"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Everything you need to write better academic papers, faster."})]}),a.jsx("div",{className:"grid md:grid-cols-2 gap-8",children:Rit.map((t,e)=>{const r=t.icon;return a.jsxs(Jo.div,{className:"group relative overflow-hidden rounded-3xl border border-border bg-card p-8 transition-all duration-300 hover:shadow-2xl hover:border-primary/50 hover:-translate-y-1",initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5,delay:e*.1},children:[a.jsx("div",{className:"absolute left-1/2 top-0 -z-10 h-1/2 w-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/10 blur-3xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),a.jsx("div",{className:`w-16 h-16 rounded-2xl ${t.color} flex items-center justify-center mb-6`,children:a.jsx(r,{className:"w-8 h-8"})}),a.jsx("h3",{className:"text-2xl font-bold text-foreground mb-3",children:t.title}),a.jsx("p",{className:"text-muted-foreground mb-6",children:t.description}),a.jsx("ul",{className:"space-y-3",children:t.highlights.map((n,s)=>a.jsxs("li",{className:"flex items-center gap-3",children:[a.jsx(pl,{className:"w-5 h-5 text-primary flex-shrink-0"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:n})]},s))})]},e)})})]})}),a.jsx("section",{className:"py-20 bg-muted/30",children:a.jsxs(Wr,{children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Simple 3-Step Workflow"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Get started in minutes. No complex setup required."})]}),a.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:Mit.map((t,e)=>{const r=t.icon;return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:a.jsx(r,{className:"w-10 h-10 text-primary"})}),a.jsx("span",{className:"absolute -top-2 -right-2 w-8 h-8 rounded-full bg-primary text-primary-foreground text-sm font-bold flex items-center justify-center",children:t.step})]}),a.jsx("h3",{className:"text-xl font-bold text-foreground mb-3",children:t.title}),a.jsx("p",{className:"text-muted-foreground",children:t.description})]},e)})})]})}),a.jsx("section",{className:"py-20",children:a.jsx(Wr,{children:a.jsxs("div",{className:"relative rounded-3xl bg-gradient-to-br from-primary to-primary/80 p-12 md:p-16 text-center overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzLTItMi00LTJsLTIgMnYyaDJ2Mmw0LTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),a.jsxs("div",{className:"relative",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-primary-foreground mb-4",children:"Ready to Transform Your Research?"}),a.jsx("p",{className:"text-xl text-primary-foreground/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of students and researchers who are writing better papers with Academly."}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.jsx(ve,{asChild:!0,size:"lg",className:"rounded-full h-14 px-8 text-base font-semibold bg-white text-primary hover:bg-white/90",children:a.jsx(mt,{to:"/login",children:"Get Started Free"})}),a.jsx(ve,{asChild:!0,size:"lg",variant:"outline",className:"rounded-full h-14 px-8 text-base font-semibold border-white/30 text-white hover:bg-white/10",children:a.jsx(mt,{to:"/pricing",children:"View Pricing"})})]})]})]})})}),a.jsx(bi,{})]});var cue="Toggle",M8=S.forwardRef((t,e)=>{const{pressed:r,defaultPressed:n,onPressedChange:s,...i}=t,[o,l]=Ps({prop:r,onChange:s,defaultProp:n??!1,caller:cue});return a.jsx(et.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:e,onClick:ze(t.onClick,()=>{t.disabled||l(!o)})})});M8.displayName=cue;var uue=M8,Ef="ToggleGroup",[due,byt]=Ln(Ef,[m0]),hue=m0(),D8=me.forwardRef((t,e)=>{const{type:r,...n}=t;if(r==="single"){const s=n;return a.jsx(Fit,{...s,ref:e})}if(r==="multiple"){const s=n;return a.jsx($it,{...s,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${Ef}\``)});D8.displayName=Ef;var[fue,pue]=due(Ef),Fit=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ps({prop:r,defaultProp:n??"",onChange:s,caller:Ef});return a.jsx(fue,{scope:t.__scopeToggleGroup,type:"single",value:me.useMemo(()=>o?[o]:[],[o]),onItemActivate:l,onItemDeactivate:me.useCallback(()=>l(""),[l]),children:a.jsx(mue,{...i,ref:e})})}),$it=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ps({prop:r,defaultProp:n??[],onChange:s,caller:Ef}),c=me.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=me.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(fue,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:a.jsx(mue,{...i,ref:e})})});D8.displayName=Ef;var[Bit,Uit]=due(Ef),mue=me.forwardRef((t,e)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:l=!0,...c}=t,u=hue(r),d=lg(o),h={role:"group",dir:d,...c};return a.jsx(Bit,{scope:r,rovingFocus:s,disabled:n,children:s?a.jsx(d6,{asChild:!0,...u,orientation:i,dir:d,loop:l,children:a.jsx(et.div,{...h,ref:e})}):a.jsx(et.div,{...h,ref:e})})}),ek="ToggleGroupItem",gue=me.forwardRef((t,e)=>{const r=pue(ek,t.__scopeToggleGroup),n=Uit(ek,t.__scopeToggleGroup),s=hue(t.__scopeToggleGroup),i=r.value.includes(t.value),o=n.disabled||t.disabled,l={...t,pressed:i,disabled:o},c=me.useRef(null);return n.rovingFocus?a.jsx(h6,{asChild:!0,...s,focusable:!o,active:i,ref:c,children:a.jsx(OG,{...l,ref:e})}):a.jsx(OG,{...l,ref:e})});gue.displayName=ek;var OG=me.forwardRef((t,e)=>{const{__scopeToggleGroup:r,value:n,...s}=t,i=pue(ek,r),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},l=i.type==="single"?o:void 0;return a.jsx(M8,{...l,...s,ref:e,onPressedChange:c=>{c?i.onItemActivate(n):i.onItemDeactivate(n)}})}),yue=D8,vue=gue;const xue=id("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),zit=S.forwardRef(({className:t,variant:e,size:r,...n},s)=>a.jsx(uue,{ref:s,className:Oe(xue({variant:e,size:r,className:t})),...n}));zit.displayName=uue.displayName;const bue=S.createContext({size:"default",variant:"default"}),R0=S.forwardRef(({className:t,variant:e,size:r,children:n,...s},i)=>a.jsx(yue,{ref:i,className:Oe("flex items-center justify-center gap-1",t),...s,children:a.jsx(bue.Provider,{value:{variant:e,size:r},children:n})}));R0.displayName=yue.displayName;const hl=S.forwardRef(({className:t,children:e,variant:r,size:n,...s},i)=>{const o=S.useContext(bue);return a.jsx(vue,{ref:i,className:Oe(xue({variant:o.variant||r,size:o.size||n}),t),...s,children:e})});hl.displayName=vue.displayName;const Hit="https://nqibmbtqcjucktqcreob.supabase.co",Wit="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg";function Vit(){const{toast:t}=vn(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState([]),[h,f]=S.useState(null),[p,g]=S.useState(!1),m=b=>{navigator.clipboard.writeText(b).then(()=>{t({title:"Copied!",description:"Copied to clipboard."})})},v=async()=>{if(n.trim()){c(!0),g(!1),f(null);try{const b=await fetch(`${Hit}/functions/v1/demo-topic-ideas`,{method:"POST",headers:{"Content-Type":"application/json",apikey:Wit},body:JSON.stringify({topic:n,context:i,language:e})});if(b.status===429){g(!0),d([]);return}const w=await b.json();if(!b.ok||w.error)throw new Error(w.error||"Request failed");const j=(w.suggestions||[]).map((N,C)=>{var k;return{id:((k=crypto.randomUUID)==null?void 0:k.call(crypto))||String(C),title:N.title,research_questions:N.research_questions??N.researchQuestions??[],method:N.method,relevance:N.relevance,sources:Array.isArray(N.sources)?N.sources:[]}});d(j)}catch(b){console.error(b),t({title:"Error",description:"Generation failed. Please try again.",variant:"destructive"})}finally{c(!1)}}},y=b=>{f(b),setTimeout(()=>{var w;(w=document.getElementById("selected-topic"))==null||w.scrollIntoView({behavior:"smooth",block:"start"})},50)},x=b=>{var j;let w=`${b.title}

Research Questions:
${b.research_questions.map((N,C)=>`${C+1}. ${N}`).join(`
`)}

Method:
${b.method}

Relevance:
${b.relevance}`;return(j=b.sources)!=null&&j.length&&(w+=`

Initial Sources:
${b.sources.map((N,C)=>`${C+1}. ${N.title}${N.doi?` (DOI: ${N.doi})`:""}${N.isbn?` (ISBN: ${N.isbn})`:""}`).join(`
`)}`),w};return a.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Free Demo"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Find Your Perfect Research Topic"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["Try our Topic Ideas generator — no account needed.",a.jsx("br",{}),"3 free generations per day."]})]})]}),a.jsxs("main",{className:"flex-1 w-full",children:[a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(hf,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Generate Topic Suggestions"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter your basic idea and receive structured suggestions"})]})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-5",children:[a.jsxs("div",{className:"space-y-2 lg:col-span-7",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Working Title / Topic Idea"}),a.jsx(Be,{placeholder:"e.g., AI in Education",value:n,onChange:b=>s(b.target.value),className:"h-12 rounded-xl text-base"})]}),a.jsxs("div",{className:"space-y-2 lg:col-span-3",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(R0,{type:"single",value:e,onValueChange:b=>b&&r(b),className:"justify-start h-12",children:[a.jsx(hl,{value:"DE",className:"h-10 px-5",children:"DE"}),a.jsx(hl,{value:"EN",className:"h-10 px-5",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Description / Context (optional)"}),a.jsx(Wt,{placeholder:"Describe program, scope, methodology, context...",value:i,onChange:b=>o(b.target.value),rows:4,className:"rounded-xl text-base resize-none"})]}),a.jsx(ve,{onClick:v,disabled:!n.trim()||l,className:"w-full rounded-full h-12 text-base font-semibold",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Suggestions"})]})]})})}),p&&a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-amber-500/30 bg-amber-50/50 dark:bg-amber-950/20 p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(s0,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"}),a.jsx("h3",{className:"text-lg font-bold text-amber-900 dark:text-amber-200",children:"Daily limit reached"})]}),a.jsx("p",{className:"text-sm text-amber-900/80 dark:text-amber-200/80 mb-6 leading-relaxed",children:"You've used your 3 free demo generations today. Come back tomorrow — or sign up free for unlimited access."}),a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(mt,{to:"/login",children:["Get started free ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})})}),u.length>0&&!p&&a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-muted-foreground mb-3",children:"Generated for you"}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:"Topic Suggestions"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(b=>a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6 hover:border-primary/30 transition-colors flex flex-col",children:[a.jsx("h3",{className:"text-xl font-bold text-foreground mb-5",children:b.title}),a.jsxs("div",{className:"space-y-4 flex-1",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Research Questions"}),a.jsx("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:b.research_questions.map((w,j)=>a.jsxs("li",{className:"flex gap-2",children:[a.jsx("span",{className:"text-primary mt-0.5",children:"•"}),a.jsx("span",{children:w})]},j))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Method"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:b.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Relevance"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:b.relevance})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-primary mb-2",children:"Initial Sources"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:b.sources.map((w,j)=>a.jsx("span",{className:"inline-flex items-center rounded-full bg-muted px-3 py-1.5 text-xs text-muted-foreground",children:w.title},j))})]})]}),a.jsxs("div",{className:"flex gap-3 pt-5 mt-5 border-t border-border",children:[a.jsxs(ve,{size:"sm",onClick:()=>y(b),className:"flex-1 rounded-full h-10",children:["Select ",a.jsx(uc,{className:"h-4 w-4 ml-1"})]}),a.jsx(ve,{size:"sm",variant:"outline",onClick:()=>m(x(b)),className:"rounded-full h-10 w-10 p-0",children:a.jsx(yn,{className:"h-4 w-4"})})]})]},b.id))})]})}),h&&a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsx("div",{id:"selected-topic",className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:a.jsxs("div",{className:"p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(xi,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Your Topic Structure"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Based on your selected topic idea"})]})]}),a.jsxs("div",{className:"bg-muted/30 p-6 md:p-8 rounded-2xl space-y-6 text-foreground",children:[a.jsx("h3",{className:"text-2xl font-bold",children:h.title}),h.research_questions.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Research Questions"}),a.jsx("ul",{className:"space-y-2",children:h.research_questions.map((b,w)=>a.jsxs("li",{className:"flex gap-2 text-sm",children:[a.jsx("span",{className:"text-primary mt-0.5",children:"•"}),a.jsx("span",{className:"leading-relaxed",children:b})]},w))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Method"}),a.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:h.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Relevance"}),a.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:h.relevance})]}),h.sources.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold text-primary mb-3",children:"Sources"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:h.sources.map((b,w)=>a.jsx("span",{className:"inline-flex items-center rounded-full bg-background border border-border px-3 py-1.5 text-xs text-foreground",children:b.title},w))})]})]}),a.jsx("div",{className:"rounded-2xl border border-primary/20 bg-primary/5 p-6 mt-6",children:a.jsxs("p",{className:"text-sm text-foreground leading-relaxed",children:[a.jsx("span",{className:"font-semibold",children:"Want to continue with this topic?"}),a.jsx("br",{}),"Sign up free to generate a full outline, theory chapter, and methodology."]})}),a.jsxs("div",{className:"flex flex-wrap gap-3 mt-6",children:[a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(mt,{to:"/login",children:["Continue in Academly"," ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})}),a.jsxs(ve,{variant:"outline",onClick:()=>m(x(h)),className:"rounded-full h-12 px-6",children:[a.jsx(yn,{className:"h-4 w-4 mr-2"}),"Copy"]})]})]})})})})]}),a.jsx(bi,{})]})}const qit="https://nqibmbtqcjucktqcreob.supabase.co",IG="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5xaWJtYnRxY2p1Y2t0cWNyZW9iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ1NTk5MTAsImV4cCI6MjA3MDEzNTkxMH0.UnFk-GqYCZtlkXNlxyHUTaFAnS6Q4hIgDgWKANrxEHg";function Git(){var M,z,I,q;const{toast:t}=vn(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState(null),[h,f]=S.useState(!1),[p,g]=S.useState(!1),[m,v]=S.useState(""),[y,x]=S.useState([]),[b,w]=S.useState(1),j=A=>{navigator.clipboard.writeText(A).then(()=>{t({title:"Copied!",description:"Copied to clipboard."})})},N=async A=>fetch(`${qit}/functions/v1/demo-keywords`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${IG}`,apikey:IG},body:JSON.stringify(A)}),C=async A=>{if(A.trim()){g(!0);try{const U=await N({action:"search_literature",keywords:A,language:e});if(U.status===429){f(!0);return}const K=await U.json();if(!U.ok||K.error)throw new Error(K.error||"Search failed");x(K.results||[]),w(1)}catch(U){console.error(U),t({title:"Error",description:"Literature search failed.",variant:"destructive"})}finally{g(!1)}}},k=async()=>{var A,U;if(n.trim()){c(!0),f(!1),x([]);try{const K=await N({action:"keywords",title:n,research_questions:i.split(`
`).map($=>$.trim()).filter($=>$),language:e});if(K.status===429){f(!0),d(null);return}const G=await K.json();if(!K.ok||G.error)throw new Error(G.error||"Request failed");const Y=G.keywords||G;d(Y);const H=((U=(A=Y==null?void 0:Y.keyword_combinations)==null?void 0:A[0])==null?void 0:U.combination)||n;v(H),await C(H)}catch(K){console.error(K),t({title:"Error",description:"Generation failed. Please try again.",variant:"destructive"})}finally{c(!1)}}},E=()=>{var U,K,G,Y;if(!u)return;const A=[];(U=u.keyword_combinations)!=null&&U.length&&(A.push("Search Combinations:"),u.keyword_combinations.forEach(H=>A.push(`- ${H.combination} — ${H.purpose}`))),(K=u.known_authors)!=null&&K.length&&(A.push(`
Known Authors:`),u.known_authors.forEach(H=>A.push(`- ${H.name} (${H.relevance})`))),(G=u.known_works)!=null&&G.length&&(A.push(`
Known Works:`),u.known_works.forEach(H=>A.push(`- ${H.title} — ${H.author} (${H.year}): ${H.relevance}`))),(Y=u.database_suggestions)!=null&&Y.length&&(A.push(`
Recommended Databases:`),A.push(u.database_suggestions.join(", "))),u.search_tips&&(A.push(`
Search Tips:`),A.push(u.search_tips)),j(A.join(`
`))};return a.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Free Demo"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Find the Right Literature Keywords"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["Generate search terms for your thesis — no account needed.",a.jsx("br",{}),"3 free generations per day."]})]})]}),a.jsxs("main",{className:"flex-1 w-full",children:[a.jsx("section",{className:"py-12",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-6",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary",children:a.jsx(al,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Find Literature Keywords"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Generate search terms and find relevant literature for your topic"})]})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-5",children:[a.jsxs("div",{className:"space-y-2 lg:col-span-7",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Be,{placeholder:"e.g., AI in Education",value:n,onChange:A=>s(A.target.value),className:"h-12 rounded-xl text-base"})]}),a.jsxs("div",{className:"space-y-2 lg:col-span-3",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(R0,{type:"single",value:e,onValueChange:A=>A&&r(A),className:"justify-start h-12",children:[a.jsx(hl,{value:"DE",className:"h-10 px-5",children:"DE"}),a.jsx(hl,{value:"EN",className:"h-10 px-5",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Wt,{placeholder:"One question per line...",value:i,onChange:A=>o(A.target.value),rows:3,className:"rounded-xl text-base resize-none"})]}),a.jsx(ve,{onClick:k,disabled:!n.trim()||l||p,className:"w-full rounded-full h-12 text-base font-semibold",children:l||p?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating & Searching..."]}):"Generate Keywords"})]})]})})}),h&&a.jsx("section",{className:"py-12",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-amber-500/30 bg-amber-50/50 dark:bg-amber-950/20 p-8 md:p-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(s0,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"}),a.jsx("h3",{className:"text-lg font-bold text-amber-900 dark:text-amber-200",children:"Daily limit reached"})]}),a.jsx("p",{className:"text-sm text-amber-900/80 dark:text-amber-200/80 mb-6 leading-relaxed",children:"You've used your 3 free demo generations today. Come back tomorrow — or sign up free for unlimited access."}),a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(mt,{to:"/login",children:["Get started free ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})})}),u&&!h&&a.jsx("section",{className:"py-12",children:a.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-8 flex-wrap gap-4",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground",children:"Keywords & Search Terms"}),a.jsxs(ve,{variant:"outline",onClick:E,className:"rounded-full",children:[a.jsx(yn,{className:"h-4 w-4 mr-2"}),"Copy All"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(hf,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Search Combinations"})]}),a.jsx("ul",{className:"space-y-2",children:(M=u.keyword_combinations)==null?void 0:M.map((A,U)=>a.jsxs("li",{onClick:()=>j(A.combination),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("code",{className:"font-mono text-sm text-foreground block",children:A.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:A.purpose})]},U))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Ij,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Known Authors"})]}),a.jsx("ul",{className:"space-y-2",children:(z=u.known_authors)==null?void 0:z.map((A,U)=>a.jsxs("li",{onClick:()=>j(A.name),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("p",{className:"font-medium text-sm text-foreground",children:A.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:A.relevance})]},U))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(xi,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Known Works"})]}),a.jsx("ul",{className:"space-y-2",children:(I=u.known_works)==null?void 0:I.map((A,U)=>a.jsxs("li",{onClick:()=>j(A.title),className:"cursor-pointer bg-muted/50 hover:bg-muted rounded-md p-2 transition-colors",children:[a.jsx("p",{className:"font-medium text-sm text-foreground",children:A.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.author," (",A.year,")"]}),a.jsx("p",{className:"text-xs italic text-muted-foreground mt-0.5",children:A.relevance})]},U))})]}),a.jsxs("div",{className:"rounded-2xl border border-border bg-card shadow-sm p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(al,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Recommended Databases"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:(q=u.database_suggestions)==null?void 0:q.map((A,U)=>a.jsx(gt,{variant:"secondary",children:A},U))}),u.search_tips&&a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed",children:u.search_tips})]})]}),a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-6 md:p-8 mt-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(xi,{className:"h-5 w-5 text-primary"}),a.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Literature Search"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-6",children:[a.jsx(Be,{value:m,onChange:A=>v(A.target.value),placeholder:"Search query...",className:"h-12 rounded-xl text-base flex-1"}),a.jsx(ve,{onClick:()=>C(m),disabled:!m.trim()||p,className:"rounded-full h-12 px-6",children:p?a.jsx(Et,{className:"h-4 w-4 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(al,{className:"h-4 w-4 mr-2"})," Search"]})})]}),y.length>0?a.jsx("ul",{className:"space-y-3",children:y.slice((b-1)*10,b*10).map((A,U)=>a.jsxs("li",{className:"rounded-xl border border-border bg-muted/30 p-4",children:[a.jsx("p",{className:"font-medium text-foreground",children:A.title||"Untitled"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Array.isArray(A.authors)?A.authors.join(", "):A.authors,A.year?` (${A.year})`:"",A.journal?` — ${A.journal}`:""]}),A.abstract&&a.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-3",children:A.abstract}),(A.url||A.doi)&&a.jsx("a",{href:A.url||`https://doi.org/${A.doi}`,target:"_blank",rel:"noreferrer",className:"text-xs text-primary mt-2 inline-block hover:underline",children:"View source →"})]},U))}):!p&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"No results yet."}),y.length>10&&a.jsxs("div",{className:"flex items-center justify-between mt-6",children:[a.jsx(ve,{variant:"outline",size:"sm",disabled:b===1,onClick:()=>w(A=>A-1),children:"Previous"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",b," of"," ",Math.ceil(y.length/10)]}),a.jsx(ve,{variant:"outline",size:"sm",disabled:b*10>=y.length,onClick:()=>w(A=>A+1),children:"Next"})]})]}),a.jsx("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-8 md:p-10 mt-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-2.5 text-primary shrink-0",children:a.jsx(jo,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl font-bold text-foreground mb-2",children:"Want to search real academic papers?"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-5",children:"Sign up free to access our full Literature Search — powered by CrossRef and OpenAlex. Find and cite real papers directly in your thesis."}),a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8",children:a.jsxs(mt,{to:"/login",children:["Get started free ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})]})})]})})]}),a.jsx(bi,{})]})}const Kit=[{name:"Dom",role:"Founder",description:"Cloud technologist with a strong focus on privacy-first infrastructure. Passionate about AI applications in academic work. Bachelor of Science."},{name:"Rebecca",role:"Marketing & IT Security",description:"IT security specialist and penetration tester with a background in secure systems and communication. Bachelor of Science."},{name:"Nicole",role:"Platform Design & IT Security",description:"IT security specialist focused on platform architecture and usability. Bachelor of Science, Master of Science."}],Yit=[{icon:FF,title:"GDPR Compliant",description:"Fully compliant with European data protection regulations."},{icon:LJ,title:"Security-First",description:"Built by IT security specialists with penetration testing expertise."},{icon:Mxe,title:"No Training on User Documents",description:"Your academic work stays yours. We never train AI models on your data."}];function Xit(){return a.jsxs(a.Fragment,{children:[a.jsx(ea,{title:"Meet the Team - Academly | Security & AI Experts",description:"Built by professionals with a background in technology, IT security, and academic research. Meet the team behind Academly.",canonical:"https://academly.ai/team"}),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Os,{}),a.jsxs("div",{className:"relative pt-32 pb-16",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{children:a.jsx("div",{className:"relative",children:a.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[a.jsxs("h1",{className:"text-4xl font-bold tracking-tight text-foreground sm:text-5xl md:text-6xl",children:["The team behind"," ",a.jsx("span",{className:"text-primary",children:"Academly"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-muted-foreground",children:"Built by professionals with a background in technology, security, and academic research."})]})})})]}),a.jsx("section",{className:"pb-16",children:a.jsx(Wr,{children:a.jsx("div",{className:"mx-auto max-w-3xl space-y-6",children:Kit.map((t,e)=>a.jsxs("div",{className:"group flex items-start gap-6 rounded-3xl border border-border bg-card p-6 sm:p-8 shadow-lg shadow-primary/5 transition-all duration-300 hover:shadow-xl hover:shadow-primary/10 animate-fade-in",style:{animationDelay:`${e*100}ms`},children:[a.jsx("div",{className:"flex h-20 w-20 sm:h-24 sm:w-24 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-primary/20 to-primary/5 ring-2 ring-primary/10 group-hover:ring-primary/20 transition-all duration-300 overflow-hidden",children:a.jsx("span",{className:"text-2xl sm:text-3xl font-bold text-primary",children:t.name.slice(0,2).toUpperCase()})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl sm:text-2xl font-semibold text-foreground group-hover:text-primary transition-colors",children:t.name}),a.jsx("p",{className:"text-sm font-medium text-primary mt-1",children:t.role}),a.jsx("p",{className:"mt-3 text-muted-foreground leading-relaxed",children:t.description})]})]},t.name))})})}),a.jsxs("section",{className:"relative py-20",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 h-max w-full m-auto grid grid-cols-2 -space-x-52 opacity-20 dark:opacity-10",children:[a.jsx("div",{className:"blur-[106px] h-40 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-24 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{children:a.jsxs("div",{className:"relative",children:[a.jsx("h2",{className:"text-center text-2xl sm:text-3xl font-bold text-foreground mb-12",children:"Your data is safe with us"}),a.jsx("div",{className:"grid gap-8 sm:grid-cols-3",children:Yit.map((t,e)=>a.jsxs("div",{className:"text-center group animate-fade-in",style:{animationDelay:`${e*100}ms`},children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 shadow-lg shadow-primary/10 group-hover:shadow-xl group-hover:shadow-primary/20 transition-all duration-300",children:a.jsx(t.icon,{className:"h-8 w-8 text-primary"})}),a.jsx("h3",{className:"font-semibold text-foreground text-lg",children:t.title}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:t.description})]},t.title))})]})})]}),a.jsx(bi,{})]})]})}var D2="Checkbox",[Qit,wyt]=Ln(D2),[Zit,L8]=Qit(D2);function Jit(t){const{__scopeCheckbox:e,checked:r,children:n,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=t,[f,p]=Ps({prop:r,defaultProp:s??!1,onChange:c,caller:D2}),[g,m]=S.useState(null),[v,y]=S.useState(null),x=S.useRef(!1),b=g?!!o||!!g.closest("form"):!0,w={checked:f,disabled:i,setChecked:p,control:g,setControl:m,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:x,required:u,defaultChecked:Gh(s)?!1:s,isFormControl:b,bubbleInput:v,setBubbleInput:y};return a.jsx(Zit,{scope:e,...w,children:eat(h)?h(w):n})}var wue="CheckboxTrigger",_ue=S.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...n},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:g}=L8(wue,t),m=jt(s,d),v=S.useRef(c);return S.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const x=()=>h(v.current);return y.addEventListener("reset",x),()=>y.removeEventListener("reset",x)}},[i,h]),a.jsx(et.button,{type:"button",role:"checkbox","aria-checked":Gh(c)?"mixed":c,"aria-required":u,"data-state":Eue(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:m,onKeyDown:ze(e,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:ze(r,y=>{h(x=>Gh(x)?!0:!x),g&&p&&(f.current=y.isPropagationStopped(),f.current||y.stopPropagation())})})});_ue.displayName=wue;var F8=S.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...h}=t;return a.jsx(Jit,{__scopeCheckbox:r,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(_ue,{...h,ref:e,__scopeCheckbox:r}),f&&a.jsx(Aue,{__scopeCheckbox:r})]})})});F8.displayName=D2;var jue="CheckboxIndicator",Sue=S.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,i=L8(jue,r);return a.jsx(Xn,{present:n||Gh(i.checked)||i.checked===!0,children:a.jsx(et.span,{"data-state":Eue(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});Sue.displayName=jue;var Nue="CheckboxBubbleInput",Aue=S.forwardRef(({__scopeCheckbox:t,...e},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:f,setBubbleInput:p}=L8(Nue,t),g=jt(r,p),m=O8(i),v=qF(n);S.useEffect(()=>{const x=f;if(!x)return;const b=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(b,"checked").set,N=!s.current;if(m!==i&&j){const C=new Event("click",{bubbles:N});x.indeterminate=Gh(i),j.call(x,Gh(i)?!1:i),x.dispatchEvent(C)}},[f,m,i,s]);const y=S.useRef(Gh(i)?!1:i);return a.jsx(et.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:u,value:d,form:h,...e,tabIndex:-1,ref:g,style:{...e.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Aue.displayName=Nue;function eat(t){return typeof t=="function"}function Gh(t){return t==="indeterminate"}function Eue(t){return Gh(t)?"indeterminate":t?"checked":"unchecked"}const go=S.forwardRef(({className:t,...e},r)=>a.jsx(F8,{ref:r,className:Oe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(Sue,{className:Oe("flex items-center justify-center text-current"),children:a.jsx(Gs,{className:"h-4 w-4"})})}));go.displayName=F8.displayName;function Cue({id:t,checked:e,onCheckedChange:r,required:n=!1,className:s,children:i}){return a.jsxs("div",{className:Oe("flex items-start gap-3",s),children:[a.jsx(go,{id:t,checked:e,onCheckedChange:o=>r(o===!0),required:n,className:"mt-0.5 flex-shrink-0"}),a.jsx("label",{htmlFor:t,className:"text-sm text-muted-foreground leading-relaxed cursor-pointer select-none",children:i})]})}var tat=Object.defineProperty,kue=t=>{throw TypeError(t)},rat=(t,e,r)=>e in t?tat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xd=(t,e,r)=>rat(t,typeof e!="symbol"?e+"":e,r),nat=(t,e,r)=>e.has(t)||kue("Cannot "+r),RG=(t,e,r)=>(nat(t,e,"read from private field"),e.get(t)),sat=(t,e,r)=>e.has(t)?kue("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);function iat(t){return t==null?[]:Array.isArray(t)?t:[t]}var MG=t=>(t==null?void 0:t.constructor.name)==="Array",aat=(t,e)=>{if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!$8(t[r],e[r]))return!1;return!0},$8=(t,e)=>{if(Object.is(t,e))return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(typeof(t==null?void 0:t.isEqual)=="function"&&typeof(e==null?void 0:e.isEqual)=="function")return t.isEqual(e);if(typeof t=="function"&&typeof e=="function")return t.toString()===e.toString();if(MG(t)&&MG(e))return aat(Array.from(t),Array.from(e));if(typeof t!="object"||typeof e!="object")return!1;const r=Object.keys(e??Object.create(null)),n=r.length;for(let s=0;s<n;s++)if(!Reflect.has(t,r[s]))return!1;for(let s=0;s<n;s++){const i=r[s];if(!$8(t[i],e[i]))return!1}return!0},oat=t=>t!=null&&typeof t=="object",CA=t=>typeof t=="string",dp=t=>typeof t=="function",Tue=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),lat=t=>Object.prototype.toString.call(t),Pue=Function.prototype.toString,cat=Pue.call(Object),uat=t=>{if(!oat(t)||lat(t)!="[object Object]"||fat(t))return!1;const e=Object.getPrototypeOf(t);if(e===null)return!0;const r=Tue(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Pue.call(r)==cat},dat=t=>typeof t=="object"&&t!==null&&"$$typeof"in t&&"props"in t,hat=t=>typeof t=="object"&&t!==null&&"__v_isVNode"in t,fat=t=>dat(t)||hat(t),pat=t=>t(),mat=(...t)=>(...e)=>{t.forEach(function(r){r==null||r(...e)})};function Oue(t,e,...r){var s;if(t in e){const i=e[t];return dp(i)?i(...r):i}const n=new Error(`No matching key: ${JSON.stringify(t)} in ${JSON.stringify(Object.keys(e))}`);throw(s=Error.captureStackTrace)==null||s.call(Error,n,Oue),n}var{floor:_yt,abs:jyt,round:Syt,min:gat,max:yat,pow:Nyt,sign:Ayt}=Math,vat=t=>Number.isNaN(t),xat=t=>vat(t)?0:t,bat=(t,e,r)=>gat(yat(xat(t),e),r);function Iue(t){if(!uat(t)||t===void 0)return t;const e=Reflect.ownKeys(t).filter(n=>typeof n=="string"),r={};for(const n of e){const s=t[n];s!==void 0&&(r[n]=Iue(s))}return r}var DN=()=>performance.now(),kA,Rue=class{constructor(t){this.onTick=t,xd(this,"frameId",null),xd(this,"pausedAtMs",null),xd(this,"context"),xd(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),xd(this,"setStartMs",e=>{this.context.startMs=e}),xd(this,"start",()=>{if(this.frameId!==null)return;const e=DN();this.pausedAtMs!==null?(this.context.startMs+=e-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=e,this.frameId=requestAnimationFrame(RG(this,kA))}),xd(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=DN())}),xd(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),sat(this,kA,e=>{if(this.context.now=e,this.context.deltaMs=e-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(RG(this,kA))}),this.context={now:0,startMs:DN(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:DN()-this.context.startMs}};kA=new WeakMap;function wat(t,e){const r=new Rue(({now:n,deltaMs:s})=>{if(s>=e){const i=e>0?n-s%e:n;r.setStartMs(i),t({startMs:i,deltaMs:s})}});return r.start(),()=>r.stop()}function _at(t,e){const r=new Rue(({deltaMs:n})=>{if(n>=e)return t(),!1});return r.start(),()=>r.stop()}function DG(...t){const e=t.length===1?t[0]:t[1],r=t.length===2?t[0]:!0}function jat(t,e){if(t==null)throw new Error(e())}var Mue=t=>typeof t=="object"&&t!==null,Sat=9,Nat=t=>Mue(t)&&t.nodeType===Sat,Aat=t=>Mue(t)&&t===t.window;function Eat(t){if(!t)return!1;const e=t.getRootNode();return Due(e)===t}function Cat(t){return Nat(t)?t:Aat(t)?t.document:(t==null?void 0:t.ownerDocument)??document}function Due(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const r=e.shadowRoot.activeElement;if(!r||r===e)break;e=r}return e}var kat=(...t)=>t.map(e=>{var r;return(r=e==null?void 0:e.trim)==null?void 0:r.call(e)}).filter(Boolean).join(" "),Tat=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,LG=t=>{const e={};let r;for(;r=Tat.exec(t);)e[r[1]]=r[2];return e},Pat=(t,e)=>{if(CA(t)){if(CA(e))return`${t};${e}`;t=LG(t)}else CA(e)&&(e=LG(e));return Object.assign({},t??{},e??{})};function L2(...t){let e={};for(let r of t){if(!r)continue;for(let s in e){if(s.startsWith("on")&&typeof e[s]=="function"&&typeof r[s]=="function"){e[s]=mat(r[s],e[s]);continue}if(s==="className"||s==="class"){e[s]=kat(e[s],r[s]);continue}if(s==="style"){e[s]=Pat(e[s],r[s]);continue}e[s]=r[s]!==void 0?r[s]:e[s]}for(let s in r)e[s]===void 0&&(e[s]=r[s]);const n=Object.getOwnPropertySymbols(r);for(let s of n)e[s]=r[s]}return e}function Oat(t,e,r){let n=[],s;return i=>{const o=t(i);return(o.length!==n.length||o.some((c,u)=>!$8(n[u],c)))&&(n=o,s=e(o,i)),s}}var Bg=(t=>(t.NotStarted="Not Started",t.Started="Started",t.Stopped="Stopped",t))(Bg||{}),hI="__init__";function Iat(t){const e=()=>{var o;return((o=t.getRootNode)==null?void 0:o.call(t))??document},r=()=>Cat(e());return{...t,getRootNode:e,getDoc:r,getWin:()=>r().defaultView??window,getActiveElement:()=>Due(e()),isActiveElement:Eat,getById:o=>e().getElementById(o)}}function Rat(t){return new Proxy({},{get(e,r){return r==="style"?n=>t({style:n}).style:t}})}var Mat=()=>t=>Array.from(new Set(t)),Lue=typeof globalThis.document<"u"?S.useLayoutEffect:S.useEffect;function tk(t){const e=t().value??t().defaultValue,r=t().isEqual??Object.is,[n]=S.useState(e),[s,i]=S.useState(n),o=t().value!==void 0,l=S.useRef(s);l.current=o?t().value:s;const c=S.useRef(l.current);Lue(()=>{c.current=l.current},[s,t().value]);const u=h=>{var g,m;const f=c.current,p=dp(h)?h(f):h;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:p,prev:f}),o||i(p),r(p,f)||(m=(g=t()).onChange)==null||m.call(g,p,f)};function d(){return o?t().value:s}return{initial:n,ref:l,get:d,set(h){(t().sync?Nc.flushSync:pat)(()=>u(h))},invoke(h,f){var p,g;(g=(p=t()).onChange)==null||g.call(p,h,f)},hash(h){var f,p;return((p=(f=t()).hash)==null?void 0:p.call(f,h))??String(h)}}}tk.cleanup=t=>{S.useEffect(()=>t,[])};tk.ref=t=>{const e=S.useRef(t);return{get:()=>e.current,set:r=>{e.current=r}}};function Dat(t){const e=S.useRef(t);return{get(r){return e.current[r]},set(r,n){e.current[r]=n}}}var Lat=(t,e)=>{const r=S.useRef(!1),n=S.useRef(!1);S.useEffect(()=>{if(r.current&&n.current)return e();n.current=!0},[...(t??[]).map(s=>typeof s=="function"?s():s)]),S.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])};function Fat(t,e={}){var z,I,q,A;const r=S.useMemo(()=>{const{id:U,ids:K,getRootNode:G}=e;return Iat({id:U,ids:K,getRootNode:G})},[e]),n=(...U)=>{t.debug&&console.log(...U)},s=((z=t.props)==null?void 0:z.call(t,{props:Iue(e),scope:r}))??e,i=$at(s),o=(I=t.context)==null?void 0:I.call(t,{prop:i,bindable:tk,scope:r,flush:FG,getContext(){return c},getComputed(){return j},getRefs(){return m},getEvent(){return p()}}),l=Fue(o),c={get(U){var K;return(K=l.current)==null?void 0:K[U].ref.current},set(U,K){var G;(G=l.current)==null||G[U].set(K)},initial(U){var K;return(K=l.current)==null?void 0:K[U].initial},hash(U){var G,Y;const K=(G=l.current)==null?void 0:G[U].get();return(Y=l.current)==null?void 0:Y[U].hash(K)}},u=S.useRef(new Map),d=S.useRef(null),h=S.useRef(null),f=S.useRef({type:""}),p=()=>({...f.current,current(){return f.current},previous(){return h.current}}),g=()=>({...N,matches(...U){return U.includes(N.ref.current)},hasTag(U){var K,G;return!!((G=(K=t.states[N.ref.current])==null?void 0:K.tags)!=null&&G.includes(U))}}),m=Dat(((q=t.refs)==null?void 0:q.call(t,{prop:i,context:c}))??{}),v=()=>({state:g(),context:c,event:p(),prop:i,send:M,action:y,guard:x,track:Lat,refs:m,computed:j,flush:FG,scope:r,choose:w}),y=U=>{const K=dp(U)?U(v()):U;if(!K)return;const G=K.map(Y=>{var $,L;const H=(L=($=t.implementations)==null?void 0:$.actions)==null?void 0:L[Y];return H||DG(`[zag-js] No implementation found for action "${JSON.stringify(Y)}"`),H});for(const Y of G)Y==null||Y(v())},x=U=>{var K,G;return dp(U)?U(v()):(G=(K=t.implementations)==null?void 0:K.guards)==null?void 0:G[U](v())},b=U=>{const K=dp(U)?U(v()):U;if(!K)return;const G=K.map(H=>{var L,F;const $=(F=(L=t.implementations)==null?void 0:L.effects)==null?void 0:F[H];return $||DG(`[zag-js] No implementation found for effect "${JSON.stringify(H)}"`),$}),Y=[];for(const H of G){const $=H==null?void 0:H(v());$&&Y.push($)}return()=>Y.forEach(H=>H==null?void 0:H())},w=U=>iat(U).find(K=>{let G=!K.guard;return CA(K.guard)?G=!!x(K.guard):dp(K.guard)&&(G=K.guard(v())),G}),j=U=>{jat(t.computed,()=>"[zag-js] No computed object found on machine");const K=t.computed[U];return K({context:c,event:p(),prop:i,refs:m,scope:r,computed:j})},N=tk(()=>({defaultValue:t.initialState({prop:i}),onChange(U,K){var Y,H,$,L;if(K){const F=u.current.get(K);F==null||F(),u.current.delete(K)}K&&y((Y=t.states[K])==null?void 0:Y.exit),y((H=d.current)==null?void 0:H.actions);const G=b(($=t.states[U])==null?void 0:$.effects);if(G&&u.current.set(U,G),K===hI){y(t.entry);const F=b(t.effects);F&&u.current.set(hI,F)}y((L=t.states[U])==null?void 0:L.entry)}})),C=S.useRef(void 0),k=S.useRef(Bg.NotStarted);Lue(()=>{queueMicrotask(()=>{const G=k.current===Bg.Started;k.current=Bg.Started,n(G?"rehydrating...":"initializing...");const Y=C.current??N.initial;N.invoke(Y,G?N.get():hI)});const U=u.current,K=N.ref.current;return()=>{n("unmounting..."),C.current=K,k.current=Bg.Stopped,U.forEach(G=>G==null?void 0:G()),u.current=new Map,d.current=null,queueMicrotask(()=>{y(t.exit)})}},[]);const E=()=>"ref"in N?N.ref.current:N.get(),M=U=>{queueMicrotask(()=>{var L,F;if(k.current!==Bg.Started)return;h.current=f.current,f.current=U;let K=E();const G=((L=t.states[K].on)==null?void 0:L[U.type])??((F=t.on)==null?void 0:F[U.type]),Y=w(G);if(!Y)return;d.current=Y;const H=Y.target??K;n("transition",U.type,Y.target||K,`(${Y.actions})`);const $=H!==K;$?Nc.flushSync(()=>N.set(H)):Y.reenter&&!$?N.invoke(K,K):y(Y.actions??[])})};return(A=t.watch)==null||A.call(t,v()),{state:g(),send:M,context:c,prop:i,scope:r,refs:m,computed:j,event:p(),getStatus:()=>k.current}}function Fue(t){const e=S.useRef(t);return e.current=t,e}function $at(t){const e=Fue(t);return function(n){return e.current[n]}}function FG(t){queueMicrotask(()=>{Nc.flushSync(()=>t())})}var Bat=Rat(t=>t);const $ue=()=>(t,e)=>e.reduce((r,n)=>{const[s,i]=r,o=n;return i[o]!==void 0&&(s[o]=i[o]),delete i[o],[s,i]},[{},{...t}]);function Uat(...t){return e=>{const r=[];for(const n of t)if(typeof n=="function"){const s=n(e);typeof s=="function"&&r.push(s)}else n&&(n.current=e);if(r.length)return()=>{for(const n of r)n()}}}function zat(t){var n,s;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const fI=t=>{const e=S.memo(S.forwardRef((r,n)=>{const{asChild:s,children:i,...o}=r;if(!s)return S.createElement(t,{...o,ref:n},i);if(!S.isValidElement(i))return null;const l=S.Children.only(i),c=zat(l);return S.cloneElement(l,{...L2(o,l.props),ref:n?Uat(n,c):c})}));return e.displayName=t.displayName||t.name,e},Hat=()=>{const t=new Map;return new Proxy(fI,{apply(e,r,n){return fI(n[0])},get(e,r){const n=r;return t.has(n)||t.set(n,fI(n)),t.get(n)}})},B8=Hat();function Wat(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Bue(t={}){const{name:e,strict:r=!0,hookName:n="useContext",providerName:s="Provider",errorMessage:i,defaultValue:o}=t,l=S.createContext(o);l.displayName=e;function c(){const u=S.useContext(l);if(!u&&r){const d=new Error(i??Wat(n,s));throw d.name="ContextError",Tue(Error,"captureStackTrace")&&dp(Error.captureStackTrace)&&Error.captureStackTrace(d,c),d}return u}return[l.Provider,c,l]}const[Vat,Uue]=Bue({name:"TimerContext",hookName:"useTimerContext",providerName:"<TimerProvider />"}),zue=S.forwardRef((t,e)=>{const r=Uue(),n=L2(r.getAreaProps(),t);return a.jsx(B8.div,{...n,ref:e})});zue.displayName="TimerArea";const qat=$ue(),Pb=S.forwardRef((t,e)=>{const[r,n]=qat(t,["type"]),s=Uue(),i=L2(s.getItemProps(r),n);return a.jsx(B8.div,{...i,ref:e,children:s.formattedTime[r.type]})});Pb.displayName="TimerItem";var Ob=(t,e=[])=>({parts:(...r)=>{if(Gat(e))return Ob(t,r);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...r)=>Ob(t,[...e,...r]),omit:(...r)=>Ob(t,e.filter(n=>!r.includes(n))),rename:r=>Ob(r,e),keys:()=>e,build:()=>[...new Set(e)].reduce((r,n)=>Object.assign(r,{[n]:{selector:[`&[data-scope="${Rg(t)}"][data-part="${Rg(n)}"]`,`& [data-scope="${Rg(t)}"][data-part="${Rg(n)}"]`].join(", "),attrs:{"data-scope":Rg(t),"data-part":Rg(n)}}}),{})}),Rg=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Gat=t=>t.length===0,Kat=Ob("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),bd=Kat.build(),Yat=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`timer:${t.id}:root`},Xat=t=>{var e;return((e=t.ids)==null?void 0:e.area)??`timer:${t.id}:area`},$G=new Set(["start","pause","resume","reset","restart"]);function Qat(t,e){const{state:r,send:n,computed:s,scope:i}=t,o=r.matches("running"),l=r.matches("paused"),c=s("time"),u=s("formattedTime"),d=s("progressPercent");return{running:o,paused:l,time:c,formattedTime:u,progressPercent:d,start(){n({type:"START"})},pause(){n({type:"PAUSE"})},resume(){n({type:"RESUME"})},reset(){n({type:"RESET"})},restart(){n({type:"RESTART"})},getRootProps(){return e.element({id:Yat(i),...bd.root.attrs})},getAreaProps(){return e.element({role:"timer",id:Xat(i),"aria-label":`${c.days} days ${u.hours}:${u.minutes}:${u.seconds}`,"aria-atomic":!0,...bd.area.attrs})},getControlProps(){return e.element({...bd.control.attrs})},getItemProps(h){const f=c[h.type];return e.element({...bd.item.attrs,"data-type":h.type,style:{"--value":f}})},getItemLabelProps(h){return e.element({...bd.itemLabel.attrs,"data-type":h.type})},getItemValueProps(h){return e.element({...bd.itemValue.attrs,"data-type":h.type})},getSeparatorProps(){return e.element({"aria-hidden":!0,...bd.separator.attrs})},getActionTriggerProps(h){if(!$G.has(h.action))throw new Error(`[zag-js] Invalid action: ${h.action}. Must be one of: ${Array.from($G).join(", ")}`);return e.button({...bd.actionTrigger.attrs,hidden:Oue(h.action,{start:()=>o||l,pause:()=>!o,reset:()=>!o&&!l,resume:()=>!l,restart:()=>!1}),type:"button",onClick(f){f.defaultPrevented||n({type:h.action.toUpperCase()})}})}}}var Zat={props({props:t}){return rot(t),{interval:1e3,startMs:0,...t}},initialState({prop:t}){return t("autoStart")?"running":"idle"},context({prop:t,bindable:e}){return{currentMs:e(()=>({defaultValue:t("startMs")}))}},watch({track:t,send:e,prop:r}){t([()=>r("startMs")],()=>{e({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:t})=>Jat(t.get("currentMs")),formattedTime:({computed:t})=>tot(t("time")),progressPercent:Oat(({context:t,prop:e})=>[t.get("currentMs"),e("targetMs"),e("startMs"),e("countdown")],([t,e=0,r,n])=>{const s=n?BG(t,e,r):BG(t,r,e);return bat(s,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:t,send:e}){return wat(({deltaMs:r})=>{e({type:"TICK",deltaMs:r})},t("interval"))},waitForNextTick({send:t}){return _at(()=>{t({type:"CONTINUE"})},0)}},actions:{updateTime({context:t,prop:e,event:r}){const n=e("countdown")?-1:1,s=eot(r.deltaMs,e("interval"));t.set("currentMs",i=>{const o=i+n*s;let l=e("targetMs");return l==null&&e("countdown")&&(l=0),e("countdown")&&l!=null?Math.max(o,l):!e("countdown")&&l!=null?Math.min(o,l):o})},resetTime({context:t,prop:e}){let r=e("targetMs");r==null&&e("countdown")&&(r=0),t.set("currentMs",e("startMs")??0)},invokeOnTick({context:t,prop:e,computed:r}){var n;(n=e("onTick"))==null||n({value:t.get("currentMs"),time:r("time"),formattedTime:r("formattedTime")})},invokeOnComplete({prop:t}){var e;(e=t("onComplete"))==null||e()}},guards:{hasReachedTarget:({context:t,prop:e})=>{let r=e("targetMs");if(r==null&&e("countdown")&&(r=0),r==null)return!1;const n=t.get("currentMs");return e("countdown")?n<=r:n>=r}}}};function Jat(t){const e=Math.max(0,t),r=e%1e3,n=Math.floor(e/1e3)%60,s=Math.floor(e/(1e3*60))%60,i=Math.floor(e/(1e3*60*60))%24;return{days:Math.floor(e/(1e3*60*60*24)),hours:i,minutes:s,seconds:n,milliseconds:r}}function BG(t,e,r){const n=r-e;return n===0?0:(t-e)/n}function cb(t,e=2){return t.toString().padStart(e,"0")}function eot(t,e){return Math.floor(t/e)*e}function tot(t){const{days:e,hours:r,minutes:n,seconds:s}=t;return{days:cb(e),hours:cb(r),minutes:cb(n),seconds:cb(s),milliseconds:cb(t.milliseconds,3)}}function rot(t){const{startMs:e,targetMs:r,countdown:n,interval:s}=t;if(s!=null&&(typeof s!="number"||s<=0))throw new Error(`[timer] Invalid interval: ${s}. Must be a positive number.`);if(e!=null&&(typeof e!="number"||e<0))throw new Error(`[timer] Invalid startMs: ${e}. Must be a non-negative number.`);if(r!=null&&(typeof r!="number"||r<0))throw new Error(`[timer] Invalid targetMs: ${r}. Must be a non-negative number.`);if(n&&e!=null&&r!=null&&e<=r)throw new Error(`[timer] Invalid countdown configuration: startMs (${e}) must be greater than targetMs (${r}).`);if(!n&&e!=null&&r!=null&&e>=r)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${e}) must be less than targetMs (${r}).`);if(n&&r==null&&e!=null&&e<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${e}) must be greater than 0 when no targetMs is provided.`)}Mat()(["autoStart","countdown","getRootNode","id","ids","interval","onComplete","onTick","startMs","targetMs"]);const[Eyt,not]=Bue({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),sot=t=>{const e=S.useId(),{getRootNode:r}=not(),n={id:e,getRootNode:r,...t},s=Fat(Zat,n);return Qat(s,Bat)},iot=$ue(),Hue=S.forwardRef((t,e)=>{const[r,n]=iot(t,["id","ids","autoStart","interval","countdown","startMs","targetMs","onComplete","onTick"]),s=sot(r),i=L2(s.getRootProps(),n);return a.jsx(Vat,{value:s,children:a.jsx(B8.div,{...i,ref:e})})});Hue.displayName="TimerRoot";const aot="2026-05-04",oot=[{value:"may_2026",label:"May 2026"},{value:"June_2026",label:"June 2026"},{value:"July_2026",label:"July 2026"},{value:"later",label:"Later / not sure yet"}],lot=[{value:"qualitative",label:"Qualitative"},{value:"quantitative",label:"Quantitative"},{value:"mixed",label:"Mixed methods"},{value:"not_sure",label:"Not sure yet"}];function cot(){const[t,e]=S.useState(""),[r,n]=S.useState(""),[s,i]=S.useState(""),[o,l]=S.useState(!1),[c,u]=S.useState(!1),[d,h]=S.useState(!1),f=async m=>{if(m.preventDefault(),!t){Fe.error("Please enter your email address");return}if(!o){Fe.error("Please accept the privacy terms to join the waitlist");return}u(!0);try{const v=new Date().toISOString(),{error:y}=await be.from("waitlist_signups").insert({email:t.toLowerCase().trim(),planned_start:r||null,research_method:s||null,source:"landingpage",privacy_accepted_at:v,privacy_version:aot,marketing_consent:!0,marketing_consent_at:v});if(y)if(y.code==="23505")Fe.error("This email is already on the waitlist!");else throw y;else h(!0),Fe.success("You're on the list!")}catch(v){console.error("Waitlist signup error:",v),Fe.error("Something went wrong. Please try again.")}finally{u(!1)}},g=(()=>{const m=new Date("2026-05-30T23:59:59"),v=new Date;return Math.max(0,m.getTime()-v.getTime())})();return a.jsxs(a.Fragment,{children:[a.jsx(ea,{title:"Join the Waitlist - Early Access to Academly",description:"Join the Academly beta — AI thesis writing tool for Bachelor and Master students. Real citations from your own PDFs. Free to try.",canonical:"https://academly.ai/waitlist"}),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Os,{}),a.jsxs("div",{className:"relative pt-32 pb-20",children:[a.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40 dark:opacity-20",children:[a.jsx("div",{className:"blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400 dark:from-blue-700"}),a.jsx("div",{className:"blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300 dark:to-indigo-600"})]}),a.jsx(Wr,{children:a.jsx("div",{className:"relative",children:a.jsxs("div",{className:"mx-auto max-w-2xl text-center",children:[a.jsxs("h1",{className:"text-4xl font-bold tracking-tight text-foreground sm:text-5xl md:text-6xl",children:["Get early access to ",a.jsx("span",{className:"text-primary",children:"Academly"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-muted-foreground",children:"Join the waitlist to be among the first students and researchers using AI for structured academic work."}),a.jsx("div",{className:"mt-12",children:g>0?a.jsx(Hue,{autoStart:!0,countdown:!0,startMs:g,children:a.jsxs(zue,{className:"flex flex-col items-center",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-4 uppercase tracking-wider",children:"Public Beta Launches In"}),a.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(Pb,{type:"days",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"days"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(Pb,{type:"hours",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"hrs"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(Pb,{type:"minutes",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"min"})]}),a.jsx("span",{className:"text-2xl sm:text-4xl font-light text-muted-foreground/50",children:":"}),a.jsxs("div",{className:"flex flex-col items-center rounded-2xl bg-card border border-border px-4 py-3 sm:px-6 sm:py-4 shadow-lg shadow-primary/5",children:[a.jsx(Pb,{type:"seconds",className:"text-3xl sm:text-5xl font-bold text-foreground tabular-nums"}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"sec"})]})]})]})}):a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-4 uppercase tracking-wider",children:"Public Beta"}),a.jsx("p",{className:"text-3xl sm:text-5xl font-bold text-primary",children:"Launching soon!"})]})})]})})})]}),a.jsx("section",{className:"pb-20 px-6 lg:px-12",children:a.jsx(Wr,{children:a.jsx("div",{className:"mx-auto max-w-md",children:d?a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl shadow-primary/5 text-center animate-fade-in",children:[a.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-success/10",children:a.jsx(pl,{className:"h-8 w-8 text-success"})}),a.jsx("h3",{className:"text-2xl font-semibold text-foreground",children:"You're on the list!"}),a.jsx("p",{className:"mt-3 text-muted-foreground",children:"We'll notify you when we launch. Check your inbox for updates."})]}):a.jsx("form",{onSubmit:f,className:"rounded-3xl border border-border bg-card p-8 shadow-xl shadow-primary/5",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"email",className:"flex items-center gap-2",children:[a.jsx(FJ,{className:"h-4 w-4 text-muted-foreground"}),"Email address ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Be,{id:"email",type:"email",placeholder:"you@university.edu",value:t,onChange:m=>e(m.target.value),required:!0,className:"h-12"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"planned-start",children:"Planned start (optional)"}),a.jsxs(it,{value:r,onValueChange:n,children:[a.jsx(rt,{id:"planned-start",className:"h-12",children:a.jsx(at,{placeholder:"Select..."})}),a.jsx(nt,{children:oot.map(m=>a.jsx(Te,{value:m.value,children:m.label},m.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"research-method",children:"Research method (optional)"}),a.jsxs(it,{value:s,onValueChange:i,children:[a.jsx(rt,{id:"research-method",className:"h-12",children:a.jsx(at,{placeholder:"Select..."})}),a.jsx(nt,{children:lot.map(m=>a.jsx(Te,{value:m.value,children:m.label},m.value))})]})]}),a.jsxs(Cue,{id:"marketing-consent",checked:o,onCheckedChange:l,required:!0,children:["I agree that Academly may contact me about early access and product updates. I have read the"," ",a.jsx(mt,{to:"/legal?tab=privacy",className:"text-primary hover:underline font-medium",target:"_blank",children:"Privacy Policy"}),"."]}),a.jsx(ve,{type:"submit",size:"lg",className:"w-full h-12 text-base font-semibold rounded-full",disabled:c||!o,children:c?"Joining...":"Join the Waitlist"}),a.jsxs("p",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[a.jsx(LJ,{className:"h-3 w-3"}),"No spam. No data sharing. Unsubscribe anytime."]})]})})})})}),a.jsx(bi,{})]})]})}var F2="Tabs",[uot,Cyt]=Ln(F2,[m0]),Wue=m0(),[dot,U8]=uot(F2),Vue=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=lg(l),[h,f]=Ps({prop:n,onChange:s,defaultProp:i??"",caller:F2});return a.jsx(dot,{scope:r,baseId:Gi(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:c,children:a.jsx(et.div,{dir:d,"data-orientation":o,...u,ref:e})})});Vue.displayName=F2;var que="TabsList",Gue=S.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,i=U8(que,r),o=Wue(r);return a.jsx(d6,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:a.jsx(et.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});Gue.displayName=que;var Kue="TabsTrigger",Yue=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=t,o=U8(Kue,r),l=Wue(r),c=Zue(o.baseId,n),u=Jue(o.baseId,n),d=n===o.value;return a.jsx(h6,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(et.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:ze(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(n):h.preventDefault()}),onKeyDown:ze(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(n)}),onFocus:ze(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(n)})})})});Yue.displayName=Kue;var Xue="TabsContent",Que=S.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...o}=t,l=U8(Xue,r),c=Zue(l.baseId,n),u=Jue(l.baseId,n),d=n===l.value,h=S.useRef(d);return S.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),a.jsx(Xn,{present:s||d,children:({present:f})=>a.jsx(et.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});Que.displayName=Xue;function Zue(t,e){return`${t}-trigger-${e}`}function Jue(t,e){return`${t}-content-${e}`}var hot=Vue,ede=Gue,tde=Yue,rde=Que;const c5=hot,rk=S.forwardRef(({className:t,...e},r)=>a.jsx(ede,{ref:r,className:Oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));rk.displayName=ede.displayName;const Od=S.forwardRef(({className:t,...e},r)=>a.jsx(tde,{ref:r,className:Oe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));Od.displayName=tde.displayName;const Id=S.forwardRef(({className:t,...e},r)=>a.jsx(rde,{ref:r,className:Oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Id.displayName=rde.displayName;const fot=()=>{const[t]=Dj(),e=t.get("tab"),[r,n]=S.useState(e==="privacy"?"privacy":"terms");return S.useEffect(()=>{(e==="privacy"||e==="terms")&&n(e)},[e]),a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Terms of Service & Privacy Policy | Academly.ai",description:"Terms of Service and Privacy Policy for Academly.ai — GDPR compliant AI thesis writing platform.",canonical:"https://academly.ai/legal"}),a.jsx(Os,{}),a.jsxs("section",{className:"relative pt-32 pb-12",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsx(Wr,{className:"relative",children:a.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-6",children:"Legal Information"}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Transparency and trust are important to us"})]})})]}),a.jsx("section",{className:"py-12 pb-20",children:a.jsx(Wr,{children:a.jsx("div",{className:"max-w-4xl mx-auto",children:a.jsxs(c5,{value:r,onValueChange:n,className:"w-full",children:[a.jsxs(rk,{className:"grid w-full grid-cols-2 rounded-full p-1 h-14 bg-muted",children:[a.jsx(Od,{value:"terms",className:"rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm h-12 text-base font-medium",children:"Terms of Service"}),a.jsx(Od,{value:"privacy",className:"rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm h-12 text-base font-medium",children:"Privacy Policy"})]}),a.jsx(Id,{value:"terms",className:"mt-8",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 md:p-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"TERMS OF SERVICE"}),a.jsxs("p",{className:"text-muted-foreground mb-8",children:["for the use of the SaaS platform Academly.ai",a.jsx("br",{}),"Effective: 15 January 2026, last amended May 2026"]}),a.jsxs("div",{className:"space-y-8 text-muted-foreground leading-relaxed",children:[a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"1. Scope and Contracting Parties"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.1 Provider"}),a.jsx("p",{children:'The provider of the platform available under the domain academly.ai (hereinafter the "Platform" or "Service") is:'}),a.jsxs("p",{className:"mt-2",children:["Academly (Dominik Dunst)",a.jsx("br",{}),"Contact: contact@academly.ai"]}),a.jsx("p",{className:"mt-2",children:"Academly.ai is currently intended exclusively for consumers (B2C). Use for commercial or business purposes is only permitted if the Provider expressly agrees to this on a case-by-case basis."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.2 Scope of these Terms"}),a.jsx("p",{children:'These Terms of Service govern the contractual relationship between the Provider and users of the Platform ("Users"). They apply to all functions offered via the Platform, in particular AI-assisted processing, document processing, quota/credit models ("Student Points"), as well as export and storage functions.'}),a.jsx("p",{className:"mt-2",children:"Any deviating, conflicting, or additional terms of the User shall not become part of the contract unless the Provider expressly agrees to them in writing."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.3 Changes to these Terms"}),a.jsx("p",{children:"The Provider may amend these Terms with effect for the future if there are objective reasons for doing so (e.g., changes in law, technical developments, adjustments to the Service). Changes that are not merely insignificant for Users will be announced at least four (4) weeks before they take effect by email to the address stored in the User account. If the User does not object within that period, the changes will be deemed accepted. The User will be explicitly informed of this consequence in the change notice."}),a.jsx("p",{className:"mt-2",children:"If the User objects in due time, the Provider may terminate the contract as of the date the new Terms would take effect."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"2. Service Description"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.1 Description of the Platform"}),a.jsx("p",{children:"The Platform is an AI-supported, web-based software-as-a-service (SaaS) solution designed to support academic workflows. In particular, it enables the uploading and processing of documents, the generation of summaries, outlines and text drafts, as well as additional functions for structuring academic content."}),a.jsx("p",{className:"mt-2",children:"Which features are available in detail depends on the plan selected by the User and may change as the product evolves."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.2 AI-assisted Functions"}),a.jsx("p",{children:"Academly.ai provides AI-assisted features that may vary depending on the selected plan. These include in particular:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"AI-generated summaries of uploaded content, structured and condensed;"}),a.jsx("li",{children:"outline/structure and drafting functions (e.g., theory, methodology, or structural building blocks);"}),a.jsx("li",{children:"document analysis (e.g., identification of relevant passages, structural suggestions, extraction)."})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Important:"})," All AI outputs are working drafts. They do not replace the User's own academic work. Outputs may contain errors, omissions, or outdated information and must be reviewed independently by the User."]}),a.jsx("p",{className:"mt-2",children:"To provide AI features, the Provider may use technical subcontractors (e.g., AI models via API providers). Details on service providers, data categories, and any transfers to third countries (if applicable) are set out in the Privacy Policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.3 Document Processing"}),a.jsx("p",{children:"Users may upload documents (e.g., PDF and other supported formats) to the Platform. Supported formats and any upload limits (e.g., file size, number of uploads, quotas) depend on the selected plan and are displayed within the Platform and/or on the pricing page. The Provider may adjust such limits for technical or security reasons."}),a.jsx("p",{className:"mt-2",children:"The User represents that they are entitled to use and upload the respective documents and that no third-party rights are infringed."}),a.jsx("p",{className:"mt-2",children:"Uploaded documents are stored and processed in order to provide Platform functionality. Details on data processing and service providers are governed by the Privacy Policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.4 Export and Backup Features"}),a.jsx("p",{children:"Users may export generated content—especially summaries, outlines, and drafts—in common formats (e.g., DOCX, TXT) and store it locally."}),a.jsx("p",{className:"mt-2",children:"The Platform may provide features for exporting/transferring User-related content. The Provider recommends regularly creating exports of your content. The Provider does not guarantee permanent storage of all User data beyond the term of the contract."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.5 Use in Different Countries"}),a.jsx("p",{children:"The Services are not intended for use in jurisdictions where providing or using the Services would violate applicable laws or regulations or would subject the Provider to special registration, licensing, or supervisory requirements. Users accessing the Platform from outside Austria do so on their own initiative and are solely responsible for complying with local legal requirements to the extent applicable."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.6 Changes, Corrections and Further Development"}),a.jsx("p",{children:"The Provider is entitled to develop, change, supplement, or restrict the Platform and individual functions, insofar as (i) this is necessary to improve the Service, maintain security, or ensure legal compliance, or (ii) it is reasonable for the User and does not materially impair the purpose of the contract. Obvious errors (e.g., in displays, descriptions, or calculations) may be corrected at any time."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.7 Third-party Offers and Links"}),a.jsx("p",{children:"To the extent the Platform contains links to websites or content of third parties, these are provided for informational purposes only. The respective third party is solely responsible for the content, availability, and data protection practices. The Provider only reviews such content to the extent required by law."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"3. Registration and User Account"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.1 Registration Requirements"}),a.jsx("p",{children:"Use of the Platform is only permitted for persons who have reached the age of 18. By registering, the User confirms that they are of legal age."}),a.jsx("p",{className:"mt-2",children:"The User must provide truthful and complete information during registration. As a rule, only one account per User is permitted. Access credentials must not be shared."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.2 Account Security"}),a.jsx("p",{children:"The User must keep their password confidential and take appropriate measures to prevent unauthorized access. Activities carried out using the account will generally be attributed to the User to the extent the User is responsible for the misuse."}),a.jsx("p",{className:"mt-2",children:"If misuse or security incidents are suspected, the Provider must be informed without undue delay at contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.3 Account Termination and Deletion"}),a.jsx("p",{children:"The User may terminate their account at any time—either via available account functions or by notifying contact@academly.ai. Personal data will be deleted in accordance with the GDPR unless statutory retention obligations or legitimate interests (e.g., legal enforcement) require further storage."}),a.jsx("p",{className:"mt-2",children:"The Provider may block or delete accounts in the event of violations of these Terms. As a rule, the User will receive a prior warning. In the case of serious violations, immediate suspension may be carried out."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"4. Subscriptions and Payments"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.1 Available Plans"}),a.jsx("p",{children:"The Platform offers plans that differ in particular with respect to quotas (e.g., Student Points), feature scope, support level, and usage limits. Current plans and details are displayed within the Platform and on the pricing page and form part of the service description."}),a.jsx("p",{className:"mt-2",children:"Prices are stated inclusive of VAT where applicable, or plus any taxes that may apply depending on the User's country of residence/billing location."}),a.jsx("p",{className:"mt-2",children:"The Provider may adjust prices and plan details for future billing periods. Changes will be announced before becoming effective; ongoing subscriptions are only affected from the next renewal."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.2 Payments via Stripe"}),a.jsx("p",{children:"Payments are processed via Stripe. For processing, necessary payment data is transmitted to Stripe. The Provider does not store full payment details (e.g., credit card numbers). In the event of payment default or failed charges, the Provider may suspend access to paid features until outstanding amounts are settled."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.3 Right of Withdrawal (Consumers) – Austria"}),a.jsx("p",{children:"Consumers generally have a statutory right of withdrawal. The withdrawal period is fourteen (14) days from the conclusion of the contract unless otherwise provided by law."}),a.jsx("p",{className:"mt-2",children:"To exercise the right of withdrawal, the User must inform the Provider of the decision to withdraw by an unequivocal statement (e.g., by email or post). Withdrawal notices should be sent to: Email: contact@academly.ai"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Consequences of withdrawal:"})," In the event of an effective withdrawal, services received shall be returned/refunded in accordance with statutory provisions."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Early expiry of the right of withdrawal:"})," For digital content and digital services, the right of withdrawal may expire early if the User expressly requests that the Provider begin performance before the withdrawal period ends and the User confirms that they thereby lose the right of withdrawal once the service has been provided or made available."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"5. Usage Rights and Restrictions"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.1 Granted Usage Rights"}),a.jsx("p",{children:"The Provider grants the User a non-exclusive, non-transferable, non-sublicensable right to use the Platform during the term of the contract within the scope of the booked plan. Use is limited to personal, academic purposes. Any commercial use requires prior written consent of the Provider."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.2 Prohibited Use"}),a.jsx("p",{children:"In particular, it is prohibited to use the Platform to create unlawful content or to infringe third-party rights. It is also prohibited to bypass security mechanisms, conduct automated mass access without permission, share accounts, or distribute malware or spam."}),a.jsx("p",{className:"mt-2",children:"The Platform must not be used to present AI outputs as the User's own academic work without appropriate own contribution and without proper labeling/citation work."}),a.jsx("p",{className:"mt-2",children:"In particular, the following is also prohibited:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"systematically reading or extracting data (scraping) without permission;"}),a.jsx("li",{children:"bypassing or manipulating technical protection measures;"}),a.jsx("li",{children:"reverse engineering, decompilation, or other analysis of the Platform unless mandatory law permits it;"}),a.jsx("li",{children:"using automated systems or scripts that place excessive load on the Platform;"}),a.jsx("li",{children:"using the Platform to deceive third parties (e.g., phishing, identity misuse);"}),a.jsx("li",{children:"uploading content that infringes third-party rights;"}),a.jsx("li",{children:"introducing malware or other disruptions;"}),a.jsx("li",{children:"account sharing or allowing multiple persons to use one account."})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.3 Fair Use and Abuse Prevention"}),a.jsx("p",{children:"The Provider may restrict use if abusive or excessive usage is identified, in particular in cases of systematic mass processing, circumvention of plan limits, or usage by multiple persons via one account. Where possible, the User will be informed in advance, unless immediate action is necessary to prevent harm."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"6. Intellectual Property"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.1 Rights in the Platform"}),a.jsx("p",{children:"All rights in the Platform (software, design, logos, texts, trademarks) remain with the Provider or its licensors. The User receives no rights beyond the granted usage right."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Trademark notice:"}),` "Academly.ai" is currently used as a product/project name. To the best of the Provider's knowledge, no registered trademark exists at this time.`]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.2 Rights in User Content"}),a.jsx("p",{children:'The User retains all rights in content uploaded to the Platform ("User Content"). By uploading, the User grants the Provider the right to store and process such content insofar as necessary to provide the Services.'})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.3 Rights in AI-generated Content"}),a.jsx("p",{children:"AI-generated content may be used by the User within the scope of Platform usage. The User acknowledges that AI outputs may not constitute works protected by copyright and that third-party rights cannot be excluded in individual cases. The User is responsible for review, use, and proper citation."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.4 Feedback"}),a.jsx("p",{children:"If the User voluntarily submits feedback, ideas, or improvement suggestions to the Provider, the Provider may use them free of charge, worldwide and without time limitation, to improve the Platform. Personal data will only be processed in accordance with the Privacy Policy."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"7. Academic Integrity and Notices"}),a.jsx("p",{children:"Academly.ai is a tool. The Provider does not guarantee academic success. Users are required to independently review content, cite sources correctly, and comply with the rules of their university/institution. The Provider assumes no liability for consequences arising from plagiarism, violations of academic rules, or improper use of the content."})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"8. Limitation of Liability"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:'8.1 Platform Availability ("Best Effort")'}),a.jsx("p",{children:'The Provider uses reasonable efforts to ensure high availability of the Platform within technical and operational possibilities ("best effort"). There is no entitlement to uninterrupted availability at all times. In particular, maintenance, further development, security measures, technical issues, or force majeure events may lead to temporary restrictions.'}),a.jsx("p",{className:"mt-2",children:"Planned maintenance will be announced in advance where possible and, where feasible, carried out during times of lower usage. The Provider is not liable for outages or restrictions caused by circumstances outside its control, in particular issues with third-party providers and subcontractors (e.g., hosting, database, payment, or AI providers) or general network failures."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.2 Data Loss"}),a.jsx("p",{children:"The Provider takes reasonable measures for data backup but does not guarantee full recoverability in all cases. Users should regularly create exports/backups of their content."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.3 Liability Cap"}),a.jsx("p",{children:"In cases of slight negligence, the Provider is only liable if essential contractual obligations (cardinal obligations) are breached, and then only for foreseeable, typical damage. To the extent legally permissible, the Provider's total liability is limited in amount to the fees actually paid by the User to the Provider during the last twelve (12) months before the damaging event occurred."}),a.jsx("p",{className:"mt-2",children:"These limitations do not apply in cases of intent or gross negligence, injury to life, body or health, or mandatory statutory liability provisions."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"9. Final Provisions"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.1 Governing Law"}),a.jsx("p",{children:"Austrian law applies, excluding the UN Convention on Contracts for the International Sale of Goods (CISG). Mandatory consumer protection provisions of the User's country of residence remain unaffected."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.2 Jurisdiction and Dispute Resolution"}),a.jsxs("p",{children:["For consumers, the statutory places of jurisdiction apply. The Provider is neither obliged nor willing to participate in dispute resolution proceedings before a consumer arbitration board. The EU Online Dispute Resolution platform is available at:"," ",a.jsx("a",{href:"https://ec.europa.eu/consumers/odr",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://ec.europa.eu/consumers/odr"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.3 Severability"}),a.jsx("p",{children:"If any provision of these Terms is or becomes invalid, the remainder of the agreement remains effective. An effective provision that most closely reflects the economic purpose of the invalid provision shall be deemed agreed."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.4 Contact"}),a.jsx("p",{children:"Questions or complaints may be sent to contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.5 Electronic Communication"}),a.jsx("p",{children:"The User agrees that contractual notices and declarations by the Provider may generally be made electronically (e.g., by email or within the Platform), to the extent legally permissible."})]})]})]})]})]})}),a.jsx(Id,{value:"privacy",className:"mt-8",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 md:p-12",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"PRIVACY POLICY"}),a.jsxs("p",{className:"text-muted-foreground mb-8",children:["for the use of the SaaS platform Academly.ai",a.jsx("br",{}),"Last updated: May 2026"]}),a.jsxs("div",{className:"space-y-8 text-muted-foreground leading-relaxed",children:[a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"1. Introduction and Controller"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.1 Controller name and contact details"}),a.jsx("p",{children:"The controller within the meaning of the General Data Protection Regulation (GDPR) and other applicable data protection laws is:"}),a.jsxs("p",{className:"mt-2",children:["Academly (Dominik Dunst)",a.jsx("br",{}),"Email: contact@academly.ai"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.2 Data Protection Officer"}),a.jsx("p",{children:"The appointment of a Data Protection Officer is currently not required under Art. 37 GDPR, as the statutory requirements are not met."}),a.jsx("p",{className:"mt-2",children:"For any data protection inquiries, please contact us using the contact details above."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"1.3 Scope of this Privacy Policy"}),a.jsx("p",{children:"This Privacy Policy applies to the platform accessible under the domain academly.ai and all related services, including mobile access and linked subdomains. It informs you about the nature, scope and purposes of the collection and use of personal data by the controller."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"2. Principles of Data Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.1 Legal bases for processing"}),a.jsx("p",{children:"We process personal data only on the basis of one of the following legal bases under Art. 6(1) GDPR:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-2",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(a) Consent (Art. 6(1)(a) GDPR)"}),a.jsx("br",{}),"Where we obtain your consent for specific processing activities, your consent forms the legal basis. You may withdraw your consent at any time with effect for the future."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(b) Performance of a contract (Art. 6(1)(b) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for the performance of a contract to which you are a party, or in order to take steps at your request prior to entering into a contract, Art. 6(1)(b) GDPR is the legal basis."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(c) Legal obligation (Art. 6(1)(c) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for compliance with a legal obligation to which we are subject, Art. 6(1)(c) GDPR is the legal basis."]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"(d) Legitimate interests (Art. 6(1)(f) GDPR)"}),a.jsx("br",{}),"Where processing is necessary for the purposes of our legitimate interests or those of a third party, and your interests or fundamental rights and freedoms do not override those interests, Art. 6(1)(f) GDPR is the legal basis. Our legitimate interests include, in particular, providing and improving our services, ensuring IT security, and preventing fraud."]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.2 Categories of data processed"}),a.jsx("p",{children:"When you use our platform, we may process the following categories of personal data:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Account data:"})," email address, nickname, profile information (university, degree program), account-related information"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Usage data:"})," IP address, access time, pages accessed, browser type, operating system, referrer URL, device information"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Content data:"})," uploaded documents, AI-generated content (summaries, thesis drafts, analyses), stored projects and notes"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Payment-related data:"})," billing address, payment history, subscription status (full payment details are processed exclusively by Stripe)"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Meta and communication data:"})," token usage, student points, activity history, communication with support"]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"2.3 Purposes of processing"}),a.jsx("p",{children:"We process personal data for the following purposes:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Providing the platform and its features"}),a.jsx("li",{children:"User account administration and authentication"}),a.jsx("li",{children:"Processing documents for AI-assisted analysis"}),a.jsx("li",{children:"Generating summaries, thesis drafts and other AI-generated outputs"}),a.jsx("li",{children:"Payment processing and subscription management"}),a.jsx("li",{children:"Ensuring IT security and fraud prevention"}),a.jsx("li",{children:"Analytics and service improvement"}),a.jsx("li",{children:"Compliance with statutory retention obligations"}),a.jsx("li",{children:"Communication with users (support and service messages)"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"3. Data Collection When Using the Platform"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.1 Registration and user account"}),a.jsx("p",{children:"When you register for a user account, we collect:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Email address:"})," required to create an account, authenticate you and communicate with you"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Password:"})," stored only in hashed form; plaintext passwords are never stored or transmitted"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Profile information (optional):"})," nickname, university, degree program, research interests"]})]}),a.jsx("p",{className:"mt-2",children:"Authentication is provided via Supabase Auth, a specialized authentication service. Processing is necessary for the performance of the contract (Art. 6(1)(b) GDPR)."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.2 Document upload and processing"}),a.jsx("p",{children:"Users may upload documents (in particular PDF files) to the platform. These documents are:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Stored securely in Supabase Storage"}),a.jsx("li",{children:"Processed to provide AI-assisted analysis features"}),a.jsx("li",{children:"Retained for the duration of the account use or until deleted by the user"})]}),a.jsx("p",{className:"mt-2",children:"This processing is necessary for the performance of the contract, as it constitutes a core function of the platform (Art. 6(1)(b) GDPR)."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Note:"})," Users are responsible for ensuring that they are authorized to use and upload the relevant documents and that no third-party rights are infringed."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.3 AI-generated content"}),a.jsx("p",{children:"In the course of using the platform, AI-generated content is created, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Thesis drafts and outlines"}),a.jsx("li",{children:"Summaries of uploaded documents"}),a.jsx("li",{children:"Theory building blocks and methodology suggestions"}),a.jsx("li",{children:"Document analyses and structure suggestions"})]}),a.jsx("p",{className:"mt-2",children:"This content is stored in the user account and can be exported or deleted by the user. The legal basis is performance of the contract (Art. 6(1)(b) GDPR)."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"3.4 Usage data and statistics"}),a.jsx("p",{children:"To provide and improve our services, we collect:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Token usage:"})," for billing and quota monitoring"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Student points:"})," to manage the credit system"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Activity history:"})," to track usage history"]})]}),a.jsx("p",{className:"mt-2",children:"Processing is based on our legitimate interests in service improvement and fraud prevention (Art. 6(1)(f) GDPR)."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"4. Hosting and Infrastructure"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.1 Vercel (frontend hosting)"}),a.jsx("p",{children:"Our frontend is hosted by Vercel Inc. Each time you access the platform, the following data may be processed automatically:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"IP address of the accessing device"}),a.jsx("li",{children:"Date and time of access"}),a.jsx("li",{children:"Browser type and version"}),a.jsx("li",{children:"Operating system"}),a.jsx("li",{children:"Referrer URL"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Vercel Inc., 340 S Lemon Ave #4133, Walnut, CA 91789, USA"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Server locations:"})," Vercel operates a global edge network. Data may be processed in various data centers worldwide, including in the USA and the EU."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," legitimate interest in the technical provision of the platform (Art. 6(1)(f) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"International transfers:"})," where data is transferred to the USA, we rely on Standard Contractual Clauses pursuant to Art. 46(2)(c) GDPR and, where applicable, on the EU–US Data Privacy Framework for appropriately certified companies, as well as supplementary technical and organizational measures."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://vercel.com/legal/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://vercel.com/legal/privacy-policy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.2 Supabase (backend infrastructure)"}),a.jsx("p",{children:"We use Supabase for backend services, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Database:"})," storage of account data, projects and generated content"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Authentication:"})," user account and login management"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"File storage:"})," secure storage of uploaded documents"]})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Supabase Inc., 970 Toa Payoh North #07-04, Singapore 318992"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Server location:"})," our Supabase instance is hosted in the EU region (Frankfurt, Germany)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR) and legitimate interests (Art. 6(1)(f) GDPR)."]}),a.jsx("p",{className:"mt-2",children:"Supabase acts as a processor pursuant to Art. 28 GDPR. We enter into data processing agreements (Art. 28 GDPR) with processors where applicable or otherwise ensure that appropriate agreements are in place."}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://supabase.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://supabase.com/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"4.3 Edge Functions (serverless)"}),a.jsx("p",{children:"To process AI requests, we use serverless functions (edge functions) executed on Supabase infrastructure. These functions:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Process requests to AI APIs in real time"}),a.jsx("li",{children:"Are executed in the EU region"}),a.jsx("li",{children:"Do not store persistent data outside the database"})]}),a.jsx("p",{className:"mt-2",children:"Processing is necessary for performance of the contract (Art. 6(1)(b) GDPR)."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"5. Payment Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.1 Stripe as payment service provider"}),a.jsx("p",{children:"Payments are processed via Stripe, an external payment service provider. Stripe processes:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Credit card or other payment information"}),a.jsx("li",{children:"Billing address"}),a.jsx("li",{children:"Email address"}),a.jsx("li",{children:"Transaction data"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Stripe Payments Europe Ltd., 1 Grand Canal Street Lower, Grand Canal Dock, Dublin, D02 H210, Ireland"]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Important note:"})," We do not store full payment details (e.g., credit card numbers) on our servers. These are processed and stored exclusively by Stripe."]}),a.jsx("p",{className:"mt-2",children:"With respect to payment data, Stripe acts as an independent controller and is subject to its own data protection obligations."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://stripe.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://stripe.com/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"5.2 Invoice data"}),a.jsx("p",{children:"Invoice data (billing address, invoice amounts, invoice date) is stored for tax and accounting purposes."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," compliance with legal obligations (Art. 6(1)(c) GDPR) in conjunction with Austrian tax and commercial retention obligations."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Retention period:"})," 7 years under Austrian tax law."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"6. Analytics and Tracking"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.1 Plausible Analytics"}),a.jsx("p",{children:"We use Plausible Analytics, a privacy-friendly web analytics service."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Provider:"})," Plausible Insights OÜ, Västriku tn 2, 50403, Tartu, Estonia"]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Key characteristics:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"No cookies"}),a.jsx("li",{children:"No collection of directly identifying personal data"}),a.jsx("li",{children:"No cross-device tracking"}),a.jsx("li",{children:"GDPR-compliant without consent"}),a.jsx("li",{children:"Servers located in the EU"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Data processed:"})," aggregated, anonymized usage statistics (page views, time on page, device type, country based on anonymized IP)."]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," legitimate interest in analytics and optimization of our platform (Art. 6(1)(f) GDPR)."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://plausible.io/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://plausible.io/privacy"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.2 Cookie policy"}),a.jsx("p",{children:"Our platform uses only technically necessary cookies required for operating the platform, such as:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Authentication cookies (session management)"}),a.jsx("li",{children:"Security cookies (CSRF protection)"})]}),a.jsx("p",{className:"mt-2",children:"These cookies are essential for the operation of the platform and do not require consent under applicable ePrivacy rules."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Analytics cookies:"})," currently not used. Plausible Analytics works without cookies."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"6.3 Notice regarding possible future use of Google Analytics"}),a.jsx("p",{children:"We do not currently use Google Analytics. If we implement Google Analytics or comparable tools requiring consent in the future, this will only occur after you have given prior consent via a cookie/consent banner (Art. 6(1)(a) GDPR in conjunction with applicable ePrivacy rules). In that case, we will update this Privacy Policy in advance and provide transparent information, in particular on the provider, data categories, retention periods and any international transfers."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"7. Email Communication"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"7.1 Transactional emails"}),a.jsx("p",{children:"We send transactional emails that are necessary for performing the contract, such as:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Account confirmation upon registration"}),a.jsx("li",{children:"Password reset"}),a.jsx("li",{children:"Payment confirmations and invoices"}),a.jsx("li",{children:"Important service messages (e.g., changes to the Terms of Service)"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR)."]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"7.2 Marketing and product updates"}),a.jsx("p",{children:"By creating an account or joining our waitlist, you consent to receive occasional product updates, feature announcements, tips for using the platform, and promotional offers from Academly by email. Legal basis: consent (Art. 6(1)(a) GDPR). Frequency: We typically send 1-4 emails per month. We do not share your email address with third parties for their marketing purposes. Opt-out: Every marketing email contains an unsubscribe link. You can withdraw your consent at any time by clicking 'Unsubscribe' in any email or by contacting us at contact@academly.ai. Withdrawal of consent does not affect the lawfulness of processing based on consent before its withdrawal. Unsubscribing from marketing emails does not affect transactional emails necessary for providing the service."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"8. Disclosure to Third Parties"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.1 Service providers"}),a.jsx("p",{children:"To provide the platform, we use service providers. Where these providers process personal data on our behalf, they act as processors within the meaning of Art. 28 GDPR. Where service providers process data for their own purposes (e.g., payment processing), they act as independent controllers and are subject to their own data protection obligations."}),a.jsx("div",{className:"mt-4 overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-border text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted",children:[a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Provider"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Role"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Purpose"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Location"})]})}),a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Supabase Inc."}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Database, authentication, storage"}),a.jsx("td",{className:"border border-border p-2",children:"EU (Frankfurt)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Vercel Inc."}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Frontend hosting/delivery"}),a.jsx("td",{className:"border border-border p-2",children:"Global (including EU/USA)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Plausible Insights OÜ"}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"Web analytics (aggregated, cookie-free)"}),a.jsx("td",{className:"border border-border p-2",children:"EU (Estonia)"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"OpenAI, LLC"}),a.jsx("td",{className:"border border-border p-2",children:"Processor"}),a.jsx("td",{className:"border border-border p-2",children:"AI processing via API"}),a.jsx("td",{className:"border border-border p-2",children:"USA"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Stripe Payments Europe Ltd."}),a.jsx("td",{className:"border border-border p-2",children:"Independent controller"}),a.jsx("td",{className:"border border-border p-2",children:"Payment processing"}),a.jsx("td",{className:"border border-border p-2",children:"Ireland/EU"})]})]})]})}),a.jsx("p",{className:"mt-2",children:"Where providers act as processors, we enter into data processing agreements (Art. 28 GDPR) and/or otherwise ensure that appropriate agreements are in place."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.2 International transfers"}),a.jsx("p",{children:"Where personal data is transferred to third countries outside the EU/EEA, this is done on the basis of appropriate safeguards, in particular:"}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"USA:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Standard Contractual Clauses pursuant to Art. 46(2)(c) GDPR (SCCs)"}),a.jsx("li",{children:"Where applicable: EU–US Data Privacy Framework for appropriately certified companies"}),a.jsx("li",{children:"Supplementary technical and organizational measures"})]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Affected services:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Vercel Inc. (hosting) – SCCs; where applicable EU–US DPF"}),a.jsx("li",{children:"OpenAI, LLC (AI processing) – SCCs"})]}),a.jsx("p",{className:"mt-2",children:"Users may request copies of the Standard Contractual Clauses by contacting contact@academly.ai."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"8.3 AI Provider — Important Notice"}),a.jsxs("p",{children:[a.jsx("strong",{className:"text-foreground",children:"OpenAI, LLC"}),a.jsx("br",{}),"3180 18th Street, San Francisco, CA 94110, USA"]}),a.jsx("p",{className:"mt-2",children:"When you use the following features, content from your uploaded documents and interactions is transmitted to OpenAI for processing:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Theory & Background Builder"}),a.jsx("li",{children:"Methods & Approach Builder"}),a.jsx("li",{children:"Supervisor Chat"}),a.jsx("li",{children:"Qualitative Analysis (interview evaluation, codebooks)"}),a.jsx("li",{children:"Document Summaries"}),a.jsx("li",{children:"Topic Explorer"})]}),a.jsxs("p",{className:"mt-2",children:["This means: interview transcripts, research documents, and chat messages you enter are sent to OpenAI's API for analysis. According to OpenAI's API data usage policy, data transmitted via the API is ",a.jsx("strong",{className:"text-foreground",children:"not used to train their models"}),"."]}),a.jsx("p",{className:"mt-2",children:a.jsx("strong",{className:"text-foreground",children:"Important notes:"})}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Transmission is encrypted"}),a.jsx("li",{children:"Standard Contractual Clauses apply for international transfers"}),a.jsx("li",{children:"Data transmitted via the API is not used by OpenAI to train its models, according to OpenAI's API data usage policy"})]}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Legal basis:"})," performance of the contract (Art. 6(1)(b) GDPR), as AI processing is a core feature of the platform."]}),a.jsxs("p",{className:"mt-2",children:["Further information:"," ",a.jsx("a",{href:"https://openai.com/policies/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://openai.com/policies/privacy-policy"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"9. Retention and Deletion"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.1 Retention periods by data category"}),a.jsx("div",{className:"mt-4 overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse border border-border text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-muted",children:[a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Data category"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Retention period"}),a.jsx("th",{className:"border border-border p-2 text-left text-foreground",children:"Reason"})]})}),a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Account data"}),a.jsx("td",{className:"border border-border p-2",children:"Until account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Documents"}),a.jsx("td",{className:"border border-border p-2",children:"Per user settings or upon account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"AI-generated content"}),a.jsx("td",{className:"border border-border p-2",children:"Until deleted by user or account deletion"}),a.jsx("td",{className:"border border-border p-2",children:"Performance of contract"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Usage statistics"}),a.jsx("td",{className:"border border-border p-2",children:"12 months"}),a.jsx("td",{className:"border border-border p-2",children:"Legitimate interests"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Payment/invoice data"}),a.jsx("td",{className:"border border-border p-2",children:"7 years"}),a.jsx("td",{className:"border border-border p-2",children:"Statutory retention obligation"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border border-border p-2",children:"Server logs"}),a.jsx("td",{className:"border border-border p-2",children:"30 days"}),a.jsx("td",{className:"border border-border p-2",children:"IT security"})]})]})]})})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.2 Automatic deletion of inactive accounts"}),a.jsx("p",{children:"Inactive accounts are automatically deleted after 24 months without login and/or without active use, unless statutory retention obligations or legitimate interests (e.g., legal enforcement) prevent deletion. Before deletion, we will inform users by email where possible and provide an opportunity to export data."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"9.3 Backup retention"}),a.jsx("p",{children:"To ensure data integrity, daily full backups are created. Backups are retained on a rolling basis for 7 days; the oldest backup is overwritten thereafter. Backup retention is intended solely for disaster recovery and is not an archiving service."})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"10. Data Security"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.1 Technical measures"}),a.jsx("p",{children:"We implement technical measures to protect personal data, including:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Encryption:"})," all data transmissions via TLS/HTTPS (at least TLS 1.2)"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Password hashing:"})," passwords stored using secure, up-to-date hashing algorithms"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Row Level Security (RLS):"})," database access restricted via row-level policies"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Access controls:"})," restricting access to authorized systems"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Regular updates:"})," applying security patches and updates"]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.2 Organizational measures"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Access to personal data is limited to what is necessary"}),a.jsx("li",{children:"Security-relevant accesses are logged where appropriate"}),a.jsx("li",{children:"Security measures are reviewed regularly"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"10.3 Incident response"}),a.jsx("p",{children:"In the event of a personal data breach, we will:"}),a.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[a.jsx("li",{children:"Notify the competent supervisory authority within 72 hours where required under Art. 33 GDPR"}),a.jsx("li",{children:"Notify affected individuals without undue delay where required under Art. 34 GDPR"}),a.jsx("li",{children:"Document the incident and take remedial measures"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"11. Data Subject Rights"}),a.jsx("p",{className:"mb-4",children:"You have the following rights regarding your personal data:"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.1 Right of access (Art. 15 GDPR)"}),a.jsx("p",{children:"You have the right to obtain information about personal data processed by us. The platform provides a data export function allowing you to download your data."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.2 Right to rectification (Art. 16 GDPR)"}),a.jsx("p",{children:"You have the right to request correction of inaccurate personal data. Many data fields can be edited directly in your account."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.3 Right to erasure (Art. 17 GDPR)"}),a.jsx("p",{children:"You have the right to request deletion of your personal data, unless statutory retention obligations apply. Full deletion can be performed via the account deletion function or by contacting contact@academly.ai."}),a.jsxs("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg border border-border",children:[a.jsx("h5",{className:"font-medium text-foreground mb-3",children:"What happens when you delete your account:"}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Immediately and permanently deleted:"})}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1 mb-4",children:[a.jsx("li",{children:"Your email address and profile information (nickname, university, research interests)"}),a.jsx("li",{children:"All uploaded documents and PDFs"}),a.jsx("li",{children:"All generated summaries and analyses"}),a.jsx("li",{children:"All thesis drafts, chapters, and sections"}),a.jsx("li",{children:"All research setups and topic explorations"}),a.jsx("li",{children:"All qualitative coding data (interviews, codebooks, coded segments)"}),a.jsx("li",{children:"All files stored in our cloud storage"})]}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Anonymized (retained without personal reference):"})}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1 mb-4",children:[a.jsx("li",{children:"Transaction records required for tax/accounting compliance (§ 132 BAO Austria: 7 years)"}),a.jsx("li",{children:"Usage statistics (aggregated, with no possibility of personal identification)"})]}),a.jsx("p",{className:"text-sm mb-2",children:a.jsx("strong",{className:"text-foreground",children:"Third-party data:"})}),a.jsx("p",{className:"text-sm mb-4",children:"We will cancel any active subscription with Stripe. Stripe retains payment records according to their own retention policy (typically 7 years for tax/legal compliance). For deletion of data held by Stripe, please contact Stripe directly or visit their privacy portal."}),a.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/50 p-3 rounded-md border border-amber-200 dark:border-amber-800",children:a.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[a.jsx("strong",{children:"Important:"}),' Before deleting your account, we recommend downloading a complete backup of your data using the "Download Backup" function in your account settings. This backup includes all your documents, summaries, thesis drafts, and qualitative coding data in standard formats.']})})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.4 Right to restriction of processing (Art. 18 GDPR)"}),a.jsx("p",{children:"Under certain conditions, you have the right to request restriction of processing."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.5 Right to data portability (Art. 20 GDPR)"}),a.jsx("p",{children:"You have the right to receive your personal data in a structured, commonly used and machine-readable format. The platform offers export functions (DOCX, TXT, backup ZIP) for your content."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.6 Right to object (Art. 21 GDPR)"}),a.jsx("p",{children:"You have the right to object, on grounds relating to your particular situation, at any time to processing based on Art. 6(1)(f) GDPR."}),a.jsx("p",{className:"mt-2",children:"You may object to direct marketing at any time without giving reasons."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.7 Withdrawal of consent (Art. 7(3) GDPR)"}),a.jsx("p",{children:"Where processing is based on consent, you may withdraw your consent at any time with effect for the future. The lawfulness of processing prior to withdrawal remains unaffected."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"11.8 Right to lodge a complaint with a supervisory authority"}),a.jsx("p",{children:"You have the right to lodge a complaint with a data protection supervisory authority. The competent authority for us is:"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Austrian Data Protection Authority (Österreichische Datenschutzbehörde)"}),a.jsx("br",{}),"Barichgasse 40-42",a.jsx("br",{}),"1030 Vienna, Austria",a.jsx("br",{}),"Email: dsb@dsb.gv.at"]}),a.jsxs("p",{className:"mt-2",children:["Website:"," ",a.jsx("a",{href:"https://www.dsb.gv.at",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://www.dsb.gv.at"})]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"12. Special Notes on AI Processing"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.1 Automated decision-making"}),a.jsx("p",{children:"We do not carry out automated decision-making, including profiling, that produces legal effects concerning users or similarly significantly affects them (Art. 22 GDPR)."}),a.jsx("p",{className:"mt-2",children:"AI-generated content is provided as working drafts only and has no legal or academic binding effect."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.2 Use of data for AI training"}),a.jsxs("p",{children:[a.jsx("strong",{className:"text-foreground",children:"Important note:"})," User data is not used to train external AI models."]}),a.jsx("p",{className:"mt-2",children:"Data transmitted to OpenAI via our API integration is not used to train models according to OpenAI's API data usage policy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"12.3 AI-generated content"}),a.jsx("p",{children:"AI-generated content may be labeled as such, in particular where this is required for transparency or to meet regulatory requirements. This is intended to be in line with applicable transparency requirements, including those arising under the EU AI Act (Regulation (EU) 2024/1689)."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Note:"})," AI-generated content may contain errors, inaccuracies, or outdated information. Users are responsible for reviewing and deciding how to use such content."]})]})]})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"13. Changes to this Privacy Policy"}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"13.1 Updates"}),a.jsx("p",{children:"We reserve the right to update this Privacy Policy to reflect changes in legal requirements or changes to our services."}),a.jsx("p",{className:"mt-2",children:"In the event of material changes, registered users will be informed by email. The current version is available on our platform at academly.ai/legal."}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Date of last update:"})," May 2026"]})]})})]}),a.jsxs("section",{children:[a.jsx("h3",{className:"font-semibold text-xl text-foreground mb-4",children:"14. Contact"}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-foreground mb-2",children:"14.1 Data protection inquiries"}),a.jsx("p",{children:"For questions about data protection, exercising your rights, or complaints, please contact:"}),a.jsxs("p",{className:"mt-2",children:[a.jsx("strong",{className:"text-foreground",children:"Email:"})," contact@academly.ai"]}),a.jsx("p",{className:"mt-2",children:"We aim to respond to requests within one month."})]})})]})]})]})})]})})})}),a.jsx(bi,{})]})},pot=id("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),td=S.forwardRef(({className:t,variant:e,...r},n)=>a.jsx("div",{ref:n,role:"alert",className:Oe(pot({variant:e}),t),...r}));td.displayName="Alert";const z8=S.forwardRef(({className:t,...e},r)=>a.jsx("h5",{ref:r,className:Oe("mb-1 font-medium leading-none tracking-tight",t),...e}));z8.displayName="AlertTitle";const rd=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{ref:r,className:Oe("text-sm [&_p]:leading-relaxed",t),...e}));rd.displayName="AlertDescription";const UG="2026-01-15",mot=!1;function got({defaultIsLogin:t=!1}){const[e,r]=S.useState(t),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(!1),[p,g]=S.useState(""),[m,v]=S.useState(!1),[y,x]=S.useState(!1),[b,w]=S.useState(""),[j,N]=S.useState(!1),[C,k]=S.useState(!1),[E,M]=S.useState(""),[z,I]=S.useState(!1),[q,A]=S.useState(!1),{signIn:U,signUp:K}=Pt(),G=async $=>{if($.preventDefault(),x(!0),w(""),e){const{error:L}=await U(n,i);L&&w(L.message)}else{if(i!==l){w("Passwords do not match"),x(!1);return}if(!m){w("Please accept the Terms of Service and Privacy Policy"),x(!1);return}const L={terms_accepted_at:new Date().toISOString(),privacy_accepted_at:new Date().toISOString(),terms_version:UG,privacy_version:UG},{error:F}=await K(n,i,L);F?w(F.message):N(!0)}x(!1)},Y=async $=>{$.preventDefault(),A(!0),w("");try{const{error:L}=await be.auth.resetPasswordForEmail(E,{redirectTo:"https://academly.ai/reset-password"});if(L)throw L;I(!0)}catch(L){w(L.message||"Failed to send reset email")}finally{A(!1)}},H=()=>{r(!e),k(!1),c(""),d(!1),f(!1),g(""),v(!1),w(""),N(!1),I(!1)};return j?a.jsxs("div",{className:"w-full max-w-5xl mx-auto grid lg:grid-cols-2 gap-12 lg:gap-16 items-center",children:[a.jsxs("div",{className:"text-center lg:text-left space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground",children:["Welcome to",a.jsx("span",{className:"text-primary",children:" Academly"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Your AI-powered research assistant. Structure your thesis, manage sources, and create properly cited drafts."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(RE,{className:"w-4.5 h-4.5 text-primary"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Writing Suite"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Theory, Methods, Discussion & Conclusion"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-emerald-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(vx,{className:"w-4.5 h-4.5 text-emerald-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Qualitative Analysis"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Full Mayring workflow — codebook, coding & findings"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-orange-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Wm,{className:"w-4.5 h-4.5 text-orange-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Your personal thesis coach, available 24/7"})]})]})]})]}),a.jsx("div",{className:"w-full max-w-md mx-auto lg:mx-0",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center mx-auto mb-6",children:a.jsx(dc,{className:"w-8 h-8 text-emerald-500"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Check your inbox!"}),a.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground mb-6",children:[a.jsx(FJ,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:n})]}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"We've sent a confirmation email to your address. Please click the link in the email to activate your account."}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Didn't receive the email? Check your spam folder or try again."}),a.jsx(ve,{variant:"outline",onClick:H,className:"w-full h-12 rounded-full",children:"Back to Login"})]})]})})]}):a.jsxs("div",{className:"w-full max-w-5xl mx-auto grid lg:grid-cols-2 gap-12 lg:gap-16 items-center",children:[a.jsxs("div",{className:"text-center lg:text-left space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-foreground",children:["Welcome to",a.jsx("span",{className:"text-primary",children:" Academly"})]}),a.jsx("p",{className:"text-xl text-muted-foreground",children:"Your AI-powered research assistant. Structure your thesis, manage sources, and create properly cited drafts."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(RE,{className:"w-4.5 h-4.5 text-primary"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Writing Suite"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Theory, Methods, Discussion & Conclusion"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-emerald-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(vx,{className:"w-4.5 h-4.5 text-emerald-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Qualitative Analysis"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Full Mayring workflow — codebook, coding & findings"})]})]}),a.jsxs("div",{className:"flex items-start gap-3.5 group",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-orange-500/8 flex items-center justify-center flex-shrink-0 mt-0.5",children:a.jsx(Wm,{className:"w-4.5 h-4.5 text-orange-500"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"AI Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Your personal thesis coach, available 24/7"})]})]})]})]}),a.jsx("div",{className:"w-full max-w-md mx-auto lg:mx-0",children:a.jsx("div",{className:"rounded-3xl border border-border bg-card p-8 shadow-xl",children:C?a.jsx("div",{children:z?a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center mx-auto mb-6",children:a.jsx(dc,{className:"w-8 h-8 text-emerald-500"})}),a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Reset email sent!"}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"Check your inbox for the reset link."}),a.jsx(ve,{variant:"outline",onClick:()=>{k(!1),I(!1)},className:"w-full h-12 rounded-full",children:"Back to Login"})]}):a.jsxs("form",{onSubmit:Y,className:"space-y-5",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Reset Password"}),a.jsx("p",{className:"text-muted-foreground",children:"Enter your email to receive a reset link."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"forgotEmail",className:"text-foreground font-medium",children:"Email"}),a.jsx(Be,{id:"forgotEmail",type:"email",value:E,onChange:$=>M($.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"your@email.com"})]}),b&&a.jsx(td,{className:"border-destructive/50 bg-destructive/10",children:a.jsx(rd,{className:"text-destructive",children:b})}),a.jsx(ve,{type:"submit",disabled:q,className:"w-full h-12 rounded-full text-base font-semibold",children:q?"Sending...":"Send Reset Link"}),a.jsx("div",{className:"text-center pt-2",children:a.jsx("button",{type:"button",onClick:()=>{k(!1),w("")},className:"text-sm text-primary hover:underline font-medium",children:"Back to Login"})})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:e?"Sign In":"Create Account"}),a.jsx("p",{className:"text-muted-foreground",children:e?"Welcome back! Sign in to continue.":"Get started with Academly"})]}),a.jsxs("form",{onSubmit:G,className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"email",className:"text-foreground font-medium",children:"Email"}),a.jsx(Be,{id:"email",type:"email",value:n,onChange:$=>s($.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"your@email.com"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"password",className:"text-foreground font-medium",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Be,{id:"password",type:u?"text":"password",value:i,onChange:$=>o($.target.value),required:!0,className:"h-12 rounded-xl pr-12",placeholder:"At least 6 characters"}),a.jsx("button",{type:"button",onClick:()=>d(!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:u?a.jsx(OE,{className:"h-5 w-5"}):a.jsx(Yi,{className:"h-5 w-5"})})]})]}),e&&a.jsx("div",{className:"text-right",children:a.jsx("button",{type:"button",onClick:()=>{k(!0),M(n),w("")},className:"text-sm text-primary hover:underline",children:"Forgot password?"})}),!e&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirmPassword",className:"text-foreground font-medium",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Be,{id:"confirmPassword",type:h?"text":"password",value:l,onChange:$=>c($.target.value),required:!0,className:"h-12 rounded-xl pr-12",placeholder:"Repeat your password"}),a.jsx("button",{type:"button",onClick:()=>f(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:h?a.jsx(OE,{className:"h-5 w-5"}):a.jsx(Yi,{className:"h-5 w-5"})})]})]}),!e&&mot&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"inviteCode",className:"text-foreground font-medium",children:"Invite Code"}),a.jsx(Be,{id:"inviteCode",type:"text",value:p,onChange:$=>g($.target.value),required:!0,className:"h-12 rounded-xl",placeholder:"Enter your beta invite code"})]}),!e&&a.jsxs(Cue,{id:"terms-consent",checked:m,onCheckedChange:v,required:!0,children:["I agree to the"," ",a.jsx(mt,{to:"/legal?tab=terms",className:"text-primary hover:underline font-medium",target:"_blank",children:"Terms of Service"})," ","and acknowledge the"," ",a.jsx(mt,{to:"/legal?tab=privacy",className:"text-primary hover:underline font-medium",target:"_blank",children:"Privacy Policy"}),"."]}),b&&a.jsx(td,{className:"border-destructive/50 bg-destructive/10",children:a.jsx(rd,{className:"text-destructive",children:b})}),a.jsx(ve,{type:"submit",disabled:y||!e&&!m,className:"w-full h-12 rounded-full text-base font-semibold",children:y?"Loading...":e?"Sign In":"Create Account"}),!e&&a.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"We'll send you account-related emails and occasional product updates. You can unsubscribe anytime."}),a.jsx("div",{className:"text-center pt-2",children:a.jsx("button",{type:"button",onClick:H,className:"text-sm text-primary hover:underline font-medium",children:e?"Don't have an account? Sign up":"Already have an account? Sign in"})})]})]})})})]})}const yot=()=>{const{user:t,loading:e}=Pt(),r=wr(),[n]=Dj(),i=n.get("mode")!=="signup";return S.useEffect(()=>{t&&!e&&r("/dashboard")},[t,e,r]),e?a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Os,{}),a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})]}):t?null:a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Sign In | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/login",noIndex:!0}),a.jsx(Os,{}),a.jsxs("div",{className:"fixed inset-0 -z-10",children:[a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl"})]}),a.jsx("section",{className:"pt-32 pb-20",children:a.jsx(Wr,{children:a.jsx(got,{defaultIsLogin:i})})})]})},vot=()=>{const t=wr(),[e,r]=S.useState(""),[n,s]=S.useState(""),[i,o]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(!1),[h,f]=S.useState(""),[p,g]=S.useState(!1);S.useEffect(()=>{const{data:{subscription:v}}=be.auth.onAuthStateChange((y,x)=>{y==="PASSWORD_RECOVERY"||(y==="SIGNED_OUT"||!x&&!window.location.hash.includes("access_token"))&&t("/login")});return()=>v.unsubscribe()},[t]);const m=async()=>{if(f(""),e!==n){f("Passwords do not match");return}if(e.length<6){f("Password must be at least 6 characters");return}d(!0);try{const{error:v}=await be.auth.updateUser({password:e});if(v)throw v;g(!0),setTimeout(()=>t("/login"),3e3)}catch(v){f(v.message||"Failed to update password")}finally{d(!1)}};return a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Reset Password | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/reset-password",noIndex:!0}),a.jsx(Os,{}),a.jsxs("div",{className:"fixed inset-0 -z-10",children:[a.jsx("div",{className:"absolute top-20 left-1/4 w-72 h-72 bg-primary/20 rounded-full blur-3xl"}),a.jsx("div",{className:"absolute top-40 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl"})]}),a.jsx("section",{className:"pt-32 pb-20",children:a.jsx(Wr,{children:a.jsx("div",{className:"max-w-md mx-auto",children:a.jsxs(Me,{children:[a.jsxs(qe,{className:"text-center",children:[a.jsx(Je,{className:"text-2xl",children:"Set new password"}),a.jsx(fn,{children:"Enter your new password below."})]}),a.jsx($e,{children:p?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[a.jsx(pl,{className:"w-12 h-12 text-green-500"}),a.jsx("p",{className:"text-lg font-medium",children:"Password updated successfully!"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Redirecting to login…"})]}):a.jsxs("form",{onSubmit:v=>{v.preventDefault(),m()},className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"password",children:"New Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Be,{id:"password",type:i?"text":"password",value:e,onChange:v=>r(v.target.value),placeholder:"Min. 6 characters",required:!0}),a.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>o(!i),children:i?a.jsx(OE,{className:"w-4 h-4"}):a.jsx(Yi,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirm",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Be,{id:"confirm",type:l?"text":"password",value:n,onChange:v=>s(v.target.value),placeholder:"Repeat password",required:!0}),a.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>c(!l),children:l?a.jsx(OE,{className:"w-4 h-4"}):a.jsx(Yi,{className:"w-4 h-4"})})]})]}),h&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[a.jsx(Ww,{className:"w-4 h-4 shrink-0"}),h]}),a.jsx(ve,{type:"submit",className:"w-full",disabled:u,children:u?"Updating…":"Update Password"})]})})]})})})})]})},xot=[{feature:"Citations from your own PDFs",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"x",text:"No"}},{feature:"Page-accurate citations",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"x",text:"No"}},{feature:"Hallucinated references",academly:{icon:"x",text:"Never"},chatgpt:{icon:"warning",text:"Frequent"}},{feature:"Qualitative Analysis (Mayring)",academly:{icon:"check",text:"Full workflow"},chatgpt:{icon:"x",text:"No"}},{feature:"Thesis-specific structure",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"warning",text:"Generic"}},{feature:"APA7 citation formatting",academly:{icon:"check",text:"Built-in"},chatgpt:{icon:"warning",text:"Inconsistent"}},{feature:"German language support",academly:{icon:"check",text:"Native"},chatgpt:{icon:"warning",text:"Partial"}},{feature:"Works with uploaded PDFs",academly:{icon:"check",text:"Core feature"},chatgpt:{icon:"x",text:"No"}},{feature:"Free to start",academly:{icon:"check",text:"Yes"},chatgpt:{icon:"check",text:"Yes (limited)"}},{feature:"GDPR compliant (EU)",academly:{icon:"check",text:"Frankfurt servers"},chatgpt:{icon:"warning",text:"US servers"}}],zG=({type:t})=>t==="check"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400 font-medium",children:[a.jsx(Gs,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Yes"})]}):t==="x"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-red-500 dark:text-red-400 font-medium",children:[a.jsx(Rs,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"No"})]}):a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-600 dark:text-amber-400 font-medium",children:[a.jsx(Pa,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Frequent"})]}),bot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Academly vs ChatGPT for Thesis Writing | Academly.ai",description:"ChatGPT invents citations. Academly only cites your own uploaded sources — with exact page numbers.",canonical:"https://academly.ai/vs/chatgpt"}),a.jsx(Os,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Comparison"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Academly vs ChatGPT for Thesis Writing"}),a.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:["ChatGPT is impressive — but it invents citations.",a.jsx("br",{}),"Academly only uses sources you upload."]})]})]}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-4xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-6 md:p-8 border-b border-border",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground",children:"Feature Comparison"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"How Academly stacks up against ChatGPT for academic writing."})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[a.jsx("th",{className:"text-left px-6 py-4 font-semibold text-foreground",children:"Feature"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-primary min-w-[140px]",children:"Academly"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-muted-foreground min-w-[140px]",children:"ChatGPT"})]})}),a.jsx("tbody",{children:xot.map((t,e)=>a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-foreground font-medium",children:t.feature}),a.jsxs("td",{className:"px-6 py-4 text-center",children:[a.jsx(zG,{type:t.academly.icon}),a.jsx("span",{className:"sr-only",children:t.academly.text})]}),a.jsxs("td",{className:"px-6 py-4 text-center",children:[a.jsx(zG,{type:t.chatgpt.icon}),a.jsx("span",{className:"sr-only",children:t.chatgpt.text})]})]},e))})]})})]})})}),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6 space-y-16",children:[a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(Pa,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Why ChatGPT Hallucinates Citations"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"ChatGPT is a language model trained on internet text. When generating citations, it produces what a citation probably looks like based on patterns — not actual sources. This fails for specific editions, regional journals, and recently published papers."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(FF,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"How Academly Solves This"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"You upload your PDFs. Academly extracts text by page and only passes that text to the AI. The AI can only cite what you uploaded — the constraint is architectural, not instructional."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(Sxe,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"When ChatGPT Is Still Useful"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Great for brainstorming, concept explanations, grammar checking. Not reliable for citations or chapter generation that needs traceable sources."})]})]})})]})}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-10 md:p-14 text-center",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Try Academly free"}),a.jsx("p",{className:"text-muted-foreground mb-8 max-w-lg mx-auto leading-relaxed",children:"2,000 credits, no credit card needed."}),a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8 text-base font-semibold",children:a.jsxs(mt,{to:"/login",children:["Get started free ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})})})]}),a.jsx(bi,{})]}),wot=[{feature:"Upload & cite your own PDFs",academly:{icon:"check",text:"Core feature"},jenni:{icon:"warning",text:"Limited"}},{feature:"Page-accurate citations",academly:{icon:"check",text:"Yes"},jenni:{icon:"warning",text:"Inconsistent"}},{feature:"Qualitative Analysis (Mayring)",academly:{icon:"check",text:"Full workflow"},jenni:{icon:"x",text:"No"}},{feature:"Theory chapter generation",academly:{icon:"check",text:"From your sources"},jenni:{icon:"warning",text:"Generic"}},{feature:"Methods & Approach Builder",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"Topic Explorer",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"AI Thesis Supervisor",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"Literature search",academly:{icon:"check",text:"CrossRef + OpenAlex"},jenni:{icon:"x",text:"No"}},{feature:"German language (native)",academly:{icon:"check",text:"Yes"},jenni:{icon:"warning",text:"Partial"}},{feature:"Mayring workflow",academly:{icon:"check",text:"Yes"},jenni:{icon:"x",text:"No"}},{feature:"GDPR / EU data storage",academly:{icon:"check",text:"Frankfurt"},jenni:{icon:"x",text:"US"}},{feature:"Free tier",academly:{icon:"check",text:"2,000 credits"},jenni:{icon:"warning",text:"Very limited"}},{feature:"Price",academly:{icon:"text",text:"From €15.99/mo"},jenni:{icon:"text",text:"From $20/mo"}}],HG=({type:t,text:e})=>t==="check"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400 font-medium",children:[a.jsx(Gs,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}):t==="x"?a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-red-500 dark:text-red-400 font-medium",children:[a.jsx(Rs,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}):t==="text"?a.jsx("span",{className:"text-foreground font-medium",children:e}):a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-600 dark:text-amber-400 font-medium",children:[a.jsx(Pa,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:e})]}),_ot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Academly vs Jenni AI — Thesis Writing | Academly.ai",description:"Jenni AI helps you write. Academly helps you write from your own sources — Mayring, APA7, no hallucinated references.",canonical:"https://academly.ai/vs/jenni-ai"}),a.jsx(Os,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Comparison"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Academly vs Jenni AI for Thesis Writing"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:"Jenni helps you write. Academly helps you write from your own sources."})]})]}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-4xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-border bg-card shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"p-6 md:p-8 border-b border-border",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground",children:"Feature Comparison"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"How Academly stacks up against Jenni AI for academic writing."})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[a.jsx("th",{className:"text-left px-6 py-4 font-semibold text-foreground",children:"Feature"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-primary min-w-[160px]",children:"Academly"}),a.jsx("th",{className:"text-center px-6 py-4 font-semibold text-muted-foreground min-w-[160px]",children:"Jenni AI"})]})}),a.jsx("tbody",{children:wot.map((t,e)=>a.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-foreground font-medium",children:t.feature}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsx(HG,{type:t.academly.icon,text:t.academly.text})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsx(HG,{type:t.jenni.icon,text:t.jenni.text})})]},e))})]})})]})})}),a.jsx("section",{className:"py-16",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-6 space-y-16",children:[a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(Uxe,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Writing Assistant vs Thesis Platform"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Jenni AI is a writing assistant — it suggests sentences as you type. Academly is a thesis platform — it structures chapters, cites your uploaded PDFs by page number, and guides you through the entire research workflow from topic to conclusion."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(xi,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"The Mayring Difference"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Qualitative content analysis by Mayring is a standard method in German-speaking academia. Academly includes a full qualitative workflow — codebook creation, interview coding, and category-based analysis. Jenni AI does not support qualitative research methods."})]})]})}),a.jsx("div",{className:"rounded-3xl border border-border bg-card shadow-sm p-8 md:p-10",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"rounded-xl bg-primary/10 p-3 text-primary shrink-0",children:a.jsx(RE,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"When Jenni AI Might Be Better"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"If you only need sentence-level suggestions and paraphrasing for short essays, Jenni AI is fast and lightweight. For thesis work that requires source-based citations, chapter structure, and methodological rigor, Academly is purpose-built."})]})]})})]})}),a.jsx("section",{className:"py-16",children:a.jsx("div",{className:"max-w-3xl mx-auto px-6",children:a.jsxs("div",{className:"rounded-3xl border border-primary/20 bg-primary/5 p-10 md:p-14 text-center",children:[a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Try Academly free"}),a.jsx("p",{className:"text-muted-foreground mb-8 max-w-lg mx-auto leading-relaxed",children:"No credit card needed."}),a.jsx(ve,{asChild:!0,className:"rounded-full h-12 px-8 text-base font-semibold",children:a.jsxs(mt,{to:"/login",children:["Get started free ",a.jsx(uc,{className:"h-4 w-4 ml-2"})]})})]})})})]}),a.jsx(bi,{})]}),jot=[{category:"Comparisons",title:"Academly vs ChatGPT for Thesis Writing",description:"ChatGPT invents citations. See how Academly only cites your own uploaded sources, with exact page numbers.",href:"/vs/chatgpt",readTime:"5 min"},{category:"Comparisons",title:"Academly vs Jenni AI for Thesis Writing",description:"Jenni helps you write. Academly helps you write from your own sources — with Mayring, APA7, and zero hallucinations.",href:"/vs/jenni-ai",readTime:"5 min"}],Sot=()=>a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(ea,{title:"Blog — Thesis Writing Guides & Academic Tips | Academly",description:"Step-by-step guides for Bachelor and Master thesis students. Mayring analysis, APA7 citations, research methodology and more.",canonical:"https://academly.ai/blog"}),a.jsx(Os,{}),a.jsxs("main",{children:[a.jsxs("section",{className:"relative pt-32 pb-16 overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-primary/5 via-transparent to-transparent"}),a.jsxs("div",{className:"relative max-w-4xl mx-auto px-6 text-center",children:[a.jsx("p",{className:"text-sm uppercase tracking-wider text-primary mb-4 font-medium",children:"Blog"}),a.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6",children:"Thesis Writing Guides"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto leading-relaxed",children:"Practical guides for Bachelor and Master students — from research methods to citations."})]})]}),a.jsx("section",{className:"pb-24",children:a.jsx("div",{className:"max-w-5xl mx-auto px-6",children:a.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:jot.map(t=>a.jsxs(mt,{to:t.href,className:"group rounded-3xl border border-border bg-card shadow-sm p-8 hover:shadow-md hover:border-primary/30 transition-all flex flex-col",children:[a.jsx("span",{className:"inline-flex items-center self-start rounded-full bg-primary/10 text-primary text-xs font-semibold uppercase tracking-wider px-3 py-1 mb-4",children:t.category}),a.jsx("h2",{className:"text-xl md:text-2xl font-bold text-foreground mb-3 group-hover:text-primary transition-colors",children:t.title}),a.jsx("p",{className:"text-muted-foreground leading-relaxed line-clamp-2 mb-6",children:t.description}),a.jsxs("div",{className:"mt-auto flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(s0,{className:"h-4 w-4"}),t.readTime]}),a.jsxs("span",{className:"inline-flex items-center gap-1 font-semibold text-primary",children:["Read more",a.jsx(uc,{className:"h-4 w-4 transition-transform group-hover:translate-x-0.5"})]})]})]},t.href))})})})]}),a.jsx(bi,{})]}),yl=S.forwardRef(({className:t,...e},r)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:r,className:Oe("w-full caption-bottom text-sm",t),...e})}));yl.displayName="Table";const vl=S.forwardRef(({className:t,...e},r)=>a.jsx("thead",{ref:r,className:Oe("[&_tr]:border-b",t),...e}));vl.displayName="TableHeader";const xl=S.forwardRef(({className:t,...e},r)=>a.jsx("tbody",{ref:r,className:Oe("[&_tr:last-child]:border-0",t),...e}));xl.displayName="TableBody";const Not=S.forwardRef(({className:t,...e},r)=>a.jsx("tfoot",{ref:r,className:Oe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Not.displayName="TableFooter";const Nn=S.forwardRef(({className:t,...e},r)=>a.jsx("tr",{ref:r,className:Oe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Nn.displayName="TableRow";const yt=S.forwardRef(({className:t,...e},r)=>a.jsx("th",{ref:r,className:Oe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));yt.displayName="TableHead";const vt=S.forwardRef(({className:t,...e},r)=>a.jsx("td",{ref:r,className:Oe("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));vt.displayName="TableCell";const Aot=S.forwardRef(({className:t,...e},r)=>a.jsx("caption",{ref:r,className:Oe("mt-4 text-sm text-muted-foreground",t),...e}));Aot.displayName="TableCaption";var nde="AlertDialog",[Eot,kyt]=Ln(nde,[Gre]),dd=Gre(),sde=t=>{const{__scopeAlertDialog:e,...r}=t,n=dd(e);return a.jsx(E6,{...n,...r,modal:!0})};sde.displayName=nde;var Cot="AlertDialogTrigger",ide=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=dd(r);return a.jsx(C6,{...s,...n,ref:e})});ide.displayName=Cot;var kot="AlertDialogPortal",ade=t=>{const{__scopeAlertDialog:e,...r}=t,n=dd(e);return a.jsx(k6,{...n,...r})};ade.displayName=kot;var Tot="AlertDialogOverlay",ode=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=dd(r);return a.jsx(Vj,{...s,...n,ref:e})});ode.displayName=Tot;var By="AlertDialogContent",[Pot,Oot]=Eot(By),Iot=oJ("AlertDialogContent"),lde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,children:n,...s}=t,i=dd(r),o=S.useRef(null),l=jt(e,o),c=S.useRef(null);return a.jsx(JEe,{contentName:By,titleName:cde,docsSlug:"alert-dialog",children:a.jsx(Pot,{scope:r,cancelRef:c,children:a.jsxs(qj,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:ze(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(Iot,{children:n}),a.jsx(Mot,{contentRef:o})]})})})});lde.displayName=By;var cde="AlertDialogTitle",ude=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=dd(r);return a.jsx(Gj,{...s,...n,ref:e})});ude.displayName=cde;var dde="AlertDialogDescription",hde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=dd(r);return a.jsx(Kj,{...s,...n,ref:e})});hde.displayName=dde;var Rot="AlertDialogAction",fde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,s=dd(r);return a.jsx(kT,{...s,...n,ref:e})});fde.displayName=Rot;var pde="AlertDialogCancel",mde=S.forwardRef((t,e)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:s}=Oot(pde,r),i=dd(r),o=jt(e,s);return a.jsx(kT,{...i,...n,ref:o})});mde.displayName=pde;var Mot=({contentRef:t})=>{const e=`\`${By}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${By}\` by passing a \`${dde}\` component as a child, which also benefits sighted users by adding visible context to the dialog.

Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${By}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.

For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Dot=sde,Lot=ide,Fot=ade,gde=ode,yde=lde,vde=fde,xde=mde,bde=ude,wde=hde;const wi=Dot,wo=Lot,$ot=Fot,_de=S.forwardRef(({className:t,...e},r)=>a.jsx(gde,{className:Oe("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));_de.displayName=gde.displayName;const Qs=S.forwardRef(({className:t,...e},r)=>a.jsxs($ot,{children:[a.jsx(_de,{}),a.jsx(yde,{ref:r,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Qs.displayName=yde.displayName;const Zs=({className:t,...e})=>a.jsx("div",{className:Oe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Zs.displayName="AlertDialogHeader";const Js=({className:t,...e})=>a.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Js.displayName="AlertDialogFooter";const ei=S.forwardRef(({className:t,...e},r)=>a.jsx(bde,{ref:r,className:Oe("text-lg font-semibold",t),...e}));ei.displayName=bde.displayName;const ti=S.forwardRef(({className:t,...e},r)=>a.jsx(wde,{ref:r,className:Oe("text-sm text-muted-foreground",t),...e}));ti.displayName=wde.displayName;const Cs=S.forwardRef(({className:t,...e},r)=>a.jsx(vde,{ref:r,className:Oe(u6(),t),...e}));Cs.displayName=vde.displayName;const Is=S.forwardRef(({className:t,...e},r)=>a.jsx(xde,{ref:r,className:Oe(u6({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Is.displayName=xde.displayName;const ui=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),u5=[.001,0,0,.001,0,0],pI=1.35,wa={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Rd={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},jde="pdfjs_internal_editor_",kt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101,COMMENT:102},Kt={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},Bot={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},$s={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},TA={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},kn={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},Ug={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},$2={ERRORS:0,WARNINGS:1,INFOS:5},nk={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},LN={moveTo:0,lineTo:1,curveTo:2,closePath:3},Uot={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let B2=$2.WARNINGS;function zot(t){Number.isInteger(t)&&(B2=t)}function Hot(){return B2}function U2(t){B2>=$2.INFOS&&console.log(`Info: ${t}`)}function Tt(t){B2>=$2.WARNINGS&&console.log(`Warning: ${t}`)}function br(t){throw new Error(t)}function Rn(t,e){t||br(e)}function Wot(t){switch(t==null?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Sde(t,e=null,r=null){if(!t)return null;if(r&&typeof t=="string"){if(r.addDefaultProtocol&&t.startsWith("www.")){const s=t.match(/\./g);(s==null?void 0:s.length)>=2&&(t=`http://${t}`)}if(r.tryConvertEncoding)try{t=Yot(t)}catch{}}const n=e?URL.parse(t,e):URL.parse(t);return Wot(n)?n:null}function Nde(t,e,r=!1){const n=URL.parse(t);return n?(n.hash=e,n.href):r&&Sde(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Ut(t,e,r,n=!1){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const gg=function(){function e(r,n){this.message=r,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class WG extends gg{constructor(e,r){super(e,"PasswordException"),this.code=r}}class mI extends gg{constructor(e,r){super(e,"UnknownErrorException"),this.details=r}}class d5 extends gg{constructor(e){super(e,"InvalidPDFException")}}class sk extends gg{constructor(e,r,n){super(e,"ResponseException"),this.status=r,this.missing=n}}class Vot extends gg{constructor(e){super(e,"FormatError")}}class nf extends gg{constructor(e){super(e,"AbortException")}}function Ade(t){(typeof t!="object"||(t==null?void 0:t.length)===void 0)&&br("Invalid argument for bytesToString");const e=t.length,r=8192;if(e<r)return String.fromCharCode.apply(null,t);const n=[];for(let s=0;s<e;s+=r){const i=Math.min(s+r,e),o=t.subarray(s,i);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function uS(t){typeof t!="string"&&br("Invalid argument for stringToBytes");const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;++n)r[n]=t.charCodeAt(n)&255;return r}function qot(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function Got(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function Kot(){try{return new Function(""),!0}catch{return!1}}class ks{static get isLittleEndian(){return Ut(this,"isLittleEndian",Got())}static get isEvalSupported(){return Ut(this,"isEvalSupported",Kot())}static get isOffscreenCanvasSupported(){return Ut(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ut(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:r}=navigator;return Ut(this,"platform",{isAndroid:r.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:r.includes("Firefox")})}static get isCSSRoundSupported(){var e,r;return Ut(this,"isCSSRoundSupported",(r=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:r.call(e,"width: round(1.5px, 1px)"))}}const gI=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));var Uu,PA,h5;class ft{static makeHexColor(e,r,n){return`#${gI[e]}${gI[r]}${gI[n]}`}static scaleMinMax(e,r){let n;e[0]?(e[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[0],r[2]*=e[0],e[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[3],r[3]*=e[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,e[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=e[1],r[3]*=e[1],e[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=e[2],r[2]*=e[2]),r[0]+=e[4],r[1]+=e[5],r[2]+=e[4],r[3]+=e[5]}static transform(e,r){return[e[0]*r[0]+e[2]*r[1],e[1]*r[0]+e[3]*r[1],e[0]*r[2]+e[2]*r[3],e[1]*r[2]+e[3]*r[3],e[0]*r[4]+e[2]*r[5]+e[4],e[1]*r[4]+e[3]*r[5]+e[5]]}static applyTransform(e,r,n=0){const s=e[n],i=e[n+1];e[n]=s*r[0]+i*r[2]+r[4],e[n+1]=s*r[1]+i*r[3]+r[5]}static applyTransformToBezier(e,r,n=0){const s=r[0],i=r[1],o=r[2],l=r[3],c=r[4],u=r[5];for(let d=0;d<6;d+=2){const h=e[n+d],f=e[n+d+1];e[n+d]=h*s+f*o+c,e[n+d+1]=h*i+f*l+u}}static applyInverseTransform(e,r){const n=e[0],s=e[1],i=r[0]*r[3]-r[1]*r[2];e[0]=(n*r[3]-s*r[2]+r[2]*r[5]-r[4]*r[3])/i,e[1]=(-n*r[1]+s*r[0]+r[4]*r[1]-r[5]*r[0])/i}static axialAlignedBoundingBox(e,r,n){const s=r[0],i=r[1],o=r[2],l=r[3],c=r[4],u=r[5],d=e[0],h=e[1],f=e[2],p=e[3];let g=s*d+c,m=g,v=s*f+c,y=v,x=l*h+u,b=x,w=l*p+u,j=w;if(i!==0||o!==0){const N=i*d,C=i*f,k=o*h,E=o*p;g+=k,y+=k,v+=E,m+=E,x+=N,j+=N,w+=C,b+=C}n[0]=Math.min(n[0],g,v,m,y),n[1]=Math.min(n[1],x,w,b,j),n[2]=Math.max(n[2],g,v,m,y),n[3]=Math.max(n[3],x,w,b,j)}static inverseTransform(e){const r=e[0]*e[3]-e[1]*e[2];return[e[3]/r,-e[1]/r,-e[2]/r,e[0]/r,(e[2]*e[5]-e[4]*e[3])/r,(e[4]*e[1]-e[5]*e[0])/r]}static singularValueDecompose2dScale(e,r){const n=e[0],s=e[1],i=e[2],o=e[3],l=n**2+s**2,c=n*i+s*o,u=i**2+o**2,d=(l+u)/2,h=Math.sqrt(d**2-(l*u-c**2));r[0]=Math.sqrt(d+h||1),r[1]=Math.sqrt(d-h||1)}static normalizeRect(e){const r=e.slice(0);return e[0]>e[2]&&(r[0]=e[2],r[2]=e[0]),e[1]>e[3]&&(r[1]=e[3],r[3]=e[1]),r}static intersect(e,r){const n=Math.max(Math.min(e[0],e[2]),Math.min(r[0],r[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(r[0],r[2]));if(n>s)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(r[1],r[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(r[1],r[3]));return i>o?null:[n,i,s,o]}static pointBoundingBox(e,r,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],r),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],r)}static rectBoundingBox(e,r,n,s,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],r,s),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],r,s)}static bezierBoundingBox(e,r,n,s,i,o,l,c,u){u[0]=Math.min(u[0],e,l),u[1]=Math.min(u[1],r,c),u[2]=Math.max(u[2],e,l),u[3]=Math.max(u[3],r,c),ce(this,Uu,h5).call(this,e,n,i,l,r,s,o,c,3*(-e+3*(n-i)+l),6*(e-2*n+i),3*(n-e),u),ce(this,Uu,h5).call(this,e,n,i,l,r,s,o,c,3*(-r+3*(s-o)+c),6*(r-2*s+o),3*(s-r),u)}}Uu=new WeakSet,PA=function(e,r,n,s,i,o,l,c,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,g=h*(h*(h*e+3*u*r)+3*f*n)+p*s,m=h*(h*(h*i+3*u*o)+3*f*l)+p*c;d[0]=Math.min(d[0],g),d[1]=Math.min(d[1],m),d[2]=Math.max(d[2],g),d[3]=Math.max(d[3],m)},h5=function(e,r,n,s,i,o,l,c,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&ce(this,Uu,PA).call(this,e,r,n,s,i,o,l,c,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const g=Math.sqrt(p),m=2*u;ce(this,Uu,PA).call(this,e,r,n,s,i,o,l,c,(-d+g)/m,f),ce(this,Uu,PA).call(this,e,r,n,s,i,o,l,c,(-d-g)/m,f)},se(ft,Uu);function Yot(t){return decodeURIComponent(escape(t))}let yI=null,VG=null;function Xot(t){return yI||(yI=/([\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,VG=new Map([["ſt","ſt"]])),t.replaceAll(yI,(e,r,n)=>r?r.normalize("NFKC"):VG.get(n))}function Ede(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),Ade(t)}const H8="pdfjs_internal_id_";function Qot(t,e,r){if(!Array.isArray(r)||r.length<2)return!1;const[n,s,...i]=r;if(!t(n)&&!Number.isInteger(n)||!e(s))return!1;const o=i.length;let l=!0;switch(s.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 i)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function di(t,e,r){return Math.min(Math.max(t,e),r)}function Cde(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(Ade(t))}function Zot(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):uS(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(r=>{r(t(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,r)=>e+r,0)});const $c="http://www.w3.org/2000/svg",ep=class ep{};Le(ep,"CSS",96),Le(ep,"PDF",72),Le(ep,"PDF_TO_CSS_UNITS",ep.CSS/ep.PDF);let sf=ep;async function dS(t,e="text"){if(Ib(t,document.baseURI)){const r=await fetch(t);if(!r.ok)throw new Error(r.statusText);switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(e){case"arraybuffer":case"blob":case"json":r(s.response);return}r(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}class hS{constructor({viewBox:e,userUnit:r,scale:n,rotation:s,offsetX:i=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=r,this.scale=n,this.rotation=s,this.offsetX=i,this.offsetY=o,n*=r;const c=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let d,h,f,p;switch(s%=360,s<0&&(s+=360),s){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=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 g,m,v,y;d===0?(g=Math.abs(u-e[1])*n+i,m=Math.abs(c-e[0])*n+o,v=(e[3]-e[1])*n,y=(e[2]-e[0])*n):(g=Math.abs(c-e[0])*n+i,m=Math.abs(u-e[1])*n+o,v=(e[2]-e[0])*n,y=(e[3]-e[1])*n),this.transform=[d*n,h*n,f*n,p*n,g-d*n*c-f*n*u,m-h*n*c-p*n*u],this.width=v,this.height=y}get rawDims(){const e=this.viewBox;return Ut(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:i=!1}={}){return new hS({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:s,dontFlip:i})}convertToViewportPoint(e,r){const n=[e,r];return ft.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const r=[e[0],e[1]];ft.applyTransform(r,this.transform);const n=[e[2],e[3]];return ft.applyTransform(n,this.transform),[r[0],r[1],n[0],n[1]]}convertToPdfPoint(e,r){const n=[e,r];return ft.applyInverseTransform(n,this.transform),n}}class W8 extends gg{constructor(e,r=0){super(e,"RenderingCancelledException"),this.extraDelay=r}}function z2(t){const e=t.length;let r=0;for(;r<e&&t[r].trim()==="";)r++;return t.substring(r,r+5).toLowerCase()==="data:"}function V8(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function Jot(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function elt(t,e="document.pdf"){if(typeof t!="string")return e;if(z2(t))return Tt('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}}}}})(t);if(!n)return e;const s=l=>{try{let c=decodeURIComponent(l);return c.includes("/")?(c=c.split("/").at(-1),c.test(/^\.pdf$/i)?c:l):c}catch{return l}},i=/\.pdf$/i,o=n.pathname.split("/").at(-1);if(i.test(o))return s(o);if(n.searchParams.size>0){const l=Array.from(n.searchParams.values()).reverse();for(const u of l)if(i.test(u))return s(u);const c=Array.from(n.searchParams.keys()).reverse();for(const u of c)if(i.test(u))return s(u)}if(n.hash){const c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(c)return s(c[0])}return e}class qG{constructor(){Le(this,"started",Object.create(null));Le(this,"times",[])}time(e){e in this.started&&Tt(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Tt(`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 r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:s,end:i}of this.times)e.push(`${n.padEnd(r)} ${i-s}ms
`);return e.join("")}}function Ib(t,e){const r=e?URL.parse(t,e):URL.parse(t);return(r==null?void 0:r.protocol)==="http:"||(r==null?void 0:r.protocol)==="https:"}function _o(t){t.preventDefault()}function On(t){t.preventDefault(),t.stopPropagation()}function tlt(t){console.log("Deprecated API usage: "+t)}var X1;class ik{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;_(this,X1)||Q(this,X1,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const r=_(this,X1).exec(e);if(!r)return null;const n=parseInt(r[1],10);let s=parseInt(r[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(r[3],10);i=i>=1&&i<=31?i:1;let o=parseInt(r[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(r[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(r[6],10);c=c>=0&&c<=59?c:0;const u=r[7]||"Z";let d=parseInt(r[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(r[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(o+=d,l+=h):u==="+"&&(o-=d,l-=h),new Date(Date.UTC(n,s,i,o,l,c))}}X1=new WeakMap,se(ik,X1);function rlt(t,{scale:e=1,rotation:r=0}){const{width:n,height:s}=t.attributes.style,i=[0,0,parseInt(n),parseInt(s)];return new hS({viewBox:i,userUnit:1,scale:e,rotation:r})}function H2(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Tt(`Not a valid color format: "${t}"`),[0,0,0])}function nlt(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const r of t.keys()){e.style.color=r;const n=window.getComputedStyle(e).color;t.set(r,H2(n))}e.remove()}function en(t){const{a:e,b:r,c:n,d:s,e:i,f:o}=t.getTransform();return[e,r,n,s,i,o]}function jl(t){const{a:e,b:r,c:n,d:s,e:i,f:o}=t.getTransform().invertSelf();return[e,r,n,s,i,o]}function Zm(t,e,r=!1,n=!0){if(e instanceof hS){const{pageWidth:s,pageHeight:i}=e.rawDims,{style:o}=t,l=ks.isCSSRoundSupported,c=`var(--total-scale-factor) * ${s}px`,u=`var(--total-scale-factor) * ${i}px`,d=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,h=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!r||e.rotation%180===0?(o.width=d,o.height=h):(o.width=h,o.height=d)}n&&t.setAttribute("data-main-rotation",e.rotation)}class _c{constructor(){const{pixelRatio:e}=_c;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,r,n,s,i=-1){let o=1/0,l=1/0,c=1/0;n=_c.capPixels(n,i),n>0&&(o=Math.sqrt(n/(e*r))),s!==-1&&(l=s/e,c=s/r);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,r){if(r>=0){const n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+r/100));return e>0?Math.min(e,n):n}return e}}const f5=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];var Vd,qd,qa,Zc,Q1,rv,nv,Z1,yk,kde,Ss,Tde,Pde,zg,Rb;const Gc=class Gc{constructor(e){se(this,Ss);se(this,Vd,null);se(this,qd,null);se(this,qa);se(this,Zc,null);se(this,Q1,null);se(this,rv,null);se(this,nv,null);Q(this,qa,e),_(Gc,Z1)||Q(Gc,Z1,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=Q(this,Vd,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const r=_(this,qa)._uiManager._signal;e.addEventListener("contextmenu",_o,{signal:r}),e.addEventListener("pointerdown",ce(Gc,yk,kde),{signal:r});const n=Q(this,Zc,document.createElement("div"));n.className="buttons",e.append(n);const s=_(this,qa).toolbarPosition;if(s){const{style:i}=e,o=_(this,qa)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*o}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return _(this,Vd)}hide(){var e;_(this,Vd).classList.add("hidden"),(e=_(this,qd))==null||e.hideDropdown()}show(){var e,r;_(this,Vd).classList.remove("hidden"),(e=_(this,Q1))==null||e.shown(),(r=_(this,rv))==null||r.shown()}addDeleteButton(){const{editorType:e,_uiManager:r}=_(this,qa),n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",_(Gc,Z1)[e]),ce(this,Ss,zg).call(this,n),n.addEventListener("click",s=>{r.delete()},{signal:r._signal}),_(this,Zc).append(n)}async addAltText(e){const r=await e.render();ce(this,Ss,zg).call(this,r),_(this,Zc).append(r,_(this,Ss,Rb)),Q(this,Q1,e)}addComment(e){if(_(this,rv))return;const r=e.render();r&&(ce(this,Ss,zg).call(this,r),_(this,Zc).prepend(r,_(this,Ss,Rb)),Q(this,rv,e),e.toolbar=this)}addColorPicker(e){if(_(this,qd))return;Q(this,qd,e);const r=e.renderButton();ce(this,Ss,zg).call(this,r),_(this,Zc).append(r,_(this,Ss,Rb))}async addEditSignatureButton(e){const r=Q(this,nv,await e.renderEditButton(_(this,qa)));ce(this,Ss,zg).call(this,r),_(this,Zc).append(r,_(this,Ss,Rb))}async addButton(e,r){switch(e){case"colorPicker":this.addColorPicker(r);break;case"altText":await this.addAltText(r);break;case"editSignature":await this.addEditSignatureButton(r);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(r);break}}updateEditSignatureButton(e){_(this,nv)&&(_(this,nv).title=e)}remove(){var e;_(this,Vd).remove(),(e=_(this,qd))==null||e.destroy(),Q(this,qd,null)}};Vd=new WeakMap,qd=new WeakMap,qa=new WeakMap,Zc=new WeakMap,Q1=new WeakMap,rv=new WeakMap,nv=new WeakMap,Z1=new WeakMap,yk=new WeakSet,kde=function(e){e.stopPropagation()},Ss=new WeakSet,Tde=function(e){_(this,qa)._focusEventsAllowed=!1,On(e)},Pde=function(e){_(this,qa)._focusEventsAllowed=!0,On(e)},zg=function(e){const r=_(this,qa)._uiManager._signal;e.addEventListener("focusin",ce(this,Ss,Tde).bind(this),{capture:!0,signal:r}),e.addEventListener("focusout",ce(this,Ss,Pde).bind(this),{capture:!0,signal:r}),e.addEventListener("contextmenu",_o,{signal:r})},Rb=function(){const e=document.createElement("div");return e.className="divider",e},se(Gc,yk),se(Gc,Z1,null);let p5=Gc;var J1,Sp,Np,af,Ode,Ide,Rde;class slt{constructor(e){se(this,af);se(this,J1,null);se(this,Sp,null);se(this,Np);Q(this,Np,e)}show(e,r,n){const[s,i]=ce(this,af,Ide).call(this,r,n),{style:o}=_(this,Sp)||Q(this,Sp,ce(this,af,Ode).call(this));e.append(_(this,Sp)),o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){_(this,Sp).remove()}}J1=new WeakMap,Sp=new WeakMap,Np=new WeakMap,af=new WeakSet,Ode=function(){const e=Q(this,Sp,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",_o,{signal:_(this,Np)._signal});const r=Q(this,J1,document.createElement("div"));return r.className="buttons",e.append(r),ce(this,af,Rde).call(this),e},Ide=function(e,r){let n=0,s=0;for(const i of e){const o=i.y+i.height;if(o<n)continue;const l=i.x+(r?i.width:0);if(o>n){s=l,n=o;continue}r?l>s&&(s=l):l<s&&(s=l)}return[r?1-s:s,n]},Rde=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");e.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=_(this,Np)._signal;e.addEventListener("contextmenu",_o,{signal:n}),e.addEventListener("click",()=>{_(this,Np).highlightSelection("floating_button")},{signal:n}),_(this,J1).append(e)};function Mde(t,e,r){for(const n of r)e.addEventListener(n,t[n].bind(t))}var vk;class ilt{constructor(){se(this,vk,0)}get id(){return`${jde}${Jn(this,vk)._++}`}}vk=new WeakMap;var sv,e_,Hs,iv,OA;const EB=class EB{constructor(){se(this,iv);se(this,sv,Ede());se(this,e_,0);se(this,Hs,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}),s=new Image;s.src=e;const i=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Ut(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:r,name:n,size:s,type:i}=e;return ce(this,iv,OA).call(this,`${r}_${n}_${s}_${i}`,e)}async getFromUrl(e){return ce(this,iv,OA).call(this,e,e)}async getFromBlob(e,r){const n=await r;return ce(this,iv,OA).call(this,e,n)}async getFromId(e){_(this,Hs)||Q(this,Hs,new Map);const r=_(this,Hs).get(e);if(!r)return null;if(r.bitmap)return r.refCounter+=1,r;if(r.file)return this.getFromFile(r.file);if(r.blobPromise){const{blobPromise:n}=r;return delete r.blobPromise,this.getFromBlob(r.id,n)}return this.getFromUrl(r.url)}getFromCanvas(e,r){_(this,Hs)||Q(this,Hs,new Map);let n=_(this,Hs).get(e);if(n!=null&&n.bitmap)return n.refCounter+=1,n;const s=new OffscreenCanvas(r.width,r.height);return s.getContext("2d").drawImage(r,0,0),n={bitmap:s.transferToImageBitmap(),id:`image_${_(this,sv)}_${Jn(this,e_)._++}`,refCounter:1,isSvg:!1},_(this,Hs).set(e,n),_(this,Hs).set(n.id,n),n}getSvgUrl(e){const r=_(this,Hs).get(e);return r!=null&&r.isSvg?r.svgUrl:null}deleteId(e){var s;_(this,Hs)||Q(this,Hs,new Map);const r=_(this,Hs).get(e);if(!r||(r.refCounter-=1,r.refCounter!==0))return;const{bitmap:n}=r;if(!r.url&&!r.file){const i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),r.blobPromise=i.convertToBlob()}(s=n.close)==null||s.call(n),r.bitmap=null}isValidId(e){return e.startsWith(`image_${_(this,sv)}_`)}};sv=new WeakMap,e_=new WeakMap,Hs=new WeakMap,iv=new WeakSet,OA=async function(e,r){_(this,Hs)||Q(this,Hs,new Map);let n=_(this,Hs).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${_(this,sv)}_${Jn(this,e_)._++}`,refCounter:0,isSvg:!1});let s;if(typeof r=="string"?(n.url=r,s=await dS(r,"blob")):r instanceof File?s=n.file=r:r instanceof Blob&&(s=r),s.type==="image/svg+xml"){const i=EB._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,d)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},o.onload=async()=>{const h=n.svgUrl=o.result;l.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},l.onerror=o.onerror=d});o.readAsDataURL(s),await c}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){Tt(s),n=null}return _(this,Hs).set(e,n),n&&_(this,Hs).set(n.id,n),n};let m5=EB;var bn,Gd,t_,Jr;class alt{constructor(e=128){se(this,bn,[]);se(this,Gd,!1);se(this,t_);se(this,Jr,-1);Q(this,t_,e)}add({cmd:e,undo:r,post:n,mustExec:s,type:i=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(s&&e(),_(this,Gd))return;const c={cmd:e,undo:r,post:n,type:i};if(_(this,Jr)===-1){_(this,bn).length>0&&(_(this,bn).length=0),Q(this,Jr,0),_(this,bn).push(c);return}if(o&&_(this,bn)[_(this,Jr)].type===i){l&&(c.undo=_(this,bn)[_(this,Jr)].undo),_(this,bn)[_(this,Jr)]=c;return}const u=_(this,Jr)+1;u===_(this,t_)?_(this,bn).splice(0,1):(Q(this,Jr,u),u<_(this,bn).length&&_(this,bn).splice(u)),_(this,bn).push(c)}undo(){if(_(this,Jr)===-1)return;Q(this,Gd,!0);const{undo:e,post:r}=_(this,bn)[_(this,Jr)];e(),r==null||r(),Q(this,Gd,!1),Q(this,Jr,_(this,Jr)-1)}redo(){if(_(this,Jr)<_(this,bn).length-1){Q(this,Jr,_(this,Jr)+1),Q(this,Gd,!0);const{cmd:e,post:r}=_(this,bn)[_(this,Jr)];e(),r==null||r(),Q(this,Gd,!1)}}hasSomethingToUndo(){return _(this,Jr)!==-1}hasSomethingToRedo(){return _(this,Jr)<_(this,bn).length-1}cleanType(e){if(_(this,Jr)!==-1){for(let r=_(this,Jr);r>=0;r--)if(_(this,bn)[r].type!==e){_(this,bn).splice(r+1,_(this,Jr)-r),Q(this,Jr,r);return}_(this,bn).length=0,Q(this,Jr,-1)}}destroy(){Q(this,bn,null)}}bn=new WeakMap,Gd=new WeakMap,t_=new WeakMap,Jr=new WeakMap;var xk,Dde;class fS{constructor(e){se(this,xk);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=ks.platform;for(const[n,s,i={}]of e)for(const o of n){const l=o.startsWith("mac+");r&&l?(this.callbacks.set(o.slice(4),{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1))):!r&&!l&&(this.callbacks.set(o,{callback:s,options:i}),this.allKeys.add(o.split("+").at(-1)))}}exec(e,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(ce(this,xk,Dde).call(this,r));if(!n)return;const{callback:s,options:{bubbles:i=!1,args:o=[],checker:l=null}}=n;l&&!l(e,r)||(s.bind(e,...o,r)(),i||On(r))}}xk=new WeakSet,Dde=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 r=this.buffer.join("+");return this.buffer.length=0,r};const bk=class bk{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return nlt(e),Ut(this,"_colors",e)}convert(e){const r=H2(e);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,s]of this._colors)if(s.every((i,o)=>i===r[o]))return bk._colorsMapping.get(n);return r}getHexCode(e){const r=this._colors.get(e);return r?ft.makeHexColor(...r):e}};Le(bk,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let g5=bk;var av,aa,zn,hs,ov,Jc,lv,Ga,Ap,Kd,Yd,cv,Ep,Rl,$o,Cp,r_,n_,uv,s_,Ml,Xd,dv,Qd,Dl,wk,Zd,i_,Jd,kp,hv,eh,a_,es,hr,eu,th,rh,o_,l_,nh,Ll,tu,c_,u_,Ka,Qe,IA,y5,Lde,Fde,RA,$de,Bde,Ude,v5,zde,x5,b5,Hde,ni,Bc,Wde,Vde,w5,qde,Mb,_5;const xy=class xy{constructor(e,r,n,s,i,o,l,c,u,d,h,f,p,g,m,v){se(this,Qe);se(this,av,new AbortController);se(this,aa,null);se(this,zn,new Map);se(this,hs,new Map);se(this,ov,null);se(this,Jc,null);se(this,lv,null);se(this,Ga,new alt);se(this,Ap,null);se(this,Kd,null);se(this,Yd,null);se(this,cv,0);se(this,Ep,new Set);se(this,Rl,null);se(this,$o,null);se(this,Cp,new Set);Le(this,"_editorUndoBar",null);se(this,r_,!1);se(this,n_,!1);se(this,uv,!1);se(this,s_,null);se(this,Ml,null);se(this,Xd,null);se(this,dv,null);se(this,Qd,!1);se(this,Dl,null);se(this,wk,new ilt);se(this,Zd,!1);se(this,i_,!1);se(this,Jd,null);se(this,kp,null);se(this,hv,null);se(this,eh,null);se(this,a_,null);se(this,es,kt.NONE);se(this,hr,new Set);se(this,eu,null);se(this,th,null);se(this,rh,null);se(this,o_,null);se(this,l_,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});se(this,nh,[0,0]);se(this,Ll,null);se(this,tu,null);se(this,c_,null);se(this,u_,null);se(this,Ka,null);const y=this._signal=_(this,av).signal;Q(this,tu,e),Q(this,c_,r),Q(this,u_,n),Q(this,ov,s),Q(this,Ap,i),Q(this,th,o),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:y}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),l._on("setpreference",this.onSetPreference.bind(this),{signal:y}),l._on("switchannotationeditorparams",x=>this.updateParams(x.type,x.value),{signal:y}),ce(this,Qe,$de).call(this),ce(this,Qe,Hde).call(this),ce(this,Qe,v5).call(this),Q(this,Jc,c.annotationStorage),Q(this,s_,c.filterFactory),Q(this,rh,u),Q(this,dv,d||null),Q(this,r_,h),Q(this,n_,f),Q(this,uv,p),Q(this,a_,g||null),this.viewParameters={realScale:sf.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=v!==!1}static get _keyboardManager(){const e=xy.prototype,r=o=>_(o,tu).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:l})=>{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new fS([[["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)&&_(o,tu).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&_(o,tu).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:r}]]))}destroy(){var e,r,n,s,i,o,l,c,u;(e=_(this,Ka))==null||e.resolve(),Q(this,Ka,null),(r=_(this,av))==null||r.abort(),Q(this,av,null),this._signal=null;for(const d of _(this,hs).values())d.destroy();_(this,hs).clear(),_(this,zn).clear(),_(this,Cp).clear(),(n=_(this,eh))==null||n.clear(),Q(this,aa,null),_(this,hr).clear(),_(this,Ga).destroy(),(s=_(this,ov))==null||s.destroy(),(i=_(this,Ap))==null||i.destroy(),(o=_(this,th))==null||o.destroy(),(l=_(this,Dl))==null||l.hide(),Q(this,Dl,null),(c=_(this,hv))==null||c.destroy(),Q(this,hv,null),_(this,Ml)&&(clearTimeout(_(this,Ml)),Q(this,Ml,null)),_(this,Ll)&&(clearTimeout(_(this,Ll)),Q(this,Ll,null)),(u=this._editorUndoBar)==null||u.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return _(this,a_)}get useNewAltTextFlow(){return _(this,n_)}get useNewAltTextWhenAddingImage(){return _(this,uv)}get hcmFilter(){return Ut(this,"hcmFilter",_(this,rh)?_(this,s_).addHCMFilter(_(this,rh).foreground,_(this,rh).background):"none")}get direction(){return Ut(this,"direction",getComputedStyle(_(this,tu)).direction)}get _highlightColors(){return Ut(this,"_highlightColors",_(this,dv)?new Map(_(this,dv).split(",").map(e=>(e=e.split("=").map(r=>r.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Ut(this,"highlightColors",null);const r=new Map,n=!!_(this,rh);for(const[s,i]of e){const o=s.endsWith("_HCM");if(n&&o){r.set(s.replace("_HCM",""),i);continue}!n&&!o&&r.set(s,i)}return Ut(this,"highlightColors",r)}get highlightColorNames(){return Ut(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const r=this.highlightColorNames.get(e);return this._highlightColors.get(r)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),Q(this,Yd,e)}setMainHighlightColorPicker(e){Q(this,hv,e)}editAltText(e,r=!1){var n;(n=_(this,ov))==null||n.editAltText(this,e,r)}hasCommentManager(){return!!_(this,Ap)}editComment(e,r){var n;(n=_(this,Ap))==null||n.open(this,e,r)}getSignature(e){var r;(r=_(this,th))==null||r.getSignature({uiManager:this,editor:e})}get signatureManager(){return _(this,th)}switchToMode(e,r){this._eventBus.on("annotationeditormodechanged",r,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,r){this._eventBus.dispatch("setpreference",{source:this,name:e,value:r})}onSetPreference({name:e,value:r}){switch(e){case"enableNewAltTextWhenAddingImage":Q(this,uv,r);break}}onPageChanging({pageNumber:e}){Q(this,cv,e-1)}focusMainContainer(){_(this,tu).focus()}findParent(e,r){for(const n of _(this,hs).values()){const{x:s,y:i,width:o,height:l}=n.div.getBoundingClientRect();if(e>=s&&e<=s+o&&r>=i&&r<=i+l)return n}return null}disableUserSelect(e=!1){_(this,c_).classList.toggle("noUserSelect",e)}addShouldRescale(e){_(this,Cp).add(e)}removeShouldRescale(e){_(this,Cp).delete(e)}onScaleChanging({scale:e}){var r;this.commitOrRemove(),this.viewParameters.realScale=e*sf.PDF_TO_CSS_UNITS;for(const n of _(this,Cp))n.onScaleChanging();(r=_(this,Yd))==null||r.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r,l=r.toString(),u=ce(this,Qe,IA).call(this,r).closest(".textLayer"),d=this.getSelectionBoxes(u);if(!d)return;r.empty();const h=ce(this,Qe,y5).call(this,u),f=_(this,es)===kt.NONE,p=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o,text:l}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(kt.HIGHLIGHT,p);return}p()}addToAnnotationStorage(e){!e.isEmpty()&&_(this,Jc)&&!_(this,Jc).has(e.id)&&_(this,Jc).setValue(e.id,e)}a11yAlert(e,r=null){const n=_(this,u_);n&&(n.setAttribute("data-l10n-id",e),r?n.setAttribute("data-l10n-args",JSON.stringify(r)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,_(this,Qd)&&(Q(this,Qd,!1),ce(this,Qe,RA).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const r of _(this,hr))if(r.div.contains(e)){Q(this,kp,[r,e]),r._focusEventsAllowed=!1;break}}focus(){if(!_(this,kp))return;const[e,r]=_(this,kp);Q(this,kp,null),r.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}addEditListeners(){ce(this,Qe,v5).call(this),ce(this,Qe,x5).call(this)}removeEditListeners(){ce(this,Qe,zde).call(this),ce(this,Qe,b5).call(this)}dragOver(e){for(const{type:r}of e.dataTransfer.items)for(const n of _(this,$o))if(n.isHandlingMimeForPasting(r)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const r of e.dataTransfer.items)for(const n of _(this,$o))if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=_(this,aa))==null||n.commitOrRemove(),!this.hasSelection)return;const r=[];for(const s of _(this,hr)){const i=s.serialize(!0);i&&r.push(i)}r.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:r}=e;for(const i of r.items)for(const o of _(this,$o))if(o.isHandlingMimeForPasting(i.type)){o.paste(i,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(i){Tt(`paste: "${i.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const s=this.currentLayer;try{const i=[];for(const c of n){const u=await s.deserialize(c);if(!u)return;i.push(u)}const o=()=>{for(const c of i)ce(this,Qe,w5).call(this,c);ce(this,Qe,_5).call(this,i)},l=()=>{for(const c of i)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(i){Tt(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),_(this,es)!==kt.NONE&&!this.isEditorHandlingKeyboard&&xy._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,_(this,Qd)&&(Q(this,Qd,!1),ce(this,Qe,RA).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(ce(this,Qe,Bde).call(this),ce(this,Qe,x5).call(this),ce(this,Qe,ni).call(this,{isEditing:_(this,es)!==kt.NONE,isEmpty:ce(this,Qe,Mb).call(this),hasSomethingToUndo:_(this,Ga).hasSomethingToUndo(),hasSomethingToRedo:_(this,Ga).hasSomethingToRedo(),hasSelectedEditor:!1})):(ce(this,Qe,Ude).call(this),ce(this,Qe,b5).call(this),ce(this,Qe,ni).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!_(this,$o)){Q(this,$o,e);for(const r of _(this,$o))ce(this,Qe,Bc).call(this,r.defaultPropertiesToUpdate)}}getId(){return _(this,wk).id}get currentLayer(){return _(this,hs).get(_(this,cv))}getLayer(e){return _(this,hs).get(e)}get currentPageIndex(){return _(this,cv)}addLayer(e){_(this,hs).set(e.pageIndex,e),_(this,Zd)?e.enable():e.disable()}removeLayer(e){_(this,hs).delete(e.pageIndex)}async updateMode(e,r=null,n=!1,s=!1,i=!1){var o,l,c;if(_(this,es)!==e&&!(_(this,Ka)&&(await _(this,Ka).promise,!_(this,Ka)))){if(Q(this,Ka,Promise.withResolvers()),(o=_(this,Yd))==null||o.commitOrRemove(),Q(this,es,e),e===kt.NONE){this.setEditingState(!1),ce(this,Qe,Vde).call(this),(l=this._editorUndoBar)==null||l.hide(),_(this,Ka).resolve();return}e===kt.SIGNATURE&&await((c=_(this,th))==null?void 0:c.loadSignatures()),this.setEditingState(!0),await ce(this,Qe,Wde).call(this),this.unselectAll();for(const u of _(this,hs).values())u.updateMode(e);if(!r){n&&this.addNewEditorFromKeyboard(),_(this,Ka).resolve();return}for(const u of _(this,zn).values())u.annotationElementId===r||u.id===r?(this.setSelected(u),i?u.editComment():s&&u.enterInEditMode()):u.unselect();_(this,Ka).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==_(this,es)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,r){if(_(this,$o)){switch(e){case Kt.CREATE:this.currentLayer.addNewEditor(r);return;case Kt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(_(this,o_)||Q(this,o_,new Map)).set(e,r),this.showAllEditors("highlight",r);break}if(this.hasSelection)for(const n of _(this,hr))n.updateParams(e,r);else for(const n of _(this,$o))n.updateDefaultParams(e,r)}}showAllEditors(e,r,n=!1){var i;for(const o of _(this,zn).values())o.editorType===e&&o.show(r);(((i=_(this,o_))==null?void 0:i.get(Kt.HIGHLIGHT_SHOW_ALL))??!0)!==r&&ce(this,Qe,Bc).call(this,[[Kt.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(e=!1){if(_(this,i_)!==e){Q(this,i_,e);for(const r of _(this,hs).values())e?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",e)}}getEditors(e){const r=[];for(const n of _(this,zn).values())n.pageIndex===e&&r.push(n);return r}getEditor(e){return _(this,zn).get(e)}addEditor(e){_(this,zn).set(e.id,e)}removeEditor(e){var r,n;e.div.contains(document.activeElement)&&(_(this,Ml)&&clearTimeout(_(this,Ml)),Q(this,Ml,setTimeout(()=>{this.focusMainContainer(),Q(this,Ml,null)},0))),_(this,zn).delete(e.id),e.annotationElementId&&((r=_(this,eh))==null||r.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!_(this,Ep).has(e.annotationElementId))&&((n=_(this,Jc))==null||n.remove(e.id))}addDeletedAnnotationElement(e){_(this,Ep).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return _(this,Ep).has(e)}removeDeletedAnnotationElement(e){_(this,Ep).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){_(this,aa)!==e&&(Q(this,aa,e),e&&ce(this,Qe,Bc).call(this,e.propertiesToUpdate))}updateUI(e){_(this,Qe,qde)===e&&ce(this,Qe,Bc).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){ce(this,Qe,Bc).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(_(this,hr).has(e)){_(this,hr).delete(e),e.unselect(),ce(this,Qe,ni).call(this,{hasSelectedEditor:this.hasSelection});return}_(this,hr).add(e),e.select(),ce(this,Qe,Bc).call(this,e.propertiesToUpdate),ce(this,Qe,ni).call(this,{hasSelectedEditor:!0})}setSelected(e){var r;this.updateToolbar({mode:e.mode,editId:e.id}),(r=_(this,Yd))==null||r.commitOrRemove();for(const n of _(this,hr))n!==e&&n.unselect();_(this,hr).clear(),_(this,hr).add(e),e.select(),ce(this,Qe,Bc).call(this,e.propertiesToUpdate),ce(this,Qe,ni).call(this,{hasSelectedEditor:!0})}isSelected(e){return _(this,hr).has(e)}get firstSelectedEditor(){return _(this,hr).values().next().value}unselect(e){e.unselect(),_(this,hr).delete(e),ce(this,Qe,ni).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return _(this,hr).size!==0}get isEnterHandled(){return _(this,hr).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;_(this,Ga).undo(),ce(this,Qe,ni).call(this,{hasSomethingToUndo:_(this,Ga).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:ce(this,Qe,Mb).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){_(this,Ga).redo(),ce(this,Qe,ni).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:_(this,Ga).hasSomethingToRedo(),isEmpty:ce(this,Qe,Mb).call(this)})}addCommands(e){_(this,Ga).add(e),ce(this,Qe,ni).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:ce(this,Qe,Mb).call(this)})}cleanUndoStack(e){_(this,Ga).cleanType(e)}delete(){var i;this.commitOrRemove();const e=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const r=e?[e]:[..._(this,hr)],n=()=>{var o;(o=this._editorUndoBar)==null||o.show(s,r.length===1?r[0].editorType:r.length);for(const l of r)l.remove()},s=()=>{for(const o of r)ce(this,Qe,w5).call(this,o)};this.addCommands({cmd:n,undo:s,mustExec:!0})}commitOrRemove(){var e;(e=_(this,aa))==null||e.commitOrRemove()}hasSomethingToControl(){return _(this,aa)||this.hasSelection}selectAll(){for(const e of _(this,hr))e.commit();ce(this,Qe,_5).call(this,_(this,zn).values())}unselectAll(){var e;if(!(_(this,aa)&&(_(this,aa).commitOrRemove(),_(this,es)!==kt.NONE))&&!((e=_(this,Yd))!=null&&e.commitOrRemove())&&this.hasSelection){for(const r of _(this,hr))r.unselect();_(this,hr).clear(),ce(this,Qe,ni).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;_(this,nh)[0]+=e,_(this,nh)[1]+=r;const[s,i]=_(this,nh),o=[..._(this,hr)],l=1e3;_(this,Ll)&&clearTimeout(_(this,Ll)),Q(this,Ll,setTimeout(()=>{Q(this,Ll,null),_(this,nh)[0]=_(this,nh)[1]=0,this.addCommands({cmd:()=>{for(const c of o)_(this,zn).has(c.id)&&(c.translateInPage(s,i),c.translationDone())},undo:()=>{for(const c of o)_(this,zn).has(c.id)&&(c.translateInPage(-s,-i),c.translationDone())},mustExec:!1})},l));for(const c of o)c.translateInPage(e,r),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),Q(this,Rl,new Map);for(const e of _(this,hr))_(this,Rl).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!_(this,Rl))return!1;this.disableUserSelect(!1);const e=_(this,Rl);Q(this,Rl,null);let r=!1;for(const[{x:s,y:i,pageIndex:o},l]of e)l.newX=s,l.newY=i,l.newPageIndex=o,r||(r=s!==l.savedX||i!==l.savedY||o!==l.savedPageIndex);if(!r)return!1;const n=(s,i,o,l)=>{if(_(this,zn).has(s.id)){const c=_(this,hs).get(l);c?s._setParentAndPosition(c,i,o):(s.pageIndex=l,s.x=i,s.y=o)}};return this.addCommands({cmd:()=>{for(const[s,{newX:i,newY:o,newPageIndex:l}]of e)n(s,i,o,l)},undo:()=>{for(const[s,{savedX:i,savedY:o,savedPageIndex:l}]of e)n(s,i,o,l)},mustExec:!0}),!0}dragSelectedEditors(e,r){if(_(this,Rl))for(const n of _(this,Rl).keys())n.drag(e,r)}rebuild(e){if(e.parent===null){const r=this.getLayer(e.pageIndex);r?(r.changeParent(e),r.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())||_(this,hr).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return _(this,aa)===e}getActive(){return _(this,aa)}getMode(){return _(this,es)}get imageManager(){return Ut(this,"imageManager",new m5)}getSelectionBoxes(e){if(!e)return null;const r=document.getSelection();for(let u=0,d=r.rangeCount;u<d;u++)if(!e.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:s,width:i,height:o}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(u,d,h,f)=>({x:(d-s)/o,y:1-(u+h-n)/i,width:f/o,height:h/i});break;case"180":l=(u,d,h,f)=>({x:1-(u+h-n)/i,y:1-(d+f-s)/o,width:h/i,height:f/o});break;case"270":l=(u,d,h,f)=>({x:1-(d+f-s)/o,y:(u-n)/i,width:f/o,height:h/i});break;default:l=(u,d,h,f)=>({x:(u-n)/i,y:(d-s)/o,width:h/i,height:f/o});break}const c=[];for(let u=0,d=r.rangeCount;u<d;u++){const h=r.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:g,height:m}of h.getClientRects())g===0||m===0||c.push(l(f,p,g,m))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:r}){(_(this,lv)||Q(this,lv,new Map)).set(e,r)}removeChangedExistingAnnotation({annotationElementId:e}){var r;(r=_(this,lv))==null||r.delete(e)}renderAnnotationElement(e){var s;const r=(s=_(this,lv))==null?void 0:s.get(e.data.id);if(!r)return;const n=_(this,Jc).getRawValue(r);n&&(_(this,es)===kt.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,r,n){var i;const s=(i=_(this,eh))==null?void 0:i.get(e);s&&(s.setCanvas(r,n),_(this,eh).delete(e))}addMissingCanvas(e,r){(_(this,eh)||Q(this,eh,new Map)).set(e,r)}};av=new WeakMap,aa=new WeakMap,zn=new WeakMap,hs=new WeakMap,ov=new WeakMap,Jc=new WeakMap,lv=new WeakMap,Ga=new WeakMap,Ap=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,cv=new WeakMap,Ep=new WeakMap,Rl=new WeakMap,$o=new WeakMap,Cp=new WeakMap,r_=new WeakMap,n_=new WeakMap,uv=new WeakMap,s_=new WeakMap,Ml=new WeakMap,Xd=new WeakMap,dv=new WeakMap,Qd=new WeakMap,Dl=new WeakMap,wk=new WeakMap,Zd=new WeakMap,i_=new WeakMap,Jd=new WeakMap,kp=new WeakMap,hv=new WeakMap,eh=new WeakMap,a_=new WeakMap,es=new WeakMap,hr=new WeakMap,eu=new WeakMap,th=new WeakMap,rh=new WeakMap,o_=new WeakMap,l_=new WeakMap,nh=new WeakMap,Ll=new WeakMap,tu=new WeakMap,c_=new WeakMap,u_=new WeakMap,Ka=new WeakMap,Qe=new WeakSet,IA=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},y5=function(e){const{currentLayer:r}=this;if(r.hasTextLayer(e))return r;for(const n of _(this,hs).values())if(n.hasTextLayer(e))return n;return null},Lde=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=ce(this,Qe,IA).call(this,e).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(_(this,Dl)||Q(this,Dl,new slt(this)),_(this,Dl).show(n,s,this.direction==="ltr"))},Fde=function(){var i,o,l;const e=document.getSelection();if(!e||e.isCollapsed){_(this,eu)&&((i=_(this,Dl))==null||i.hide(),Q(this,eu,null),ce(this,Qe,ni).call(this,{hasSelectedText:!1}));return}const{anchorNode:r}=e;if(r===_(this,eu))return;const s=ce(this,Qe,IA).call(this,e).closest(".textLayer");if(!s){_(this,eu)&&((o=_(this,Dl))==null||o.hide(),Q(this,eu,null),ce(this,Qe,ni).call(this,{hasSelectedText:!1}));return}if((l=_(this,Dl))==null||l.hide(),Q(this,eu,r),ce(this,Qe,ni).call(this,{hasSelectedText:!0}),!(_(this,es)!==kt.HIGHLIGHT&&_(this,es)!==kt.NONE)&&(_(this,es)===kt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),Q(this,Qd,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=_(this,es)===kt.HIGHLIGHT?ce(this,Qe,y5).call(this,s):null;c==null||c.toggleDrawing();const u=new AbortController,d=this.combinedSignal(u),h=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&ce(this,Qe,RA).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("blur",h,{signal:d})}},RA=function(e=""){_(this,es)===kt.HIGHLIGHT?this.highlightSelection(e):_(this,r_)&&ce(this,Qe,Lde).call(this)},$de=function(){document.addEventListener("selectionchange",ce(this,Qe,Fde).bind(this),{signal:this._signal})},Bde=function(){if(_(this,Xd))return;Q(this,Xd,new AbortController);const e=this.combinedSignal(_(this,Xd));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Ude=function(){var e;(e=_(this,Xd))==null||e.abort(),Q(this,Xd,null)},v5=function(){if(_(this,Jd))return;Q(this,Jd,new AbortController);const e=this.combinedSignal(_(this,Jd));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},zde=function(){var e;(e=_(this,Jd))==null||e.abort(),Q(this,Jd,null)},x5=function(){if(_(this,Kd))return;Q(this,Kd,new AbortController);const e=this.combinedSignal(_(this,Kd));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})},b5=function(){var e;(e=_(this,Kd))==null||e.abort(),Q(this,Kd,null)},Hde=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},ni=function(e){Object.entries(e).some(([n,s])=>_(this,l_)[n]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(_(this,l_),e)}),_(this,es)===kt.HIGHLIGHT&&e.hasSelectedEditor===!1&&ce(this,Qe,Bc).call(this,[[Kt.HIGHLIGHT_FREE,!0]]))},Bc=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},Wde=async function(){if(!_(this,Zd)){Q(this,Zd,!0);const e=[];for(const r of _(this,hs).values())e.push(r.enable());await Promise.all(e);for(const r of _(this,zn).values())r.enable()}},Vde=function(){if(this.unselectAll(),_(this,Zd)){Q(this,Zd,!1);for(const e of _(this,hs).values())e.disable();for(const e of _(this,zn).values())e.disable()}},w5=function(e){const r=_(this,hs).get(e.pageIndex);r?r.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},qde=function(){let e=null;for(e of _(this,hr));return e},Mb=function(){if(_(this,zn).size===0)return!0;if(_(this,zn).size===1)for(const e of _(this,zn).values())return e.isEmpty();return!1},_5=function(e){for(const r of _(this,hr))r.unselect();_(this,hr).clear();for(const r of e)r.isEmpty()||(_(this,hr).add(r),r.select());ce(this,Qe,ni).call(this,{hasSelectedEditor:this.hasSelection})},Le(xy,"TRANSLATE_SMALL",1),Le(xy,"TRANSLATE_BIG",10);let Jm=xy;var ts,Fl,Bo,fv,$l,oa,pv,Bl,Oi,ru,Tp,Ul,sh,nl,Db,MA;const si=class si{constructor(e){se(this,nl);se(this,ts,null);se(this,Fl,!1);se(this,Bo,null);se(this,fv,null);se(this,$l,null);se(this,oa,null);se(this,pv,!1);se(this,Bl,null);se(this,Oi,null);se(this,ru,null);se(this,Tp,null);se(this,Ul,!1);Q(this,Oi,e),Q(this,Ul,e._uiManager.useNewAltTextFlow),_(si,sh)||Q(si,sh,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){si._l10n??(si._l10n=e)}async render(){const e=Q(this,Bo,document.createElement("button"));e.className="altText",e.tabIndex="0";const r=Q(this,fv,document.createElement("span"));e.append(r),_(this,Ul)?(e.classList.add("new"),e.setAttribute("data-l10n-id",_(si,sh).missing),r.setAttribute("data-l10n-id",_(si,sh)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=_(this,Oi)._uiManager._signal;e.addEventListener("contextmenu",_o,{signal:n}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:n});const s=i=>{i.preventDefault(),_(this,Oi)._uiManager.editAltText(_(this,Oi)),_(this,Ul)&&_(this,Oi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:_(this,nl,Db)}})};return e.addEventListener("click",s,{capture:!0,signal:n}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(Q(this,pv,!0),s(i))},{signal:n}),await ce(this,nl,MA).call(this),e}finish(){_(this,Bo)&&(_(this,Bo).focus({focusVisible:_(this,pv)}),Q(this,pv,!1))}isEmpty(){return _(this,Ul)?_(this,ts)===null:!_(this,ts)&&!_(this,Fl)}hasData(){return _(this,Ul)?_(this,ts)!==null||!!_(this,ru):this.isEmpty()}get guessedText(){return _(this,ru)}async setGuessedText(e){_(this,ts)===null&&(Q(this,ru,e),Q(this,Tp,await si._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),ce(this,nl,MA).call(this))}toggleAltTextBadge(e=!1){var r;if(!_(this,Ul)||_(this,ts)){(r=_(this,Bl))==null||r.remove(),Q(this,Bl,null);return}if(!_(this,Bl)){const n=Q(this,Bl,document.createElement("div"));n.className="noAltTextBadge",_(this,Oi).div.append(n)}_(this,Bl).classList.toggle("hidden",!e)}serialize(e){let r=_(this,ts);return!e&&_(this,ru)===r&&(r=_(this,Tp)),{altText:r,decorative:_(this,Fl),guessedText:_(this,ru),textWithDisclaimer:_(this,Tp)}}get data(){return{altText:_(this,ts),decorative:_(this,Fl)}}set data({altText:e,decorative:r,guessedText:n,textWithDisclaimer:s,cancel:i=!1}){n&&(Q(this,ru,n),Q(this,Tp,s)),!(_(this,ts)===e&&_(this,Fl)===r)&&(i||(Q(this,ts,e),Q(this,Fl,r)),ce(this,nl,MA).call(this))}toggle(e=!1){_(this,Bo)&&(!e&&_(this,oa)&&(clearTimeout(_(this,oa)),Q(this,oa,null)),_(this,Bo).disabled=!e)}shown(){_(this,Oi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:_(this,nl,Db)}})}destroy(){var e,r;(e=_(this,Bo))==null||e.remove(),Q(this,Bo,null),Q(this,fv,null),Q(this,$l,null),(r=_(this,Bl))==null||r.remove(),Q(this,Bl,null)}};ts=new WeakMap,Fl=new WeakMap,Bo=new WeakMap,fv=new WeakMap,$l=new WeakMap,oa=new WeakMap,pv=new WeakMap,Bl=new WeakMap,Oi=new WeakMap,ru=new WeakMap,Tp=new WeakMap,Ul=new WeakMap,sh=new WeakMap,nl=new WeakSet,Db=function(){return _(this,ts)&&"added"||_(this,ts)===null&&this.guessedText&&"review"||"missing"},MA=async function(){var s,i,o;const e=_(this,Bo);if(!e)return;if(_(this,Ul)){if(e.classList.toggle("done",!!_(this,ts)),e.setAttribute("data-l10n-id",_(si,sh)[_(this,nl,Db)]),(s=_(this,fv))==null||s.setAttribute("data-l10n-id",_(si,sh)[`${_(this,nl,Db)}-label`]),!_(this,ts)){(i=_(this,$l))==null||i.remove();return}}else{if(!_(this,ts)&&!_(this,Fl)){e.classList.remove("done"),(o=_(this,$l))==null||o.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let r=_(this,$l);if(!r){Q(this,$l,r=document.createElement("span")),r.className="tooltip",r.setAttribute("role","tooltip"),r.id=`alt-text-tooltip-${_(this,Oi).id}`;const l=100,c=_(this,Oi)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(_(this,oa)),Q(this,oa,null)},{once:!0}),e.addEventListener("mouseenter",()=>{Q(this,oa,setTimeout(()=>{Q(this,oa,null),_(this,$l).classList.add("show"),_(this,Oi)._reportTelemetry({action:"alt_text_tooltip"})},l))},{signal:c}),e.addEventListener("mouseleave",()=>{var u;_(this,oa)&&(clearTimeout(_(this,oa)),Q(this,oa,null)),(u=_(this,$l))==null||u.classList.remove("show")},{signal:c})}_(this,Fl)?r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(r.removeAttribute("data-l10n-id"),r.textContent=_(this,ts)),r.parentNode||e.append(r);const n=_(this,Oi).getElementForAltText();n==null||n.setAttribute("aria-describedby",r.id)},se(si,sh,null),Le(si,"_l10n",null);let ak=si;var zl,Pp,Uo,d_,nu,mv,ih,LX;let FN=(LX=class{constructor(e){se(this,zl,null);se(this,Pp,!1);se(this,Uo,null);se(this,d_,null);se(this,nu,null);se(this,mv,null);se(this,ih,!1);Q(this,Uo,e),this.toolbar=null}render(){if(!_(this,Uo)._uiManager.hasCommentManager())return null;const e=Q(this,zl,document.createElement("button"));e.className="comment",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button");const r=_(this,Uo)._uiManager._signal;e.addEventListener("contextmenu",_o,{signal:r}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:r});const n=s=>{s.preventDefault(),this.edit()};return e.addEventListener("click",n,{capture:!0,signal:r}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(Q(this,Pp,!0),n(s))},{signal:r}),e}edit(){const{bottom:e,left:r,right:n}=_(this,Uo).getClientDimensions(),s={top:e};_(this,Uo)._uiManager.direction==="ltr"?s.right=n:s.left=r,_(this,Uo)._uiManager.editComment(_(this,Uo),s)}finish(){_(this,zl)&&(_(this,zl).focus({focusVisible:_(this,Pp)}),Q(this,Pp,!1))}isDeleted(){return _(this,ih)||_(this,nu)===""}hasBeenEdited(){return this.isDeleted()||_(this,nu)!==_(this,d_)}serialize(){return this.data}get data(){return{text:_(this,nu),date:_(this,mv),deleted:_(this,ih)}}set data(e){if(e===null){Q(this,nu,""),Q(this,ih,!0);return}Q(this,nu,e),Q(this,mv,new Date),Q(this,ih,!1)}setInitialText(e){Q(this,d_,e),this.data=e}toggle(e=!1){_(this,zl)&&(_(this,zl).disabled=!e)}shown(){}destroy(){var e;(e=_(this,zl))==null||e.remove(),Q(this,zl,null),Q(this,nu,""),Q(this,mv,null),Q(this,Uo,null),Q(this,Pp,!1),Q(this,ih,!1)}},zl=new WeakMap,Pp=new WeakMap,Uo=new WeakMap,d_=new WeakMap,nu=new WeakMap,mv=new WeakMap,ih=new WeakMap,LX);var gv,Op,h_,f_,p_,m_,g_,su,Ip,iu,Rp,au,of,Gde,Kde,Yde;const CB=class CB{constructor({container:e,isPinchingDisabled:r=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:i=null,onPinchEnd:o=null,signal:l}){se(this,of);se(this,gv);se(this,Op,!1);se(this,h_,null);se(this,f_);se(this,p_);se(this,m_);se(this,g_);se(this,su,null);se(this,Ip);se(this,iu,null);se(this,Rp);se(this,au,null);Q(this,gv,e),Q(this,h_,n),Q(this,f_,r),Q(this,p_,s),Q(this,m_,i),Q(this,g_,o),Q(this,Rp,new AbortController),Q(this,Ip,AbortSignal.any([l,_(this,Rp).signal])),e.addEventListener("touchstart",ce(this,of,Gde).bind(this),{passive:!1,signal:_(this,Ip)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/_c.pixelRatio}destroy(){var e,r;(e=_(this,Rp))==null||e.abort(),Q(this,Rp,null),(r=_(this,su))==null||r.abort(),Q(this,su,null)}};gv=new WeakMap,Op=new WeakMap,h_=new WeakMap,f_=new WeakMap,p_=new WeakMap,m_=new WeakMap,g_=new WeakMap,su=new WeakMap,Ip=new WeakMap,iu=new WeakMap,Rp=new WeakMap,au=new WeakMap,of=new WeakSet,Gde=function(e){var s,i,o;if((s=_(this,f_))!=null&&s.call(this))return;if(e.touches.length===1){if(_(this,su))return;const l=Q(this,su,new AbortController),c=AbortSignal.any([_(this,Ip),l.signal]),u=_(this,gv),d={capture:!0,signal:c,passive:!1},h=f=>{var p;f.pointerType==="touch"&&((p=_(this,su))==null||p.abort(),Q(this,su,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(On(f),h(f))},d),u.addEventListener("pointerup",h,d),u.addEventListener("pointercancel",h,d);return}if(!_(this,au)){Q(this,au,new AbortController);const l=AbortSignal.any([_(this,Ip),_(this,au).signal]),c=_(this,gv),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",ce(this,of,Kde).bind(this),u);const d=ce(this,of,Yde).bind(this);c.addEventListener("touchend",d,u),c.addEventListener("touchcancel",d,u),u.capture=!0,c.addEventListener("pointerdown",On,u),c.addEventListener("pointermove",On,u),c.addEventListener("pointercancel",On,u),c.addEventListener("pointerup",On,u),(i=_(this,p_))==null||i.call(this)}if(On(e),e.touches.length!==2||(o=_(this,h_))!=null&&o.call(this)){Q(this,iu,null);return}let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]),Q(this,iu,{touch0X:r.screenX,touch0Y:r.screenY,touch1X:n.screenX,touch1Y:n.screenY})},Kde=function(e){var w;if(!_(this,iu)||e.touches.length!==2)return;On(e);let[r,n]=e.touches;r.identifier>n.identifier&&([r,n]=[n,r]);const{screenX:s,screenY:i}=r,{screenX:o,screenY:l}=n,c=_(this,iu),{touch0X:u,touch0Y:d,touch1X:h,touch1Y:f}=c,p=h-u,g=f-d,m=o-s,v=l-i,y=Math.hypot(m,v)||1,x=Math.hypot(p,g)||1;if(!_(this,Op)&&Math.abs(x-y)<=CB.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=s,c.touch0Y=i,c.touch1X=o,c.touch1Y=l,!_(this,Op)){Q(this,Op,!0);return}const b=[(s+o)/2,(i+l)/2];(w=_(this,m_))==null||w.call(this,b,x,y)},Yde=function(e){var r;e.touches.length>=2||(_(this,au)&&(_(this,au).abort(),Q(this,au,null),(r=_(this,g_))==null||r.call(this)),_(this,iu)&&(On(e),Q(this,iu,null),Q(this,Op,!1)))};let ok=CB;var Mp,zo,Gr,fs,yv,ah,y_,Dp,ps,Lp,ou,oh,v_,Fp,la,x_,$p,lu,Hl,vv,xv,Ya,Bp,b_,_k,xt,j5,w_,S5,DA,Xde,Qde,N5,LA,A5,Zde,Jde,ehe,E5,the,C5,rhe,nhe,she,k5,Lb;const Dt=class Dt{constructor(e){se(this,xt);se(this,Mp,null);se(this,zo,null);se(this,Gr,null);se(this,fs,null);se(this,yv,!1);se(this,ah,null);se(this,y_,"");se(this,Dp,!1);se(this,ps,null);se(this,Lp,null);se(this,ou,null);se(this,oh,null);se(this,v_,"");se(this,Fp,!1);se(this,la,null);se(this,x_,!1);se(this,$p,!1);se(this,lu,!1);se(this,Hl,null);se(this,vv,0);se(this,xv,0);se(this,Ya,null);se(this,Bp,null);Le(this,"isSelected",!1);Le(this,"_isCopy",!1);Le(this,"_editToolbar",null);Le(this,"_initialOptions",Object.create(null));Le(this,"_initialData",null);Le(this,"_isVisible",!0);Le(this,"_uiManager",null);Le(this,"_focusEventsAllowed",!0);se(this,b_,!1);se(this,_k,Dt._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;const{rotation:r,rawDims:{pageWidth:n,pageHeight:s,pageX:i,pageY:o}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[i,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=Dt.prototype._resizeWithKeyboard,r=Jm.TRANSLATE_SMALL,n=Jm.TRANSLATE_BIG;return Ut(this,"_resizerKeyboardManager",new fS([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],Dt.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 Ut(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const r=new olt({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});r.annotationElementId=e.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(e,r){if(Dt._l10n??(Dt._l10n=e),Dt._l10nResizer||(Dt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Dt._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);Dt._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,r){br("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return _(this,b_)}set _isDraggable(e){var r;Q(this,b_,e),(r=this.div)==null||r.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(e*2),this.y+=this.width*e/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(e*2),this.y-=this.width*e/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=_(this,_k)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):ce(this,xt,Lb).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(_(this,Fp)?Q(this,Fp,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const r=e.relatedTarget;r!=null&&r.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,r,n,s){const[i,o]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(e+n)/i,this.y=(r+s)/o,this.fixAndSetPosition()}_moveAfterPaste(e,r){const[n,s]=this.parentDimensions;this.setAt(e*n,r*s,this.width*n,this.height*s),this._onTranslated()}translate(e,r){ce(this,xt,j5).call(this,this.parentDimensions,e,r)}translateInPage(e,r){_(this,la)||Q(this,la,[this.x,this.y,this.width,this.height]),ce(this,xt,j5).call(this,this.pageDimensions,e,r),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,r){_(this,la)||Q(this,la,[this.x,this.y,this.width,this.height]);const{div:n,parentDimensions:[s,i]}=this;if(this.x+=e/s,this.y+=r/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,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:d}=n;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),n.scrollIntoView({block:"nearest"})}_onTranslating(e,r){}_onTranslated(e,r){}get _hasBeenMoved(){return!!_(this,la)&&(_(this,la)[0]!==this.x||_(this,la)[1]!==this.y)}get _hasBeenResized(){return!!_(this,la)&&(_(this,la)[2]!==this.width||_(this,la)[3]!==this.height)}getBaseTranslation(){const[e,r]=this.parentDimensions,{_borderLineWidth:n}=Dt,s=n/e,i=n/r;switch(this.rotation){case 90:return[-s,i];case 180:return[s,i];case 270:return[s,-i];default:return[-s,-i]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:r},pageDimensions:[n,s]}=this;let{x:i,y:o,width:l,height:c}=this;if(l*=n,c*=s,i*=n,o*=s,this._mustFixPosition)switch(e){case 0:i=di(i,0,n-l),o=di(o,0,s-c);break;case 90:i=di(i,0,n-c),o=di(o,l,s);break;case 180:i=di(i,l,n),o=di(o,c,s);break;case 270:i=di(i,c,n),o=di(o,0,s-l);break}this.x=i/=n,this.y=o/=s;const[u,d]=this.getBaseTranslation();i+=u,o+=d,r.left=`${(100*i).toFixed(2)}%`,r.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,r){var n;return ce(n=Dt,w_,S5).call(n,e,r,this.parentRotation)}pageTranslationToScreen(e,r){var n;return ce(n=Dt,w_,S5).call(n,e,r,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:[r,n]}=this;return[r*e,n*e]}setDims(e,r){const[n,s]=this.parentDimensions,{style:i}=this.div;i.width=`${(100*e/n).toFixed(2)}%`,_(this,Dp)||(i.height=`${(100*r/s).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:r,width:n}=e,s=n.endsWith("%"),i=!_(this,Dp)&&r.endsWith("%");if(s&&i)return;const[o,l]=this.parentDimensions;s||(e.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),!_(this,Dp)&&!i&&(e.height=`${(100*parseFloat(r)/l).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=_(this,Gr))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||_(this,$p))return this._editToolbar;this._editToolbar=new p5(this),this.div.append(this._editToolbar.render()),this._editToolbar.addButton("comment",this.addCommentButton());const{toolbarButtons:e}=this;if(e)for(const[r,n]of e)await this._editToolbar.addButton(r,n);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=_(this,Gr))==null||e.destroy())}addContainer(e){var n;const r=(n=this._editToolbar)==null?void 0:n.div;r?r.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return _(this,Gr)||(ak.initialize(Dt._l10n),Q(this,Gr,new ak(this)),_(this,Mp)&&(_(this,Gr).data=_(this,Mp),Q(this,Mp,null))),_(this,Gr)}get altTextData(){var e;return(e=_(this,Gr))==null?void 0:e.data}set altTextData(e){_(this,Gr)&&(_(this,Gr).data=e)}get guessedAltText(){var e;return(e=_(this,Gr))==null?void 0:e.guessedText}async setGuessedAltText(e){var r;await((r=_(this,Gr))==null?void 0:r.setGuessedText(e))}serializeAltText(e){var r;return(r=_(this,Gr))==null?void 0:r.serialize(e)}hasAltText(){return!!_(this,Gr)&&!_(this,Gr).isEmpty()}hasAltTextData(){var e;return((e=_(this,Gr))==null?void 0:e.hasData())??!1}addCommentButton(){return _(this,fs)?_(this,fs):Q(this,fs,new FN(this))}get commentColor(){return null}get comment(){const e=_(this,fs);return{text:e.data.text,date:e.data.date,deleted:e.isDeleted(),color:this.commentColor}}set comment(e){_(this,fs)||Q(this,fs,new FN(this)),_(this,fs).data=e}setCommentData(e){_(this,fs)||Q(this,fs,new FN(this)),_(this,fs).setInitialText(e)}get hasEditedComment(){var e;return(e=_(this,fs))==null?void 0:e.hasBeenEdited()}async editComment(){_(this,fs)||Q(this,fs,new FN(this)),_(this,fs).edit()}addComment(e){this.hasEditedComment&&(e.popup={contents:this.comment.text,deleted:this.comment.deleted})}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=_(this,yv)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),ce(this,xt,C5).call(this);const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/r).toFixed(2)}%`,e.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Mde(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(_(this,Bp)||Q(this,Bp,new ok({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:ce(this,xt,Zde).bind(this),onPinching:ce(this,xt,Jde).bind(this),onPinchEnd:ce(this,xt,ehe).bind(this),signal:this._uiManager._signal}))),(o=this._uiManager._editorUndoBar)==null||o.hide(),e}pointerdown(e){const{isMac:r}=ks.platform;if(e.button!==0||e.ctrlKey&&r){e.preventDefault();return}if(Q(this,Fp,!0),this._isDraggable){ce(this,xt,the).call(this,e);return}ce(this,xt,E5).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){_(this,Hl)&&clearTimeout(_(this,Hl)),Q(this,Hl,setTimeout(()=>{var e;Q(this,Hl,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,r,n){e.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,r,n=this.rotation){const s=this.parentScale,[i,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=e/s,d=r/s,h=this.x*i,f=this.y*o,p=this.width*i,g=this.height*o;switch(n){case 0:return[h+u+l,o-f-d-g+c,h+u+p+l,o-f-d+c];case 90:return[h+d+l,o-f+u+c,h+d+g+l,o-f+u+p+c];case 180:return[h-u-p+l,o-f+d+c,h-u+l,o-f+d+g+c];case 270:return[h-d-g+l,o-f-u-p+c,h-d+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,r){const[n,s,i,o]=e,l=i-n,c=o-s;switch(this.rotation){case 0:return[n,r-o,l,c];case 90:return[n,r-s,c,l];case 180:return[i,r-s,l,c];case 270:return[i,r-o,c,l];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),Q(this,$p,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),Q(this,$p,!1),!0):!1}isInEditMode(){return _(this,$p)}shouldGetKeyboardEvents(){return _(this,lu)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:r,bottom:n,right:s}=this.getClientDimensions(),{innerHeight:i,innerWidth:o}=window;return r<o&&s>0&&e<i&&n>0}rebuild(){ce(this,xt,C5).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,r=null){br("An editor must be serializable")}static async deserialize(e,r,n){const s=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n,annotationElementId:e.annotationElementId});s.rotation=e.rotation,Q(s,Mp,e.accessibilityData),s._isCopy=e.isCopy||!1;const[i,o]=s.pageDimensions,[l,c,u,d]=s.getRectInCurrentCoords(e.rect,o);return s.x=l/i,s.y=c/o,s.width=u/i,s.height=d/o,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,r;if((e=_(this,oh))==null||e.abort(),Q(this,oh,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),_(this,Hl)&&(clearTimeout(_(this,Hl)),Q(this,Hl,null)),ce(this,xt,Lb).call(this),this.removeEditToolbar(),_(this,Ya)){for(const n of _(this,Ya).values())clearTimeout(n);Q(this,Ya,null)}this.parent=null,(r=_(this,Bp))==null||r.destroy(),Q(this,Bp,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(ce(this,xt,Xde).call(this),_(this,ps).classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),Q(this,ou,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const r=_(this,ps).children;if(!_(this,zo)){Q(this,zo,Array.from(r));const o=ce(this,xt,rhe).bind(this),l=ce(this,xt,nhe).bind(this),c=this._uiManager._signal;for(const u of _(this,zo)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",ce(this,xt,she).bind(this,d),{signal:c}),u.setAttribute("data-l10n-id",Dt._l10nResizer[d])}}const n=_(this,zo)[0];let s=0;for(const o of r){if(o===n)break;s++}const i=(360-this.rotation+this.parentRotation)%360/90*(_(this,zo).length/4);if(i!==s){if(i<s)for(let l=0;l<s-i;l++)_(this,ps).append(_(this,ps).firstChild);else if(i>s)for(let l=0;l<i-s;l++)_(this,ps).firstChild.before(_(this,ps).lastChild);let o=0;for(const l of r){const u=_(this,zo)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Dt._l10nResizer[u])}}ce(this,xt,k5).call(this,0),Q(this,lu,!0),_(this,ps).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,r){_(this,lu)&&ce(this,xt,A5).call(this,_(this,v_),{deltaX:e,deltaY:r,fromKeyboard:!0})}_stopResizingWithKeyboard(){ce(this,xt,Lb).call(this),this.div.focus()}select(){var e,r,n;if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=this._editToolbar)==null||i.show())});return}(r=this._editToolbar)==null||r.show(),(n=_(this,Gr))==null||n.toggleAltTextBadge(!1)}}unselect(){var e,r,n,s,i;this.isSelected&&(this.isSelected=!1,(e=_(this,ps))==null||e.classList.add("hidden"),(r=this.div)==null||r.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(i=_(this,Gr))==null||i.toggleAltTextBadge(!0))}updateParams(e,r){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return _(this,x_)}set isEditing(e){Q(this,x_,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,r){Q(this,Dp,!0);const n=e/r,{style:s}=this.div;s.aspectRatio=n,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,r=!1){if(r){_(this,Ya)||Q(this,Ya,new Map);const{action:n}=e;let s=_(this,Ya).get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),_(this,Ya).delete(n),_(this,Ya).size===0&&Q(this,Ya,null)},Dt._telemetryTimeout),_(this,Ya).set(n,s);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),Q(this,yv,!1)}disable(){this.div&&(this.div.tabIndex=-1),Q(this,yv,!0)}renderAnnotationElement(e){let r=e.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),e.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(e){const{firstChild:r}=e.container;(r==null?void 0:r.nodeName)==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}};Mp=new WeakMap,zo=new WeakMap,Gr=new WeakMap,fs=new WeakMap,yv=new WeakMap,ah=new WeakMap,y_=new WeakMap,Dp=new WeakMap,ps=new WeakMap,Lp=new WeakMap,ou=new WeakMap,oh=new WeakMap,v_=new WeakMap,Fp=new WeakMap,la=new WeakMap,x_=new WeakMap,$p=new WeakMap,lu=new WeakMap,Hl=new WeakMap,vv=new WeakMap,xv=new WeakMap,Ya=new WeakMap,Bp=new WeakMap,b_=new WeakMap,_k=new WeakMap,xt=new WeakSet,j5=function([e,r],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/e,this.y+=s/r,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},w_=new WeakSet,S5=function(e,r,n){switch(n){case 90:return[r,-e];case 180:return[-e,-r];case 270:return[-r,e];default:return[e,r]}},DA=function(e){switch(e){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}},Xde=function(){if(_(this,ps))return;Q(this,ps,document.createElement("div")),_(this,ps).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of e){const s=document.createElement("div");_(this,ps).append(s),s.classList.add("resizer",n),s.setAttribute("data-resizer-name",n),s.addEventListener("pointerdown",ce(this,xt,Qde).bind(this,n),{signal:r}),s.addEventListener("contextmenu",_o,{signal:r}),s.tabIndex=-1}this.div.prepend(_(this,ps))},Qde=function(e,r){var d;r.preventDefault();const{isMac:n}=ks.platform;if(r.button!==0||r.ctrlKey&&n)return;(d=_(this,Gr))==null||d.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,Q(this,Lp,[r.screenX,r.screenY]);const i=new AbortController,o=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",ce(this,xt,A5).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",On,{passive:!1,signal:o}),window.addEventListener("contextmenu",_o,{signal:o}),Q(this,ou,{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(r.target).cursor;const u=()=>{var h;i.abort(),this.parent.togglePointerEvents(!0),(h=_(this,Gr))==null||h.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=l,this.div.style.cursor=c,ce(this,xt,LA).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},N5=function(e,r,n,s){this.width=n,this.height=s,this.x=e,this.y=r;const[i,o]=this.parentDimensions;this.setDims(i*n,o*s),this.fixAndSetPosition(),this._onResized()},LA=function(){if(!_(this,ou))return;const{savedX:e,savedY:r,savedWidth:n,savedHeight:s}=_(this,ou);Q(this,ou,null);const i=this.x,o=this.y,l=this.width,c=this.height;i===e&&o===r&&l===n&&c===s||this.addCommands({cmd:ce(this,xt,N5).bind(this,i,o,l,c),undo:ce(this,xt,N5).bind(this,e,r,n,s),mustExec:!0})},A5=function(e,r){const[n,s]=this.parentDimensions,i=this.x,o=this.y,l=this.width,c=this.height,u=Dt.MIN_SIZE/n,d=Dt.MIN_SIZE/s,h=ce(this,xt,DA).call(this,this.rotation),f=(K,G)=>[h[0]*K+h[2]*G,h[1]*K+h[3]*G],p=ce(this,xt,DA).call(this,360-this.rotation),g=(K,G)=>[p[0]*K+p[2]*G,p[1]*K+p[3]*G];let m,v,y=!1,x=!1;switch(e){case"topLeft":y=!0,m=(K,G)=>[0,0],v=(K,G)=>[K,G];break;case"topMiddle":m=(K,G)=>[K/2,0],v=(K,G)=>[K/2,G];break;case"topRight":y=!0,m=(K,G)=>[K,0],v=(K,G)=>[0,G];break;case"middleRight":x=!0,m=(K,G)=>[K,G/2],v=(K,G)=>[0,G/2];break;case"bottomRight":y=!0,m=(K,G)=>[K,G],v=(K,G)=>[0,0];break;case"bottomMiddle":m=(K,G)=>[K/2,G],v=(K,G)=>[K/2,0];break;case"bottomLeft":y=!0,m=(K,G)=>[0,G],v=(K,G)=>[K,0];break;case"middleLeft":x=!0,m=(K,G)=>[0,G/2],v=(K,G)=>[K,G/2];break}const b=m(l,c),w=v(l,c);let j=f(...w);const N=Dt._round(i+j[0]),C=Dt._round(o+j[1]);let k=1,E=1,M,z;if(r.fromKeyboard)({deltaX:M,deltaY:z}=r);else{const{screenX:K,screenY:G}=r,[Y,H]=_(this,Lp);[M,z]=this.screenToPageTranslation(K-Y,G-H),_(this,Lp)[0]=K,_(this,Lp)[1]=G}if([M,z]=g(M/n,z/s),y){const K=Math.hypot(l,c);k=E=Math.max(Math.min(Math.hypot(w[0]-b[0]-M,w[1]-b[1]-z)/K,1/l,1/c),u/l,d/c)}else x?k=di(Math.abs(w[0]-b[0]-M),u,1)/l:E=di(Math.abs(w[1]-b[1]-z),d,1)/c;const I=Dt._round(l*k),q=Dt._round(c*E);j=f(...v(I,q));const A=N-j[0],U=C-j[1];_(this,la)||Q(this,la,[this.x,this.y,this.width,this.height]),this.width=I,this.height=q,this.x=A,this.y=U,this.setDims(n*I,s*q),this.fixAndSetPosition(),this._onResizing()},Zde=function(){var e;Q(this,ou,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=_(this,Gr))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},Jde=function(e,r,n){let i=.7*(n/r)+1-.7;if(i===1)return;const o=ce(this,xt,DA).call(this,this.rotation),l=(N,C)=>[o[0]*N+o[2]*C,o[1]*N+o[3]*C],[c,u]=this.parentDimensions,d=this.x,h=this.y,f=this.width,p=this.height,g=Dt.MIN_SIZE/c,m=Dt.MIN_SIZE/u;i=Math.max(Math.min(i,1/f,1/p),g/f,m/p);const v=Dt._round(f*i),y=Dt._round(p*i);if(v===f&&y===p)return;_(this,la)||Q(this,la,[d,h,f,p]);const x=l(f/2,p/2),b=Dt._round(d+x[0]),w=Dt._round(h+x[1]),j=l(v/2,y/2);this.x=b-j[0],this.y=w-j[1],this.width=v,this.height=y,this.setDims(c*v,u*y),this.fixAndSetPosition(),this._onResizing()},ehe=function(){var e;(e=_(this,Gr))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),ce(this,xt,LA).call(this)},E5=function(e){const{isMac:r}=ks.platform;e.ctrlKey&&!r||e.shiftKey||e.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)},the=function(e){const{isSelected:r}=this;this._uiManager.setUpDragSession();let n=!1;const s=new AbortController,i=this._uiManager.combinedSignal(s),o={capture:!0,passive:!1,signal:i},l=u=>{s.abort(),Q(this,ah,null),Q(this,Fp,!1),this._uiManager.endDragSession()||ce(this,xt,E5).call(this,u),n&&this._onStopDragging()};r&&(Q(this,vv,e.clientX),Q(this,xv,e.clientY),Q(this,ah,e.pointerId),Q(this,y_,e.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._onStartDragging());const{clientX:d,clientY:h,pointerId:f}=u;if(f!==_(this,ah)){On(u);return}const[p,g]=this.screenToPageTranslation(d-_(this,vv),h-_(this,xv));Q(this,vv,d),Q(this,xv,h),this._uiManager.dragSelectedEditors(p,g)},o),window.addEventListener("touchmove",On,o),window.addEventListener("pointerdown",u=>{u.pointerType===_(this,y_)&&(_(this,Bp)||u.isPrimary)&&l(u),On(u)},o));const c=u=>{if(!_(this,ah)||_(this,ah)===u.pointerId){l(u);return}On(u)};window.addEventListener("pointerup",c,{signal:i}),window.addEventListener("blur",c,{signal:i})},C5=function(){if(_(this,oh)||!this.div)return;Q(this,oh,new AbortController);const e=this._uiManager.combinedSignal(_(this,oh));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},rhe=function(e){Dt._resizerKeyboardManager.exec(this,e)},nhe=function(e){var r;_(this,lu)&&((r=e.relatedTarget)==null?void 0:r.parentNode)!==_(this,ps)&&ce(this,xt,Lb).call(this)},she=function(e){Q(this,v_,_(this,lu)?e:"")},k5=function(e){if(_(this,zo))for(const r of _(this,zo))r.tabIndex=e},Lb=function(){Q(this,lu,!1),ce(this,xt,k5).call(this,-1),ce(this,xt,LA).call(this)},se(Dt,w_),Le(Dt,"_l10n",null),Le(Dt,"_l10nResizer",null),Le(Dt,"_borderLineWidth",-1),Le(Dt,"_colorManager",new g5),Le(Dt,"_zIndex",1),Le(Dt,"_telemetryTimeout",1e3);let Pr=Dt;class olt extends Pr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const GG=3285377520,Ua=4294901760,Sl=65535;class ihe{constructor(e){this.h1=e?e&4294967295:GG,this.h2=e?e&4294967295:GG}update(e){let r,n;if(typeof e=="string"){r=new Uint8Array(e.length*2),n=0;for(let m=0,v=e.length;m<v;m++){const y=e.charCodeAt(m);y<=255?r[n++]=y:(r[n++]=y>>>8,r[n++]=y&255)}}else if(ArrayBuffer.isView(e))r=e.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=n>>2,i=n-s*4,o=new Uint32Array(r.buffer,0,s);let l=0,c=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&Sl,g=f&Sl;for(let m=0;m<s;m++)m&1?(l=o[m],l=l*h&Ua|l*p&Sl,l=l<<15|l>>>17,l=l*f&Ua|l*g&Sl,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[m],c=c*h&Ua|c*p&Sl,c=c<<15|c>>>17,c=c*f&Ua|c*g&Sl,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(l=0,i){case 3:l^=r[s*4+2]<<16;case 2:l^=r[s*4+1]<<8;case 1:l^=r[s*4],l=l*h&Ua|l*p&Sl,l=l<<15|l>>>17,l=l*f&Ua|l*g&Sl,s&1?u^=l:d^=l}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,r=this.h2;return e^=r>>>1,e=e*3981806797&Ua|e*36045&Sl,r=r*4283543511&Ua|((r<<16|e>>>16)*2950163797&Ua)>>>16,e^=r>>>1,e=e*444984403&Ua|e*60499&Sl,r=r*3301882366&Ua|((r<<16|e>>>16)*3120437893&Ua)>>>16,e^=r>>>1,(e>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const T5=Object.freeze({map:null,hash:"",transfer:void 0});var Up,zp,ms,jk,ahe;class q8{constructor(){se(this,jk);se(this,Up,!1);se(this,zp,null);se(this,ms,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,r){const n=_(this,ms).get(e);return n===void 0?r:Object.assign(r,n)}getRawValue(e){return _(this,ms).get(e)}remove(e){if(_(this,ms).delete(e),_(this,ms).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of _(this,ms).values())if(r instanceof Pr)return;this.onAnnotationEditor(null)}}setValue(e,r){const n=_(this,ms).get(e);let s=!1;if(n!==void 0)for(const[i,o]of Object.entries(r))n[i]!==o&&(s=!0,n[i]=o);else s=!0,_(this,ms).set(e,r);s&&ce(this,jk,ahe).call(this),r instanceof Pr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(e){return _(this,ms).has(e)}get size(){return _(this,ms).size}resetModified(){_(this,Up)&&(Q(this,Up,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new ohe(this)}get serializable(){if(_(this,ms).size===0)return T5;const e=new Map,r=new ihe,n=[],s=Object.create(null);let i=!1;for(const[o,l]of _(this,ms)){const c=l instanceof Pr?l.serialize(!1,s):l;c&&(e.set(o,c),r.update(`${o}:${JSON.stringify(c)}`),i||(i=!!c.bitmap))}if(i)for(const o of e.values())o.bitmap&&n.push(o.bitmap);return e.size>0?{map:e,hash:r.hexdigest(),transfer:n}:T5}get editorStats(){let e=null;const r=new Map;for(const n of _(this,ms).values()){if(!(n instanceof Pr))continue;const s=n.telemetryFinalData;if(!s)continue;const{type:i}=s;r.has(i)||r.set(i,Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const o=e[i]||(e[i]=new Map);for(const[l,c]of Object.entries(s)){if(l==="type")continue;let u=o.get(l);u||(u=new Map,o.set(l,u));const d=u.get(c)??0;u.set(c,d+1)}}for(const[n,s]of r)e[n]=s.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){Q(this,zp,null)}get modifiedIds(){if(_(this,zp))return _(this,zp);const e=[];for(const r of _(this,ms).values())!(r instanceof Pr)||!r.annotationElementId||!r.serialize()||e.push(r.annotationElementId);return Q(this,zp,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return _(this,ms).entries()}}Up=new WeakMap,zp=new WeakMap,ms=new WeakMap,jk=new WeakSet,ahe=function(){_(this,Up)||(Q(this,Up,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var __;class ohe extends q8{constructor(r){super();se(this,__);const{map:n,hash:s,transfer:i}=r.serializable,o=structuredClone(n,i?{transfer:i}:null);Q(this,__,{map:o,hash:s,transfer:i})}get print(){br("Should not call PrintAnnotationStorage.print")}get serializable(){return _(this,__)}get modifiedIds(){return Ut(this,"modifiedIds",{ids:new Set,hash:""})}}__=new WeakMap;var bv;class llt{constructor({ownerDocument:e=globalThis.document,styleElement:r=null}){se(this,bv,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 r=this.styleElement.sheet;r.insertRule(e,r.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),_(this,bv).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:r,_inspectFont:n}){if(!(!e||_(this,bv).has(e.loadedName))){if(Rn(!r,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:o}=e,l=new FontFace(s,i,o);this.addNativeFontFace(l);try{await l.load(),_(this,bv).add(s),n==null||n(e)}catch{Tt(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}br("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(s){throw Tt(`Failed to load font '${n.family}': '${s}'.`),e.disableFontFace=!0,s}}return}const r=e.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){var r;const e=!!((r=this._document)!=null&&r.fonts);return Ut(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Ut(this,"isSyncFontLoadingSupported",ui||ks.platform.isFirefox)}_queueLoadingCallback(e){function r(){for(Rn(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){const i=n.shift();setTimeout(i.callback,0)}}const{loadingRequests:n}=this,s={done:!1,complete:r,callback:e};return n.push(s),s}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ut(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,r){function n(w,j){return w.charCodeAt(j)<<24|w.charCodeAt(j+1)<<16|w.charCodeAt(j+2)<<8|w.charCodeAt(j+3)&255}function s(w,j,N,C){const k=w.substring(0,j),E=w.substring(j+N);return k+C+E}let i,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function d(w,j){if(++u>30){Tt("Load test font never loaded."),j();return}if(c.font="30px "+w,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){j();return}setTimeout(d.bind(null,w,j))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,h.length,h);const g=16,m=1482184792;let v=n(f,g);for(i=0,o=h.length-3;i<o;i+=4)v=v-m+n(h,i)|0;i<h.length&&(v=v-m+n(h+"XXX",i)|0),f=s(f,g,4,qot(v));const y=`url(data:font/opentype;base64,${btoa(f)});`,x=`@font-face {font-family:"${h}";src:${y}}`;this.insertRule(x);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const w of[e.loadedName,h]){const j=this._document.createElement("span");j.textContent="Hi",j.style.fontFamily=w,b.append(j)}this._document.body.append(b),d(h,()=>{b.remove(),r.complete()})}}bv=new WeakMap;class clt{constructor(e,r=null){this.compiledGlyphs=Object.create(null);for(const n in e)this[n]=e[n];this._inspectFont=r}createNativeFontFace(){var r;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(r=this._inspectFont)==null||r.call(this,this),e}createFontFaceRule(){var n;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${Cde(this.data)});`;let r;if(!this.cssFontInfo)r=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),r=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${e}}`}return(n=this._inspectFont)==null||n.call(this,this,e),r}getPathGenerator(e,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];const n=this.loadedName+"_path_"+r;let s;try{s=e.get(n)}catch(o){Tt(`getPathGenerator - ignoring character: "${o}".`)}const i=new Path2D(s||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[r]=i}}function ult(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(ui)return t;const e=URL.parse(t,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 dlt(t){if(ui&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return uS(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t==null?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function $N(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const P5=t=>typeof t=="object"&&Number.isInteger(t==null?void 0:t.num)&&t.num>=0&&Number.isInteger(t==null?void 0:t.gen)&&t.gen>=0,hlt=t=>typeof t=="object"&&typeof(t==null?void 0:t.name)=="string",flt=Qot.bind(null,P5,hlt);var cu,Sk;class plt{constructor(){se(this,cu,new Map);se(this,Sk,Promise.resolve())}postMessage(e,r){const n={data:structuredClone(e,r?{transfer:r}:null)};_(this,Sk).then(()=>{for(const[s]of _(this,cu))s.call(this,n)})}addEventListener(e,r,n=null){let s=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:i}=n;if(i.aborted){Tt("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(e,r);s=()=>i.removeEventListener("abort",o),i.addEventListener("abort",o)}_(this,cu).set(r,s)}removeEventListener(e,r){const n=_(this,cu).get(r);n==null||n(),_(this,cu).delete(r)}terminate(){for(const[,e]of _(this,cu))e==null||e();_(this,cu).clear()}}cu=new WeakMap,Sk=new WeakMap;const BN={DATA:1,ERROR:2},Cn={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function KG(){}function Ci(t){if(t instanceof nf||t instanceof d5||t instanceof WG||t instanceof sk||t instanceof mI)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||br('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new nf(t.message);case"InvalidPDFException":return new d5(t.message);case"PasswordException":return new WG(t.message,t.code);case"ResponseException":return new sk(t.message,t.status,t.missing);case"UnknownErrorException":return new mI(t.message,t.details)}return new mI(t.message,t.toString())}var wv,yo,lhe,che,uhe,FA;class Fb{constructor(e,r,n){se(this,yo);se(this,wv,new AbortController);this.sourceName=e,this.targetName=r,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",ce(this,yo,lhe).bind(this),{signal:_(this,wv).signal})}on(e,r){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=r}send(e,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:r},n)}sendWithPromise(e,r,n){const s=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[s]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:r},n)}catch(o){i.reject(o)}return i.promise}sendWithStream(e,r,n,s){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{const d=Promise.withResolvers();return this.streamControllers[i]={controller:u,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:i,data:r,desiredSize:u.desiredSize},s),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,c.postMessage({sourceName:o,targetName:l,stream:Cn.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{Rn(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:Cn.CANCEL,streamId:i,reason:Ci(u)}),d.promise}},n)}destroy(){var e;(e=_(this,wv))==null||e.abort(),Q(this,wv,null)}}wv=new WeakMap,yo=new WeakSet,lhe=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){ce(this,yo,uhe).call(this,e);return}if(e.callback){const n=e.callbackId,s=this.callbackCapabilities[n];if(!s)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===BN.DATA)s.resolve(e.data);else if(e.callback===BN.ERROR)s.reject(Ci(e.reason));else throw new Error("Unexpected callback case");return}const r=this.actionHandler[e.action];if(!r)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,s=e.sourceName,i=this.comObj;Promise.try(r,e.data).then(function(o){i.postMessage({sourceName:n,targetName:s,callback:BN.DATA,callbackId:e.callbackId,data:o})},function(o){i.postMessage({sourceName:n,targetName:s,callback:BN.ERROR,callbackId:e.callbackId,reason:Ci(o)})});return}if(e.streamId){ce(this,yo,che).call(this,e);return}r(e.data)},che=function(e){const r=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this,l=this.actionHandler[e.action],c={enqueue(u,d=1,h){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:s,stream:Cn.ENQUEUE,streamId:r,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:Cn.CLOSE,streamId:r}),delete o.streamSinks[r])},error(u){Rn(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:s,stream:Cn.ERROR,streamId:r,reason:Ci(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[r]=c,Promise.try(l,e.data,c).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Cn.START_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Cn.START_COMPLETE,streamId:r,reason:Ci(u)})})},uhe=function(e){const r=e.streamId,n=this.sourceName,s=e.sourceName,i=this.comObj,o=this.streamControllers[r],l=this.streamSinks[r];switch(e.stream){case Cn.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(Ci(e.reason));break;case Cn.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(Ci(e.reason));break;case Cn.PULL:if(!l){i.postMessage({sourceName:n,targetName:s,stream:Cn.PULL_COMPLETE,streamId:r,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,Promise.try(l.onPull||KG).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Cn.PULL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Cn.PULL_COMPLETE,streamId:r,reason:Ci(u)})});break;case Cn.ENQUEUE:if(Rn(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case Cn.CLOSE:if(Rn(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),ce(this,yo,FA).call(this,o,r);break;case Cn.ERROR:Rn(o,"error should have stream controller"),o.controller.error(Ci(e.reason)),ce(this,yo,FA).call(this,o,r);break;case Cn.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(Ci(e.reason)),ce(this,yo,FA).call(this,o,r);break;case Cn.CANCEL:if(!l)break;const c=Ci(e.reason);Promise.try(l.onCancel||KG,c).then(function(){i.postMessage({sourceName:n,targetName:s,stream:Cn.CANCEL_COMPLETE,streamId:r,success:!0})},function(u){i.postMessage({sourceName:n,targetName:s,stream:Cn.CANCEL_COMPLETE,streamId:r,reason:Ci(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}},FA=async function(e,r){var n,s,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(s=e.pullCall)==null?void 0:s.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[r]};var j_;class dhe{constructor({enableHWA:e=!1}){se(this,j_,!1);Q(this,j_,e)}create(e,r){if(e<=0||r<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,r);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!_(this,j_)})}}reset(e,r,n){if(!e.canvas)throw new Error("Canvas is not specified");if(r<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=r,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,r){br("Abstract method `_createCanvas` called.")}}j_=new WeakMap;class mlt extends dhe{constructor({ownerDocument:e=globalThis.document,enableHWA:r=!1}){super({enableHWA:r}),this._document=e}_createCanvas(e,r){const n=this._document.createElement("canvas");return n.width=e,n.height=r,n}}class hhe{constructor({baseUrl:e=null,isCompressed:r=!0}){this.baseUrl=e,this.isCompressed=r}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 r=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(r).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${r}`)})}async _fetch(e){br("Abstract method `_fetch` called.")}}class YG extends hhe{async _fetch(e){const r=await dS(e,this.isCompressed?"arraybuffer":"text");return r instanceof ArrayBuffer?new Uint8Array(r):uS(r)}}class fhe{addFilter(e){return"none"}addHCMFilter(e,r){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,r,n,s,i){return"none"}destroy(e=!1){}}var Hp,_v,uu,du,Ws,Wp,Vp,st,Bs,$b,Hg,$A,Wg,phe,O5,Vg,Bb,Ub,I5,zb;class glt extends fhe{constructor({docId:r,ownerDocument:n=globalThis.document}){super();se(this,st);se(this,Hp);se(this,_v);se(this,uu);se(this,du);se(this,Ws);se(this,Wp);se(this,Vp,0);Q(this,du,r),Q(this,Ws,n)}addFilter(r){if(!r)return"none";let n=_(this,st,Bs).get(r);if(n)return n;const[s,i,o]=ce(this,st,$A).call(this,r),l=r.length===1?s:`${s}${i}${o}`;if(n=_(this,st,Bs).get(l),n)return _(this,st,Bs).set(r,n),n;const c=`g_${_(this,du)}_transfer_map_${Jn(this,Vp)._++}`,u=ce(this,st,Wg).call(this,c);_(this,st,Bs).set(r,u),_(this,st,Bs).set(l,u);const d=ce(this,st,Vg).call(this,c);return ce(this,st,Ub).call(this,s,i,o,d),u}addHCMFilter(r,n){var g;const s=`${r}-${n}`,i="base";let o=_(this,st,$b).get(i);if((o==null?void 0:o.key)===s||(o?((g=o.filter)==null||g.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},_(this,st,$b).set(i,o)),!r||!n))return o.url;const l=ce(this,st,zb).call(this,r);r=ft.makeHexColor(...l);const c=ce(this,st,zb).call(this,n);if(n=ft.makeHexColor(...c),_(this,st,Hg).style.color="",r==="#000000"&&n==="#ffffff"||r===n)return o.url;const u=new Array(256);for(let m=0;m<=255;m++){const v=m/255;u[m]=v<=.03928?v/12.92:((v+.055)/1.055)**2.4}const d=u.join(","),h=`g_${_(this,du)}_hcm_filter`,f=o.filter=ce(this,st,Vg).call(this,h);ce(this,st,Ub).call(this,d,d,d,f),ce(this,st,O5).call(this,f);const p=(m,v)=>{const y=l[m]/255,x=c[m]/255,b=new Array(v+1);for(let w=0;w<=v;w++)b[w]=y+w/v*(x-y);return b.join(",")};return ce(this,st,Ub).call(this,p(0,5),p(1,5),p(2,5),f),o.url=ce(this,st,Wg).call(this,h),o.url}addAlphaFilter(r){let n=_(this,st,Bs).get(r);if(n)return n;const[s]=ce(this,st,$A).call(this,[r]),i=`alpha_${s}`;if(n=_(this,st,Bs).get(i),n)return _(this,st,Bs).set(r,n),n;const o=`g_${_(this,du)}_alpha_map_${Jn(this,Vp)._++}`,l=ce(this,st,Wg).call(this,o);_(this,st,Bs).set(r,l),_(this,st,Bs).set(i,l);const c=ce(this,st,Vg).call(this,o);return ce(this,st,I5).call(this,s,c),l}addLuminosityFilter(r){let n=_(this,st,Bs).get(r||"luminosity");if(n)return n;let s,i;if(r?([s]=ce(this,st,$A).call(this,[r]),i=`luminosity_${s}`):i="luminosity",n=_(this,st,Bs).get(i),n)return _(this,st,Bs).set(r,n),n;const o=`g_${_(this,du)}_luminosity_map_${Jn(this,Vp)._++}`,l=ce(this,st,Wg).call(this,o);_(this,st,Bs).set(r,l),_(this,st,Bs).set(i,l);const c=ce(this,st,Vg).call(this,o);return ce(this,st,phe).call(this,c),r&&ce(this,st,I5).call(this,s,c),l}addHighlightHCMFilter(r,n,s,i,o){var x;const l=`${n}-${s}-${i}-${o}`;let c=_(this,st,$b).get(r);if((c==null?void 0:c.key)===l||(c?((x=c.filter)==null||x.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},_(this,st,$b).set(r,c)),!n||!s))return c.url;const[u,d]=[n,s].map(ce(this,st,zb).bind(this));let h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[p,g]=[i,o].map(ce(this,st,zb).bind(this));f<h&&([h,f,p,g]=[f,h,g,p]),_(this,st,Hg).style.color="";const m=(b,w,j)=>{const N=new Array(256),C=(f-h)/j,k=b/255,E=(w-b)/(255*j);let M=0;for(let z=0;z<=j;z++){const I=Math.round(h+z*C),q=k+z*E;for(let A=M;A<=I;A++)N[A]=q;M=I+1}for(let z=M;z<256;z++)N[z]=N[M-1];return N.join(",")},v=`g_${_(this,du)}_hcm_${r}_filter`,y=c.filter=ce(this,st,Vg).call(this,v);return ce(this,st,O5).call(this,y),ce(this,st,Ub).call(this,m(p[0],g[0],5),m(p[1],g[1],5),m(p[2],g[2],5),y),c.url=ce(this,st,Wg).call(this,v),c.url}destroy(r=!1){var n,s,i,o;r&&((n=_(this,Wp))!=null&&n.size)||((s=_(this,uu))==null||s.parentNode.parentNode.remove(),Q(this,uu,null),(i=_(this,_v))==null||i.clear(),Q(this,_v,null),(o=_(this,Wp))==null||o.clear(),Q(this,Wp,null),Q(this,Vp,0))}}Hp=new WeakMap,_v=new WeakMap,uu=new WeakMap,du=new WeakMap,Ws=new WeakMap,Wp=new WeakMap,Vp=new WeakMap,st=new WeakSet,Bs=function(){return _(this,_v)||Q(this,_v,new Map)},$b=function(){return _(this,Wp)||Q(this,Wp,new Map)},Hg=function(){if(!_(this,uu)){const r=_(this,Ws).createElement("div"),{style:n}=r;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const s=_(this,Ws).createElementNS($c,"svg");s.setAttribute("width",0),s.setAttribute("height",0),Q(this,uu,_(this,Ws).createElementNS($c,"defs")),r.append(s),s.append(_(this,uu)),_(this,Ws).body.append(r)}return _(this,uu)},$A=function(r){if(r.length===1){const u=r[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=u[f]/255;const h=d.join(",");return[h,h,h]}const[n,s,i]=r,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]=s[u]/255,c[u]=i[u]/255;return[o.join(","),l.join(","),c.join(",")]},Wg=function(r){if(_(this,Hp)===void 0){Q(this,Hp,"");const n=_(this,Ws).URL;n!==_(this,Ws).baseURI&&(z2(n)?Tt('#createUrl: ignore "data:"-URL for performance reasons.'):Q(this,Hp,Nde(n,"")))}return`url(${_(this,Hp)}#${r})`},phe=function(r){const n=_(this,Ws).createElementNS($c,"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"),r.append(n)},O5=function(r){const n=_(this,Ws).createElementNS($c,"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"),r.append(n)},Vg=function(r){const n=_(this,Ws).createElementNS($c,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",r),_(this,st,Hg).append(n),n},Bb=function(r,n,s){const i=_(this,Ws).createElementNS($c,n);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),r.append(i)},Ub=function(r,n,s,i){const o=_(this,Ws).createElementNS($c,"feComponentTransfer");i.append(o),ce(this,st,Bb).call(this,o,"feFuncR",r),ce(this,st,Bb).call(this,o,"feFuncG",n),ce(this,st,Bb).call(this,o,"feFuncB",s)},I5=function(r,n){const s=_(this,Ws).createElementNS($c,"feComponentTransfer");n.append(s),ce(this,st,Bb).call(this,s,"feFuncA",r)},zb=function(r){return _(this,st,Hg).style.color=r,H2(getComputedStyle(_(this,st,Hg)).getPropertyValue("color"))};class mhe{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 r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load font data at: ${r}`)})}async _fetch(e){br("Abstract method `_fetch` called.")}}class XG extends mhe{async _fetch(e){const r=await dS(e,"arraybuffer");return new Uint8Array(r)}}class ghe{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 r=`${this.baseUrl}${e}`;return this._fetch(r).catch(n=>{throw new Error(`Unable to load wasm data at: ${r}`)})}async _fetch(e){br("Abstract method `_fetch` called.")}}class QG extends ghe{async _fetch(e){const r=await dS(e,"arraybuffer");return new Uint8Array(r)}}ui&&Tt("Please use the `legacy` build in Node.js environments.");async function G8(t){const r=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(r)}class ylt extends fhe{}class vlt extends dhe{_createCanvas(e,r){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,r)}}class xlt extends hhe{async _fetch(e){return G8(e)}}class blt extends mhe{async _fetch(e){return G8(e)}}class wlt extends ghe{async _fetch(e){return G8(e)}}const ws={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function R5(t,e){if(!e)return;const r=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],r,n),t.clip(s)}class K8{isModifyingCurrentTransform(){return!1}getPattern(){br("Abstract method `getPattern` called.")}}class _lt extends K8{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 r;this._type==="axial"?r=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(e,r,n,s){let i;if(s===ws.STROKE||s===ws.FILL){const o=r.current.getClippedPathBoundingBox(s,en(e))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=r.cachedCanvases.getCanvas("pattern",l,c),d=u.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-o[0],-o[1]),n=ft.transform(n,[1,0,0,1,o[0],o[1]]),d.transform(...r.baseTransform),this.matrix&&d.transform(...this.matrix),R5(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(n);i.setTransform(h)}else R5(e,this._bbox),i=this._createGradient(e);return i}}function vI(t,e,r,n,s,i,o,l){const c=e.coords,u=e.colors,d=t.data,h=t.width*4;let f;c[r+1]>c[n+1]&&(f=r,r=n,n=f,f=i,i=o,o=f),c[n+1]>c[s+1]&&(f=n,n=s,s=f,f=o,o=l,l=f),c[r+1]>c[n+1]&&(f=r,r=n,n=f,f=i,i=o,o=f);const p=(c[r]+e.offsetX)*e.scaleX,g=(c[r+1]+e.offsetY)*e.scaleY,m=(c[n]+e.offsetX)*e.scaleX,v=(c[n+1]+e.offsetY)*e.scaleY,y=(c[s]+e.offsetX)*e.scaleX,x=(c[s+1]+e.offsetY)*e.scaleY;if(g>=x)return;const b=u[i],w=u[i+1],j=u[i+2],N=u[o],C=u[o+1],k=u[o+2],E=u[l],M=u[l+1],z=u[l+2],I=Math.round(g),q=Math.round(x);let A,U,K,G,Y,H,$,L;for(let F=I;F<=q;F++){if(F<v){const B=F<g?0:(g-F)/(g-v);A=p-(p-m)*B,U=b-(b-N)*B,K=w-(w-C)*B,G=j-(j-k)*B}else{let B;F>x?B=1:v===x?B=0:B=(v-F)/(v-x),A=m-(m-y)*B,U=N-(N-E)*B,K=C-(C-M)*B,G=k-(k-z)*B}let W;F<g?W=0:F>x?W=1:W=(g-F)/(g-x),Y=p-(p-y)*W,H=b-(b-E)*W,$=w-(w-M)*W,L=j-(j-z)*W;const X=Math.round(Math.min(A,Y)),oe=Math.round(Math.max(A,Y));let le=h*F+X*4;for(let B=X;B<=oe;B++)W=(A-B)/(A-Y),W<0?W=0:W>1&&(W=1),d[le++]=U-(U-H)*W|0,d[le++]=K-(K-$)*W|0,d[le++]=G-(G-L)*W|0,d[le++]=255}}function jlt(t,e,r){const n=e.coords,s=e.colors;let i,o;switch(e.type){case"lattice":const l=e.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(i=0;i<c;i++){let d=i*l;for(let h=0;h<u;h++,d++)vI(t,r,n[d],n[d+1],n[d+l],s[d],s[d+1],s[d+l]),vI(t,r,n[d+l+1],n[d+1],n[d+l],s[d+l+1],s[d+1],s[d+l])}break;case"triangles":for(i=0,o=n.length;i<o;i+=3)vI(t,r,n[i],n[i+1],n[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}class Slt extends K8{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,r,n){const l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,d=Math.ceil(this._bounds[3])-c,h=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*e[1]*1.1)),3e3),p=u/h,g=d/f,m={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/g},v=h+2*2,y=f+2*2,x=n.getCanvas("mesh",v,y),b=x.context,w=b.createImageData(h,f);if(r){const N=w.data;for(let C=0,k=N.length;C<k;C+=4)N[C]=r[0],N[C+1]=r[1],N[C+2]=r[2],N[C+3]=255}for(const N of this._figures)jlt(w,N,m);return b.putImageData(w,2,2),{canvas:x.canvas,offsetX:l-2*p,offsetY:c-2*g,scaleX:p,scaleY:g}}isModifyingCurrentTransform(){return!0}getPattern(e,r,n,s){R5(e,this._bbox);const i=new Float32Array(2);if(s===ws.SHADING)ft.singularValueDecompose2dScale(en(e),i);else if(this.matrix){ft.singularValueDecompose2dScale(this.matrix,i);const[l,c]=i;ft.singularValueDecompose2dScale(r.baseTransform,i),i[0]*=l,i[1]*=c}else ft.singularValueDecompose2dScale(r.baseTransform,i);const o=this._createMeshCanvas(i,s===ws.SHADING?null:this._background,r.cachedCanvases);return s!==ws.SHADING&&(e.setTransform(...r.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 Nlt extends K8{getPattern(){return"hotpink"}}function Alt(t){switch(t[0]){case"RadialAxial":return new _lt(t);case"Mesh":return new Slt(t);case"Dummy":return new Nlt}throw new Error(`Unknown IR type: ${t[0]}`)}const ZG={COLORED:1,UNCOLORED:2},Nk=class Nk{constructor(e,r,n,s){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=r,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(e){const{bbox:r,operatorList:n,paintType:s,tilingType:i,color:o,canvasGraphicsFactory:l}=this;let{xstep:c,ystep:u}=this;c=Math.abs(c),u=Math.abs(u),U2("TilingType: "+i);const d=r[0],h=r[1],f=r[2],p=r[3],g=f-d,m=p-h,v=new Float32Array(2);ft.singularValueDecompose2dScale(this.matrix,v);const[y,x]=v;ft.singularValueDecompose2dScale(this.baseTransform,v);const b=y*v[0],w=x*v[1];let j=g,N=m,C=!1,k=!1;const E=Math.ceil(c*b),M=Math.ceil(u*w),z=Math.ceil(g*b),I=Math.ceil(m*w);E>=z?j=c:C=!0,M>=I?N=u:k=!0;const q=this.getSizeAndScale(j,this.ctx.canvas.width,b),A=this.getSizeAndScale(N,this.ctx.canvas.height,w),U=e.cachedCanvases.getCanvas("pattern",q.size,A.size),K=U.context,G=l.createCanvasGraphics(K);if(G.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(G,s,o),K.translate(-q.scale*d,-A.scale*h),G.transform(q.scale,0,0,A.scale,0,0),K.save(),this.clipBbox(G,d,h,f,p),G.baseTransform=en(G.ctx),G.executeOperatorList(n),G.endDrawing(),K.restore(),C||k){const Y=U.canvas;C&&(j=c),k&&(N=u);const H=this.getSizeAndScale(j,this.ctx.canvas.width,b),$=this.getSizeAndScale(N,this.ctx.canvas.height,w),L=H.size,F=$.size,W=e.cachedCanvases.getCanvas("pattern-workaround",L,F),X=W.context,oe=C?Math.floor(g/c):0,le=k?Math.floor(m/u):0;for(let B=0;B<=oe;B++)for(let R=0;R<=le;R++)X.drawImage(Y,L*B,F*R,L,F,0,0,L,F);return{canvas:W.canvas,scaleX:H.scale,scaleY:$.scale,offsetX:d,offsetY:h}}return{canvas:U.canvas,scaleX:q.scale,scaleY:A.scale,offsetX:d,offsetY:h}}getSizeAndScale(e,r,n){const s=Math.max(Nk.MAX_PATTERN_SIZE,r);let i=Math.ceil(e*n);return i>=s?i=s:n=i/e,{scale:n,size:i}}clipBbox(e,r,n,s,i){const o=s-r,l=i-n;e.ctx.rect(r,n,o,l),ft.axialAlignedBoundingBox([r,n,s,i],en(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,r,n){const s=e.ctx,i=e.current;switch(r){case ZG.COLORED:const{fillStyle:o,strokeStyle:l}=this.ctx;s.fillStyle=i.fillColor=o,s.strokeStyle=i.strokeColor=l;break;case ZG.UNCOLORED:s.fillStyle=s.strokeStyle=n,i.fillColor=i.strokeColor=n;break;default:throw new Vot(`Unsupported paint type: ${r}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,r,n,s){let i=n;s!==ws.SHADING&&(i=ft.transform(i,r.baseTransform),this.matrix&&(i=ft.transform(i,this.matrix)));const o=this.createPatternCanvas(r);let l=new DOMMatrix(i);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");return c.setTransform(l),c}};Le(Nk,"MAX_PATTERN_SIZE",3e3);let M5=Nk;function Elt({src:t,srcPos:e=0,dest:r,width:n,height:s,nonBlackColor:i=4294967295,inverseDecode:o=!1}){const l=ks.isLittleEndian?4278190080:255,[c,u]=o?[i,l]:[l,i],d=n>>3,h=n&7,f=t.length;r=new Uint32Array(r.buffer);let p=0;for(let g=0;g<s;g++){for(const v=e+d;e<v;e++){const y=e<f?t[e]:255;r[p++]=y&128?u:c,r[p++]=y&64?u:c,r[p++]=y&32?u:c,r[p++]=y&16?u:c,r[p++]=y&8?u:c,r[p++]=y&4?u:c,r[p++]=y&2?u:c,r[p++]=y&1?u:c}if(h===0)continue;const m=e<f?t[e++]:255;for(let v=0;v<h;v++)r[p++]=m&1<<7-v?u:c}return{srcPos:e,destPos:p}}const JG=16,eK=100,Clt=15,tK=10,Di=16,xI=new DOMMatrix,ja=new Float32Array(2),yy=new Float32Array([1/0,1/0,-1/0,-1/0]);function klt(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(r,n){e.translate(r,n),this.__originalTranslate(r,n)},t.scale=function(r,n){e.scale(r,n),this.__originalScale(r,n)},t.transform=function(r,n,s,i,o,l){e.transform(r,n,s,i,o,l),this.__originalTransform(r,n,s,i,o,l)},t.setTransform=function(r,n,s,i,o,l){e.setTransform(r,n,s,i,o,l),this.__originalSetTransform(r,n,s,i,o,l)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(r){e.rotate(r),this.__originalRotate(r)},t.clip=function(r){e.clip(r),this.__originalClip(r)},t.moveTo=function(r,n){e.moveTo(r,n),this.__originalMoveTo(r,n)},t.lineTo=function(r,n){e.lineTo(r,n),this.__originalLineTo(r,n)},t.bezierCurveTo=function(r,n,s,i,o,l){e.bezierCurveTo(r,n,s,i,o,l),this.__originalBezierCurveTo(r,n,s,i,o,l)},t.rect=function(r,n,s,i){e.rect(r,n,s,i),this.__originalRect(r,n,s,i)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class Tlt{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,r,n){let s;return this.cache[e]!==void 0?(s=this.cache[e],this.canvasFactory.reset(s,r,n)):(s=this.canvasFactory.create(r,n),this.cache[e]=s),s}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const r=this.cache[e];this.canvasFactory.destroy(r),delete this.cache[e]}}}function UN(t,e,r,n,s,i,o,l,c,u){const[d,h,f,p,g,m]=en(t);if(h===0&&f===0){const x=o*d+g,b=Math.round(x),w=l*p+m,j=Math.round(w),N=(o+c)*d+g,C=Math.abs(Math.round(N)-b)||1,k=(l+u)*p+m,E=Math.abs(Math.round(k)-j)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),b,j),t.drawImage(e,r,n,s,i,0,0,C,E),t.setTransform(d,h,f,p,g,m),[C,E]}if(d===0&&p===0){const x=l*f+g,b=Math.round(x),w=o*h+m,j=Math.round(w),N=(l+u)*f+g,C=Math.abs(Math.round(N)-b)||1,k=(o+c)*h+m,E=Math.abs(Math.round(k)-j)||1;return t.setTransform(0,Math.sign(h),Math.sign(f),0,b,j),t.drawImage(e,r,n,s,i,0,0,E,C),t.setTransform(d,h,f,p,g,m),[E,C]}t.drawImage(e,r,n,s,i,o,l,c,u);const v=Math.hypot(d,h),y=Math.hypot(f,p);return[v*c,y*u]}class rK{constructor(e,r){Le(this,"alphaIsShape",!1);Le(this,"fontSize",0);Le(this,"fontSizeScale",1);Le(this,"textMatrix",null);Le(this,"textMatrixScale",1);Le(this,"fontMatrix",u5);Le(this,"leading",0);Le(this,"x",0);Le(this,"y",0);Le(this,"lineX",0);Le(this,"lineY",0);Le(this,"charSpacing",0);Le(this,"wordSpacing",0);Le(this,"textHScale",1);Le(this,"textRenderingMode",$s.FILL);Le(this,"textRise",0);Le(this,"fillColor","#000000");Le(this,"strokeColor","#000000");Le(this,"patternFill",!1);Le(this,"patternStroke",!1);Le(this,"fillAlpha",1);Le(this,"strokeAlpha",1);Le(this,"lineWidth",1);Le(this,"activeSMask",null);Le(this,"transferMaps","none");this.clipBox=new Float32Array([0,0,e,r]),this.minMax=yy.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=ws.FILL,r=null){const n=this.minMax.slice();if(e===ws.STROKE){r||br("Stroke bounding box must include transform."),ft.singularValueDecompose2dScale(r,ja);const s=ja[0]*this.lineWidth/2,i=ja[1]*this.lineWidth/2;n[0]-=s,n[1]-=i,n[2]+=s,n[3]+=i}return n}updateClipFromPath(){const e=ft.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(yy,0)}getClippedPathBoundingBox(e=ws.FILL,r=null){return ft.intersect(this.clipBox,this.getPathBoundingBox(e,r))}}function nK(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const r=e.height,n=e.width,s=r%Di,i=(r-s)/Di,o=s===0?i:i+1,l=t.createImageData(n,Di);let c=0,u;const d=e.data,h=l.data;let f,p,g,m;if(e.kind===TA.GRAYSCALE_1BPP){const v=d.byteLength,y=new Uint32Array(h.buffer,0,h.byteLength>>2),x=y.length,b=n+7>>3,w=4294967295,j=ks.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(g=f<i?Di:s,u=0,p=0;p<g;p++){const N=v-c;let C=0;const k=N>b?n:N*8-7,E=k&-8;let M=0,z=0;for(;C<E;C+=8)z=d[c++],y[u++]=z&128?w:j,y[u++]=z&64?w:j,y[u++]=z&32?w:j,y[u++]=z&16?w:j,y[u++]=z&8?w:j,y[u++]=z&4?w:j,y[u++]=z&2?w:j,y[u++]=z&1?w:j;for(;C<k;C++)M===0&&(z=d[c++],M=128),y[u++]=z&M?w:j,M>>=1}for(;u<x;)y[u++]=0;t.putImageData(l,0,f*Di)}}else if(e.kind===TA.RGBA_32BPP){for(p=0,m=n*Di*4,f=0;f<i;f++)h.set(d.subarray(c,c+m)),c+=m,t.putImageData(l,0,p),p+=Di;f<o&&(m=n*s*4,h.set(d.subarray(c,c+m)),t.putImageData(l,0,p))}else if(e.kind===TA.RGB_24BPP)for(g=Di,m=n*g,f=0;f<o;f++){for(f>=i&&(g=s,m=n*g),u=0,p=m;p--;)h[u++]=d[c++],h[u++]=d[c++],h[u++]=d[c++],h[u++]=255;t.putImageData(l,0,f*Di)}else throw new Error(`bad image kind: ${e.kind}`)}function sK(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const r=e.height,n=e.width,s=r%Di,i=(r-s)/Di,o=s===0?i:i+1,l=t.createImageData(n,Di);let c=0;const u=e.data,d=l.data;for(let h=0;h<o;h++){const f=h<i?Di:s;({srcPos:c}=Elt({src:u,srcPos:c,dest:d,width:n,height:f,nonBlackColor:0})),t.putImageData(l,0,h*Di)}}function ub(t,e){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)t[n]!==void 0&&(e[n]=t[n]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function zN(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function iK(t,e){if(e)return!0;ft.singularValueDecompose2dScale(t,ja);const r=Math.fround(_c.pixelRatio*sf.PDF_TO_CSS_UNITS);return ja[0]<=r&&ja[1]<=r}const Plt=["butt","round","square"],Olt=["miter","round","bevel"],Ilt={},aK={};var fl,D5,L5,F5;const kB=class kB{constructor(e,r,n,s,i,{optionalContentConfig:o,markedContentStack:l=null},c,u){se(this,fl);this.ctx=e,this.current=new rK(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=s,this.filterFactory=i,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 Tlt(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}getObject(e,r=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):r}beginDrawing({transform:e,viewport:r,transparency:n=!1,background:s=null}){const i=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,i,o),this.ctx.fillStyle=l,n){const c=this.cachedCanvases.getCanvas("transparent",i,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...en(this.compositeCtx))}this.ctx.save(),zN(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=en(this.ctx)}executeOperatorList(e,r,n,s){const i=e.argsArray,o=e.fnArray;let l=r||0;const c=i.length;if(c===l)return l;const u=c-l>tK&&typeof n=="function",d=u?Date.now()+Clt:0;let h=0;const f=this.commonObjs,p=this.objs;let g;for(;;){if(s!==void 0&&l===s.nextBreakPoint)return s.breakIt(l,n),l;if(g=o[l],g!==nk.dependency)this[g].apply(this,i[l]);else for(const m of i[l]){const v=m.startsWith("g_")?f:p;if(!v.has(m))return v.get(m,n),l}if(l++,l===c)return l;if(u&&++h>tK){if(Date.now()>d)return n(),l;h=0}}}endDrawing(){ce(this,fl,D5).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const r of e.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);e.clear()}this._cachedBitmapsMap.clear(),ce(this,fl,L5).call(this)}_scaleImage(e,r){const n=e.width??e.displayWidth,s=e.height??e.displayHeight;let i=Math.max(Math.hypot(r[0],r[1]),1),o=Math.max(Math.hypot(r[2],r[3]),1),l=n,c=s,u="prescale1",d,h;for(;i>2&&l>1||o>2&&c>1;){let f=l,p=c;i>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),i/=l/f),o>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,l,c,0,0,f,p),e=d.canvas,l=f,c=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const r=this.ctx,{width:n,height:s}=e,i=this.current.fillColor,o=this.current.patternFill,l=en(r);let c,u,d,h;if((e.bitmap||e.data)&&e.count>1){const E=e.bitmap||e.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),i]),c=this._cachedBitmapsMap.get(E),c||(c=new Map,this._cachedBitmapsMap.set(E,c));const M=c.get(u);if(M&&!o){const z=Math.round(Math.min(l[0],l[2])+l[4]),I=Math.round(Math.min(l[1],l[3])+l[5]);return{canvas:M,offsetX:z,offsetY:I}}d=M}d||(h=this.cachedCanvases.getCanvas("maskCanvas",n,s),sK(h.context,e));let f=ft.transform(l,[1/n,0,0,-1/s,0,0]);f=ft.transform(f,[1,0,0,1,0,-s]);const p=yy.slice();ft.axialAlignedBoundingBox([0,0,n,s],f,p);const[g,m,v,y]=p,x=Math.round(v-g)||1,b=Math.round(y-m)||1,w=this.cachedCanvases.getCanvas("fillCanvas",x,b),j=w.context,N=g,C=m;j.translate(-N,-C),j.transform(...f),d||(d=this._scaleImage(h.canvas,jl(j)),d=d.img,c&&o&&c.set(u,d)),j.imageSmoothingEnabled=iK(en(j),e.interpolate),UN(j,d,0,0,d.width,d.height,0,0,n,s),j.globalCompositeOperation="source-in";const k=ft.transform(jl(j),[1,0,0,1,-N,-C]);return j.fillStyle=o?i.getPattern(r,this,k,ws.FILL):i,j.fillRect(0,0,n,s),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(u,w.canvas)),{canvas:w.canvas,offsetX:Math.round(N),offsetY:Math.round(C)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=Plt[e]}setLineJoin(e){this.ctx.lineJoin=Olt[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=r)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[r,n]of e)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,r);this.suspendedCtx=this.ctx;const i=this.ctx=s.context;i.setTransform(this.suspendedCtx.getTransform()),ub(this.suspendedCtx,i),klt(i,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ub(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 r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,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,r,n,s){const i=s[0],o=s[1],l=s[2]-i,c=s[3]-o;l===0||c===0||(this.genericComposeSMask(r.context,n,l,c,r.subtype,r.backdrop,r.transferMap,i,o,r.offsetX,r.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,r,n,s,i,o,l,c,u,d,h){let f=e.canvas,p=c-d,g=u-h;if(o)if(p<0||g<0||p+n>f.width||g+s>f.height){const v=this.cachedCanvases.getCanvas("maskExtension",n,s),y=v.context;y.drawImage(f,-p,-g),y.globalCompositeOperation="destination-atop",y.fillStyle=o,y.fillRect(0,0,n,s),y.globalCompositeOperation="source-over",f=v.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(p,g,n,s),e.clip(v),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(p,g,n,s),e.restore()}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),i==="Alpha"&&l?r.filter=this.filterFactory.addAlphaFilter(l):i==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(l));const m=new Path2D;m.rect(c,u,n,s),r.clip(m),r.globalCompositeOperation="destination-in",r.drawImage(f,p,g,n,s,c,u,n,s),r.restore()}save(){this.inSMaskMode&&ub(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&ub(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,r,n,s,i,o){this.ctx.transform(e,r,n,s,i,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,r,n){let[s]=r;if(!n){s||(s=r[0]=new Path2D),this[e](s);return}if(!(s instanceof Path2D)){const i=r[0]=new Path2D;for(let o=0,l=s.length;o<l;)switch(s[o++]){case LN.moveTo:i.moveTo(s[o++],s[o++]);break;case LN.lineTo:i.lineTo(s[o++],s[o++]);break;case LN.curveTo:i.bezierCurveTo(s[o++],s[o++],s[o++],s[o++],s[o++],s[o++]);break;case LN.closePath:i.closePath();break;default:Tt(`Unrecognized drawing path operator: ${s[o-1]}`);break}s=i}ft.axialAlignedBoundingBox(n,en(this.ctx),this.current.minMax),this[e](s)}closePath(){this.ctx.closePath()}stroke(e,r=!0){const n=this.ctx,s=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&(s!=null&&s.getPattern)){const i=s.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=s.getPattern(n,this,jl(n),ws.STROKE),i){const o=new Path2D;o.addPath(e,n.getTransform().invertSelf().multiplySelf(i)),e=o}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);r&&this.consumePath(e,this.current.getClippedPathBoundingBox(ws.STROKE,en(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,r=!0){const n=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let o=!1;if(i){const c=s.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.fillStyle=s.getPattern(n,this,jl(n),ws.FILL),c){const u=new Path2D;u.addPath(e,n.getTransform().invertSelf().multiplySelf(c)),e=u}o=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),o&&n.restore(),r&&this.consumePath(e,l)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=Ilt}eoClip(){this.pendingClip=aK}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,r=this.ctx;if(e===void 0)return;const n=new Path2D,s=r.getTransform().invertSelf();for(const{transform:i,x:o,y:l,fontSize:c,path:u}of e)u&&n.addPath(u,new DOMMatrix(i).preMultiplySelf(s).translate(o,l).scale(c,-c));r.clip(n),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,r){var d;const n=this.commonObjs.get(e),s=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=n.fontMatrix||u5,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Tt("Invalid font matrix for font "+e),r<0?(r=-r,s.fontDirection=-1):s.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const i=n.loadedName||"sans-serif",o=((d=n.systemFontInfo)==null?void 0:d.css)||`"${i}", ${n.fallbackName}`;let l="normal";n.black?l="900":n.bold&&(l="bold");const c=n.italic?"italic":"normal";let u=r;r<JG?u=JG:r>eK&&(u=eK),this.current.fontSizeScale=r/u,this.ctx.font=`${c} ${l} ${u}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,r){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=r}setLeadingMoveText(e,r){this.setLeading(-r),this.moveText(e,r)}setTextMatrix(e){const{current:r}=this;r.textMatrix=e,r.textMatrixScale=Math.hypot(e[0],e[1]),r.x=r.lineX=0,r.y=r.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,r,n,s,i){const o=this.ctx,l=this.current,c=l.font,u=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,h=u&$s.FILL_STROKE_MASK,f=!!(u&$s.ADD_TO_PATH_FLAG),p=l.patternFill&&!c.missingFile,g=l.patternStroke&&!c.missingFile;let m;if((c.disableFontFace||f||p||g)&&!c.missingFile&&(m=c.getPathGenerator(this.commonObjs,e)),m&&(c.disableFontFace||p||g)){o.save(),o.translate(r,n),o.scale(d,-d);let v;if((h===$s.FILL||h===$s.FILL_STROKE)&&(s?(v=o.getTransform(),o.setTransform(...s),o.fill(ce(this,fl,F5).call(this,m,v,s))):o.fill(m)),h===$s.STROKE||h===$s.FILL_STROKE)if(i){v||(v=o.getTransform()),o.setTransform(...i);const{a:y,b:x,c:b,d:w}=v,j=ft.inverseTransform(i),N=ft.transform([y,x,b,w,0,0],j);ft.singularValueDecompose2dScale(N,ja),o.lineWidth*=Math.max(ja[0],ja[1])/d,o.stroke(ce(this,fl,F5).call(this,m,v,i))}else o.lineWidth/=d,o.stroke(m);o.restore()}else(h===$s.FILL||h===$s.FILL_STROKE)&&o.fillText(e,r,n),(h===$s.STROKE||h===$s.FILL_STROKE)&&o.strokeText(e,r,n);f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:en(o),x:r,y:n,fontSize:d,path:m})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const r=e.getImageData(0,0,10,10).data;let n=!1;for(let s=3;s<r.length;s+=4)if(r[s]>0&&r[s]<255){n=!0;break}return Ut(this,"isFontSubpixelAAEnabled",n)}showText(e){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(e);const s=r.fontSize;if(s===0)return;const i=this.ctx,o=r.fontSizeScale,l=r.charSpacing,c=r.wordSpacing,u=r.fontDirection,d=r.textHScale*u,h=e.length,f=n.vertical,p=f?1:-1,g=n.defaultVMetrics,m=s*r.fontMatrix[0],v=r.textRenderingMode===$s.FILL&&!n.disableFontFace&&!r.patternFill;i.save(),r.textMatrix&&i.transform(...r.textMatrix),i.translate(r.x,r.y+r.textRise),u>0?i.scale(d,-1):i.scale(d,1);let y,x;if(r.patternFill){i.save();const C=r.fillColor.getPattern(i,this,jl(i),ws.FILL);y=en(i),i.restore(),i.fillStyle=C}if(r.patternStroke){i.save();const C=r.strokeColor.getPattern(i,this,jl(i),ws.STROKE);x=en(i),i.restore(),i.strokeStyle=C}let b=r.lineWidth;const w=r.textMatrixScale;if(w===0||b===0){const C=r.textRenderingMode&$s.FILL_STROKE_MASK;(C===$s.STROKE||C===$s.FILL_STROKE)&&(b=this.getSinglePixelWidth())}else b/=w;if(o!==1&&(i.scale(o,o),b/=o),i.lineWidth=b,n.isInvalidPDFjsFont){const C=[];let k=0;for(const E of e)C.push(E.unicode),k+=E.width;i.fillText(C.join(""),0,0),r.x+=k*m*d,i.restore(),this.compose();return}let j=0,N;for(N=0;N<h;++N){const C=e[N];if(typeof C=="number"){j+=p*C*s/1e3;continue}let k=!1;const E=(C.isSpace?c:0)+l,M=C.fontChar,z=C.accent;let I,q,A=C.width;if(f){const K=C.vmetric||g,G=-(C.vmetric?K[1]:A*.5)*m,Y=K[2]*m;A=K?-K[0]:A,I=G/o,q=(j+Y)/o}else I=j/o,q=0;if(n.remeasure&&A>0){const K=i.measureText(M).width*1e3/s*o;if(A<K&&this.isFontSubpixelAAEnabled){const G=A/K;k=!0,i.save(),i.scale(G,1),I/=G}else A!==K&&(I+=(A-K)/2e3*s/o)}if(this.contentVisible&&(C.isInFont||n.missingFile)){if(v&&!z)i.fillText(M,I,q);else if(this.paintChar(M,I,q,y,x),z){const K=I+s*z.offset.x/o,G=q-s*z.offset.y/o;this.paintChar(z.fontChar,K,G,y,x)}}const U=f?A*m-E*u:A*m+E*u;j+=U,k&&i.restore()}f?r.y-=j:r.x+=j*d,i.restore(),this.compose()}showType3Text(e){const r=this.ctx,n=this.current,s=n.font,i=n.fontSize,o=n.fontDirection,l=s.vertical?1:-1,c=n.charSpacing,u=n.wordSpacing,d=n.textHScale*o,h=n.fontMatrix||u5,f=e.length,p=n.textRenderingMode===$s.INVISIBLE;let g,m,v,y;if(!(p||i===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),n.textMatrix&&r.transform(...n.textMatrix),r.translate(n.x,n.y+n.textRise),r.scale(d,o),g=0;g<f;++g){if(m=e[g],typeof m=="number"){y=l*m*i/1e3,this.ctx.translate(y,0),n.x+=y*d;continue}const x=(m.isSpace?u:0)+c,b=s.charProcOperatorList[m.operatorListId];b?this.contentVisible&&(this.save(),r.scale(i,i),r.transform(...h),this.executeOperatorList(b),this.restore()):Tt(`Type3 character "${m.operatorListId}" is not available.`);const w=[m.width,0];ft.applyTransform(w,h),v=w[0]*i+x,r.translate(v,0),n.x+=v*d}r.restore()}}setCharWidth(e,r){}setCharWidthAndBounds(e,r,n,s,i,o){const l=new Path2D;l.rect(n,s,i-n,o-s),this.ctx.clip(l),this.endPath()}getColorN_Pattern(e){let r;if(e[0]==="TilingPattern"){const n=this.baseTransform||en(this.ctx),s={createCanvasGraphics:i=>new kB(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new M5(e,this.ctx,s,n)}else r=this._getPattern(e[1],e[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,r=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=Alt(this.getObject(e)),this.cachedPatterns.set(e,n)),r&&(n.matrix=r),n}shadingFill(e){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(e);r.fillStyle=n.getPattern(r,this,jl(r),ws.SHADING);const s=jl(r);if(s){const{width:i,height:o}=r.canvas,l=yy.slice();ft.axialAlignedBoundingBox([0,0,i,o],s,l);const[c,u,d,h]=l;this.ctx.fillRect(c,u,d-c,h-u)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){br("Should not call beginInlineImage")}beginImageData(){br("Should not call beginImageData")}paintFormXObjectBegin(e,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=en(this.ctx),r)){ft.axialAlignedBoundingBox(r,this.baseTransform,this.current.minMax);const[n,s,i,o]=r,l=new Path2D;l.rect(n,s,i-n,o-s),this.ctx.clip(l),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;e.isolated||U2("TODO: Support non-isolated groups."),e.knockout&&Tt("Knockout groups not supported.");const n=en(r);if(e.matrix&&r.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=yy.slice();ft.axialAlignedBoundingBox(e.bbox,en(r),s);const i=[0,0,r.canvas.width,r.canvas.height];s=ft.intersect(s,i)||[0,0,0,0];const o=Math.floor(s[0]),l=Math.floor(s[1]),c=Math.max(Math.ceil(s[2])-o,1),u=Math.max(Math.ceil(s[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,u]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(d,c,u),f=h.context;f.translate(-o,-l),f.transform(...n);let p=new Path2D;const[g,m,v,y]=e.bbox;if(p.rect(g,m,v-g,y-m),e.matrix){const x=new Path2D;x.addPath(p,new DOMMatrix(e.matrix)),p=x}f.clip(p),e.smask?this.smaskStack.push({canvas:h.canvas,context:f,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(o,l),r.save()),ub(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=en(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const i=yy.slice();ft.axialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],s,i),this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,r,n,s,i){if(ce(this,fl,D5).call(this),zN(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const o=r[2]-r[0],l=r[3]-r[1];if(i&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=o,r[3]=l,ft.singularValueDecompose2dScale(en(this.ctx),ja);const{viewportScale:c}=this,u=Math.ceil(o*this.outputScaleX*c),d=Math.ceil(l*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,d);const{canvas:h,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(ja[0],0,0,-ja[1],0,l*ja[1]),zN(this.ctx)}else{zN(this.ctx),this.endPath();const c=new Path2D;c.rect(r[0],r[1],o,l),this.ctx.clip(c)}}this.current=new rK(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),ce(this,fl,L5).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const r=e.count;e=this.getObject(e.data,e),e.count=r;const n=this.ctx,s=this._createMaskCanvas(e),i=s.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(i,s.offsetX,s.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,r,n=0,s=0,i,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=en(l);l.transform(r,n,s,i,0,0);const u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]);for(let d=0,h=o.length;d<h;d+=2){const f=ft.transform(c,[r,n,s,i,o[d],o[d+1]]);l.drawImage(u.canvas,f[4],f[5])}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,s=this.current.patternFill;for(const i of e){const{data:o,width:l,height:c,transform:u}=i,d=this.cachedCanvases.getCanvas("maskCanvas",l,c),h=d.context;h.save();const f=this.getObject(o,i);sK(h,f),h.globalCompositeOperation="source-in",h.fillStyle=s?n.getPattern(h,this,jl(r),ws.FILL):n,h.fillRect(0,0,l,c),h.restore(),r.save(),r.transform(...u),r.scale(1,-1),UN(r,d.canvas,0,0,l,c,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const r=this.getObject(e);if(!r){Tt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(e,r,n,s){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){Tt("Dependent image isn't ready yet");return}const o=i.width,l=i.height,c=[];for(let u=0,d=s.length;u<d;u+=2)c.push({transform:[r,0,0,n,s[u],s[u+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(i,c)}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:r,width:n,height:s}=e,i=this.cachedCanvases.getCanvas("inlineImage",n,s),o=i.context;return o.filter=this.current.transferMaps,o.drawImage(r,0,0),o.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const r=e.width,n=e.height,s=this.ctx;this.save();const{filter:i}=s;i!=="none"&&i!==""&&(s.filter="none"),s.scale(1/r,-1/n);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)o=e;else{const u=this.cachedCanvases.getCanvas("inlineImage",r,n).context;nK(u,e),o=this.applyTransferMapsToCanvas(u)}const l=this._scaleImage(o,jl(s));s.imageSmoothingEnabled=iK(en(s),e.interpolate),UN(s,l.img,0,0,l.paintWidth,l.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,r){if(!this.contentVisible)return;const n=this.ctx;let s;if(e.bitmap)s=e.bitmap;else{const i=e.width,o=e.height,c=this.cachedCanvases.getCanvas("inlineImage",i,o).context;nK(c,e),s=this.applyTransferMapsToCanvas(c)}for(const i of r)n.save(),n.transform(...i.transform),n.scale(1,-1),UN(n,s,i.x,i.y,i.w,i.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,r){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,r){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e,r){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(r);const s=this.ctx;this.pendingClip&&(n||(this.pendingClip===aK?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=en(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const r=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:r,b:n,c:s,d:i}=this.ctx.getTransform();let o,l;if(n===0&&s===0){const c=Math.abs(r),u=Math.abs(i);if(c===u)if(e===0)o=l=1/c;else{const d=c*e;o=l=d<1?1/d:1}else if(e===0)o=1/c,l=1/u;else{const d=c*e,h=u*e;o=d<1?1/d:1,l=h<1?1/h:1}}else{const c=Math.abs(r*i-n*s),u=Math.hypot(r,n),d=Math.hypot(s,i);if(e===0)o=d/c,l=u/c;else{const h=e*c;o=d>h?d/h:1,l=u>h?u/h:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,r){const{ctx:n,current:{lineWidth:s}}=this,[i,o]=this.getScaleForStroking();if(i===o){n.lineWidth=(s||1)*i,n.stroke(e);return}const l=n.getLineDash();r&&n.save(),n.scale(i,o),xI.a=1/i,xI.d=1/o;const c=new Path2D;if(c.addPath(e,xI),l.length>0){const u=Math.max(i,o);n.setLineDash(l.map(d=>d/u)),n.lineDashOffset/=u}n.lineWidth=s||1,n.stroke(c),r&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};fl=new WeakSet,D5=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)},L5=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const r=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}},F5=function(e,r,n){const s=new Path2D;return s.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(r)),s};let Uy=kB;for(const t in nk)Uy.prototype[t]!==void 0&&(Uy.prototype[nk[t]]=Uy.prototype[t]);var S_,N_;class nc{static get workerPort(){return _(this,S_)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");Q(this,S_,e)}static get workerSrc(){return _(this,N_)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");Q(this,N_,e)}}S_=new WeakMap,N_=new WeakMap,se(nc,S_,null),se(nc,N_,"");var jv,A_;class Rlt{constructor({parsedData:e,rawData:r}){se(this,jv);se(this,A_);Q(this,jv,e),Q(this,A_,r)}getRaw(){return _(this,A_)}get(e){return _(this,jv).get(e)??null}[Symbol.iterator](){return _(this,jv).entries()}}jv=new WeakMap,A_=new WeakMap;const qg=Symbol("INTERNAL");var E_,C_,k_,Sv;class Mlt{constructor(e,{name:r,intent:n,usage:s,rbGroups:i}){se(this,E_,!1);se(this,C_,!1);se(this,k_,!1);se(this,Sv,!0);Q(this,E_,!!(e&wa.DISPLAY)),Q(this,C_,!!(e&wa.PRINT)),this.name=r,this.intent=n,this.usage=s,this.rbGroups=i}get visible(){if(_(this,k_))return _(this,Sv);if(!_(this,Sv))return!1;const{print:e,view:r}=this.usage;return _(this,E_)?(r==null?void 0:r.viewState)!=="OFF":_(this,C_)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,r,n=!1){e!==qg&&br("Internal method `_setVisible` called."),Q(this,k_,n),Q(this,Sv,r)}}E_=new WeakMap,C_=new WeakMap,k_=new WeakMap,Sv=new WeakMap;var lh,yr,Nv,Av,T_,$5;class Dlt{constructor(e,r=wa.DISPLAY){se(this,T_);se(this,lh,null);se(this,yr,new Map);se(this,Nv,null);se(this,Av,null);if(this.renderingIntent=r,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,Q(this,Av,e.order);for(const n of e.groups)_(this,yr).set(n.id,new Mlt(r,n));if(e.baseState==="OFF")for(const n of _(this,yr).values())n._setVisible(qg,!1);for(const n of e.on)_(this,yr).get(n)._setVisible(qg,!0);for(const n of e.off)_(this,yr).get(n)._setVisible(qg,!1);Q(this,Nv,this.getHash())}}isVisible(e){if(_(this,yr).size===0)return!0;if(!e)return U2("Optional content group not defined."),!0;if(e.type==="OCG")return _(this,yr).has(e.id)?_(this,yr).get(e.id).visible:(Tt(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return ce(this,T_,$5).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const r of e.ids){if(!_(this,yr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(_(this,yr).get(r).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const r of e.ids){if(!_(this,yr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(!_(this,yr).get(r).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const r of e.ids){if(!_(this,yr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(!_(this,yr).get(r).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const r of e.ids){if(!_(this,yr).has(r))return Tt(`Optional content group not found: ${r}`),!0;if(_(this,yr).get(r).visible)return!1}return!0}return Tt(`Unknown optional content policy ${e.policy}.`),!0}return Tt(`Unknown group type ${e.type}.`),!0}setVisibility(e,r=!0,n=!0){var i;const s=_(this,yr).get(e);if(!s){Tt(`Optional content group not found: ${e}`);return}if(n&&r&&s.rbGroups.length)for(const o of s.rbGroups)for(const l of o)l!==e&&((i=_(this,yr).get(l))==null||i._setVisible(qg,!1,!0));s._setVisible(qg,!!r,!0),Q(this,lh,null)}setOCGState({state:e,preserveRB:r}){let n;for(const s of e){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}const i=_(this,yr).get(s);if(i)switch(n){case"ON":this.setVisibility(s,!0,r);break;case"OFF":this.setVisibility(s,!1,r);break;case"Toggle":this.setVisibility(s,!i.visible,r);break}}Q(this,lh,null)}get hasInitialVisibility(){return _(this,Nv)===null||this.getHash()===_(this,Nv)}getOrder(){return _(this,yr).size?_(this,Av)?_(this,Av).slice():[..._(this,yr).keys()]:null}getGroup(e){return _(this,yr).get(e)||null}getHash(){if(_(this,lh)!==null)return _(this,lh);const e=new ihe;for(const[r,n]of _(this,yr))e.update(`${r}:${n.visible}`);return Q(this,lh,e.hexdigest())}[Symbol.iterator](){return _(this,yr).entries()}}lh=new WeakMap,yr=new WeakMap,Nv=new WeakMap,Av=new WeakMap,T_=new WeakSet,$5=function(e){const r=e.length;if(r<2)return!0;const n=e[0];for(let s=1;s<r;s++){const i=e[s];let o;if(Array.isArray(i))o=ce(this,T_,$5).call(this,i);else if(_(this,yr).has(i))o=_(this,yr).get(i).visible;else return Tt(`Optional content group not found: ${i}`),!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 Llt{constructor(e,{disableRange:r=!1,disableStream:n=!1}){Rn(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:i,progressiveDone:o,contentDispositionFilename:l}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(i==null?void 0:i.length)>0){const c=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=s,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:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const s=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(n),!0)});Rn(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var r,n,s,i;e.total===void 0?(n=(r=this._rangeReaders[0])==null?void 0:r.onProgress)==null||n.call(r,{loaded:e.loaded}):(i=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||i.call(s,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const r=this._rangeReaders.indexOf(e);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Rn(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new Flt(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new $lt(this,e,r);return this._pdfDataRangeTransport.requestDataRange(e,r),this._rangeReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeReaders.slice(0))n.cancel(e);this._pdfDataRangeTransport.abort()}}class Flt{constructor(e,r,n=!1,s=null){this._stream=e,this._done=n||!1,this._filename=V8(s)?s:null,this._queuedChunks=r||[],this._loaded=0;for(const i of this._queuedChunks)this._loaded+=i.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class $lt{constructor(e,r,n){this._stream=e,this._begin=r,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 r=this._queuedChunk;return this._queuedChunk=null,{value:r,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 r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Blt(t){let e=!0,r=n("filename\\*","i").exec(t);if(r){r=r[1];let d=l(r);return d=unescape(d),d=c(d),d=u(d),i(d)}if(r=o(t),r){const d=u(r);return i(d)}if(r=n("filename","i").exec(t),r){r=r[1];let d=l(r);return d=u(d),i(d)}function n(d,h){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(d,h){if(d){if(!/^[\x00-\xFF]+$/.test(h))return h;try{const f=new TextDecoder(d,{fatal:!0}),p=uS(h);h=f.decode(p),e=!1}catch{}}return h}function i(d){return e&&/[\x80-\xff]/.test(d)&&(d=s("utf-8",d),e&&(d=s("iso-8859-1",d))),d}function o(d){const h=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,m,v,y]=f;if(m=parseInt(m,10),m in h){if(m===0)break;continue}h[m]=[v,y]}const g=[];for(let m=0;m<h.length&&m in h;++m){let[v,y]=h[m];y=l(y),v&&(y=unescape(y),m===0&&(y=c(y))),g.push(y)}return g.join("")}function l(d){if(d.startsWith('"')){const h=d.slice(1).split('\\"');for(let f=0;f<h.length;++f){const p=h[f].indexOf('"');p!==-1&&(h[f]=h[f].slice(0,p),h.length=f+1),h[f]=h[f].replaceAll(/\\(.)/g,"$1")}d=h.join('"')}return d}function c(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),g=d.slice(h+1).replace(/^[^']*'/,"");return s(f,g)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,g){if(p==="q"||p==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,v){return String.fromCharCode(parseInt(v,16))}),s(f,g);try{g=atob(g)}catch{}return s(f,g)})}return""}function yhe(t,e){const r=new Headers;if(!t||!e||typeof e!="object")return r;for(const n in e){const s=e[n];s!==void 0&&r.append(n,s)}return r}function W2(t){var e;return((e=URL.parse(t))==null?void 0:e.origin)??null}function vhe({responseHeaders:t,isHttp:e,rangeChunkSize:r,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(t.get("Content-Length"),10);return!Number.isInteger(i)||(s.suggestedLength=i,i<=2*r)||n||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function xhe(t){const e=t.get("Content-Disposition");if(e){let r=Blt(e);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(V8(r))return r}return null}function pS(t,e){return new sk(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function bhe(t){return t===200||t===206}function whe(t,e,r){return{method:"GET",headers:t,signal:r.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function _he(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Tt(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class Ult{constructor(e){Le(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=yhe(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 Rn(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new zlt(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new Hlt(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class zlt{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const r=e.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange;const n=new Headers(e.headers),s=r.url;fetch(s,whe(n,this._withCredentials,this._abortController)).then(i=>{if(e._responseOrigin=W2(i.url),!bhe(i.status))throw pS(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const o=i.headers,{allowRangeRequests:l,suggestedLength:c}=vhe({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=xhe(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new nf("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:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:_he(e),done:!1})}cancel(e){var r;(r=this._reader)==null||r.cancel(e),this._abortController.abort()}}class Hlt{constructor(e,r,n){this._stream=e,this._reader=null,this._loaded=0;const s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const i=new Headers(e.headers);i.append("Range",`bytes=${r}-${n-1}`);const o=s.url;fetch(o,whe(i,this._withCredentials,this._abortController)).then(l=>{const c=W2(l.url);if(c!==e._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${e._responseOrigin}".`);if(!bhe(l.status))throw pS(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:r}=await this._reader.read();return r?{value:e,done:r}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:_he(e),done:!1})}cancel(e){var r;(r=this._reader)==null||r.cancel(e),this._abortController.abort()}}const bI=200,wI=206;function Wlt(t){const e=t.response;return typeof e!="string"?e:uS(e).buffer}class Vlt{constructor({url:e,httpHeaders:r,withCredentials:n}){Le(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=yhe(this.isHttp,r),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const r=new XMLHttpRequest,n=this.currXhrId++,s=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const[i,o]of this.headers)r.setRequestHeader(i,o);return this.isHttp&&"begin"in e&&"end"in e?(r.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.expectedStatus=wI):s.expectedStatus=bI,r.responseType="arraybuffer",Rn(e.onError,"Expected `onError` callback to be provided."),r.onerror=()=>{e.onError(r.status)},r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),s.onHeadersReceived=e.onHeadersReceived,s.onDone=e.onDone,s.onError=e.onError,s.onProgress=e.onProgress,r.send(null),n}onProgress(e,r){var s;const n=this.pendingRequests[e];n&&((s=n.onProgress)==null||s.call(n,r))}onStateChange(e,r){const n=this.pendingRequests[e];if(!n)return;const s=n.xhr;if(s.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),s.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],s.status===0&&this.isHttp){n.onError(s.status);return}const i=s.status||bI;if(!(i===bI&&n.expectedStatus===wI)&&i!==n.expectedStatus){n.onError(s.status);return}const l=Wlt(s);if(i===wI){const c=s.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);u?n.onDone({begin:parseInt(u[1],10),chunk:l}):(Tt('Missing or invalid "Content-Range" header.'),n.onError(0))}else l?n.onDone({begin:0,chunk:l}):n.onError(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const r=this.pendingRequests[e].xhr;delete this.pendingRequests[e],r.abort()}}class qlt{constructor(e){this._source=e,this._manager=new Vlt(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const r=this._rangeRequestReaders.indexOf(e);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Rn(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Glt(this._manager,this._source),this._fullRequestReader}getRangeReader(e,r){const n=new Klt(this._manager,e,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class Glt{constructor(e,r){this._manager=e,this._url=r.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=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.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,r=this._manager.getRequestXhr(e);this._manager._responseOrigin=W2(r.responseURL);const n=r.getAllResponseHeaders(),s=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(l=>{const[c,...u]=l.split(": ");return[c,u.join(": ")]}):[]),{allowRangeRequests:i,suggestedLength:o}=vhe({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=xhe(s),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=pS(e,this._url),this._headersCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var r;(r=this.onProgress)==null||r.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 r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Klt{constructor(e,r,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:r,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 r;const e=W2((r=this._manager.getRequestXhr(this._requestId))==null?void 0:r.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 r=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,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=pS(e,this._url));for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var r;this.isStreamingSupported||(r=this.onProgress)==null||r.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,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 r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Ylt=/^[a-z][a-z0-9\-+.]+:/i;function Xlt(t){if(Ylt.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class Qlt{constructor(e){this.source=e,this.url=Xlt(e.url),Rn(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 Rn(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Zlt(this),this._fullRequestReader}getRangeReader(e,r){if(r<=this._progressiveDataLength)return null;const n=new Jlt(this,e,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var r;(r=this._fullRequestReader)==null||r.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class Zlt{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=e.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const n=process.getBuiltinModule("fs");n.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=pS(0,this._url.href)),this._storedError=s,this._headersCapability.reject(s)})}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",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new nf("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Jlt{constructor(e,r,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 s=e.source;this._isStreamingSupported=!s.disableStream;const i=process.getBuiltinModule("fs");this._setReadableStream(i.createReadStream(this._url,{start:r,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",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const db=Symbol("INITIAL_DATA");var ca,P_,B5;class jhe{constructor(){se(this,P_);se(this,ca,Object.create(null))}get(e,r=null){if(r){const s=ce(this,P_,B5).call(this,e);return s.promise.then(()=>r(s.data)),null}const n=_(this,ca)[e];if(!n||n.data===db)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const r=_(this,ca)[e];return!!r&&r.data!==db}delete(e){const r=_(this,ca)[e];return!r||r.data===db?!1:(delete _(this,ca)[e],!0)}resolve(e,r=null){const n=ce(this,P_,B5).call(this,e);n.data=r,n.resolve()}clear(){var e;for(const r in _(this,ca)){const{data:n}=_(this,ca)[r];(e=n==null?void 0:n.bitmap)==null||e.close()}Q(this,ca,Object.create(null))}*[Symbol.iterator](){for(const e in _(this,ca)){const{data:r}=_(this,ca)[e];r!==db&&(yield[e,r])}}}ca=new WeakMap,P_=new WeakSet,B5=function(e){var r;return(r=_(this,ca))[e]||(r[e]={...Promise.withResolvers(),data:db})};const ect=1e5,oK=30;var FX,ch,Ii,O_,I_,qp,hu,R_,M_,Gp,Ev,Cv,uh,kv,D_,Tv,Kp,L_,F_,Pv,Yp,$_,dh,Ov,nd,She,Nhe,U5,Ia,BA,z5,Ahe,Ehe;const Bn=class Bn{constructor({textContentSource:e,container:r,viewport:n}){se(this,nd);se(this,ch,Promise.withResolvers());se(this,Ii,null);se(this,O_,!1);se(this,I_,!!((FX=globalThis.FontInspector)!=null&&FX.enabled));se(this,qp,null);se(this,hu,null);se(this,R_,0);se(this,M_,0);se(this,Gp,null);se(this,Ev,null);se(this,Cv,0);se(this,uh,0);se(this,kv,Object.create(null));se(this,D_,[]);se(this,Tv,null);se(this,Kp,[]);se(this,L_,new WeakMap);se(this,F_,null);var c;if(e instanceof ReadableStream)Q(this,Tv,e);else if(typeof e=="object")Q(this,Tv,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');Q(this,Ii,Q(this,Ev,r)),Q(this,uh,n.scale*_c.pixelRatio),Q(this,Cv,n.rotation),Q(this,hu,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:i,pageX:o,pageY:l}=n.rawDims;Q(this,F_,[1,0,0,-1,-o,l+i]),Q(this,M_,s),Q(this,R_,i),ce(c=Bn,Ia,Ahe).call(c),Zm(r,n),_(this,ch).promise.finally(()=>{_(Bn,Ov).delete(this),Q(this,hu,null),Q(this,kv,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:r}=ks.platform;return Ut(this,"fontFamilyMap",new Map([["sans-serif",`${e&&r?"Calibri, ":""}sans-serif`],["monospace",`${e&&r?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{_(this,Gp).read().then(({value:r,done:n})=>{if(n){_(this,ch).resolve();return}_(this,qp)??Q(this,qp,r.lang),Object.assign(_(this,kv),r.styles),ce(this,nd,She).call(this,r.items),e()},_(this,ch).reject)};return Q(this,Gp,_(this,Tv).getReader()),_(Bn,Ov).add(this),e(),_(this,ch).promise}update({viewport:e,onBefore:r=null}){var i;const n=e.scale*_c.pixelRatio,s=e.rotation;if(s!==_(this,Cv)&&(r==null||r(),Q(this,Cv,s),Zm(_(this,Ev),{rotation:s})),n!==_(this,uh)){r==null||r(),Q(this,uh,n);const o={div:null,properties:null,ctx:ce(i=Bn,Ia,BA).call(i,_(this,qp))};for(const l of _(this,Kp))o.properties=_(this,L_).get(l),o.div=l,ce(this,nd,U5).call(this,o)}}cancel(){var r;const e=new nf("TextLayer task cancelled.");(r=_(this,Gp))==null||r.cancel(e).catch(()=>{}),Q(this,Gp,null),_(this,ch).reject(e)}get textDivs(){return _(this,Kp)}get textContentItemsStr(){return _(this,D_)}static cleanup(){if(!(_(this,Ov).size>0)){_(this,Pv).clear();for(const{canvas:e}of _(this,Yp).values())e.remove();_(this,Yp).clear()}}};ch=new WeakMap,Ii=new WeakMap,O_=new WeakMap,I_=new WeakMap,qp=new WeakMap,hu=new WeakMap,R_=new WeakMap,M_=new WeakMap,Gp=new WeakMap,Ev=new WeakMap,Cv=new WeakMap,uh=new WeakMap,kv=new WeakMap,D_=new WeakMap,Tv=new WeakMap,Kp=new WeakMap,L_=new WeakMap,F_=new WeakMap,Pv=new WeakMap,Yp=new WeakMap,$_=new WeakMap,dh=new WeakMap,Ov=new WeakMap,nd=new WeakSet,She=function(e){var s,i;if(_(this,O_))return;(i=_(this,hu)).ctx??(i.ctx=ce(s=Bn,Ia,BA).call(s,_(this,qp)));const r=_(this,Kp),n=_(this,D_);for(const o of e){if(r.length>ect){Tt("Ignoring additional textDivs for performance reasons."),Q(this,O_,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=_(this,Ii);Q(this,Ii,document.createElement("span")),_(this,Ii).classList.add("markedContent"),o.id&&_(this,Ii).setAttribute("id",`${o.id}`),l.append(_(this,Ii))}else o.type==="endMarkedContent"&&Q(this,Ii,_(this,Ii).parentNode);continue}n.push(o.str),ce(this,nd,Nhe).call(this,o)}},Nhe=function(e){var m;const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};_(this,Kp).push(r);const s=ft.transform(_(this,F_),e.transform);let i=Math.atan2(s[1],s[0]);const o=_(this,kv)[e.fontName];o.vertical&&(i+=Math.PI/2);let l=_(this,I_)&&o.fontSubstitution||o.fontFamily;l=Bn.fontFamilyMap.get(l)||l;const c=Math.hypot(s[2],s[3]),u=c*ce(m=Bn,Ia,Ehe).call(m,l,o,_(this,qp));let d,h;i===0?(d=s[4],h=s[5]-u):(d=s[4]+u*Math.sin(i),h=s[5]-u*Math.cos(i));const f="calc(var(--total-scale-factor) *",p=r.style;_(this,Ii)===_(this,Ev)?(p.left=`${(100*d/_(this,M_)).toFixed(2)}%`,p.top=`${(100*h/_(this,R_)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(_(Bn,dh)*c).toFixed(2)}px)`,p.fontFamily=l,n.fontSize=c,r.setAttribute("role","presentation"),r.textContent=e.str,r.dir=e.dir,_(this,I_)&&(r.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),i!==0&&(n.angle=i*(180/Math.PI));let g=!1;if(e.str.length>1)g=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),y=Math.abs(e.transform[3]);v!==y&&Math.max(v,y)/Math.min(v,y)>1.5&&(g=!0)}if(g&&(n.canvasWidth=o.vertical?e.height:e.width),_(this,L_).set(r,n),_(this,hu).div=r,_(this,hu).properties=n,ce(this,nd,U5).call(this,_(this,hu)),n.hasText&&_(this,Ii).append(r),n.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),_(this,Ii).append(v)}},U5=function(e){var l;const{div:r,properties:n,ctx:s}=e,{style:i}=r;let o="";if(_(Bn,dh)>1&&(o=`scale(${1/_(Bn,dh)})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:c}=i,{canvasWidth:u,fontSize:d}=n;ce(l=Bn,Ia,z5).call(l,s,d*_(this,uh),c);const{width:h}=s.measureText(r.textContent);h>0&&(o=`scaleX(${u*_(this,uh)/h}) ${o}`)}n.angle!==0&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(i.transform=o)},Ia=new WeakSet,BA=function(e=null){let r=_(this,Yp).get(e||(e=""));if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),_(this,Yp).set(e,r),_(this,$_).set(r,{size:0,family:""})}return r},z5=function(e,r,n){const s=_(this,$_).get(e);r===s.size&&n===s.family||(e.font=`${r}px ${n}`,s.size=r,s.family=n)},Ahe=function(){if(_(this,dh)!==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),Q(this,dh,e.getBoundingClientRect().height),e.remove()},Ehe=function(e,r,n){const s=_(this,Pv).get(e);if(s)return s;const i=ce(this,Ia,BA).call(this,n);i.canvas.width=i.canvas.height=oK,ce(this,Ia,z5).call(this,i,oK,e);const o=i.measureText(""),l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);i.canvas.width=i.canvas.height=0;let u=.8;return l?u=l/(l+c):(ks.platform.isFirefox&&Tt("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),r.ascent?u=r.ascent:r.descent&&(u=1+r.descent)),_(this,Pv).set(e,u),u},se(Bn,Ia),se(Bn,Pv,new Map),se(Bn,Yp,new Map),se(Bn,$_,new WeakMap),se(Bn,dh,null),se(Bn,Ov,new Set);let U1=Bn;class z1{static textContent(e){const r=[],n={items:r,styles:Object.create(null)};function s(i){var c;if(!i)return;let o=null;const l=i.name;if(l==="#text")o=i.value;else if(z1.shouldBuildText(l))(c=i==null?void 0:i.attributes)!=null&&c.textContent?o=i.attributes.textContent:i.value&&(o=i.value);else return;if(o!==null&&r.push({str:o}),!!i.children)for(const u of i.children)s(u)}return s(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const tct=100;function Che(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new H5,{docId:r}=e,n=t.url?ult(t.url):null,s=t.data?dlt(t.data):null,i=t.httpHeaders||null,o=t.withCredentials===!0,l=t.password??null,c=t.range instanceof khe?t.range:null,u=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof H1?t.worker:null;const h=t.verbosity,f=typeof t.docBaseUrl=="string"&&!z2(t.docBaseUrl)?t.docBaseUrl:null,p=$N(t.cMapUrl),g=t.cMapPacked!==!1,m=t.CMapReaderFactory||(ui?xlt:YG),v=$N(t.iccUrl),y=$N(t.standardFontDataUrl),x=t.StandardFontDataFactory||(ui?blt:XG),b=$N(t.wasmUrl),w=t.WasmFactory||(ui?wlt:QG),j=t.stopAtErrors!==!0,N=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,C=t.isEvalSupported!==!1,k=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!ui,E=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!ui&&(ks.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,z=typeof t.disableFontFace=="boolean"?t.disableFontFace:ui,I=t.fontExtraProperties===!0,q=t.enableXfa===!0,A=t.ownerDocument||globalThis.document,U=t.disableRange===!0,K=t.disableStream===!0,G=t.disableAutoFetch===!0,Y=t.pdfBug===!0,H=t.CanvasFactory||(ui?vlt:mlt),$=t.FilterFactory||(ui?ylt:glt),L=t.enableHWA===!0,F=t.useWasm!==!1,W=c?c.length:t.length??NaN,X=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!ui&&!z,oe=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(m===YG&&x===XG&&w===QG&&p&&y&&b&&Ib(p,document.baseURI)&&Ib(y,document.baseURI)&&Ib(b,document.baseURI)),le=null;zot(h);const B={canvasFactory:new H({ownerDocument:A,enableHWA:L}),filterFactory:new $({docId:r,ownerDocument:A}),cMapReaderFactory:oe?null:new m({baseUrl:p,isCompressed:g}),standardFontDataFactory:oe?null:new x({baseUrl:y}),wasmFactory:oe?null:new w({baseUrl:b})};d||(d=H1.create({verbosity:h,port:nc.workerPort}),e._worker=d);const R={docId:r,apiVersion:"5.4.54",data:s,password:l,disableAutoFetch:G,rangeChunkSize:u,length:W,docBaseUrl:f,enableXfa:q,evaluatorOptions:{maxImageSize:N,disableFontFace:z,ignoreErrors:j,isEvalSupported:C,isOffscreenCanvasSupported:k,isImageDecoderSupported:E,canvasMaxAreaInBytes:M,fontExtraProperties:I,useSystemFonts:X,useWasm:F,useWorkerFetch:oe,cMapUrl:p,iccUrl:v,standardFontDataUrl:y,wasmUrl:b}},ee={ownerDocument:A,pdfBug:Y,styleElement:le,loadingParams:{disableAutoFetch:G,enableXfa:q}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const te=d.messageHandler.sendWithPromise("GetDocRequest",R,s?[s.buffer]:null);let Z;if(c)Z=new Llt(c,{disableRange:U,disableStream:K});else if(!s){if(!n)throw new Error("getDocument - no `url` parameter provided.");const J=Ib(n)?Ult:ui?Qlt:qlt;Z=new J({url:n,length:W,httpHeaders:i,withCredentials:o,rangeChunkSize:u,disableRange:U,disableStream:K})}return te.then(J=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const he=new Fb(r,J,d.port),P=new sct(he,e,Z,ee,B,L);e._transport=P,he.send("Ready",null)})}).catch(e._capability.reject),e}var Ak;const Ek=class Ek{constructor(){Le(this,"_capability",Promise.withResolvers());Le(this,"_transport",null);Le(this,"_worker",null);Le(this,"docId",`d${Jn(Ek,Ak)._++}`);Le(this,"destroyed",!1);Le(this,"onPassword",null);Le(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,r,n,s;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((r=this._transport)==null?void 0:r.destroy())}catch(i){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,i}this._transport=null,(s=this._worker)==null||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Ak=new WeakMap,se(Ek,Ak,0);let H5=Ek;var Xp,B_,U_,z_,H_;class khe{constructor(e,r,n=!1,s=null){se(this,Xp,Promise.withResolvers());se(this,B_,[]);se(this,U_,[]);se(this,z_,[]);se(this,H_,[]);this.length=e,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=s}addRangeListener(e){_(this,H_).push(e)}addProgressListener(e){_(this,z_).push(e)}addProgressiveReadListener(e){_(this,U_).push(e)}addProgressiveDoneListener(e){_(this,B_).push(e)}onDataRange(e,r){for(const n of _(this,H_))n(e,r)}onDataProgress(e,r){_(this,Xp).promise.then(()=>{for(const n of _(this,z_))n(e,r)})}onDataProgressiveRead(e){_(this,Xp).promise.then(()=>{for(const r of _(this,U_))r(e)})}onDataProgressiveDone(){_(this,Xp).promise.then(()=>{for(const e of _(this,B_))e()})}transportReady(){_(this,Xp).resolve()}requestDataRange(e,r){br("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}Xp=new WeakMap,B_=new WeakMap,U_=new WeakMap,z_=new WeakMap,H_=new WeakMap;class rct{constructor(e,r){this._pdfInfo=e,this._transport=r}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 Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(r)}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 fu,Qp,Hb;class nct{constructor(e,r,n,s=!1){se(this,Qp);se(this,fu,!1);this._pageIndex=e,this._pageInfo=r,this._transport=n,this._stats=s?new qG:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new jhe,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:r=this.rotate,offsetX:n=0,offsetY:s=0,dontFlip:i=!1}={}){return new hS({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:r,offsetX:n,offsetY:s,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ut(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:r=e.canvas,viewport:n,intent:s="display",annotationMode:i=Rd.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:d=null,printAnnotationStorage:h=null,isEditing:f=!1}){var j,N;(j=this._stats)==null||j.time("Overall");const p=this._transport.getRenderingIntent(s,i,h,f),{renderingIntent:g,cacheKey:m}=p;Q(this,fu,!1),c||(c=this._transport.getOptionalContentConfig(g));let v=this._intentStates.get(m);v||(v=Object.create(null),this._intentStates.set(m,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);const y=!!(g&wa.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(N=this._stats)==null||N.time("Page Request"),this._pumpOperatorList(p));const x=C=>{var k;v.renderTasks.delete(b),y&&Q(this,fu,!0),ce(this,Qp,Hb).call(this),C?(b.capability.reject(C),this._abortOperatorList({intentState:v,reason:C instanceof Error?C:new Error(C)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(k=globalThis.Stats)!=null&&k.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new W5({callback:x,params:{canvas:r,canvasContext:e,viewport:n,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA});(v.renderTasks||(v.renderTasks=new Set)).add(b);const w=b.task;return Promise.all([v.displayReadyCapability.promise,c]).then(([C,k])=>{var E;if(this.destroyed){x();return}if((E=this._stats)==null||E.time("Rendering"),!(k.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:C,optionalContentConfig:k}),b.operatorListChanged()}).catch(x),w}getOperatorList({intent:e="display",annotationMode:r=Rd.ENABLE,printAnnotationStorage:n=null,isEditing:s=!1}={}){var u;function i(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const o=this._transport.getRenderingIntent(e,r,n,s,!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=i,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:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:r===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>z1.textContent(n));const r=this.streamTextContent(e);return new Promise(function(n,s){function i(){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),i()},s)}const o=r.getReader(),l={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),Q(this,fu,!1),Promise.all(e)}cleanup(e=!1){Q(this,fu,!0);const r=ce(this,Qp,Hb).call(this);return e&&r&&this._stats&&(this._stats=new qG),r}_startRenderPage(e,r){var s,i;const n=this._intentStates.get(r);n&&((s=this._stats)==null||s.timeEnd("Page Request"),(i=n.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,r){for(let n=0,s=e.length;n<s;n++)r.operatorList.fnArray.push(e.fnArray[n]),r.operatorList.argsArray.push(e.argsArray[n]);r.operatorList.lastChunk=e.lastChunk,r.operatorList.separateAnnots=e.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();e.lastChunk&&ce(this,Qp,Hb).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:r,annotationStorageSerializable:n,modifiedIds:s}){const{map:i,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:r,annotationStorage:i,modifiedIds:s},o).getReader(),u=this._intentStates.get(r);u.streamReader=c;const d=()=>{c.read().then(({value:h,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),d())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();ce(this,Qp,Hb).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:r,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(r instanceof W8){let s=tct;r.extraDelay>0&&r.extraDelay<1e3&&(s+=r.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:r,force:!0})},s);return}}if(e.streamReader.cancel(new nf(r.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[s,i]of this._intentStates)if(i===e){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}fu=new WeakMap,Qp=new WeakSet,Hb=function(){if(!_(this,fu)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:r}of this._intentStates.values())if(e.size>0||!r.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),Q(this,fu,!1),!0};var hh,Ho,pu,Zp,Ck,Jp,em,gi,UA,The,Phe,Wb,Iv,zA;const qr=class qr{constructor({name:e=null,port:r=null,verbosity:n=Hot()}={}){se(this,gi);se(this,hh,Promise.withResolvers());se(this,Ho,null);se(this,pu,null);se(this,Zp,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,r){if(_(qr,em).has(r))throw new Error("Cannot use more than one PDFWorker per port.");_(qr,em).set(r,this),ce(this,gi,The).call(this,r)}else ce(this,gi,Phe).call(this)}get promise(){return _(this,hh).promise}get port(){return _(this,pu)}get messageHandler(){return _(this,Ho)}destroy(){var e,r;this.destroyed=!0,(e=_(this,Zp))==null||e.terminate(),Q(this,Zp,null),_(qr,em).delete(_(this,pu)),Q(this,pu,null),(r=_(this,Ho))==null||r.destroy(),Q(this,Ho,null)}static create(e){const r=_(this,em).get(e==null?void 0:e.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new qr(e)}static get workerSrc(){if(nc.workerSrc)return nc.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ut(this,"_setupFakeWorkerGlobal",(async()=>_(this,Iv,zA)?_(this,Iv,zA):(await import(this.workerSrc)).WorkerMessageHandler)())}};hh=new WeakMap,Ho=new WeakMap,pu=new WeakMap,Zp=new WeakMap,Ck=new WeakMap,Jp=new WeakMap,em=new WeakMap,gi=new WeakSet,UA=function(){_(this,hh).resolve(),_(this,Ho).send("configure",{verbosity:this.verbosity})},The=function(e){Q(this,pu,e),Q(this,Ho,new Fb("main","worker",e)),_(this,Ho).on("ready",()=>{}),ce(this,gi,UA).call(this)},Phe=function(){if(_(qr,Jp)||_(qr,Iv,zA)){ce(this,gi,Wb).call(this);return}let{workerSrc:e}=qr;try{qr._isSameOrigin(window.location,e)||(e=qr._createCDNWrapper(new URL(e,window.location).href));const r=new Worker(e,{type:"module"}),n=new Fb("main","worker",r),s=()=>{i.abort(),n.destroy(),r.terminate(),this.destroyed?_(this,hh).reject(new Error("Worker was destroyed")):ce(this,gi,Wb).call(this)},i=new AbortController;r.addEventListener("error",()=>{_(this,Zp)||s()},{signal:i.signal}),n.on("test",l=>{if(i.abort(),this.destroyed||!l){s();return}Q(this,Ho,n),Q(this,pu,r),Q(this,Zp,r),ce(this,gi,UA).call(this)}),n.on("ready",l=>{if(i.abort(),this.destroyed){s();return}try{o()}catch{ce(this,gi,Wb).call(this)}});const o=()=>{const l=new Uint8Array;n.send("test",l,[l.buffer])};o();return}catch{U2("The worker has been disabled.")}ce(this,gi,Wb).call(this)},Wb=function(){_(qr,Jp)||(Tt("Setting up fake worker."),Q(qr,Jp,!0)),qr._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){_(this,hh).reject(new Error("Worker was destroyed"));return}const r=new plt;Q(this,pu,r);const n=`fake${Jn(qr,Ck)._++}`,s=new Fb(n+"_worker",n,r);e.setup(s,r),Q(this,Ho,new Fb(n,n+"_worker",r)),ce(this,gi,UA).call(this)}).catch(e=>{_(this,hh).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Iv=new WeakSet,zA=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},se(qr,Iv),se(qr,Ck,0),se(qr,Jp,!1),se(qr,em,new WeakMap),ui&&(Q(qr,Jp,!0),nc.workerSrc||(nc.workerSrc="./pdf.worker.mjs")),qr._isSameOrigin=(e,r)=>{const n=URL.parse(e);if(!(n!=null&&n.origin)||n.origin==="null")return!1;const s=new URL(r,n);return n.origin===s.origin},qr._createCDNWrapper=e=>{const r=`await import("${e}");`;return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},qr.fromPort=e=>{if(tlt("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return qr.create(e)};let H1=qr;var mu,Wl,Rv,Mv,gu,tm,Vb;class sct{constructor(e,r,n,s,i,o){se(this,tm);se(this,mu,new Map);se(this,Wl,new Map);se(this,Rv,new Map);se(this,Mv,new Map);se(this,gu,null);this.messageHandler=e,this.loadingTask=r,this.commonObjs=new jhe,this.fontLoader=new llt({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.wasmFactory=i.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 Ut(this,"annotationStorage",new q8)}getRenderingIntent(e,r=Rd.ENABLE,n=null,s=!1,i=!1){let o=wa.DISPLAY,l=T5;switch(e){case"any":o=wa.ANY;break;case"display":break;case"print":o=wa.PRINT;break;default:Tt(`getRenderingIntent - invalid intent: ${e}`)}const c=o&wa.PRINT&&n instanceof ohe?n:this.annotationStorage;switch(r){case Rd.DISABLE:o+=wa.ANNOTATIONS_DISABLE;break;case Rd.ENABLE:break;case Rd.ENABLE_FORMS:o+=wa.ANNOTATIONS_FORMS;break;case Rd.ENABLE_STORAGE:o+=wa.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Tt(`getRenderingIntent - invalid annotationMode: ${r}`)}s&&(o+=wa.IS_EDITING),i&&(o+=wa.OPLIST);const{ids:u,hash:d}=c.modifiedIds,h=[o,l.hash,d];return{renderingIntent:o,cacheKey:h.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=_(this,gu))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of _(this,Wl).values())e.push(s._destroy());_(this,Wl).clear(),_(this,Rv).clear(),_(this,Mv).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return e.push(r),Promise.all(e).then(()=>{var s,i;this.commonObjs.clear(),this.fontLoader.clear(),_(this,mu).clear(),this.filterFactory.destroy(),U1.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new nf("Worker was terminated.")),(i=this.messageHandler)==null||i.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:r}=this;e.on("GetReader",(n,s)=>{Rn(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=i=>{this._lastProgress={loaded:i.loaded,total:i.total}},s.onPull=()=>{this._fullReader.read().then(function({value:i,done:o}){if(o){s.close();return}Rn(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{s.error(i)})},s.onCancel=i=>{this._fullReader.cancel(i),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",async n=>{var l;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:i,contentLength:o}=this._fullReader;return(!s||!i)&&(this._lastProgress&&((l=r.onProgress)==null||l.call(r,this._lastProgress)),this._fullReader.onProgress=c=>{var u;(u=r.onProgress)==null||u.call(r,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:s,isRangeSupported:i,contentLength:o}}),e.on("GetRangeReader",(n,s)=>{Rn(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(n.begin,n.end);if(!i){s.close();return}s.onPull=()=>{i.read().then(function({value:o,done:l}){if(l){s.close();return}Rn(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{s.error(o)})},s.onCancel=o=>{i.cancel(o),s.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new rct(n,this))}),e.on("DocException",n=>{r._capability.reject(Ci(n))}),e.on("PasswordRequest",n=>{Q(this,gu,Promise.withResolvers());try{if(!r.onPassword)throw Ci(n);const s=i=>{i instanceof Error?_(this,gu).reject(i):_(this,gu).resolve({password:i})};r.onPassword(s,n.code)}catch(s){_(this,gu).reject(s)}return _(this,gu).promise}),e.on("DataLoaded",n=>{var s;(s=r.onProgress)==null||s.call(r,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;_(this,Wl).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,s,i])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in i){const d=i.error;Tt(`Error during font loading: ${d}`),this.commonObjs.resolve(n,d);break}const l=this._params.pdfBug&&((o=globalThis.FontInspector)!=null&&o.enabled)?(d,h)=>globalThis.FontInspector.fontAdded(d,h):null,c=new clt(i,l);this.fontLoader.bind(c).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c.fontExtraProperties&&c.data&&(c.data=null),this.commonObjs.resolve(n,c)});break;case"CopyLocalImage":const{imageRef:u}=i;Rn(u,"The imageRef must be defined.");for(const d of _(this,Wl).values())for(const[,h]of d.objs)if((h==null?void 0:h.ref)===u)return h.dataLen?(this.commonObjs.resolve(n,structuredClone(h)),h.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([n,s,i,o])=>{var c;if(this.destroyed)return;const l=_(this,Wl).get(s);if(!l.objs.has(n)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(i){case"Image":case"Pattern":l.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",n=>{var s;this.destroyed||(s=r.onProgress)==null||s.call(r,{loaded:n.loaded,total:n.total})}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");const s=this[n.type];if(!s)throw new Error(`${n.type} not initialized, see the \`useWorkerFetch\` parameter.`);return s.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&Tt("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:r}=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},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=e-1,n=_(this,Rv).get(r);if(n)return n;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&_(this,Mv).set(i.refStr,e);const o=new nct(r,i,this,this._params.pdfBug);return _(this,Wl).set(r,o),o});return _(this,Rv).set(r,s),s}getPageIndex(e){return P5(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:r})}getFieldObjects(){return ce(this,tm,Vb).call(this,"GetFieldObjects")}hasJSActions(){return ce(this,tm,Vb).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)}getDocJSActions(){return ce(this,tm,Vb).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 ce(this,tm,Vb).call(this,"GetOptionalContentConfig").then(r=>new Dlt(r,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",r=_(this,mu).get(e);if(r)return r;const n=this.messageHandler.sendWithPromise(e,null).then(s=>{var i,o;return{info:s[0],metadata:s[1]?new Rlt(s[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return _(this,mu).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 r of _(this,Wl).values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),_(this,mu).clear(),this.filterFactory.destroy(!0),U1.cleanup()}}cachedPageNumber(e){if(!P5(e))return null;const r=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return _(this,Mv).get(r)??null}}mu=new WeakMap,Wl=new WeakMap,Rv=new WeakMap,Mv=new WeakMap,gu=new WeakMap,tm=new WeakSet,Vb=function(e,r=null){const n=_(this,mu).get(e);if(n)return n;const s=this.messageHandler.sendWithPromise(e,r);return _(this,mu).set(e,s),s};var fh;class ict{constructor(e){se(this,fh,null);Le(this,"onContinue",null);Le(this,"onError",null);Q(this,fh,e)}get promise(){return _(this,fh).capability.promise}cancel(e=0){_(this,fh).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=_(this,fh).operatorList;if(!e)return!1;const{annotationCanvasMap:r}=_(this,fh);return e.form||e.canvas&&(r==null?void 0:r.size)>0}}fh=new WeakMap;var ph,rm;const tp=class tp{constructor({callback:e,params:r,objs:n,commonObjs:s,annotationCanvasMap:i,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null,enableHWA:p=!1}){se(this,ph,null);this.callback=e,this.params=r,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=h,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ict(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=r.canvas,this._canvasContext=r.canvas?null:r.canvasContext,this._enableHWA=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:r}){var l,c;if(this.cancelled)return;if(this._canvas){if(_(tp,rm).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.");_(tp,rm).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:n,transform:s,background:i}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Uy(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:i}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,r=0){var n,s,i;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),_(this,ph)&&(window.cancelAnimationFrame(_(this,ph)),Q(this,ph,null)),_(tp,rm).delete(this._canvas),e||(e=new W8(`Rendering cancelled, page ${this._pageIndex+1}`,r)),this.callback(e),(i=(s=this.task).onError)==null||i.call(s,e)}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?Q(this,ph,window.requestAnimationFrame(()=>{Q(this,ph,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),_(tp,rm).delete(this._canvas),this.callback())))}};ph=new WeakMap,rm=new WeakMap,se(tp,rm,new WeakSet);let W5=tp;const Ohe="5.4.54",act="295fb3ec4";var ua,nm,Dv,Hn,W_,Lv,yu,V_,mh,Wo,q_,xr,V5,q5,G5,Kf,Ihe,Nd;const ki=class ki{constructor({editor:e=null,uiManager:r=null}){se(this,xr);se(this,ua,null);se(this,nm,null);se(this,Dv);se(this,Hn,null);se(this,W_,!1);se(this,Lv,!1);se(this,yu,null);se(this,V_);se(this,mh,null);se(this,Wo,null);var n,s;e?(Q(this,Lv,!1),Q(this,yu,e)):Q(this,Lv,!0),Q(this,Wo,(e==null?void 0:e._uiManager)||r),Q(this,V_,_(this,Wo)._eventBus),Q(this,Dv,((n=e==null?void 0:e.color)==null?void 0:n.toUpperCase())||((s=_(this,Wo))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),_(ki,q_)||Q(ki,q_,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 Ut(this,"_keyboardManager",new fS([[["Escape","mac+Escape"],ki.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ki.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ki.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ki.prototype._moveToPrevious],[["Home","mac+Home"],ki.prototype._moveToBeginning],[["End","mac+End"],ki.prototype._moveToEnd]]))}renderButton(){const e=Q(this,ua,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",_(this,yu)&&(e.ariaControls=`${_(this,yu).id}_colorpicker_dropdown`);const r=_(this,Wo)._signal;e.addEventListener("click",ce(this,xr,Kf).bind(this),{signal:r}),e.addEventListener("keydown",ce(this,xr,G5).bind(this),{signal:r});const n=Q(this,nm,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=_(this,Dv),e.append(n),e}renderMainDropdown(){const e=Q(this,Hn,ce(this,xr,V5).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===_(this,ua)){ce(this,xr,Kf).call(this,e);return}const r=e.target.getAttribute("data-color");r&&ce(this,xr,q5).call(this,r,e)}_moveToNext(e){var r,n;if(!_(this,xr,Nd)){ce(this,xr,Kf).call(this,e);return}if(e.target===_(this,ua)){(r=_(this,Hn).firstChild)==null||r.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var r,n;if(e.target===((r=_(this,Hn))==null?void 0:r.firstChild)||e.target===_(this,ua)){_(this,xr,Nd)&&this._hideDropdownFromKeyboard();return}_(this,xr,Nd)||ce(this,xr,Kf).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var r;if(!_(this,xr,Nd)){ce(this,xr,Kf).call(this,e);return}(r=_(this,Hn).firstChild)==null||r.focus()}_moveToEnd(e){var r;if(!_(this,xr,Nd)){ce(this,xr,Kf).call(this,e);return}(r=_(this,Hn).lastChild)==null||r.focus()}hideDropdown(){var e,r;(e=_(this,Hn))==null||e.classList.add("hidden"),_(this,ua).ariaExpanded="false",(r=_(this,mh))==null||r.abort(),Q(this,mh,null)}_hideDropdownFromKeyboard(){var e;if(!_(this,Lv)){if(!_(this,xr,Nd)){(e=_(this,yu))==null||e.unselect();return}this.hideDropdown(),_(this,ua).focus({preventScroll:!0,focusVisible:_(this,W_)})}}updateColor(e){if(_(this,nm)&&(_(this,nm).style.backgroundColor=e),!_(this,Hn))return;const r=_(this,Wo).highlightColors.values();for(const n of _(this,Hn).children)n.ariaSelected=r.next().value===e.toUpperCase()}destroy(){var e,r;(e=_(this,ua))==null||e.remove(),Q(this,ua,null),Q(this,nm,null),(r=_(this,Hn))==null||r.remove(),Q(this,Hn,null)}};ua=new WeakMap,nm=new WeakMap,Dv=new WeakMap,Hn=new WeakMap,W_=new WeakMap,Lv=new WeakMap,yu=new WeakMap,V_=new WeakMap,mh=new WeakMap,Wo=new WeakMap,q_=new WeakMap,xr=new WeakSet,V5=function(){const e=document.createElement("div"),r=_(this,Wo)._signal;e.addEventListener("contextmenu",_o,{signal:r}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),_(this,yu)&&(e.id=`${_(this,yu).id}_colorpicker_dropdown`);for(const[n,s]of _(this,Wo).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",s),i.title=n,i.setAttribute("data-l10n-id",_(ki,q_)[n]);const o=document.createElement("span");i.append(o),o.className="swatch",o.style.backgroundColor=s,i.ariaSelected=s===_(this,Dv),i.addEventListener("click",ce(this,xr,q5).bind(this,s),{signal:r}),e.append(i)}return e.addEventListener("keydown",ce(this,xr,G5).bind(this),{signal:r}),e},q5=function(e,r){r.stopPropagation(),_(this,V_).dispatch("switchannotationeditorparams",{source:this,type:Kt.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},G5=function(e){ki._keyboardManager.exec(this,e)},Kf=function(e){if(_(this,xr,Nd)){this.hideDropdown();return}if(Q(this,W_,e.detail===0),_(this,mh)||(Q(this,mh,new AbortController),window.addEventListener("pointerdown",ce(this,xr,Ihe).bind(this),{signal:_(this,Wo).combinedSignal(_(this,mh))})),_(this,ua).ariaExpanded="true",_(this,Hn)){_(this,Hn).classList.remove("hidden");return}const r=Q(this,Hn,ce(this,xr,V5).call(this));_(this,ua).append(r)},Ihe=function(e){var r;(r=_(this,Hn))!=null&&r.contains(e.target)||this.hideDropdown()},Nd=function(){return _(this,Hn)&&!_(this,Hn).classList.contains("hidden")},se(ki,q_,null);let lk=ki;var Vl,G_,Fv,K_;const rp=class rp{constructor(e){se(this,Vl,null);se(this,G_,null);se(this,Fv,null);Q(this,G_,e),Q(this,Fv,e._uiManager),_(rp,K_)||Q(rp,K_,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(_(this,Vl))return _(this,Vl);const{editorType:e,colorType:r,colorValue:n}=_(this,G_),s=Q(this,Vl,document.createElement("input"));return s.type="color",s.value=n||"#000000",s.className="basicColorPicker",s.tabIndex=0,s.setAttribute("data-l10n-id",_(rp,K_)[e]),s.addEventListener("input",()=>{_(this,Fv).updateParams(r,s.value)},{signal:_(this,Fv)._signal}),s}update(e){_(this,Vl)&&(_(this,Vl).value=e)}destroy(){var e;(e=_(this,Vl))==null||e.remove(),Q(this,Vl,null)}hideDropdown(){}};Vl=new WeakMap,G_=new WeakMap,Fv=new WeakMap,K_=new WeakMap,se(rp,K_,null);let ck=rp;function lK(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function hb(t){return Math.max(0,Math.min(255,255*t))}class cK{static CMYK_G([e,r,n,s]){return["G",1-Math.min(1,.3*e+.59*n+.11*r+s)]}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=hb(e),[e,e,e]}static G_HTML([e]){const r=lK(e);return`#${r}${r}${r}`}static RGB_G([e,r,n]){return["G",.3*e+.59*r+.11*n]}static RGB_rgb(e){return e.map(hb)}static RGB_HTML(e){return`#${e.map(lK).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,r,n,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,r+s)]}static CMYK_rgb([e,r,n,s]){return[hb(1-Math.min(1,e+s)),hb(1-Math.min(1,n+s)),hb(1-Math.min(1,r+s))]}static CMYK_HTML(e){const r=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([e,r,n]){const s=1-e,i=1-r,o=1-n,l=Math.min(s,i,o);return["CMYK",s,i,o,l]}}class oct{create(e,r,n=!1){if(e<=0||r<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${e}px`),s.setAttribute("height",`${r}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${r}`),s}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){br("Abstract method `_createSVG` called.")}}class uk extends oct{_createSVG(e){return document.createElementNS($c,e)}}class Rhe{static setupStorage(e,r,n,s,i){const o=s.getValue(r,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(r,{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"),i==="print")break;e.addEventListener("change",l=>{s.setValue(r,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),i==="print")break;e.addEventListener("input",l=>{s.setValue(r,{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;s.setValue(r,{value:u})});break}}static setAttributes({html:e,element:r,storage:n=null,intent:s,linkService:i}){const{attributes:o}=r,l=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${s}`);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&&i.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,r,n)}static render(e){var h,f;const r=e.annotationStorage,n=e.linkService,s=e.xfaHtml,i=e.intent||"display",o=document.createElement(s.name);s.attributes&&this.setAttributes({html:o,element:s,intent:i,linkService:n});const l=i!=="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=[];if(s.children.length===0){if(s.value){const p=document.createTextNode(s.value);o.append(p),l&&z1.shouldBuildText(s.name)&&u.push(p)}return{textDivs:u}}const d=[[s,-1,o]];for(;d.length>0;){const[p,g,m]=d.at(-1);if(g+1===p.children.length){d.pop();continue}const v=p.children[++d.at(-1)[1]];if(v===null)continue;const{name:y}=v;if(y==="#text"){const b=document.createTextNode(v.value);u.push(b),m.append(b);continue}const x=(h=v==null?void 0:v.attributes)!=null&&h.xmlns?document.createElementNS(v.attributes.xmlns,y):document.createElement(y);if(m.append(x),v.attributes&&this.setAttributes({html:x,element:v,storage:r,intent:i,linkService:n}),((f=v.children)==null?void 0:f.length)>0)d.push([v,-1,x]);else if(v.value){const b=document.createTextNode(v.value);l&&z1.shouldBuildText(y)&&u.push(b),x.append(b)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const r=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=r,e.div.hidden=!1}}const lct=9,eg=new WeakSet,cct=new Date().getTimezoneOffset()*60*1e3;class uK{static create(e){switch(e.data.annotationType){case kn.LINK:return new Y8(e);case kn.TEXT:return new uct(e);case kn.WIDGET:switch(e.data.fieldType){case"Tx":return new dct(e);case"Btn":return e.data.radioButton?new Lhe(e):e.data.checkBox?new fct(e):new pct(e);case"Ch":return new mct(e);case"Sig":return new hct(e)}return new yg(e);case kn.POPUP:return new Y5(e);case kn.FREETEXT:return new zhe(e);case kn.LINE:return new yct(e);case kn.SQUARE:return new vct(e);case kn.CIRCLE:return new xct(e);case kn.POLYLINE:return new Hhe(e);case kn.CARET:return new wct(e);case kn.INK:return new X8(e);case kn.POLYGON:return new bct(e);case kn.HIGHLIGHT:return new Whe(e);case kn.UNDERLINE:return new _ct(e);case kn.SQUIGGLY:return new jct(e);case kn.STRIKEOUT:return new Sct(e);case kn.STAMP:return new Vhe(e);case kn.FILEATTACHMENT:return new Nct(e);default:return new An(e)}}}var sm,$v,vu,Y_,K5;const TB=class TB{constructor(e,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!1}={}){se(this,Y_);se(this,sm,null);se(this,$v,!1);se(this,vu,null);this.isRenderable=r,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,r&&(this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:r}){return!!(e!=null&&e.str||r!=null&&r.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return TB._hasPopupData(this.data)}updateEdited(e){var i;if(!this.container)return;e.rect&&(_(this,sm)||Q(this,sm,{rect:this.data.rect.slice(0)}));const{rect:r,popup:n}=e;r&&ce(this,Y_,K5).call(this,r);let s=((i=_(this,vu))==null?void 0:i.popup)||this.popup;!s&&(n!=null&&n.text)&&(this._createPopup(n),s=_(this,vu).popup),s&&(s.updateEdited(e),n!=null&&n.deleted&&(s.remove(),Q(this,vu,null),this.popup=null))}resetEdited(){var e;_(this,sm)&&(ce(this,Y_,K5).call(this,_(this,sm).rect),(e=_(this,vu))==null||e.popup.resetEdited(),Q(this,sm,null))}_createContainer(e){const{data:r,parent:{page:n,viewport:s}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",r.id),!(this instanceof yg)&&!(this instanceof Y8)&&(i.tabIndex=0);const{style:o}=i;if(o.zIndex=this.parent.zIndex++,r.alternativeText&&(i.title=r.alternativeText),r.noRotate&&i.classList.add("norotate"),!r.rect||this instanceof Y5){const{rotation:m}=r;return!r.hasOwnCanvas&&m!==0&&this.setRotation(m,i),i}const{width:l,height:c}=this;if(!e&&r.borderStyle.width>0){o.borderWidth=`${r.borderStyle.width}px`;const m=r.borderStyle.horizontalCornerRadius,v=r.borderStyle.verticalCornerRadius;if(m>0||v>0){const x=`calc(${m}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;o.borderRadius=x}else if(this instanceof Lhe){const x=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=x}switch(r.borderStyle.style){case Ug.SOLID:o.borderStyle="solid";break;case Ug.DASHED:o.borderStyle="dashed";break;case Ug.BEVELED:Tt("Unimplemented border style: beveled");break;case Ug.INSET:Tt("Unimplemented border style: inset");break;case Ug.UNDERLINE:o.borderBottomStyle="solid";break}const y=r.borderColor||null;y?(Q(this,$v,!0),o.borderColor=ft.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):o.borderWidth=0}const u=ft.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=s.rawDims;o.left=`${100*(u[0]-f)/d}%`,o.top=`${100*(u[1]-p)/h}%`;const{rotation:g}=r;return r.hasOwnCanvas||g===0?(o.width=`${100*l/d}%`,o.height=`${100*c/h}%`):this.setRotation(g,i),i}setRotation(e,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims;let{width:i,height:o}=this;e%180!==0&&([i,o]=[o,i]),r.style.width=`${100*i/n}%`,r.style.height=`${100*o/s}%`,r.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(r,n,s)=>{const i=s.detail[r],o=i[0],l=i.slice(1);s.target.style[n]=cK[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:cK[`${o}_rgb`](l)})};return Ut(this,"_commonActions",{display:r=>{const{display:n}=r.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{e("bgColor","backgroundColor",r)},fillColor:r=>{e("fillColor","backgroundColor",r)},fgColor:r=>{e("fgColor","color",r)},textColor:r=>{e("textColor","color",r)},borderColor:r=>{e("borderColor","borderColor",r)},strokeColor:r=>{e("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,r){const n=this._commonActions;for(const s of Object.keys(r.detail)){const i=e[s]||n[s];i==null||i(r)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[s,i]of Object.entries(r)){const o=n[s];if(o){const l={detail:{[s]:i},target:e};o(l),delete r[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[r,n,s,i]=this.data.rect.map(m=>Math.fround(m));if(e.length===8){const[m,v,y,x]=e.subarray(2,6);if(s===m&&i===v&&r===y&&n===x)return}const{style:o}=this.container;let l;if(_(this,$v)){const{borderColor:m,borderWidth:v}=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="${m}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const c=s-r,u=i-n,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),g=`clippath_${this.data.id}`;p.setAttribute("id",g),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let m=2,v=e.length;m<v;m+=8){const y=e[m],x=e[m+1],b=e[m+2],w=e[m+3],j=d.createElement("rect"),N=(b-r)/c,C=(i-x)/u,k=(y-b)/c,E=(x-w)/u;j.setAttribute("x",N),j.setAttribute("y",C),j.setAttribute("width",k),j.setAttribute("height",E),p.append(j),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${N}" y="${C}" width="${k}" height="${E}"/>`)}_(this,$v)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(h),this.container.style.clipPath=`url(#${g})`}_createPopup(e=null){const{data:r}=this;let n,s;e?(n={str:e.text},s=e.date):(n=r.contentsObj,s=r.modificationDate);const i=Q(this,vu,new Y5({data:{color:r.color,titleObj:r.titleObj,modificationDate:s,contentsObj:n,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}get hasPopupElement(){return!!(_(this,vu)||this.popup||this.data.popupRef)}render(){br("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,r=null){const n=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:i,id:o,exportValues:l}of s){if(i===-1||o===r)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!eg.has(u)){Tt(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:u})}return n}for(const s of document.getElementsByName(e)){const{exportValue:i}=s,o=s.getAttribute("data-element-id");o!==r&&eg.has(s)&&n.push({id:o,exportValue:i,domElement:s})}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 r of e)r.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:e,editId:r,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};sm=new WeakMap,$v=new WeakMap,vu=new WeakMap,Y_=new WeakSet,K5=function(e){const{container:{style:r},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}}}=this;n==null||n.splice(0,4,...e),r.left=`${100*(e[0]-l)/i}%`,r.top=`${100*(o-e[3]+c)/o}%`,s===0?(r.width=`${100*(e[2]-e[0])/i}%`,r.height=`${100*(e[3]-e[1])/o}%`):this.setRotation(s)};let An=TB;var Na,Yf,Mhe,Dhe;class Y8 extends An{constructor(r,n=null){super(r,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});se(this,Na);this.isTooltipOnly=r.data.isTooltipOnly}render(){const{data:r,linkService:n}=this,s=document.createElement("a");s.setAttribute("data-element-id",r.id);let i=!1;return r.url?(n.addLinkAttributes(s,r.url,r.newWindow),i=!0):r.action?(this._bindNamedAction(s,r.action,r.overlaidText),i=!0):r.attachment?(ce(this,Na,Mhe).call(this,s,r.attachment,r.overlaidText,r.attachmentDest),i=!0):r.setOCGState?(ce(this,Na,Dhe).call(this,s,r.setOCGState,r.overlaidText),i=!0):r.dest?(this._bindLink(s,r.dest,r.overlaidText),i=!0):(r.actions&&(r.actions.Action||r.actions["Mouse Up"]||r.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,r),i=!0),r.resetForm?(this._bindResetFormAction(s,r.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(s),this.container}_bindLink(r,n,s=""){r.href=this.linkService.getDestinationHash(n),r.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&ce(this,Na,Yf).call(this),s&&(r.title=s)}_bindNamedAction(r,n,s=""){r.href=this.linkService.getAnchorUrl(""),r.onclick=()=>(this.linkService.executeNamedAction(n),!1),s&&(r.title=s),ce(this,Na,Yf).call(this)}_bindJSAction(r,n){r.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(n.actions)){const o=s.get(i);o&&(r[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:i}}),!1})}n.overlaidText&&(r.title=n.overlaidText),r.onclick||(r.onclick=()=>!1),ce(this,Na,Yf).call(this)}_bindResetFormAction(r,n){const s=r.onclick;if(s||(r.href=this.linkService.getAnchorUrl("")),ce(this,Na,Yf).call(this),!this._fieldObjects){Tt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(r.onclick=()=>!1);return}r.onclick=()=>{var h;s==null||s();const{fields:i,refs:o,include:l}=n,c=[];if(i.length!==0||o.length!==0){const f=new Set(o);for(const p of i){const g=this._fieldObjects[p]||[];for(const{id:m}of g)f.add(m)}for(const p of Object.values(this._fieldObjects))for(const g of p)f.has(g.id)===l&&c.push(g)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const u=this.annotationStorage,d=[];for(const f of c){const{id:p}=f;switch(d.push(p),f.type){case"text":{const m=f.defaultValue||"";u.setValue(p,{value:m});break}case"checkbox":case"radiobutton":{const m=f.defaultValue===f.exportValues;u.setValue(p,{value:m});break}case"combobox":case"listbox":{const m=f.defaultValue||"";u.setValue(p,{value:m});break}default:continue}const g=document.querySelector(`[data-element-id="${p}"]`);if(g){if(!eg.has(g)){Tt(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;g.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}Na=new WeakSet,Yf=function(){this.container.setAttribute("data-internal-link","")},Mhe=function(r,n,s="",i=null){r.href=this.linkService.getAnchorUrl(""),n.description?r.title=n.description:s&&(r.title=s),r.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(n.content,n.filename,i),!1},ce(this,Na,Yf).call(this)},Dhe=function(r,n,s=""){r.href=this.linkService.getAnchorUrl(""),r.onclick=()=>(this.linkService.executeSetOCGState(n),!1),s&&(r.title=s),ce(this,Na,Yf).call(this)};class uct extends An{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class yg extends An{render(){return this.container}showElementAndHideCanvas(e){var r;this.data.hasOwnCanvas&&(((r=e.previousSibling)==null?void 0:r.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return ks.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,r,n,s,i){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:s,value:i(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(n,o=>{var l;if(n==="blur"){if(!r.focused||!o.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}i&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(o)}}))})}_setEventListeners(e,r,n,s){var i,o,l;for(const[c,u]of n)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(r||(r={focused:!1})),this._setEventListener(e,r,c,u,s),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,r,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(e,r,"focus","Focus",null))}_setBackgroundColor(e){const r=this.data.backgroundColor||null;e.style.backgroundColor=r===null?"transparent":ft.makeHexColor(r[0],r[1],r[2])}_setTextStyle(e){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||lct,i=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),d=Math.round(u/(pI*s))||1,h=u/d;o=Math.min(s,c(h/pI))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(s,c(u/pI))}i.fontSize=`calc(${o}px * var(--total-scale-factor))`,i.color=ft.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(i.textAlign=r[this.data.textAlignment])}_setRequired(e,r){r?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",r)}}class dct extends yg{constructor(e){const r=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:r})}setPropertyOnSiblings(e,r,n,s){const i=this.annotationStorage;for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[r]=n),i.setValue(o.id,{[s]:n})}render(){var s,i;const e=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const o=e.getValue(r,{value:this.data.fieldValue});let l=o.value||"";const c=e.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((s=this.data.textContent)==null?void 0:s.join(`
`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={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),eg.add(n),n.setAttribute("data-element-id",r),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:h,datetimeType:f,timeStep:p}=this.data,g=!!f&&this.enableScripting;h&&(n.title=h),this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",v=>{e.setValue(r,{value:v.target.value}),this.setPropertyOnSiblings(n,"value",v.target.value,"value"),d.formattedValue=null}),n.addEventListener("resetform",v=>{const y=this.data.defaultFieldValue??"";n.value=d.userValue=y,d.formattedValue=null});let m=v=>{const{formattedValue:y}=d;y!=null&&(v.target.value=y),v.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{var b;if(d.focused)return;const{target:x}=y;if(g&&(x.type=f,p&&(x.step=p)),d.userValue){const w=d.userValue;if(g)if(f==="time"){const j=new Date(w),N=[j.getHours(),j.getMinutes(),j.getSeconds()];x.value=N.map(C=>C.toString().padStart(2,"0")).join(":")}else x.value=new Date(w-cct).toISOString().split(f==="date"?"T":".",1)[0];else x.value=w}d.lastCommittedValue=x.value,d.commitKey=1,(b=this.data.actions)!=null&&b.Focus||(d.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);const x={value(b){d.userValue=b.detail.value??"",g||e.setValue(r,{value:d.userValue.toString()}),b.target.value=d.userValue},formattedValue(b){const{formattedValue:w}=b.detail;d.formattedValue=w,w!=null&&b.target!==document.activeElement&&(b.target.value=w);const j={formattedValue:w};g&&(j.value=w),e.setValue(r,j)},selRange(b){b.target.setSelectionRange(...b.detail.selRange)},charLimit:b=>{var C;const{charLimit:w}=b.detail,{target:j}=b;if(w===0){j.removeAttribute("maxLength");return}j.setAttribute("maxLength",w);let N=d.userValue;!N||N.length<=w||(N=N.slice(0,w),j.value=d.userValue=N,e.setValue(r,{value:N}),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:N,willCommit:!0,commitKey:1,selStart:j.selectionStart,selEnd:j.selectionEnd}}))}};this._dispatchEventFromSandbox(x,y)}),n.addEventListener("keydown",y=>{var w;d.commitKey=1;let x=-1;if(y.key==="Escape"?x=0:y.key==="Enter"&&!this.data.multiLine?x=2:y.key==="Tab"&&(d.commitKey=3),x===-1)return;const{value:b}=y.target;d.lastCommittedValue!==b&&(d.lastCommittedValue=b,d.userValue=b,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:b,willCommit:!0,commitKey:x,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const v=m;m=null,n.addEventListener("blur",y=>{var w,j;if(!d.focused||!y.relatedTarget)return;(w=this.data.actions)!=null&&w.Blur||(d.focused=!1);const{target:x}=y;let{value:b}=x;if(g){if(b&&f==="time"){const N=b.split(":").map(C=>parseInt(C,10));b=new Date(2e3,0,1,N[0],N[1],N[2]||0).valueOf(),x.step=""}else b=new Date(b).valueOf();x.type="text"}d.userValue=b,d.lastCommittedValue!==b&&((j=this.linkService.eventBus)==null||j.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:b,willCommit:!0,commitKey:d.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),v(y)}),(i=this.data.actions)!=null&&i.Keystroke&&n.addEventListener("beforeinput",y=>{var E;d.lastCommittedValue=null;const{data:x,target:b}=y,{value:w,selectionStart:j,selectionEnd:N}=b;let C=j,k=N;switch(y.inputType){case"deleteWordBackward":{const M=w.substring(0,j).match(/\w*[^\w]*$/);M&&(C-=M[0].length);break}case"deleteWordForward":{const M=w.substring(j).match(/^[^\w]*\w*/);M&&(k+=M[0].length);break}case"deleteContentBackward":j===N&&(C-=1);break;case"deleteContentForward":j===N&&(k+=1);break}y.preventDefault(),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:w,change:x||"",willCommit:!1,selStart:C,selEnd:k}})}),this._setEventListeners(n,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(m&&n.addEventListener("blur",m),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${y}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 hct extends yg{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class fct extends yg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,r=this.data,n=r.id;let s=e.getValue(n,{value:r.exportValue===r.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",e.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return eg.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=r.fieldName,s&&i.setAttribute("checked",!0),i.setAttribute("exportValue",r.exportValue),i.tabIndex=0,i.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n)){const d=c&&u.exportValue===r.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(n,{value:c})}),i.addEventListener("resetform",o=>{const l=r.defaultFieldValue||"Off";o.target.checked=l===r.exportValue}),this.enableScripting&&this.hasJSActions&&(i.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(i,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(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Lhe extends yg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,r=this.data,n=r.id;let s=e.getValue(n,{value:r.fieldValue===r.buttonValue}).value;if(typeof s=="string"&&(s=s!==r.buttonValue,e.setValue(n,{value:s})),s)for(const o of this._getElementsByName(r.fieldName,n))e.setValue(o.id,{value:!1});const i=document.createElement("input");if(eg.add(i),i.setAttribute("data-element-id",n),i.disabled=r.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=r.fieldName,s&&i.setAttribute("checked",!0),i.tabIndex=0,i.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})}),i.addEventListener("resetform",o=>{const l=r.defaultFieldValue;o.target.checked=l!=null&&l===r.buttonValue}),this.enableScripting&&this.hasJSActions){const o=r.buttonValue;i.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const d=o===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===n;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(i,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)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class pct extends Y8{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const r=e.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class mct extends yg{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,r=this.data.id,n=e.getValue(r,{value:this.data.fieldValue}),s=document.createElement("select");eg.add(s),s.setAttribute("data-element-id",r),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",d=>{const h=this.data.defaultFieldValue;for(const f of s.options)f.selected=f.value===h});for(const d of this.data.options){const h=document.createElement("option");h.textContent=d.displayValue,h.value=d.exportValue,n.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),s.append(h)}let o=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),o=()=>{d.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const l=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=s;return p?Array.prototype.filter.call(f,g=>g.selected).map(g=>g[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let c=l(!1);const u=d=>{const h=d.target.options;return Array.prototype.map.call(h,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",d=>{const h={value(f){o==null||o();const p=f.detail.value,g=new Set(Array.isArray(p)?p:[p]);for(const m of s.options)m.selected=g.has(m.value);e.setValue(r,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){const p=s.options,g=f.detail.remove;p[g].selected=!1,s.remove(g),p.length>0&&Array.prototype.findIndex.call(p,v=>v.selected)===-1&&(p[0].selected=!0),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);e.setValue(r,{value:null,items:[]}),c=l(!1)},insert(f){const{index:p,displayValue:g,exportValue:m}=f.detail.insert,v=s.children[p],y=document.createElement("option");y.textContent=g,y.value=m,v?v.before(y):s.append(y),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},items(f){const{items:p}=f.detail;for(;s.length!==0;)s.remove(0);for(const g of p){const{displayValue:m,exportValue:v}=g,y=document.createElement("option");y.textContent=m,y.value=v,s.append(y)}s.options.length>0&&(s.options[0].selected=!0),e.setValue(r,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){const p=new Set(f.detail.indices);for(const g of f.target.options)g.selected=p.has(g.index);e.setValue(r,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),s.addEventListener("input",d=>{var p;const h=l(!0),f=l(!1);e.setValue(r,{value:h}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:c,change:f,changeEx:h,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):s.addEventListener("input",function(d){e.setValue(r,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Y5 extends An{constructor(e){const{data:r,elements:n}=e;super(e,{isRenderable:An._hasPopupData(r)}),this.elements=n,this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const r=this.popup=new gct({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}),n=[];for(const s of this.elements)s.popup=r,s.container.ariaHasPopup="dialog",n.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(s=>`${H8}${s}`).join(",")),this.container}}var Bv,kk,Tk,Uv,zv,ln,xu,gh,Hv,X_,Wv,ql,da,yh,bu,Q_,wu,Vv,im,vh,nr,HA,WA,X5,Fhe,$he,Bhe,Uhe,VA,qA,Q5;class gct{constructor({container:e,color:r,elements:n,titleObj:s,modificationDate:i,contentsObj:o,richText:l,parent:c,rect:u,parentRect:d,open:h}){se(this,nr);se(this,Bv,ce(this,nr,Bhe).bind(this));se(this,kk,ce(this,nr,Q5).bind(this));se(this,Tk,ce(this,nr,qA).bind(this));se(this,Uv,ce(this,nr,VA).bind(this));se(this,zv,null);se(this,ln,null);se(this,xu,null);se(this,gh,null);se(this,Hv,null);se(this,X_,null);se(this,Wv,null);se(this,ql,!1);se(this,da,null);se(this,yh,null);se(this,bu,null);se(this,Q_,null);se(this,wu,null);se(this,Vv,null);se(this,im,null);se(this,vh,!1);Q(this,ln,e),Q(this,Vv,s),Q(this,xu,o),Q(this,wu,l),Q(this,X_,c),Q(this,zv,r),Q(this,Q_,u),Q(this,Wv,d),Q(this,Hv,n),Q(this,gh,ik.toDateObject(i)),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup()),ce(this,nr,HA).call(this),_(this,ln).hidden=!0,h&&ce(this,nr,VA).call(this)}render(){var s;if(_(this,da))return;const e=Q(this,da,document.createElement("div"));if(e.className="popup",_(this,zv)){const i=e.style.outlineColor=ft.makeHexColor(..._(this,zv));e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}const r=document.createElement("span");if(r.className="header",(s=_(this,Vv))!=null&&s.str){const i=document.createElement("span");i.className="title",r.append(i),{dir:i.dir,str:i.textContent}=_(this,Vv)}if(e.append(r),_(this,gh)){const i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:_(this,gh).valueOf()})),i.dateTime=_(this,gh).toISOString(),r.append(i)}const n=_(this,nr,WA);if(n)Rhe.render({xfaHtml:n,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const i=this._formatContents(_(this,xu));e.append(i)}_(this,ln).append(e)}_formatContents({str:e,dir:r}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=r;const s=e.split(/(?:\r\n?|\n)/);for(let i=0,o=s.length;i<o;++i){const l=s[i];n.append(document.createTextNode(l)),i<o-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:e,popup:r,deleted:n}){var s;if(n||r!=null&&r.deleted){this.remove();return}ce(this,nr,HA).call(this),_(this,im)||Q(this,im,{contentsObj:_(this,xu),richText:_(this,wu)}),e&&Q(this,bu,null),r&&(Q(this,wu,ce(this,nr,$he).call(this,r.text)),Q(this,gh,ik.toDateObject(r.date)),Q(this,xu,null)),(s=_(this,da))==null||s.remove(),Q(this,da,null)}resetEdited(){var e;_(this,im)&&({contentsObj:Jn(this,xu)._,richText:Jn(this,wu)._}=_(this,im),Q(this,im,null),(e=_(this,da))==null||e.remove(),Q(this,da,null),Q(this,bu,null))}remove(){var e,r;(e=_(this,yh))==null||e.abort(),Q(this,yh,null),(r=_(this,da))==null||r.remove(),Q(this,da,null),Q(this,vh,!1),Q(this,ql,!1);for(const n of this.trigger)n.classList.remove("popupTriggerArea")}forceHide(){Q(this,vh,this.isVisible),_(this,vh)&&(_(this,ln).hidden=!0)}maybeShow(){ce(this,nr,HA).call(this),_(this,vh)&&(_(this,da)||ce(this,nr,qA).call(this),Q(this,vh,!1),_(this,ln).hidden=!1)}get isVisible(){return _(this,ln).hidden===!1}}Bv=new WeakMap,kk=new WeakMap,Tk=new WeakMap,Uv=new WeakMap,zv=new WeakMap,ln=new WeakMap,xu=new WeakMap,gh=new WeakMap,Hv=new WeakMap,X_=new WeakMap,Wv=new WeakMap,ql=new WeakMap,da=new WeakMap,yh=new WeakMap,bu=new WeakMap,Q_=new WeakMap,wu=new WeakMap,Vv=new WeakMap,im=new WeakMap,vh=new WeakMap,nr=new WeakSet,HA=function(){var r;if(_(this,yh))return;Q(this,yh,new AbortController);const{signal:e}=_(this,yh);for(const n of this.trigger)n.addEventListener("click",_(this,Uv),{signal:e}),n.addEventListener("mouseenter",_(this,Tk),{signal:e}),n.addEventListener("mouseleave",_(this,kk),{signal:e}),n.classList.add("popupTriggerArea");for(const n of _(this,Hv))(r=n.container)==null||r.addEventListener("keydown",_(this,Bv),{signal:e})},WA=function(){const e=_(this,wu),r=_(this,xu);return e!=null&&e.str&&(!(r!=null&&r.str)||r.str===e.str)&&_(this,wu).html||null},X5=function(){var e,r,n;return((n=(r=(e=_(this,nr,WA))==null?void 0:e.attributes)==null?void 0:r.style)==null?void 0:n.fontSize)||0},Fhe=function(){var e,r,n;return((n=(r=(e=_(this,nr,WA))==null?void 0:e.attributes)==null?void 0:r.style)==null?void 0:n.color)||null},$he=function(e){const r=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:r}]}},s={style:{color:_(this,nr,Fhe),fontSize:_(this,nr,X5)?`calc(${_(this,nr,X5)}px * var(--total-scale-factor))`:""}};for(const i of e.split(`
`))r.push({name:"span",value:i,attributes:s});return n},Bhe=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&_(this,ql))&&ce(this,nr,VA).call(this)},Uhe=function(){if(_(this,bu)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:s,pageY:i}}}=_(this,X_);let o=!!_(this,Wv),l=o?_(this,Wv):_(this,Q_);for(const g of _(this,Hv))if(!l||ft.intersect(g.data.rect,l)!==null){l=g.data.rect,o=!0;break}const c=ft.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),d=o?l[2]-l[0]+5:0,h=c[0]+d,f=c[1];Q(this,bu,[100*(h-s)/r,100*(f-i)/n]);const{style:p}=_(this,ln);p.left=`${_(this,bu)[0]}%`,p.top=`${_(this,bu)[1]}%`},VA=function(){Q(this,ql,!_(this,ql)),_(this,ql)?(ce(this,nr,qA).call(this),_(this,ln).addEventListener("click",_(this,Uv)),_(this,ln).addEventListener("keydown",_(this,Bv))):(ce(this,nr,Q5).call(this),_(this,ln).removeEventListener("click",_(this,Uv)),_(this,ln).removeEventListener("keydown",_(this,Bv)))},qA=function(){_(this,da)||this.render(),this.isVisible?_(this,ql)&&_(this,ln).classList.add("focused"):(ce(this,nr,Uhe).call(this),_(this,ln).hidden=!1,_(this,ln).style.zIndex=parseInt(_(this,ln).style.zIndex)+1e3)},Q5=function(){_(this,ln).classList.remove("focused"),!(_(this,ql)||!this.isVisible)&&(_(this,ln).hidden=!0,_(this,ln).style.zIndex=parseInt(_(this,ln).style.zIndex)-1e3)};class zhe extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=kt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const r of this.textContent){const n=document.createElement("span");n.textContent=r,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Z_;class yct extends An{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,Z_,null)}render(){this.container.classList.add("lineAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=Q(this,Z_,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",r.rect[2]-r.lineCoordinates[0]),o.setAttribute("y1",r.rect[3]-r.lineCoordinates[1]),o.setAttribute("x2",r.rect[2]-r.lineCoordinates[2]),o.setAttribute("y2",r.rect[3]-r.lineCoordinates[3]),o.setAttribute("stroke-width",r.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,Z_)}addHighlightArea(){this.container.classList.add("highlightArea")}}Z_=new WeakMap;var J_;class vct extends An{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,J_,null)}render(){this.container.classList.add("squareAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=r.borderStyle.width,l=Q(this,J_,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",n-o),l.setAttribute("height",s-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,J_)}addHighlightArea(){this.container.classList.add("highlightArea")}}J_=new WeakMap;var ej;class xct extends An{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,ej,null)}render(){this.container.classList.add("circleAnnotation");const{data:r,width:n,height:s}=this,i=this.svgFactory.create(n,s,!0),o=r.borderStyle.width,l=Q(this,ej,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",s/2),l.setAttribute("rx",n/2-o/2),l.setAttribute("ry",s/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!r.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,ej)}addHighlightArea(){this.container.classList.add("highlightArea")}}ej=new WeakMap;var tj;class Hhe extends An{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,tj,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:r,vertices:n,borderStyle:s,popupRef:i},width:o,height:l}=this;if(!n)return this.container;const c=this.svgFactory.create(o,l,!0);let u=[];for(let h=0,f=n.length;h<f;h+=2){const p=n[h]-r[0],g=r[3]-n[h+1];u.push(`${p},${g}`)}u=u.join(" ");const d=Q(this,tj,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",u),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return _(this,tj)}addHighlightArea(){this.container.classList.add("highlightArea")}}tj=new WeakMap;class bct extends Hhe{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class wct extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var rj,am,nj,Z5;class X8 extends An{constructor(r){super(r,{isRenderable:!0,ignoreBorder:!0});se(this,nj);se(this,rj,null);se(this,am,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?kt.HIGHLIGHT:kt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:r,rotation:n,inkLists:s,borderStyle:i,popupRef:o}}=this,{transform:l,width:c,height:u}=ce(this,nj,Z5).call(this,n,r),d=this.svgFactory.create(c,u,!0),h=Q(this,rj,this.svgFactory.createElement("svg:g"));d.append(h),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",l);for(let f=0,p=s.length;f<p;f++){const g=this.svgFactory.createElement(this.svgElementName);_(this,am).push(g),g.setAttribute("points",s[f].join(",")),h.append(g)}return!o&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(r){super.updateEdited(r);const{thickness:n,points:s,rect:i}=r,o=_(this,rj);if(n>=0&&o.setAttribute("stroke-width",n||1),s)for(let l=0,c=_(this,am).length;l<c;l++)_(this,am)[l].setAttribute("points",s[l].join(","));if(i){const{transform:l,width:c,height:u}=ce(this,nj,Z5).call(this,this.data.rotation,i);o.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),o.setAttribute("transform",l)}}getElementsToTriggerPopup(){return _(this,am)}addHighlightArea(){this.container.classList.add("highlightArea")}}rj=new WeakMap,am=new WeakMap,nj=new WeakSet,Z5=function(r,n){switch(r){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 Whe extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=kt.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&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 _ct extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&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 jct extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&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 Sct extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:r}}=this;if(!r&&this.hasPopupData&&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 Vhe extends An{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=kt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var sj,ij,J5;class Nct extends An{constructor(r){var s;super(r,{isRenderable:!0});se(this,ij);se(this,sj,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:r,data:n}=this;let s;n.hasAppearance||n.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),s.addEventListener("dblclick",ce(this,ij,J5).bind(this)),Q(this,sj,s);const{isMac:i}=ks.platform;return r.addEventListener("keydown",o=>{o.key==="Enter"&&(i?o.metaKey:o.ctrlKey)&&ce(this,ij,J5).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),r.append(s),r}getElementsToTriggerPopup(){return _(this,sj)}addHighlightArea(){this.container.classList.add("highlightArea")}}sj=new WeakMap,ij=new WeakSet,J5=function(){var r;(r=this.downloadManager)==null||r.openOrDownloadData(this.content,this.filename)};var aj,om,xh,oj,lf,t3,r3;const PB=class PB{constructor({div:e,accessibilityManager:r,annotationCanvasMap:n,annotationEditorUIManager:s,page:i,viewport:o,structTreeLayer:l}){se(this,lf);se(this,aj,null);se(this,om,null);se(this,xh,new Map);se(this,oj,null);this.div=e,Q(this,aj,r),Q(this,om,n),Q(this,oj,l||null),this.page=i,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return _(this,xh).size>0}async render(e){var o;const{annotations:r}=e,n=this.div;Zm(n,this.viewport);const s=new Map,i={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new uk,annotationStorage:e.annotationStorage||new q8,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const l of r){if(l.noHTML)continue;const c=l.annotationType===kn.POPUP;if(c){const h=s.get(l.id);if(!h)continue;i.elements=h}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;i.data=l;const u=uK.create(i);if(!u.isRenderable)continue;if(!c&&l.popupRef){const h=s.get(l.popupRef);h?h.push(u):s.set(l.popupRef,[u])}const d=u.render();l.hidden&&(d.style.visibility="hidden"),await ce(this,lf,t3).call(this,d,l.id,i.elements),u._isEditable&&(_(this,xh).set(u.data.id,u),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(u))}ce(this,lf,r3).call(this)}async addLinkAnnotations(e,r){const n={data:null,layer:this.div,linkService:r,svgFactory:new uk,parent:this};for(const s of e){s.borderStyle||(s.borderStyle=PB._defaultBorderStyle),n.data=s;const i=uK.create(n);if(!i.isRenderable)continue;const o=i.render();await ce(this,lf,t3).call(this,o,s.id,null)}}update({viewport:e}){const r=this.div;this.viewport=e,Zm(r,{rotation:e.rotation}),ce(this,lf,r3).call(this),r.hidden=!1}getEditableAnnotations(){return Array.from(_(this,xh).values())}getEditableAnnotation(e){return _(this,xh).get(e)}static get _defaultBorderStyle(){return Ut(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Ug.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};aj=new WeakMap,om=new WeakMap,xh=new WeakMap,oj=new WeakMap,lf=new WeakSet,t3=async function(e,r,n){var l,c;const s=e.firstChild||e,i=s.id=`${H8}${r}`,o=await((l=_(this,oj))==null?void 0:l.getAriaAttributes(i));if(o)for(const[u,d]of o)s.setAttribute(u,d);n?n.at(-1).container.after(e):(this.div.append(e),(c=_(this,aj))==null||c.moveElementInDOM(this.div,e,s,!1))},r3=function(){var r;if(!_(this,om))return;const e=this.div;for(const[n,s]of _(this,om)){const i=e.querySelector(`[data-annotation-id="${n}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:o}=i;o?o.nodeName==="CANVAS"?o.replaceWith(s):o.classList.contains("annotationContent")?o.after(s):o.before(s):i.append(s);const l=_(this,xh).get(n);l&&(l._hasNoCanvas?((r=this._annotationEditorUIManager)==null||r.setMissingCanvas(n,i.id,s),l._hasNoCanvas=!1):l.canvas=s)}_(this,om).clear()};let e3=PB;const HN=/\r\n?|\n/g;var Xa,ha,lj,lm,fa,Dn,qhe,Ghe,Khe,GA,zu,KA,YA,Yhe,s3,Xhe;const Sr=class Sr extends Pr{constructor(r){super({...r,name:"freeTextEditor"});se(this,Dn);se(this,Xa);se(this,ha,"");se(this,lj,`${this.id}-editor`);se(this,lm,null);se(this,fa);Le(this,"_colorPicker",null);Q(this,Xa,r.color||Sr._defaultColor||Pr._defaultLineColor),Q(this,fa,r.fontSize||Sr._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const r=Sr.prototype,n=o=>o.isEmpty(),s=Jm.TRANSLATE_SMALL,i=Jm.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new fS([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],r.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],r.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],r._translateEmpty,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],r._translateEmpty,{args:[-i,0],checker:n}],[["ArrowRight","mac+ArrowRight"],r._translateEmpty,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],r._translateEmpty,{args:[i,0],checker:n}],[["ArrowUp","mac+ArrowUp"],r._translateEmpty,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],r._translateEmpty,{args:[0,-i],checker:n}],[["ArrowDown","mac+ArrowDown"],r._translateEmpty,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],r._translateEmpty,{args:[0,i],checker:n}]]))}static initialize(r,n){Pr.initialize(r,n);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(r,n){switch(r){case Kt.FREETEXT_SIZE:Sr._defaultFontSize=n;break;case Kt.FREETEXT_COLOR:Sr._defaultColor=n;break}}updateParams(r,n){switch(r){case Kt.FREETEXT_SIZE:ce(this,Dn,qhe).call(this,n);break;case Kt.FREETEXT_COLOR:ce(this,Dn,Ghe).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Kt.FREETEXT_SIZE,Sr._defaultFontSize],[Kt.FREETEXT_COLOR,Sr._defaultColor||Pr._defaultLineColor]]}get propertiesToUpdate(){return[[Kt.FREETEXT_SIZE,_(this,fa)],[Kt.FREETEXT_COLOR,_(this,Xa)]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new ck(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Kt.FREETEXT_COLOR}get colorValue(){return _(this,Xa)}_translateEmpty(r,n){this._uiManager.translateSelectedEditors(r,n,!0)}getInitialTranslation(){const r=this.parentScale;return[-Sr._internalPadding*r,-(Sr._internalPadding+_(this,fa))*r]}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"),Q(this,lm,new AbortController);const r=this._uiManager.combinedSignal(_(this,lm));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:r}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:r}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:r}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:r}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:r}),!0}disableEditMode(){var r;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_(this,lj)),this._isDraggable=!0,(r=_(this,lm))==null||r.abort(),Q(this,lm,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(r){this._focusEventsAllowed&&(super.focusin(r),r.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(r){var n;this.width||(this.enableEditMode(),r&&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 r=_(this,ha),n=Q(this,ha,ce(this,Dn,Khe).call(this).trimEnd());if(r===n)return;const s=i=>{if(Q(this,ha,i),!i){this.remove();return}ce(this,Dn,YA).call(this),this._uiManager.rebuild(this),ce(this,Dn,GA).call(this)};this.addCommands({cmd:()=>{s(n)},undo:()=>{s(r)},mustExec:!1}),ce(this,Dn,GA).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(r){r.target===this.div&&r.key==="Enter"&&(this.enterInEditMode(),r.preventDefault())}editorDivKeydown(r){Sr._keyboardManager.exec(this,r)}editorDivFocus(r){this.isEditing=!0}editorDivBlur(r){this.isEditing=!1}editorDivInput(r){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 r,n;(this._isCopy||this.annotationElementId)&&(r=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_(this,lj)),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:s}=this.editorDiv;if(s.fontSize=`calc(${_(this,fa)}px * var(--total-scale-factor))`,s.color=_(this,Xa),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[d,h]=this.pageDimensions,[f,p]=this.pageTranslation;let g,m;switch(this.rotation){case 0:g=r+(l[0]-f)/d,m=n+this.height-(l[1]-p)/h;break;case 90:g=r+(l[0]-f)/d,m=n-(l[1]-p)/h,[c,u]=[u,-c];break;case 180:g=r-this.width+(l[0]-f)/d,m=n-(l[1]-p)/h,[c,u]=[-c,-u];break;case 270:g=r+(l[0]-f-this.height*h)/d,m=n+(l[1]-p-this.width*d)/h,[c,u]=[-u,c];break}this.setAt(g*i,m*o,c,u)}else this._moveAfterPaste(r,n);ce(this,Dn,YA).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(r){var g,m,v;const n=r.clipboardData||window.clipboardData,{types:s}=n;if(s.length===1&&s[0]==="text/plain")return;r.preventDefault();const i=ce(g=Sr,zu,s3).call(g,n.getData("text")||"").replaceAll(HN,`
`);if(!i)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!i.includes(`
`)){l.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,d=[],h=[];if(c.nodeType===Node.TEXT_NODE){const y=c.parentElement;if(h.push(c.nodeValue.slice(u).replaceAll(HN,"")),y!==this.editorDiv){let x=d;for(const b of this.editorDiv.childNodes){if(b===y){x=h;continue}x.push(ce(m=Sr,zu,KA).call(m,b))}}d.push(c.nodeValue.slice(0,u).replaceAll(HN,""))}else if(c===this.editorDiv){let y=d,x=0;for(const b of this.editorDiv.childNodes)x++===u&&(y=h),y.push(ce(v=Sr,zu,KA).call(v,b))}Q(this,ha,`${d.join(`
`)}${i}${h.join(`
`)}`),ce(this,Dn,YA).call(this);const f=new Range;let p=Math.sumPrecise(d.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const x=y.nodeValue.length;if(p<=x){f.setStart(y,p),f.setEnd(y,p);break}p-=x}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(r,n,s){var l;let i=null;if(r instanceof zhe){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:d,rotation:h,id:f,popupRef:p,contentsObj:g},textContent:m,textPosition:v,parent:{page:{pageNumber:y}}}=r;if(!m||m.length===0)return null;i=r={annotationType:kt.FREETEXT,color:Array.from(u),fontSize:c,value:m.join(`
`),position:v,pageIndex:y-1,rect:d.slice(0),rotation:h,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(g==null?void 0:g.str)||null}}const o=await super.deserialize(r,n,s);return Q(o,fa,r.fontSize),Q(o,Xa,ft.makeHexColor(...r.color)),Q(o,ha,ce(l=Sr,zu,s3).call(l,r.value)),o._initialData=i,r.comment&&o.setCommentData(r.comment),o}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=Sr._internalPadding*this.parentScale,s=this.getRect(n,n),i=Pr._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_(this,Xa)),o={annotationType:kt.FREETEXT,color:i,fontSize:_(this,fa),value:ce(this,Dn,Yhe).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(o),r?(o.isCopy=!0,o):this.annotationElementId&&!ce(this,Dn,Xhe).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(r){const n=super.renderAnnotationElement(r),{style:s}=n;s.fontSize=`calc(${_(this,fa)}px * var(--total-scale-factor))`,s.color=_(this,Xa),n.replaceChildren();for(const l of _(this,ha).split(`
`)){const c=document.createElement("div");c.append(l?document.createTextNode(l):document.createElement("br")),n.append(c)}const i=Sr._internalPadding*this.parentScale,o={rect:this.getRect(i,i)};return o.popup=this.hasEditedComment?this.comment:{text:_(this,ha)},r.updateEdited(o),n}resetAnnotationElement(r){super.resetAnnotationElement(r),r.resetEdited()}};Xa=new WeakMap,ha=new WeakMap,lj=new WeakMap,lm=new WeakMap,fa=new WeakMap,Dn=new WeakSet,qhe=function(r){const n=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-_(this,fa))*this.parentScale),Q(this,fa,i),ce(this,Dn,GA).call(this)},s=_(this,fa);this.addCommands({cmd:n.bind(this,r),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Ghe=function(r){const n=i=>{var o;Q(this,Xa,this.editorDiv.style.color=i),(o=this._colorPicker)==null||o.update(i)},s=_(this,Xa);this.addCommands({cmd:n.bind(this,r),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Khe=function(){var s;const r=[];this.editorDiv.normalize();let n=null;for(const i of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(r.push(ce(s=Sr,zu,KA).call(s,i)),n=i);return r.join(`
`)},GA=function(){const[r,n]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",i.div.append(this.div),s=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/r,this.height=s.height/n):(this.width=s.height/r,this.height=s.width/n),this.fixAndSetPosition()},zu=new WeakSet,KA=function(r){return(r.nodeType===Node.TEXT_NODE?r.nodeValue:r.innerText).replaceAll(HN,"")},YA=function(){if(this.editorDiv.replaceChildren(),!!_(this,ha))for(const r of _(this,ha).split(`
`)){const n=document.createElement("div");n.append(r?document.createTextNode(r):document.createElement("br")),this.editorDiv.append(n)}},Yhe=function(){return _(this,ha).replaceAll(" "," ")},s3=function(r){return r.replaceAll(" "," ")},Xhe=function(r){const{value:n,fontSize:s,color:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||r.value!==n||r.fontSize!==s||r.color.some((l,c)=>l!==i[c])||r.pageIndex!==o},se(Sr,zu),Le(Sr,"_freeTextDefaultContent",""),Le(Sr,"_internalPadding",0),Le(Sr,"_defaultColor",null),Le(Sr,"_defaultFontSize",10),Le(Sr,"_type","freetext"),Le(Sr,"_editorType",kt.FREETEXT);let n3=Sr;class ot{toSVGPath(){br("Abstract method `toSVGPath` must be implemented.")}get box(){br("Abstract getter `box` must be implemented.")}serialize(e,r){br("Abstract method `serialize` must be implemented.")}static _rescale(e,r,n,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=r+e[l]*s,o[l+1]=n+e[l+1]*i;return o}static _rescaleAndSwap(e,r,n,s,i,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=r+e[l+1]*s,o[l+1]=n+e[l]*i;return o}static _translate(e,r,n,s){s||(s=new Float32Array(e.length));for(let i=0,o=e.length;i<o;i+=2)s[i]=r+e[i],s[i+1]=n+e[i+1];return s}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,r,n,s,i){switch(i){case 90:return[1-r/n,e/s];case 180:return[1-e/n,1-r/s];case 270:return[r/n,1-e/s];default:return[e/n,r/s]}}static _normalizePagePoint(e,r,n){switch(n){case 90:return[1-r,e];case 180:return[1-e,1-r];case 270:return[r,1-e];default:return[e,r]}}static createBezierPoints(e,r,n,s,i,o){return[(e+5*n)/6,(r+5*s)/6,(5*n+i)/6,(5*s+o)/6,(n+i)/2,(s+o)/2]}}Le(ot,"PRECISION",1e-4);var pa,Vo,qv,Gv,Gl,Bt,cm,um,cj,uj,Kv,Yv,bh,dj,Pk,Ok,Yn,qb,Qhe,Zhe,Jhe,efe,tfe,rfe;const Kc=class Kc{constructor({x:e,y:r},n,s,i,o,l=0){se(this,Yn);se(this,pa);se(this,Vo,[]);se(this,qv);se(this,Gv);se(this,Gl,[]);se(this,Bt,new Float32Array(18));se(this,cm);se(this,um);se(this,cj);se(this,uj);se(this,Kv);se(this,Yv);se(this,bh,[]);Q(this,pa,n),Q(this,Yv,i*s),Q(this,Gv,o),_(this,Bt).set([NaN,NaN,NaN,NaN,e,r],6),Q(this,qv,l),Q(this,uj,_(Kc,dj)*s),Q(this,cj,_(Kc,Ok)*s),Q(this,Kv,s),_(this,bh).push(e,r)}isEmpty(){return isNaN(_(this,Bt)[8])}add({x:e,y:r}){var E;Q(this,cm,e),Q(this,um,r);const[n,s,i,o]=_(this,pa);let[l,c,u,d]=_(this,Bt).subarray(8,12);const h=e-u,f=r-d,p=Math.hypot(h,f);if(p<_(this,cj))return!1;const g=p-_(this,uj),m=g/p,v=m*h,y=m*f;let x=l,b=c;l=u,c=d,u+=v,d+=y,(E=_(this,bh))==null||E.push(e,r);const w=-y/g,j=v/g,N=w*_(this,Yv),C=j*_(this,Yv);return _(this,Bt).set(_(this,Bt).subarray(2,8),0),_(this,Bt).set([u+N,d+C],4),_(this,Bt).set(_(this,Bt).subarray(14,18),12),_(this,Bt).set([u-N,d-C],16),isNaN(_(this,Bt)[6])?(_(this,Gl).length===0&&(_(this,Bt).set([l+N,c+C],2),_(this,Gl).push(NaN,NaN,NaN,NaN,(l+N-n)/i,(c+C-s)/o),_(this,Bt).set([l-N,c-C],14),_(this,Vo).push(NaN,NaN,NaN,NaN,(l-N-n)/i,(c-C-s)/o)),_(this,Bt).set([x,b,l,c,u,d],6),!this.isEmpty()):(_(this,Bt).set([x,b,l,c,u,d],6),Math.abs(Math.atan2(b-c,x-l)-Math.atan2(y,v))<Math.PI/2?([l,c,u,d]=_(this,Bt).subarray(2,6),_(this,Gl).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/i,((c+d)/2-s)/o),[l,c,x,b]=_(this,Bt).subarray(14,18),_(this,Vo).push(NaN,NaN,NaN,NaN,((x+l)/2-n)/i,((b+c)/2-s)/o),!0):([x,b,l,c,u,d]=_(this,Bt).subarray(0,6),_(this,Gl).push(((x+5*l)/6-n)/i,((b+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),[u,d,l,c,x,b]=_(this,Bt).subarray(12,18),_(this,Vo).push(((x+5*l)/6-n)/i,((b+5*c)/6-s)/o,((5*l+u)/6-n)/i,((5*c+d)/6-s)/o,((l+u)/2-n)/i,((c+d)/2-s)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=_(this,Gl),r=_(this,Vo);if(isNaN(_(this,Bt)[6])&&!this.isEmpty())return ce(this,Yn,Qhe).call(this);const n=[];n.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)isNaN(e[s])?n.push(`L${e[s+4]} ${e[s+5]}`):n.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);ce(this,Yn,Jhe).call(this,n);for(let s=r.length-6;s>=6;s-=6)isNaN(r[s])?n.push(`L${r[s+4]} ${r[s+5]}`):n.push(`C${r[s]} ${r[s+1]} ${r[s+2]} ${r[s+3]} ${r[s+4]} ${r[s+5]}`);return ce(this,Yn,Zhe).call(this,n),n.join(" ")}newFreeDrawOutline(e,r,n,s,i,o){return new nfe(e,r,n,s,i,o)}getOutlines(){var h;const e=_(this,Gl),r=_(this,Vo),n=_(this,Bt),[s,i,o,l]=_(this,pa),c=new Float32Array((((h=_(this,bh))==null?void 0:h.length)??0)+2);for(let f=0,p=c.length-2;f<p;f+=2)c[f]=(_(this,bh)[f]-s)/o,c[f+1]=(_(this,bh)[f+1]-i)/l;if(c[c.length-2]=(_(this,cm)-s)/o,c[c.length-1]=(_(this,um)-i)/l,isNaN(n[6])&&!this.isEmpty())return ce(this,Yn,efe).call(this,c);const u=new Float32Array(_(this,Gl).length+24+_(this,Vo).length);let d=e.length;for(let f=0;f<d;f+=2){if(isNaN(e[f])){u[f]=u[f+1]=NaN;continue}u[f]=e[f],u[f+1]=e[f+1]}d=ce(this,Yn,rfe).call(this,u,d);for(let f=r.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(r[f+p])){u[d]=u[d+1]=NaN,d+=2;continue}u[d]=r[f+p],u[d+1]=r[f+p+1],d+=2}return ce(this,Yn,tfe).call(this,u,d),this.newFreeDrawOutline(u,c,_(this,pa),_(this,Kv),_(this,qv),_(this,Gv))}};pa=new WeakMap,Vo=new WeakMap,qv=new WeakMap,Gv=new WeakMap,Gl=new WeakMap,Bt=new WeakMap,cm=new WeakMap,um=new WeakMap,cj=new WeakMap,uj=new WeakMap,Kv=new WeakMap,Yv=new WeakMap,bh=new WeakMap,dj=new WeakMap,Pk=new WeakMap,Ok=new WeakMap,Yn=new WeakSet,qb=function(){const e=_(this,Bt).subarray(4,6),r=_(this,Bt).subarray(16,18),[n,s,i,o]=_(this,pa);return[(_(this,cm)+(e[0]-r[0])/2-n)/i,(_(this,um)+(e[1]-r[1])/2-s)/o,(_(this,cm)+(r[0]-e[0])/2-n)/i,(_(this,um)+(r[1]-e[1])/2-s)/o]},Qhe=function(){const[e,r,n,s]=_(this,pa),[i,o,l,c]=ce(this,Yn,qb).call(this);return`M${(_(this,Bt)[2]-e)/n} ${(_(this,Bt)[3]-r)/s} L${(_(this,Bt)[4]-e)/n} ${(_(this,Bt)[5]-r)/s} L${i} ${o} L${l} ${c} L${(_(this,Bt)[16]-e)/n} ${(_(this,Bt)[17]-r)/s} L${(_(this,Bt)[14]-e)/n} ${(_(this,Bt)[15]-r)/s} Z`},Zhe=function(e){const r=_(this,Vo);e.push(`L${r[4]} ${r[5]} Z`)},Jhe=function(e){const[r,n,s,i]=_(this,pa),o=_(this,Bt).subarray(4,6),l=_(this,Bt).subarray(16,18),[c,u,d,h]=ce(this,Yn,qb).call(this);e.push(`L${(o[0]-r)/s} ${(o[1]-n)/i} L${c} ${u} L${d} ${h} L${(l[0]-r)/s} ${(l[1]-n)/i}`)},efe=function(e){const r=_(this,Bt),[n,s,i,o]=_(this,pa),[l,c,u,d]=ce(this,Yn,qb).call(this),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(r[2]-n)/i,(r[3]-s)/o,NaN,NaN,NaN,NaN,(r[4]-n)/i,(r[5]-s)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[16]-n)/i,(r[17]-s)/o,NaN,NaN,NaN,NaN,(r[14]-n)/i,(r[15]-s)/o],0),this.newFreeDrawOutline(h,e,_(this,pa),_(this,Kv),_(this,qv),_(this,Gv))},tfe=function(e,r){const n=_(this,Vo);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],r),r+=6},rfe=function(e,r){const n=_(this,Bt).subarray(4,6),s=_(this,Bt).subarray(16,18),[i,o,l,c]=_(this,pa),[u,d,h,f]=ce(this,Yn,qb).call(this);return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/l,(n[1]-o)/c,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,(s[0]-i)/l,(s[1]-o)/c],r),r+=24},se(Kc,dj,8),se(Kc,Pk,2),se(Kc,Ok,_(Kc,dj)+_(Kc,Pk));let dk=Kc;var Xv,dm,_u,hj,ma,fj,wn,Ik,sfe;class nfe extends ot{constructor(r,n,s,i,o,l){super();se(this,Ik);se(this,Xv);se(this,dm,new Float32Array(4));se(this,_u);se(this,hj);se(this,ma);se(this,fj);se(this,wn);Q(this,wn,r),Q(this,ma,n),Q(this,Xv,s),Q(this,fj,i),Q(this,_u,o),Q(this,hj,l),this.lastPoint=[NaN,NaN],ce(this,Ik,sfe).call(this,l);const[c,u,d,h]=_(this,dm);for(let f=0,p=r.length;f<p;f+=2)r[f]=(r[f]-c)/d,r[f+1]=(r[f+1]-u)/h;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/d,n[f+1]=(n[f+1]-u)/h}toSVGPath(){const r=[`M${_(this,wn)[4]} ${_(this,wn)[5]}`];for(let n=6,s=_(this,wn).length;n<s;n+=6){if(isNaN(_(this,wn)[n])){r.push(`L${_(this,wn)[n+4]} ${_(this,wn)[n+5]}`);continue}r.push(`C${_(this,wn)[n]} ${_(this,wn)[n+1]} ${_(this,wn)[n+2]} ${_(this,wn)[n+3]} ${_(this,wn)[n+4]} ${_(this,wn)[n+5]}`)}return r.push("Z"),r.join(" ")}serialize([r,n,s,i],o){const l=s-r,c=i-n;let u,d;switch(o){case 0:u=ot._rescale(_(this,wn),r,i,l,-c),d=ot._rescale(_(this,ma),r,i,l,-c);break;case 90:u=ot._rescaleAndSwap(_(this,wn),r,n,l,c),d=ot._rescaleAndSwap(_(this,ma),r,n,l,c);break;case 180:u=ot._rescale(_(this,wn),s,n,-l,c),d=ot._rescale(_(this,ma),s,n,-l,c);break;case 270:u=ot._rescaleAndSwap(_(this,wn),s,i,-l,-c),d=ot._rescaleAndSwap(_(this,ma),s,i,-l,-c);break}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return _(this,dm)}newOutliner(r,n,s,i,o,l=0){return new dk(r,n,s,i,o,l)}getNewOutline(r,n){const[s,i,o,l]=_(this,dm),[c,u,d,h]=_(this,Xv),f=o*d,p=l*h,g=s*d+c,m=i*h+u,v=this.newOutliner({x:_(this,ma)[0]*f+g,y:_(this,ma)[1]*p+m},_(this,Xv),_(this,fj),r,_(this,hj),n??_(this,_u));for(let y=2;y<_(this,ma).length;y+=2)v.add({x:_(this,ma)[y]*f+g,y:_(this,ma)[y+1]*p+m});return v.getOutlines()}}Xv=new WeakMap,dm=new WeakMap,_u=new WeakMap,hj=new WeakMap,ma=new WeakMap,fj=new WeakMap,wn=new WeakMap,Ik=new WeakSet,sfe=function(r){const n=_(this,wn);let s=n[4],i=n[5];const o=[s,i,s,i];let l=s,c=i;const u=r?Math.max:Math.min;for(let h=6,f=n.length;h<f;h+=6){const p=n[h+4],g=n[h+5];if(isNaN(n[h]))ft.pointBoundingBox(p,g,o),c<g?(l=p,c=g):c===g&&(l=u(l,p));else{const m=[1/0,1/0,-1/0,-1/0];ft.bezierBoundingBox(s,i,...n.slice(h,h+6),m),ft.rectBoundingBox(...m,o),c<m[3]?(l=m[2],c=m[3]):c===m[3]&&(l=u(l,m[2]))}s=p,i=g}const d=_(this,dm);d[0]=o[0]-_(this,_u),d[1]=o[1]-_(this,_u),d[2]=o[2]-o[0]+2*_(this,_u),d[3]=o[3]-o[1]+2*_(this,_u),this.lastPoint=[l,c]};var pj,mj,wh,qo,vi,ife,XA,afe,ofe,a3;class i3{constructor(e,r=0,n=0,s=!0){se(this,vi);se(this,pj);se(this,mj);se(this,wh,[]);se(this,qo,[]);const i=[1/0,1/0,-1/0,-1/0],l=10**-4;for(const{x:g,y:m,width:v,height:y}of e){const x=Math.floor((g-r)/l)*l,b=Math.ceil((g+v+r)/l)*l,w=Math.floor((m-r)/l)*l,j=Math.ceil((m+y+r)/l)*l,N=[x,w,j,!0],C=[b,w,j,!1];_(this,wh).push(N,C),ft.rectBoundingBox(x,w,b,j,i)}const c=i[2]-i[0]+2*n,u=i[3]-i[1]+2*n,d=i[0]-n,h=i[1]-n,f=_(this,wh).at(s?-1:-2),p=[f[0],f[2]];for(const g of _(this,wh)){const[m,v,y]=g;g[0]=(m-d)/c,g[1]=(v-h)/u,g[2]=(y-h)/u}Q(this,pj,new Float32Array([d,h,c,u])),Q(this,mj,p)}getOutlines(){_(this,wh).sort((r,n)=>r[0]-n[0]||r[1]-n[1]||r[2]-n[2]);const e=[];for(const r of _(this,wh))r[3]?(e.push(...ce(this,vi,a3).call(this,r)),ce(this,vi,afe).call(this,r)):(ce(this,vi,ofe).call(this,r),e.push(...ce(this,vi,a3).call(this,r)));return ce(this,vi,ife).call(this,e)}}pj=new WeakMap,mj=new WeakMap,wh=new WeakMap,qo=new WeakMap,vi=new WeakSet,ife=function(e){const r=[],n=new Set;for(const o of e){const[l,c,u]=o;r.push([l,c,o],[l,u,o])}r.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=r.length;o<l;o+=2){const c=r[o][2],u=r[o+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}const s=[];let i;for(;n.size>0;){const o=n.values().next().value;let[l,c,u,d,h]=o;n.delete(o);let f=l,p=c;for(i=[l,u],s.push(i);;){let g;if(n.has(d))g=d;else if(n.has(h))g=h;else break;n.delete(g),[l,c,u,d,h]=g,f!==l&&(i.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}i.push(f,p)}return new Act(s,_(this,pj),_(this,mj))},XA=function(e){const r=_(this,qo);let n=0,s=r.length-1;for(;n<=s;){const i=n+s>>1,o=r[i][0];if(o===e)return i;o<e?n=i+1:s=i-1}return s+1},afe=function([,e,r]){const n=ce(this,vi,XA).call(this,e);_(this,qo).splice(n,0,[e,r])},ofe=function([,e,r]){const n=ce(this,vi,XA).call(this,e);for(let s=n;s<_(this,qo).length;s++){const[i,o]=_(this,qo)[s];if(i!==e)break;if(i===e&&o===r){_(this,qo).splice(s,1);return}}for(let s=n-1;s>=0;s--){const[i,o]=_(this,qo)[s];if(i!==e)break;if(i===e&&o===r){_(this,qo).splice(s,1);return}}},a3=function(e){const[r,n,s]=e,i=[[r,n,s]],o=ce(this,vi,XA).call(this,s);for(let l=0;l<o;l++){const[c,u]=_(this,qo)[l];for(let d=0,h=i.length;d<h;d++){const[,f,p]=i[d];if(!(u<=f||p<=c)){if(f>=c){if(p>u)i[d][1]=u;else{if(h===1)return[];i.splice(d,1),d--,h--}continue}i[d][2]=c,p>u&&i.push([r,u,p])}}}return i};var gj,Qv;class Act extends ot{constructor(r,n,s){super();se(this,gj);se(this,Qv);Q(this,Qv,r),Q(this,gj,n),this.lastPoint=s}toSVGPath(){const r=[];for(const n of _(this,Qv)){let[s,i]=n;r.push(`M${s} ${i}`);for(let o=2;o<n.length;o+=2){const l=n[o],c=n[o+1];l===s?(r.push(`V${c}`),i=c):c===i&&(r.push(`H${l}`),s=l)}r.push("Z")}return r.join(" ")}serialize([r,n,s,i],o){const l=[],c=s-r,u=i-n;for(const d of _(this,Qv)){const h=new Array(d.length);for(let f=0;f<d.length;f+=2)h[f]=r+d[f]*c,h[f+1]=i-d[f+1]*u;l.push(h)}return l}get box(){return _(this,gj)}get classNamesForOutlining(){return["highlightOutline"]}}gj=new WeakMap,Qv=new WeakMap;class o3 extends dk{newFreeDrawOutline(e,r,n,s,i,o){return new Ect(e,r,n,s,i,o)}}class Ect extends nfe{newOutliner(e,r,n,s,i,o=0){return new o3(e,r,n,s,i,o)}}var Zv,yj,ju,hm,vj,Ri,xj,bj,fm,Qa,ga,gs,Jv,Su,Vs,ex,Za,wj,It,l3,QA,lfe,cfe,ufe,c3,Xf,ao,Gg,dfe,ZA,Gb,hfe,ffe,pfe,mfe,gfe;const ar=class ar extends Pr{constructor(r){super({...r,name:"highlightEditor"});se(this,It);se(this,Zv,null);se(this,yj,0);se(this,ju);se(this,hm,null);se(this,vj,null);se(this,Ri,null);se(this,xj,null);se(this,bj,0);se(this,fm,null);se(this,Qa,null);se(this,ga,null);se(this,gs,!1);se(this,Jv,null);se(this,Su);se(this,Vs,null);se(this,ex,"");se(this,Za);se(this,wj,"");this.color=r.color||ar._defaultColor,Q(this,Za,r.thickness||ar._defaultThickness),Q(this,Su,r.opacity||ar._defaultOpacity),Q(this,ju,r.boxes||null),Q(this,wj,r.methodOfCreation||""),Q(this,ex,r.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",r.highlightId>-1?(Q(this,gs,!0),ce(this,It,QA).call(this,r),ce(this,It,Xf).call(this)):_(this,ju)&&(Q(this,Zv,r.anchorNode),Q(this,yj,r.anchorOffset),Q(this,xj,r.focusNode),Q(this,bj,r.focusOffset),ce(this,It,l3).call(this),ce(this,It,Xf).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const r=ar.prototype;return Ut(this,"_keyboardManager",new fS([[["ArrowLeft","mac+ArrowLeft"],r._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],r._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],r._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],r._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:_(this,gs)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:_(this,Za),methodOfCreation:_(this,wj)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}get commentColor(){return this.color}static computeTelemetryFinalData(r){return{numberOfColors:r.get("color").size}}static initialize(r,n){var s;Pr.initialize(r,n),ar._defaultColor||(ar._defaultColor=((s=n.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(r,n){switch(r){case Kt.HIGHLIGHT_COLOR:ar._defaultColor=n;break;case Kt.HIGHLIGHT_THICKNESS:ar._defaultThickness=n;break}}translateInPage(r,n){}get toolbarPosition(){return _(this,Jv)}updateParams(r,n){switch(r){case Kt.HIGHLIGHT_COLOR:ce(this,It,lfe).call(this,n);break;case Kt.HIGHLIGHT_THICKNESS:ce(this,It,cfe).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Kt.HIGHLIGHT_COLOR,ar._defaultColor],[Kt.HIGHLIGHT_THICKNESS,ar._defaultThickness]]}get propertiesToUpdate(){return[[Kt.HIGHLIGHT_COLOR,this.color||ar._defaultColor],[Kt.HIGHLIGHT_THICKNESS,_(this,Za)||ar._defaultThickness],[Kt.HIGHLIGHT_FREE,_(this,gs)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",Q(this,vj,new lk({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(ce(this,It,Gb).call(this))}getBaseTranslation(){return[0,0]}getRect(r,n){return super.getRect(r,n,ce(this,It,Gb).call(this))}onceAdded(r){this.annotationElementId||this.parent.addUndoableEditor(this),r&&this.div.focus()}remove(){ce(this,It,c3).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(ce(this,It,Xf).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var s;let n=!1;this.parent&&!r?ce(this,It,c3).call(this):r&&(ce(this,It,Xf).call(this,r),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(r),this.show(this._isVisible),n&&this.select()}rotate(r){var i,o,l;const{drawLayer:n}=this.parent;let s;_(this,gs)?(r=(r-this.rotation+360)%360,s=ce(i=ar,ao,Gg).call(i,_(this,Qa).box,r)):s=ce(o=ar,ao,Gg).call(o,[this.x,this.y,this.width,this.height],r),n.updateProperties(_(this,ga),{bbox:s,root:{"data-main-rotation":r}}),n.updateProperties(_(this,Vs),{bbox:ce(l=ar,ao,Gg).call(l,_(this,Ri).box,r),root:{"data-main-rotation":r}})}render(){if(this.div)return this.div;const r=super.render();_(this,ex)&&(r.setAttribute("aria-label",_(this,ex)),r.setAttribute("role","mark")),_(this,gs)?r.classList.add("free"):this.div.addEventListener("keydown",ce(this,It,dfe).bind(this),{signal:this._uiManager._signal});const n=Q(this,fm,document.createElement("div"));r.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=_(this,hm);const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),Mde(this,_(this,fm),["pointerover","pointerleave"]),this.enableEditing(),r}pointerover(){var r;this.isSelected||(r=this.parent)==null||r.drawLayer.updateProperties(_(this,Vs),{rootClass:{hovered:!0}})}pointerleave(){var r;this.isSelected||(r=this.parent)==null||r.drawLayer.updateProperties(_(this,Vs),{rootClass:{hovered:!1}})}_moveCaret(r){switch(this.parent.unselect(this),r){case 0:case 2:ce(this,It,ZA).call(this,!0);break;case 1:case 3:ce(this,It,ZA).call(this,!1);break}}select(){var r;super.select(),_(this,Vs)&&((r=this.parent)==null||r.drawLayer.updateProperties(_(this,Vs),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var r;super.unselect(),_(this,Vs)&&((r=this.parent)==null||r.drawLayer.updateProperties(_(this,Vs),{rootClass:{selected:!1}}),_(this,gs)||ce(this,It,ZA).call(this,!1))}get _mustFixPosition(){return!_(this,gs)}show(r=this._isVisible){super.show(r),this.parent&&(this.parent.drawLayer.updateProperties(_(this,ga),{rootClass:{hidden:!r}}),this.parent.drawLayer.updateProperties(_(this,Vs),{rootClass:{hidden:!r}}))}static startHighlighting(r,n,{target:s,x:i,y:o}){const{x:l,y:c,width:u,height:d}=s.getBoundingClientRect(),h=new AbortController,f=r.combinedSignal(h),p=g=>{h.abort(),ce(this,ao,mfe).call(this,r,g)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",On,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",_o,{signal:f}),s.addEventListener("pointermove",ce(this,ao,pfe).bind(this,r),{signal:f}),this._freeHighlight=new o3({x:i,y:o},[l,c,u,d],r.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=r.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(r,n,s){var m,v,y,x;let i=null;if(r instanceof Whe){const{data:{quadPoints:b,rect:w,rotation:j,id:N,color:C,opacity:k,popupRef:E,contentsObj:M},parent:{page:{pageNumber:z}}}=r;i=r={annotationType:kt.HIGHLIGHT,color:Array.from(C),opacity:k,quadPoints:b,boxes:null,pageIndex:z-1,rect:w.slice(0),rotation:j,annotationElementId:N,id:N,deleted:!1,popupRef:E,comment:(M==null?void 0:M.str)||null}}else if(r instanceof X8){const{data:{inkLists:b,rect:w,rotation:j,id:N,color:C,borderStyle:{rawWidth:k},popupRef:E,contentsObj:M},parent:{page:{pageNumber:z}}}=r;i=r={annotationType:kt.HIGHLIGHT,color:Array.from(C),thickness:k,inkLists:b,boxes:null,pageIndex:z-1,rect:w.slice(0),rotation:j,annotationElementId:N,id:N,deleted:!1,popupRef:E,comment:(M==null?void 0:M.str)||null}}const{color:o,quadPoints:l,inkLists:c,opacity:u}=r,d=await super.deserialize(r,n,s);d.color=ft.makeHexColor(...o),Q(d,Su,u||1),c&&Q(d,Za,r.thickness),d._initialData=i,r.comment&&d.setCommentData(r.comment);const[h,f]=d.pageDimensions,[p,g]=d.pageTranslation;if(l){const b=Q(d,ju,[]);for(let w=0;w<l.length;w+=8)b.push({x:(l[w]-p)/h,y:1-(l[w+1]-g)/f,width:(l[w+2]-l[w])/h,height:(l[w+1]-l[w+5])/f});ce(m=d,It,l3).call(m),ce(v=d,It,Xf).call(v),d.rotate(d.rotation)}else if(c){Q(d,gs,!0);const b=c[0],w={x:b[0]-p,y:f-(b[1]-g)},j=new o3(w,[0,0,h,f],1,_(d,Za)/2,!0,.001);for(let k=0,E=b.length;k<E;k+=2)w.x=b[k]-p,w.y=f-(b[k+1]-g),j.add(w);const{id:N,clipPathId:C}=n.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:j.toSVGPath()}},!0,!0);ce(y=d,It,QA).call(y,{highlightOutlines:j.getOutlines(),highlightId:N,clipPathId:C}),ce(x=d,It,Xf).call(x),d.rotate(d.parentRotation)}return d}serialize(r=!1){if(this.isEmpty()||r)return null;if(this.deleted)return this.serializeDeleted();const n=this.getRect(0,0),s=Pr._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i={annotationType:kt.HIGHLIGHT,color:s,opacity:_(this,Su),thickness:_(this,Za),quadPoints:ce(this,It,hfe).call(this),outlines:ce(this,It,ffe).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:ce(this,It,Gb).call(this),structTreeParentId:this._structTreeParentId};return this.addComment(i),this.annotationElementId&&!ce(this,It,gfe).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(r){const n={rect:this.getRect(0,0)};return this.hasEditedComment&&(n.popup=this.comment),r.updateEdited(n),null}static canCreateNewEmptyEditor(){return!1}};Zv=new WeakMap,yj=new WeakMap,ju=new WeakMap,hm=new WeakMap,vj=new WeakMap,Ri=new WeakMap,xj=new WeakMap,bj=new WeakMap,fm=new WeakMap,Qa=new WeakMap,ga=new WeakMap,gs=new WeakMap,Jv=new WeakMap,Su=new WeakMap,Vs=new WeakMap,ex=new WeakMap,Za=new WeakMap,wj=new WeakMap,It=new WeakSet,l3=function(){const r=new i3(_(this,ju),.001);Q(this,Qa,r.getOutlines()),[this.x,this.y,this.width,this.height]=_(this,Qa).box;const n=new i3(_(this,ju),.0025,.001,this._uiManager.direction==="ltr");Q(this,Ri,n.getOutlines());const{lastPoint:s}=_(this,Ri);Q(this,Jv,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},QA=function({highlightOutlines:r,highlightId:n,clipPathId:s}){var h,f;if(Q(this,Qa,r),Q(this,Ri,r.getNewOutline(_(this,Za)/2+1.5,.0025)),n>=0)Q(this,ga,n),Q(this,hm,s),this.parent.drawLayer.finalizeDraw(n,{bbox:r.box,path:{d:r.toSVGPath()}}),Q(this,Vs,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:_(this,Ri).box,path:{d:_(this,Ri).toSVGPath()}},!0));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(_(this,ga),{bbox:ce(h=ar,ao,Gg).call(h,_(this,Qa).box,(p-this.rotation+360)%360),path:{d:r.toSVGPath()}}),this.parent.drawLayer.updateProperties(_(this,Vs),{bbox:ce(f=ar,ao,Gg).call(f,_(this,Ri).box,p),path:{d:_(this,Ri).toSVGPath()}})}const[o,l,c,u]=r.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[p,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/p,this.height=u*p/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[p,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/p,this.height=u*p/g;break}}const{lastPoint:d}=_(this,Ri);Q(this,Jv,[(d[0]-o)/c,(d[1]-l)/u])},lfe=function(r){const n=(o,l)=>{var c,u;this.color=o,Q(this,Su,l),(c=this.parent)==null||c.drawLayer.updateProperties(_(this,ga),{root:{fill:o,"fill-opacity":l}}),(u=_(this,vj))==null||u.updateColor(o)},s=this.color,i=_(this,Su);this.addCommands({cmd:n.bind(this,r,ar._defaultOpacity),undo:n.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(r)},!0)},cfe=function(r){const n=_(this,Za),s=i=>{Q(this,Za,i),ce(this,It,ufe).call(this,i)};this.addCommands({cmd:s.bind(this,r),undo:s.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Kt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:r},!0)},ufe=function(r){if(!_(this,gs))return;ce(this,It,QA).call(this,{highlightOutlines:_(this,Qa).getNewOutline(r/2)}),this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)},c3=function(){_(this,ga)===null||!this.parent||(this.parent.drawLayer.remove(_(this,ga)),Q(this,ga,null),this.parent.drawLayer.remove(_(this,Vs)),Q(this,Vs,null))},Xf=function(r=this.parent){_(this,ga)===null&&({id:Jn(this,ga)._,clipPathId:Jn(this,hm)._}=r.drawLayer.draw({bbox:_(this,Qa).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":_(this,Su)},rootClass:{highlight:!0,free:_(this,gs)},path:{d:_(this,Qa).toSVGPath()}},!1,!0),Q(this,Vs,r.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:_(this,gs)},bbox:_(this,Ri).box,path:{d:_(this,Ri).toSVGPath()}},_(this,gs))),_(this,fm)&&(_(this,fm).style.clipPath=_(this,hm)))},ao=new WeakSet,Gg=function([r,n,s,i],o){switch(o){case 90:return[1-n-i,r,i,s];case 180:return[1-r-s,1-n-i,s,i];case 270:return[n,1-r-s,i,s]}return[r,n,s,i]},dfe=function(r){ar._keyboardManager.exec(this,r)},ZA=function(r){if(!_(this,Zv))return;const n=window.getSelection();r?n.setPosition(_(this,Zv),_(this,yj)):n.setPosition(_(this,xj),_(this,bj))},Gb=function(){return _(this,gs)?this.rotation:0},hfe=function(){if(_(this,gs))return null;const[r,n]=this.pageDimensions,[s,i]=this.pageTranslation,o=_(this,ju),l=new Float32Array(o.length*8);let c=0;for(const{x:u,y:d,width:h,height:f}of o){const p=u*r+s,g=(1-d)*n+i;l[c]=l[c+4]=p,l[c+1]=l[c+3]=g,l[c+2]=l[c+6]=p+h*r,l[c+5]=l[c+7]=g-f*n,c+=8}return l},ffe=function(r){return _(this,Qa).serialize(r,ce(this,It,Gb).call(this))},pfe=function(r,n){this._freeHighlight.add(n)&&r.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},mfe=function(r,n){this._freeHighlight.isEmpty()?r.drawLayer.remove(this._freeHighlightId):r.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},gfe=function(r){const{color:n}=this._initialData;return this.hasEditedComment||r.color.some((s,i)=>s!==n[i])},se(ar,ao),Le(ar,"_defaultColor",null),Le(ar,"_defaultOpacity",1),Le(ar,"_defaultThickness",12),Le(ar,"_type","highlight"),Le(ar,"_editorType",kt.HIGHLIGHT),Le(ar,"_freeHighlightId",-1),Le(ar,"_freeHighlight",null),Le(ar,"_freeHighlightClipId","");let hk=ar;var pm;class yfe{constructor(){se(this,pm,Object.create(null))}updateProperty(e,r){this[e]=r,this.updateSVGProperty(e,r)}updateProperties(e){if(e)for(const[r,n]of Object.entries(e))r.startsWith("_")||this.updateProperty(r,n)}updateSVGProperty(e,r){_(this,pm)[e]=r}toSVGProperties(){const e=_(this,pm);return Q(this,pm,Object.create(null)),{root:e}}reset(){Q(this,pm,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){br("Not implemented")}}pm=new WeakMap;var ya,tx,rs,mm,gm,_h,jh,Sh,ym,tr,u3,d3,h3,Kb,vfe,JA,Yb,Kg;const ut=class ut extends Pr{constructor(r){super(r);se(this,tr);se(this,ya,null);se(this,tx);Le(this,"_colorPicker",null);Le(this,"_drawId",null);Q(this,tx,r.mustBeCommitted||!1),this._addOutlines(r)}_addOutlines(r){r.drawOutlines&&(ce(this,tr,u3).call(this,r),ce(this,tr,Kb).call(this))}static _mergeSVGProperties(r,n){const s=new Set(Object.keys(r));for(const[i,o]of Object.entries(n))s.has(i)?Object.assign(r[i],o):r[i]=o;return r}static getDefaultDrawingOptions(r){br("Not implemented")}static get typesMap(){br("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(r,n){const s=this.typesMap.get(r);s&&this._defaultDrawingOptions.updateProperty(s,n),this._currentParent&&(_(ut,rs).updateProperty(s,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(r,n){const s=this.constructor.typesMap.get(r);s&&this._updateProperty(r,s,n)}static get defaultPropertiesToUpdate(){const r=[],n=this._defaultDrawingOptions;for(const[s,i]of this.typesMap)r.push([s,n[i]]);return r}get propertiesToUpdate(){const r=[],{_drawingOptions:n}=this;for(const[s,i]of this.constructor.typesMap)r.push([s,n[i]]);return r}_updateProperty(r,n,s){const i=this._drawingOptions,o=i[n],l=c=>{var d,h;i.updateProperty(n,c);const u=_(this,ya).updateProperty(n,c);u&&ce(this,tr,Yb).call(this,u),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),r===this.colorType&&((h=this._colorPicker)==null||h.update(c))};this.addCommands({cmd:l.bind(this,s),undo:l.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:r,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,ut._mergeSVGProperties(_(this,ya).getPathResizingSVGProperties(ce(this,tr,JA).call(this)),{bbox:ce(this,tr,Kg).call(this)}))}_onResized(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,ut._mergeSVGProperties(_(this,ya).getPathResizedSVGProperties(ce(this,tr,JA).call(this)),{bbox:ce(this,tr,Kg).call(this)}))}_onTranslating(r,n){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:ce(this,tr,Kg).call(this)})}_onTranslated(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,ut._mergeSVGProperties(_(this,ya).getPathTranslatedSVGProperties(ce(this,tr,JA).call(this),this.parentDimensions),{bbox:ce(this,tr,Kg).call(this)}))}_onStartDragging(){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var r;(r=this.parent)==null||r.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(r){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,_(this,tx)&&(Q(this,tx,!1),this.commit(),this.parent.setSelected(this),r&&this.isOnScreen&&this.div.focus())}remove(){ce(this,tr,h3).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(ce(this,tr,Kb).call(this),ce(this,tr,Yb).call(this,_(this,ya).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var s;let n=!1;this.parent&&!r?(this._uiManager.removeShouldRescale(this),ce(this,tr,h3).call(this)):r&&(this._uiManager.addShouldRescale(this),ce(this,tr,Kb).call(this,r),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(r),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,ut._mergeSVGProperties({bbox:ce(this,tr,Kg).call(this)},_(this,ya).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&ce(this,tr,Yb).call(this,_(this,ya).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let r,n;this._isCopy&&(r=this.x,n=this.y);const s=super.render();s.classList.add("draw");const i=document.createElement("div");s.append(i),i.setAttribute("aria-hidden","true"),i.className="internal";const[o,l]=this.parentDimensions;return this.setDims(this.width*o,this.height*l),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(r,n),s}static createDrawerInstance(r,n,s,i,o){br("Not implemented")}static startDrawing(r,n,s,i){var v;const{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:d}=i;if(_(ut,jh)&&_(ut,jh)!==d)return;const{viewport:{rotation:h}}=r,{width:f,height:p}=o.getBoundingClientRect(),g=Q(ut,mm,new AbortController),m=r.combinedSignal(g);if(_(ut,_h)||Q(ut,_h,u),_(ut,jh)??Q(ut,jh,d),window.addEventListener("pointerup",y=>{var x;_(ut,_h)===y.pointerId?this._endDraw(y):(x=_(ut,Sh))==null||x.delete(y.pointerId)},{signal:m}),window.addEventListener("pointercancel",y=>{var x;_(ut,_h)===y.pointerId?this._currentParent.endDrawingSession():(x=_(ut,Sh))==null||x.delete(y.pointerId)},{signal:m}),window.addEventListener("pointerdown",y=>{_(ut,jh)===y.pointerType&&((_(ut,Sh)||Q(ut,Sh,new Set)).add(y.pointerId),_(ut,rs).isCancellable()&&(_(ut,rs).removeLastElement(),_(ut,rs).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",_o,{signal:m}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),o.addEventListener("touchmove",y=>{y.timeStamp===_(ut,ym)&&On(y)},{signal:m}),r.toggleDrawing(),(v=n._editorUndoBar)==null||v.hide(),_(ut,rs)){r.drawLayer.updateProperties(this._currentDrawId,_(ut,rs).startNew(l,c,f,p,h));return}n.updateUIForDefaultProperties(this),Q(ut,rs,this.createDrawerInstance(l,c,f,p,h)),Q(ut,gm,this.getDefaultDrawingOptions()),this._currentParent=r,{id:this._currentDrawId}=r.drawLayer.draw(this._mergeSVGProperties(_(ut,gm).toSVGProperties(),_(ut,rs).defaultSVGProperties),!0,!1)}static _drawMove(r){var o;if(Q(ut,ym,-1),!_(ut,rs))return;const{offsetX:n,offsetY:s,pointerId:i}=r;if(_(ut,_h)===i){if(((o=_(ut,Sh))==null?void 0:o.size)>=1){this._endDraw(r);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,_(ut,rs).add(n,s)),Q(ut,ym,r.timeStamp),On(r)}}static _cleanup(r){r&&(this._currentDrawId=-1,this._currentParent=null,Q(ut,rs,null),Q(ut,gm,null),Q(ut,jh,null),Q(ut,ym,NaN)),_(ut,mm)&&(_(ut,mm).abort(),Q(ut,mm,null),Q(ut,_h,NaN),Q(ut,Sh,null))}static _endDraw(r){const n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),(r==null?void 0:r.target)===n.div&&n.drawLayer.updateProperties(this._currentDrawId,_(ut,rs).end(r.offsetX,r.offsetY)),this.supportMultipleDrawings){const s=_(ut,rs),i=this._currentDrawId,o=s.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(i,s.setLastElement(o))},undo:()=>{n.drawLayer.updateProperties(i,s.removeLastElement())},mustExec:!1,type:Kt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(r){const n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Kt.DRAW_STEP),!_(ut,rs).isEmpty()){const{pageDimensions:[s,i],scale:o}=n,l=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:_(ut,rs).getOutlines(s*o,i*o,o,this._INNER_MARGIN),drawingOptions:_(ut,gm),mustBeCommitted:!r});return this._cleanup(!0),l}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(r){}static deserializeDraw(r,n,s,i,o,l){br("Not implemented")}static async deserialize(r,n,s){var h,f;const{rawDims:{pageWidth:i,pageHeight:o,pageX:l,pageY:c}}=n.viewport,u=this.deserializeDraw(l,c,i,o,this._INNER_MARGIN,r),d=await super.deserialize(r,n,s);return d.createDrawingOptions(r),ce(h=d,tr,u3).call(h,{drawOutlines:u}),ce(f=d,tr,Kb).call(f),d.onScaleChanging(),d.rotate(),d}serializeDraw(r){const[n,s]=this.pageTranslation,[i,o]=this.pageDimensions;return _(this,ya).serialize([n,s,i,o],r)}renderAnnotationElement(r){return r.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ya=new WeakMap,tx=new WeakMap,rs=new WeakMap,mm=new WeakMap,gm=new WeakMap,_h=new WeakMap,jh=new WeakMap,Sh=new WeakMap,ym=new WeakMap,tr=new WeakSet,u3=function({drawOutlines:r,drawId:n,drawingOptions:s}){Q(this,ya,r),this._drawingOptions||(this._drawingOptions=s),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,r.defaultProperties)):this._drawId=ce(this,tr,d3).call(this,r,this.parent),ce(this,tr,Yb).call(this,r.box)},d3=function(r,n){const{id:s}=n.drawLayer.draw(ut._mergeSVGProperties(this._drawingOptions.toSVGProperties(),r.defaultSVGProperties),!1,!1);return s},h3=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Kb=function(r=this.parent){if(!(this._drawId!==null&&this.parent===r)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,r.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=ce(this,tr,d3).call(this,_(this,ya),r)}},vfe=function([r,n,s,i]){const{parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[n,1-r,s*(l/o),i*(o/l)];case 180:return[1-r,1-n,s,i];case 270:return[1-n,r,s*(l/o),i*(o/l)];default:return[r,n,s,i]}},JA=function(){const{x:r,y:n,width:s,height:i,parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[1-n,r,s*(o/l),i*(l/o)];case 180:return[1-r,1-n,s,i];case 270:return[n,1-r,s*(o/l),i*(l/o)];default:return[r,n,s,i]}},Yb=function(r){if([this.x,this.y,this.width,this.height]=ce(this,tr,vfe).call(this,r),this.div){this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)}this._onResized()},Kg=function(){const{x:r,y:n,width:s,height:i,rotation:o,parentRotation:l,parentDimensions:[c,u]}=this;switch((o*4+l)/90){case 1:return[1-n-i,r,i,s];case 2:return[1-r-s,1-n-i,s,i];case 3:return[n,1-r-s,i,s];case 4:return[r,n-s*(c/u),i*(u/c),s*(c/u)];case 5:return[1-n,r,s*(c/u),i*(u/c)];case 6:return[1-r-i*(u/c),1-n,i*(u/c),s*(c/u)];case 7:return[n-s*(c/u),1-r-i*(u/c),s*(c/u),i*(u/c)];case 8:return[r-s,n-i,s,i];case 9:return[1-n,r-s,i,s];case 10:return[1-r,1-n,s,i];case 11:return[n-i,1-r,i,s];case 12:return[r-i*(u/c),n,i*(u/c),s*(c/u)];case 13:return[1-n-s*(c/u),r-i*(u/c),s*(c/u),i*(u/c)];case 14:return[1-r,1-n-s*(c/u),i*(u/c),s*(c/u)];case 15:return[n,1-r,s*(c/u),i*(u/c)];default:return[r,n,s,i]}},Le(ut,"_currentDrawId",-1),Le(ut,"_currentParent",null),se(ut,rs,null),se(ut,mm,null),se(ut,gm,null),se(ut,_h,NaN),se(ut,jh,null),se(ut,Sh,null),se(ut,ym,NaN),Le(ut,"_INNER_MARGIN",3);let fk=ut;var Kl,ns,ss,vm,rx,oi,ys,Ja,xm,bm,wm,nx,eE;class Cct{constructor(e,r,n,s,i,o){se(this,nx);se(this,Kl,new Float64Array(6));se(this,ns);se(this,ss);se(this,vm);se(this,rx);se(this,oi);se(this,ys,"");se(this,Ja,0);se(this,xm,new mS);se(this,bm);se(this,wm);Q(this,bm,n),Q(this,wm,s),Q(this,vm,i),Q(this,rx,o),[e,r]=ce(this,nx,eE).call(this,e,r);const l=Q(this,ns,[NaN,NaN,NaN,NaN,e,r]);Q(this,oi,[e,r]),Q(this,ss,[{line:l,points:_(this,oi)}]),_(this,Kl).set(l,0)}updateProperty(e,r){e==="stroke-width"&&Q(this,rx,r)}isEmpty(){return!_(this,ss)||_(this,ss).length===0}isCancellable(){return _(this,oi).length<=10}add(e,r){[e,r]=ce(this,nx,eE).call(this,e,r);const[n,s,i,o]=_(this,Kl).subarray(2,6),l=e-i,c=r-o;return Math.hypot(_(this,bm)*l,_(this,wm)*c)<=2?null:(_(this,oi).push(e,r),isNaN(n)?(_(this,Kl).set([i,o,e,r],2),_(this,ns).push(NaN,NaN,NaN,NaN,e,r),{path:{d:this.toSVGPath()}}):(isNaN(_(this,Kl)[0])&&_(this,ns).splice(6,6),_(this,Kl).set([n,s,i,o,e,r],0),_(this,ns).push(...ot.createBezierPoints(n,s,i,o,e,r)),{path:{d:this.toSVGPath()}}))}end(e,r){const n=this.add(e,r);return n||(_(this,oi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,r,n,s,i){Q(this,bm,n),Q(this,wm,s),Q(this,vm,i),[e,r]=ce(this,nx,eE).call(this,e,r);const o=Q(this,ns,[NaN,NaN,NaN,NaN,e,r]);Q(this,oi,[e,r]);const l=_(this,ss).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),_(this,ss).push({line:o,points:_(this,oi)}),_(this,Kl).set(o,0),Q(this,Ja,0),this.toSVGPath(),null}getLastElement(){return _(this,ss).at(-1)}setLastElement(e){return _(this,ss)?(_(this,ss).push(e),Q(this,ns,e.line),Q(this,oi,e.points),Q(this,Ja,0),{path:{d:this.toSVGPath()}}):_(this,xm).setLastElement(e)}removeLastElement(){if(!_(this,ss))return _(this,xm).removeLastElement();_(this,ss).pop(),Q(this,ys,"");for(let e=0,r=_(this,ss).length;e<r;e++){const{line:n,points:s}=_(this,ss)[e];Q(this,ns,n),Q(this,oi,s),Q(this,Ja,0),this.toSVGPath()}return{path:{d:_(this,ys)}}}toSVGPath(){const e=ot.svgRound(_(this,ns)[4]),r=ot.svgRound(_(this,ns)[5]);if(_(this,oi).length===2)return Q(this,ys,`${_(this,ys)} M ${e} ${r} Z`),_(this,ys);if(_(this,oi).length<=6){const s=_(this,ys).lastIndexOf("M");Q(this,ys,`${_(this,ys).slice(0,s)} M ${e} ${r}`),Q(this,Ja,6)}if(_(this,oi).length===4){const s=ot.svgRound(_(this,ns)[10]),i=ot.svgRound(_(this,ns)[11]);return Q(this,ys,`${_(this,ys)} L ${s} ${i}`),Q(this,Ja,12),_(this,ys)}const n=[];_(this,Ja)===0&&(n.push(`M ${e} ${r}`),Q(this,Ja,6));for(let s=_(this,Ja),i=_(this,ns).length;s<i;s+=6){const[o,l,c,u,d,h]=_(this,ns).slice(s,s+6).map(ot.svgRound);n.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}return Q(this,ys,_(this,ys)+n.join(" ")),Q(this,Ja,_(this,ns).length),_(this,ys)}getOutlines(e,r,n,s){const i=_(this,ss).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),_(this,xm).build(_(this,ss),e,r,n,_(this,vm),_(this,rx),s),Q(this,Kl,null),Q(this,ns,null),Q(this,ss,null),Q(this,ys,null),_(this,xm)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Kl=new WeakMap,ns=new WeakMap,ss=new WeakMap,vm=new WeakMap,rx=new WeakMap,oi=new WeakMap,ys=new WeakMap,Ja=new WeakMap,xm=new WeakMap,bm=new WeakMap,wm=new WeakMap,nx=new WeakSet,eE=function(e,r){return ot._normalizePoint(e,r,_(this,bm),_(this,wm),_(this,vm))};var li,_j,jj,va,Yl,Xl,sx,ix,_m,_s,Uc,xfe,bfe,wfe;class mS extends ot{constructor(){super(...arguments);se(this,_s);se(this,li);se(this,_j,0);se(this,jj);se(this,va);se(this,Yl);se(this,Xl);se(this,sx);se(this,ix);se(this,_m)}build(r,n,s,i,o,l,c){Q(this,Yl,n),Q(this,Xl,s),Q(this,sx,i),Q(this,ix,o),Q(this,_m,l),Q(this,jj,c??0),Q(this,va,r),ce(this,_s,bfe).call(this)}get thickness(){return _(this,_m)}setLastElement(r){return _(this,va).push(r),{path:{d:this.toSVGPath()}}}removeLastElement(){return _(this,va).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const r=[];for(const{line:n}of _(this,va)){if(r.push(`M${ot.svgRound(n[4])} ${ot.svgRound(n[5])}`),n.length===6){r.push("Z");continue}if(n.length===12&&isNaN(n[6])){r.push(`L${ot.svgRound(n[10])} ${ot.svgRound(n[11])}`);continue}for(let s=6,i=n.length;s<i;s+=6){const[o,l,c,u,d,h]=n.subarray(s,s+6).map(ot.svgRound);r.push(`C${o} ${l} ${c} ${u} ${d} ${h}`)}}return r.join("")}serialize([r,n,s,i],o){const l=[],c=[],[u,d,h,f]=ce(this,_s,xfe).call(this);let p,g,m,v,y,x,b,w,j;switch(_(this,ix)){case 0:j=ot._rescale,p=r,g=n+i,m=s,v=-i,y=r+u*s,x=n+(1-d-f)*i,b=r+(u+h)*s,w=n+(1-d)*i;break;case 90:j=ot._rescaleAndSwap,p=r,g=n,m=s,v=i,y=r+d*s,x=n+u*i,b=r+(d+f)*s,w=n+(u+h)*i;break;case 180:j=ot._rescale,p=r+s,g=n,m=-s,v=i,y=r+(1-u-h)*s,x=n+d*i,b=r+(1-u)*s,w=n+(d+f)*i;break;case 270:j=ot._rescaleAndSwap,p=r+s,g=n+i,m=-s,v=-i,y=r+(1-d-f)*s,x=n+(1-u-h)*i,b=r+(1-d)*s,w=n+(1-u)*i;break}for(const{line:N,points:C}of _(this,va))l.push(j(N,p,g,m,v,o?new Array(N.length):null)),c.push(j(C,p,g,m,v,o?new Array(C.length):null));return{lines:l,points:c,rect:[y,x,b,w]}}static deserialize(r,n,s,i,o,{paths:{lines:l,points:c},rotation:u,thickness:d}){const h=[];let f,p,g,m,v;switch(u){case 0:v=ot._rescale,f=-r/s,p=n/i+1,g=1/s,m=-1/i;break;case 90:v=ot._rescaleAndSwap,f=-n/i,p=-r/s,g=1/i,m=1/s;break;case 180:v=ot._rescale,f=r/s+1,p=-n/i,g=-1/s,m=1/i;break;case 270:v=ot._rescaleAndSwap,f=n/i+1,p=r/s+1,g=-1/i,m=-1/s;break}if(!l){l=[];for(const x of c){const b=x.length;if(b===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1]]));continue}if(b===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,x[0],x[1],NaN,NaN,NaN,NaN,x[2],x[3]]));continue}const w=new Float32Array(3*(b-2));l.push(w);let[j,N,C,k]=x.subarray(0,4);w.set([NaN,NaN,NaN,NaN,j,N],0);for(let E=4;E<b;E+=2){const M=x[E],z=x[E+1];w.set(ot.createBezierPoints(j,N,C,k,M,z),(E-2)*3),[j,N,C,k]=[C,k,M,z]}}}for(let x=0,b=l.length;x<b;x++)h.push({line:v(l[x].map(w=>w??NaN),f,p,g,m),points:v(c[x].map(w=>w??NaN),f,p,g,m)});const y=new this.prototype.constructor;return y.build(h,s,i,1,u,d,o),y}get box(){return _(this,li)}updateProperty(r,n){return r==="stroke-width"?ce(this,_s,wfe).call(this,n):null}updateParentDimensions([r,n],s){const[i,o]=ce(this,_s,Uc).call(this);Q(this,Yl,r),Q(this,Xl,n),Q(this,sx,s);const[l,c]=ce(this,_s,Uc).call(this),u=l-i,d=c-o,h=_(this,li);return h[0]-=u,h[1]-=d,h[2]+=2*u,h[3]+=2*d,h}updateRotation(r){return Q(this,_j,r),{path:{transform:this.rotationTransform}}}get viewBox(){return _(this,li).map(ot.svgRound).join(" ")}get defaultProperties(){const[r,n]=_(this,li);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${ot.svgRound(r)} ${ot.svgRound(n)}`}}}get rotationTransform(){const[,,r,n]=_(this,li);let s=0,i=0,o=0,l=0,c=0,u=0;switch(_(this,_j)){case 90:i=n/r,o=-r/n,c=r;break;case 180:s=-1,l=-1,c=r,u=n;break;case 270:i=-n/r,o=r/n,u=n;break;default:return""}return`matrix(${s} ${i} ${o} ${l} ${ot.svgRound(c)} ${ot.svgRound(u)})`}getPathResizingSVGProperties([r,n,s,i]){const[o,l]=ce(this,_s,Uc).call(this),[c,u,d,h]=_(this,li);if(Math.abs(d-o)<=ot.PRECISION||Math.abs(h-l)<=ot.PRECISION){const v=r+s/2-(c+d/2),y=n+i/2-(u+h/2);return{path:{"transform-origin":`${ot.svgRound(r)} ${ot.svgRound(n)}`,transform:`${this.rotationTransform} translate(${v} ${y})`}}}const f=(s-2*o)/(d-2*o),p=(i-2*l)/(h-2*l),g=d/s,m=h/i;return{path:{"transform-origin":`${ot.svgRound(c)} ${ot.svgRound(u)}`,transform:`${this.rotationTransform} scale(${g} ${m}) translate(${ot.svgRound(o)} ${ot.svgRound(l)}) scale(${f} ${p}) translate(${ot.svgRound(-o)} ${ot.svgRound(-l)})`}}}getPathResizedSVGProperties([r,n,s,i]){const[o,l]=ce(this,_s,Uc).call(this),c=_(this,li),[u,d,h,f]=c;if(c[0]=r,c[1]=n,c[2]=s,c[3]=i,Math.abs(h-o)<=ot.PRECISION||Math.abs(f-l)<=ot.PRECISION){const y=r+s/2-(u+h/2),x=n+i/2-(d+f/2);for(const{line:b,points:w}of _(this,va))ot._translate(b,y,x,b),ot._translate(w,y,x,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${ot.svgRound(r)} ${ot.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(s-2*o)/(h-2*o),g=(i-2*l)/(f-2*l),m=-p*(u+o)+r+o,v=-g*(d+l)+n+l;if(p!==1||g!==1||m!==0||v!==0)for(const{line:y,points:x}of _(this,va))ot._rescale(y,m,v,p,g,y),ot._rescale(x,m,v,p,g,x);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${ot.svgRound(r)} ${ot.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([r,n],s){const[i,o]=s,l=_(this,li),c=r-l[0],u=n-l[1];if(_(this,Yl)===i&&_(this,Xl)===o)for(const{line:d,points:h}of _(this,va))ot._translate(d,c,u,d),ot._translate(h,c,u,h);else{const d=_(this,Yl)/i,h=_(this,Xl)/o;Q(this,Yl,i),Q(this,Xl,o);for(const{line:f,points:p}of _(this,va))ot._rescale(f,c,u,d,h,f),ot._rescale(p,c,u,d,h,p);l[2]*=d,l[3]*=h}return l[0]=r,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${ot.svgRound(r)} ${ot.svgRound(n)}`}}}get defaultSVGProperties(){const r=_(this,li);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${ot.svgRound(r[0])} ${ot.svgRound(r[1])}`,transform:this.rotationTransform||null},bbox:r}}}li=new WeakMap,_j=new WeakMap,jj=new WeakMap,va=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,sx=new WeakMap,ix=new WeakMap,_m=new WeakMap,_s=new WeakSet,Uc=function(r=_(this,_m)){const n=_(this,jj)+r/2*_(this,sx);return _(this,ix)%180===0?[n/_(this,Yl),n/_(this,Xl)]:[n/_(this,Xl),n/_(this,Yl)]},xfe=function(){const[r,n,s,i]=_(this,li),[o,l]=ce(this,_s,Uc).call(this,0);return[r+o,n+l,s-2*o,i-2*l]},bfe=function(){const r=Q(this,li,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:i}of _(this,va)){if(i.length<=12){for(let c=4,u=i.length;c<u;c+=6)ft.pointBoundingBox(i[c],i[c+1],r);continue}let o=i[4],l=i[5];for(let c=6,u=i.length;c<u;c+=6){const[d,h,f,p,g,m]=i.subarray(c,c+6);ft.bezierBoundingBox(o,l,d,h,f,p,g,m,r),o=g,l=m}}const[n,s]=ce(this,_s,Uc).call(this);r[0]=di(r[0]-n,0,1),r[1]=di(r[1]-s,0,1),r[2]=di(r[2]+n,0,1),r[3]=di(r[3]+s,0,1),r[2]-=r[0],r[3]-=r[1]},wfe=function(r){const[n,s]=ce(this,_s,Uc).call(this);Q(this,_m,r);const[i,o]=ce(this,_s,Uc).call(this),[l,c]=[i-n,o-s],u=_(this,li);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};class V2 extends yfe{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Pr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,r){e==="stroke-width"&&(r??(r=this["stroke-width"]),r*=this._viewParameters.realScale),super.updateSVGProperty(e,r)}clone(){const e=new V2(this._viewParameters);return e.updateAll(this),e}}var Rk,_fe;const by=class by extends fk{constructor(r){super({...r,name:"inkEditor"});se(this,Rk);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(r,n){Pr.initialize(r,n),this._defaultDrawingOptions=new V2(n.viewParameters)}static getDefaultDrawingOptions(r){const n=this._defaultDrawingOptions.clone();return n.updateProperties(r),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ut(this,"typesMap",new Map([[Kt.INK_THICKNESS,"stroke-width"],[Kt.INK_COLOR,"stroke"],[Kt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(r,n,s,i,o){return new Cct(r,n,s,i,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(r,n,s,i,o,l){return mS.deserialize(r,n,s,i,o,l)}static async deserialize(r,n,s){let i=null;if(r instanceof X8){const{data:{inkLists:l,rect:c,rotation:u,id:d,color:h,opacity:f,borderStyle:{rawWidth:p},popupRef:g,contentsObj:m},parent:{page:{pageNumber:v}}}=r;i=r={annotationType:kt.INK,color:Array.from(h),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:v-1,rect:c.slice(0),rotation:u,annotationElementId:d,id:d,deleted:!1,popupRef:g,comment:(m==null?void 0:m.str)||null}}const o=await super.deserialize(r,n,s);return o._initialData=i,r.comment&&o.setCommentData(r.comment),o}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new ck(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Kt.INK_COLOR}get colorValue(){return this._drawingOptions.stroke}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:r,_drawingOptions:n,parent:s}=this;n.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(r,n.toSVGProperties())}static onScaleChangingWhenDrawing(){const r=this._currentParent;r&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),r.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:r,thickness:n,opacity:s}){this._drawingOptions=by.getDefaultDrawingOptions({stroke:ft.makeHexColor(...r),"stroke-width":n,"stroke-opacity":s})}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:n,points:s,rect:i}=this.serializeDraw(r),{_drawingOptions:{stroke:o,"stroke-opacity":l,"stroke-width":c}}=this,u={annotationType:kt.INK,color:Pr._colorManager.convert(o),opacity:l,thickness:c,paths:{lines:n,points:s},pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(u),r?(u.isCopy=!0,u):this.annotationElementId&&!ce(this,Rk,_fe).call(this,u)?null:(u.id=this.annotationElementId,u)}renderAnnotationElement(r){const{points:n,rect:s}=this.serializeDraw(!1),i={rect:s,thickness:this._drawingOptions["stroke-width"],points:n};return this.hasEditedComment&&(i.popup=this.comment),r.updateEdited(i),null}};Rk=new WeakSet,_fe=function(r){const{color:n,thickness:s,opacity:i,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||r.color.some((l,c)=>l!==n[c])||r.thickness!==s||r.opacity!==i||r.pageIndex!==o},Le(by,"_type","ink"),Le(by,"_editorType",kt.INK),Le(by,"_defaultDrawingOptions",null);let f3=by;class p3 extends mS{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const WN=8,fb=3;var jm,dr,m3,Go,jfe,Sfe,g3,tE,Nfe,Afe,Efe,y3,v3,Cfe;class Tu{static extractContoursFromText(e,{fontFamily:r,fontStyle:n,fontWeight:s},i,o,l,c){let u=new OffscreenCanvas(1,1),d=u.getContext("2d",{alpha:!1});const h=200,f=d.font=`${n} ${s} ${h}px ${r}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:g,actualBoundingBoxAscent:m,actualBoundingBoxDescent:v,fontBoundingBoxAscent:y,fontBoundingBoxDescent:x,width:b}=d.measureText(e),w=1.5,j=Math.ceil(Math.max(Math.abs(p)+Math.abs(g)||0,b)*w),N=Math.ceil(Math.max(Math.abs(m)+Math.abs(v)||h,Math.abs(y)+Math.abs(x)||h)*w);u=new OffscreenCanvas(j,N),d=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter="grayscale(1)",d.fillStyle="white",d.fillRect(0,0,j,N),d.fillStyle="black",d.fillText(e,j*(w-1)/2,N*(3-w)/2);const C=ce(this,dr,y3).call(this,d.getImageData(0,0,j,N).data),k=ce(this,dr,Efe).call(this,C),E=ce(this,dr,v3).call(this,k),M=ce(this,dr,g3).call(this,C,j,N,E);return this.processDrawnLines({lines:{curves:M,width:j,height:N},pageWidth:i,pageHeight:o,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,r,n,s,i){const[o,l,c]=ce(this,dr,Cfe).call(this,e),[u,d]=ce(this,dr,Afe).call(this,o,l,c,Math.hypot(l,c)*_(this,jm).sigmaSFactor,_(this,jm).sigmaR,_(this,jm).kernelSize),h=ce(this,dr,v3).call(this,d),f=ce(this,dr,g3).call(this,u,l,c,h);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:r,pageHeight:n,rotation:s,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:r,pageHeight:n,rotation:s,innerMargin:i,mustSmooth:o,areContours:l}){s%180!==0&&([r,n]=[n,r]);const{curves:c,width:u,height:d}=e,h=e.thickness??0,f=[],p=Math.min(r/u,n/d),g=p/r,m=p/n,v=[];for(const{points:x}of c){const b=o?ce(this,dr,Nfe).call(this,x):x;if(!b)continue;v.push(b);const w=b.length,j=new Float32Array(w),N=new Float32Array(3*(w===2?2:w-2));if(f.push({line:N,points:j}),w===2){j[0]=b[0]*g,j[1]=b[1]*m,N.set([NaN,NaN,NaN,NaN,j[0],j[1]],0);continue}let[C,k,E,M]=b;C*=g,k*=m,E*=g,M*=m,j.set([C,k,E,M],0),N.set([NaN,NaN,NaN,NaN,C,k],0);for(let z=4;z<w;z+=2){const I=j[z]=b[z]*g,q=j[z+1]=b[z+1]*m;N.set(ot.createBezierPoints(C,k,E,M,I,q),(z-2)*3),[C,k,E,M]=[E,M,I,q]}}if(f.length===0)return null;const y=l?new p3:new mS;return y.build(f,r,n,1,s,l?0:h,i),{outline:y,newCurves:v,areContours:l,thickness:h,width:u,height:d}}static async compressSignature({outlines:e,areContours:r,thickness:n,width:s,height:i}){let o=1/0,l=-1/0,c=0;for(const b of e){c+=b.length;for(let w=2,j=b.length;w<j;w++){const N=b[w]-b[w-2];o=Math.min(o,N),l=Math.max(l,N)}}let u;o>=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;const d=e.length,h=WN+fb*d,f=new Uint32Array(h);let p=0;f[p++]=h*Uint32Array.BYTES_PER_ELEMENT+(c-2*d)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=s,f[p++]=i,f[p++]=r?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=d,f[p++]=u.BYTES_PER_ELEMENT;for(const b of e)f[p++]=b.length-2,f[p++]=b[0],f[p++]=b[1];const g=new CompressionStream("deflate-raw"),m=g.writable.getWriter();await m.ready,m.write(f);const v=u.prototype.constructor;for(const b of e){const w=new v(b.length-2);for(let j=2,N=b.length;j<N;j++)w[j-2]=b[j]-b[j-2];m.write(w)}m.close();const y=await new Response(g.readable).arrayBuffer(),x=new Uint8Array(y);return Cde(x)}static async decompressSignature(e){try{const r=Zot(e),{readable:n,writable:s}=new DecompressionStream("deflate-raw"),i=s.getWriter();await i.ready,i.write(r).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let o=null,l=0;for await(const b of n)o||(o=new Uint8Array(new Uint32Array(b.buffer,0,4)[0])),o.set(b,l),l+=b.length;const c=new Uint32Array(o.buffer,0,o.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);const d=c[2],h=c[3],f=c[4]===0,p=c[5],g=c[6],m=c[7],v=[],y=(WN+fb*g)*Uint32Array.BYTES_PER_ELEMENT;let x;switch(m){case Int8Array.BYTES_PER_ELEMENT:x=new Int8Array(o.buffer,y);break;case Int16Array.BYTES_PER_ELEMENT:x=new Int16Array(o.buffer,y);break;case Int32Array.BYTES_PER_ELEMENT:x=new Int32Array(o.buffer,y);break}l=0;for(let b=0;b<g;b++){const w=c[fb*b+WN],j=new Float32Array(w+2);v.push(j);for(let N=0;N<fb-1;N++)j[N]=c[fb*b+WN+N+1];for(let N=0;N<w;N++)j[N+2]=j[N]+x[l++]}return{areContours:f,thickness:p,outlines:v,width:d,height:h}}catch(r){return Tt(`decompressSignature: ${r}`),null}}}jm=new WeakMap,dr=new WeakSet,m3=function(e,r,n,s){return n-=e,s-=r,n===0?s>0?0:4:n===1?s+6:2-s},Go=new WeakMap,jfe=function(e,r,n,s,i,o,l){const c=ce(this,dr,m3).call(this,n,s,i,o);for(let u=0;u<8;u++){const d=(-u+c-l+16)%8,h=_(this,Go)[2*d],f=_(this,Go)[2*d+1];if(e[(n+h)*r+(s+f)]!==0)return d}return-1},Sfe=function(e,r,n,s,i,o,l){const c=ce(this,dr,m3).call(this,n,s,i,o);for(let u=0;u<8;u++){const d=(u+c+l+16)%8,h=_(this,Go)[2*d],f=_(this,Go)[2*d+1];if(e[(n+h)*r+(s+f)]!==0)return d}return-1},g3=function(e,r,n,s){const i=e.length,o=new Int32Array(i);for(let d=0;d<i;d++)o[d]=e[d]<=s?1:0;for(let d=1;d<n-1;d++)o[d*r]=o[d*r+r-1]=0;for(let d=0;d<r;d++)o[d]=o[r*n-1-d]=0;let l=1,c;const u=[];for(let d=1;d<n-1;d++){c=1;for(let h=1;h<r-1;h++){const f=d*r+h,p=o[f];if(p===0)continue;let g=d,m=h;if(p===1&&o[f-1]===0)l+=1,m-=1;else if(p>=1&&o[f+1]===0)l+=1,m+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}const v=[h,d],y=m===h+1,x={isHole:y,points:v,id:l,parent:0};u.push(x);let b;for(const z of u)if(z.id===c){b=z;break}b?b.isHole?x.parent=y?b.parent:c:x.parent=y?c:b.parent:x.parent=y?c:0;const w=ce(this,dr,jfe).call(this,o,r,d,h,g,m,0);if(w===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let j=_(this,Go)[2*w],N=_(this,Go)[2*w+1];const C=d+j,k=h+N;g=C,m=k;let E=d,M=h;for(;;){const z=ce(this,dr,Sfe).call(this,o,r,E,M,g,m,1);j=_(this,Go)[2*z],N=_(this,Go)[2*z+1];const I=E+j,q=M+N;v.push(q,I);const A=E*r+M;if(o[A+1]===0?o[A]=-l:o[A]===1&&(o[A]=l),I===d&&q===h&&E===C&&M===k){o[f]!==1&&(c=Math.abs(o[f]));break}else g=E,m=M,E=I,M=q}}}return u},tE=function(e,r,n,s){if(n-r<=4){for(let C=r;C<n-2;C+=2)s.push(e[C],e[C+1]);return}const i=e[r],o=e[r+1],l=e[n-4]-i,c=e[n-3]-o,u=Math.hypot(l,c),d=l/u,h=c/u,f=d*o-h*i,p=c/l,g=1/u,m=Math.atan(p),v=Math.cos(m),y=Math.sin(m),x=g*(Math.abs(v)+Math.abs(y)),b=g*(1-x+x**2),w=Math.max(Math.atan(Math.abs(y+v)*b),Math.atan(Math.abs(y-v)*b));let j=0,N=r;for(let C=r+2;C<n-2;C+=2){const k=Math.abs(f-d*e[C+1]+h*e[C]);k>j&&(N=C,j=k)}j>(u*w)**2?(ce(this,dr,tE).call(this,e,r,N+2,s),ce(this,dr,tE).call(this,e,N,n,s)):s.push(i,o)},Nfe=function(e){const r=[],n=e.length;return ce(this,dr,tE).call(this,e,0,n,r),r.push(e[n-2],e[n-1]),r.length<=4?null:r},Afe=function(e,r,n,s,i,o){const l=new Float32Array(o**2),c=-2*s**2,u=o>>1;for(let m=0;m<o;m++){const v=(m-u)**2;for(let y=0;y<o;y++)l[m*o+y]=Math.exp((v+(y-u)**2)/c)}const d=new Float32Array(256),h=-2*i**2;for(let m=0;m<256;m++)d[m]=Math.exp(m**2/h);const f=e.length,p=new Uint8Array(f),g=new Uint32Array(256);for(let m=0;m<n;m++)for(let v=0;v<r;v++){const y=m*r+v,x=e[y];let b=0,w=0;for(let N=0;N<o;N++){const C=m+N-u;if(!(C<0||C>=n))for(let k=0;k<o;k++){const E=v+k-u;if(E<0||E>=r)continue;const M=e[C*r+E],z=l[N*o+k]*d[Math.abs(M-x)];b+=M*z,w+=z}}const j=p[y]=Math.round(b/w);g[j]++}return[p,g]},Efe=function(e){const r=new Uint32Array(256);for(const n of e)r[n]++;return r},y3=function(e){const r=e.length,n=new Uint8ClampedArray(r>>2);let s=-1/0,i=1/0;for(let l=0,c=n.length;l<c;l++){const u=n[l]=e[l<<2];s=Math.max(s,u),i=Math.min(i,u)}const o=255/(s-i);for(let l=0,c=n.length;l<c;l++)n[l]=(n[l]-i)*o;return n},v3=function(e){let r,n=-1/0,s=-1/0;const i=e.findIndex(c=>c!==0);let o=i,l=i;for(r=i;r<256;r++){const c=e[r];c>n&&(r-o>s&&(s=r-o,l=r-1),n=c,o=r)}for(r=l-1;r>=0&&!(e[r]>e[r+1]);r--);return r},Cfe=function(e){const r=e,{width:n,height:s}=e,{maxDim:i}=_(this,jm);let o=n,l=s;if(n>i||s>i){let f=n,p=s,g=Math.log2(Math.max(n,s)/i);const m=Math.floor(g);g=g===m?m-1:m;for(let y=0;y<g;y++){o=Math.ceil(f/2),l=Math.ceil(p/2);const x=new OffscreenCanvas(o,l);x.getContext("2d").drawImage(e,0,0,f,p,0,0,o,l),f=o,p=l,e!==r&&e.close(),e=x.transferToImageBitmap()}const v=Math.min(i/o,i/l);o=Math.round(o*v),l=Math.round(l*v)}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 d=u.getImageData(0,0,o,l).data;return[ce(this,dr,y3).call(this,d),o,l]},se(Tu,dr),se(Tu,jm,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),se(Tu,Go,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Q8 extends yfe{constructor(){super(),super.updateProperties({fill:Pr._defaultLineColor,"stroke-width":0})}clone(){const e=new Q8;return e.updateAll(this),e}}class Z8 extends V2{constructor(e){super(e),super.updateProperties({stroke:Pr._defaultLineColor,"stroke-width":1})}clone(){const e=new Z8(this._viewParameters);return e.updateAll(this),e}}var Nh,Ql,Ah,Sm;const sa=class sa extends fk{constructor(r){super({...r,mustBeCommitted:!0,name:"signatureEditor"});se(this,Nh,!1);se(this,Ql,null);se(this,Ah,null);se(this,Sm,null);this._willKeepAspectRatio=!0,Q(this,Ah,r.signatureData||null),Q(this,Ql,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(r,n){Pr.initialize(r,n),this._defaultDrawingOptions=new Q8,this._defaultDrawnSignatureOptions=new Z8(n.viewParameters)}static getDefaultDrawingOptions(r){const n=this._defaultDrawingOptions.clone();return n.updateProperties(r),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ut(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!_(this,Ql)}}static computeTelemetryFinalData(r){const n=r.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 r,n;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,r=this.x,n=this.y),super.render(),this._drawId===null)if(_(this,Ah)){const{lines:i,mustSmooth:o,areContours:l,description:c,uuid:u,heightInPage:d}=_(this,Ah),{rawDims:{pageWidth:h,pageHeight:f},rotation:p}=this.parent.viewport,g=Tu.processDrawnLines({lines:i,pageWidth:h,pageHeight:f,rotation:p,innerMargin:sa._INNER_MARGIN,mustSmooth:o,areContours:l});this.addSignature(g,d,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:_(this,Ql)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(r,n)),this.div}setUuid(r){Q(this,Sm,r),this.addEditToolbar()}getUuid(){return _(this,Sm)}get description(){return _(this,Ql)}set description(r){Q(this,Ql,r),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:r})),super.addEditToolbar().then(n=>{n==null||n.updateEditSignatureButton(r)}))}getSignaturePreview(){const{newCurves:r,areContours:n,thickness:s,width:i,height:o}=_(this,Ah),l=Math.max(i,o),c=Tu.processDrawnLines({lines:{curves:r.map(u=>({points:u})),thickness:s,width:i,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(r,n,s,i){const{x:o,y:l}=this,{outline:c}=Q(this,Ah,r);Q(this,Nh,c instanceof p3),this.description=s;let u;_(this,Nh)?u=sa.getDefaultDrawingOptions():(u=sa._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});const[d,h]=this.parentDimensions,[,f]=this.pageDimensions;let p=n/f;p=p>=1?.5:p,this.width*=p/this.height,this.width>=1&&(p*=.9/this.width,this.width=.9),this.height=p,this.setDims(d*this.width,h*this.height),this.x=o,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:i}=this.parent.viewport;return Tu.process(r,n,s,i,sa._INNER_MARGIN)}getFromText(r,n){const{rawDims:{pageWidth:s,pageHeight:i},rotation:o}=this.parent.viewport;return Tu.extractContoursFromText(r,n,s,i,o,sa._INNER_MARGIN)}getDrawnSignature(r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:i}=this.parent.viewport;return Tu.processDrawnLines({lines:r,pageWidth:n,pageHeight:s,rotation:i,innerMargin:sa._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:r,thickness:n}){r?this._drawingOptions=sa.getDefaultDrawingOptions():(this._drawingOptions=sa._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(r=!1){if(this.isEmpty())return null;const{lines:n,points:s,rect:i}=this.serializeDraw(r),{_drawingOptions:{"stroke-width":o}}=this,l={annotationType:kt.SIGNATURE,isSignature:!0,areContours:_(this,Nh),color:[0,0,0],thickness:_(this,Nh)?0:o,pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return this.addComment(l),r?(l.paths={lines:n,points:s},l.uuid=_(this,Sm),l.isCopy=!0):l.lines=n,_(this,Ql)&&(l.accessibilityData={type:"Figure",alt:_(this,Ql)}),l}static deserializeDraw(r,n,s,i,o,l){return l.areContours?p3.deserialize(r,n,s,i,o,l):mS.deserialize(r,n,s,i,o,l)}static async deserialize(r,n,s){var o;const i=await super.deserialize(r,n,s);return Q(i,Nh,r.areContours),i.description=((o=r.accessibilityData)==null?void 0:o.alt)||"",Q(i,Sm,r.uuid),i}};Nh=new WeakMap,Ql=new WeakMap,Ah=new WeakMap,Sm=new WeakMap,Le(sa,"_type","signature"),Le(sa,"_editorType",kt.SIGNATURE),Le(sa,"_defaultDrawingOptions",null);let x3=sa;var Kr,is,Eh,Nu,Ch,ax,Au,Nm,Zl,xa,ox,rr,Xb,Qb,rE,nE,sE,w3,iE,kfe;class b3 extends Pr{constructor(r){super({...r,name:"stampEditor"});se(this,rr);se(this,Kr,null);se(this,is,null);se(this,Eh,null);se(this,Nu,null);se(this,Ch,null);se(this,ax,"");se(this,Au,null);se(this,Nm,!1);se(this,Zl,null);se(this,xa,!1);se(this,ox,!1);Q(this,Nu,r.bitmapUrl),Q(this,Ch,r.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(r,n){Pr.initialize(r,n)}static isHandlingMimeForPasting(r){return f5.includes(r)}static paste(r,n){n.pasteEditor({mode:kt.STAMP},{bitmapFile:r.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var r;return{type:"stamp",hasAltText:!!((r=this.altTextData)!=null&&r.altText)}}static computeTelemetryFinalData(r){const n=r.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(r=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:o,height:l}=r||this.copyCanvas(null,null,!0).imageData,c=await s.guess({name:"altText",request:{data:i,width:o,height:l,channels:i.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 r;_(this,is)&&(Q(this,Kr,null),this._uiManager.imageManager.deleteId(_(this,is)),(r=_(this,Au))==null||r.remove(),Q(this,Au,null),_(this,Zl)&&(clearTimeout(_(this,Zl)),Q(this,Zl,null))),super.remove()}rebuild(){if(!this.parent){_(this,is)&&ce(this,rr,rE).call(this);return}super.rebuild(),this.div!==null&&(_(this,is)&&_(this,Au)===null&&ce(this,rr,rE).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(r){this._isDraggable=!0,r&&this.div.focus()}isEmpty(){return!(_(this,Eh)||_(this,Kr)||_(this,Nu)||_(this,Ch)||_(this,is)||_(this,Nm))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let r,n;return this._isCopy&&(r=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),_(this,Nm)||(_(this,Kr)?ce(this,rr,nE).call(this):ce(this,rr,rE).call(this)),this._isCopy&&this._moveAfterPaste(r,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(r,n){const{id:s,bitmap:i}=this._uiManager.imageManager.getFromCanvas(r,n);n.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(Q(this,is,s),i&&Q(this,Kr,i),Q(this,Nm,!1),ce(this,rr,nE).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;_(this,Zl)!==null&&clearTimeout(_(this,Zl)),Q(this,Zl,setTimeout(()=>{Q(this,Zl,null),ce(this,rr,w3).call(this)},200))}copyCanvas(r,n,s=!1){var p;r||(r=224);const{width:i,height:o}=_(this,Kr),l=new _c;let c=_(this,Kr),u=i,d=o,h=null;if(n){if(i>n||o>n){const k=Math.min(n/i,n/o);u=Math.floor(i*k),d=Math.floor(o*k)}h=document.createElement("canvas");const g=h.width=Math.ceil(u*l.sx),m=h.height=Math.ceil(d*l.sy);_(this,xa)||(c=ce(this,rr,sE).call(this,g,m));const v=h.getContext("2d");v.filter=this._uiManager.hcmFilter;let y="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":(p=window.matchMedia)!=null&&p.call(window,"(prefers-color-scheme: dark)").matches&&(y="#8f8f9d",x="#42414d");const b=15,w=b*l.sx,j=b*l.sy,N=new OffscreenCanvas(w*2,j*2),C=N.getContext("2d");C.fillStyle=y,C.fillRect(0,0,w*2,j*2),C.fillStyle=x,C.fillRect(0,0,w,j),C.fillRect(w,j,w,j),v.fillStyle=v.createPattern(N,"repeat"),v.fillRect(0,0,g,m),v.drawImage(c,0,0,c.width,c.height,0,0,g,m)}let f=null;if(s){let g,m;if(l.symmetric&&c.width<r&&c.height<r)g=c.width,m=c.height;else if(c=_(this,Kr),i>r||o>r){const x=Math.min(r/i,r/o);g=Math.floor(i*x),m=Math.floor(o*x),_(this,xa)||(c=ce(this,rr,sE).call(this,g,m))}const y=new OffscreenCanvas(g,m).getContext("2d",{willReadFrequently:!0});y.drawImage(c,0,0,c.width,c.height,0,0,g,m),f={width:g,height:m,data:y.getImageData(0,0,g,m).data}}return{canvas:h,width:u,height:d,imageData:f}}static async deserialize(r,n,s){var v;let i=null,o=!1;if(r instanceof Vhe){const{data:{rect:y,rotation:x,id:b,structParent:w,popupRef:j,contentsObj:N},container:C,parent:{page:{pageNumber:k}},canvas:E}=r;let M,z;E?(delete r.canvas,{id:M,bitmap:z}=s.imageManager.getFromCanvas(C.id,E),E.remove()):(o=!0,r._hasNoCanvas=!0);const I=((v=await n._structTree.getAriaAttributes(`${H8}${b}`))==null?void 0:v.get("aria-label"))||"";i=r={annotationType:kt.STAMP,bitmapId:M,bitmap:z,pageIndex:k-1,rect:y.slice(0),rotation:x,annotationElementId:b,id:b,deleted:!1,accessibilityData:{decorative:!1,altText:I},isSvg:!1,structParent:w,popupRef:j,comment:(N==null?void 0:N.str)||null}}const l=await super.deserialize(r,n,s),{rect:c,bitmap:u,bitmapUrl:d,bitmapId:h,isSvg:f,accessibilityData:p}=r;o?(s.addMissingCanvas(r.id,l),Q(l,Nm,!0)):h&&s.imageManager.isValidId(h)?(Q(l,is,h),u&&Q(l,Kr,u)):Q(l,Nu,d),Q(l,xa,f);const[g,m]=l.pageDimensions;return l.width=(c[2]-c[0])/g,l.height=(c[3]-c[1])/m,p&&(l.altTextData=p),l._initialData=i,r.comment&&l.setCommentData(r.comment),Q(l,ox,!!i),l}serialize(r=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:kt.STAMP,bitmapId:_(this,is),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:_(this,xa),structTreeParentId:this._structTreeParentId};if(this.addComment(s),r)return s.bitmapUrl=ce(this,rr,iE).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(s.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){const c=ce(this,rr,kfe).call(this,s);if(c.isSame)return null;c.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1}if(s.id=this.annotationElementId,n===null)return s;n.stamps||(n.stamps=new Map);const l=_(this,xa)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!n.stamps.has(_(this,is)))n.stamps.set(_(this,is),{area:l,serialized:s}),s.bitmap=ce(this,rr,iE).call(this,!1);else if(_(this,xa)){const c=n.stamps.get(_(this,is));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=ce(this,rr,iE).call(this,!1))}return s}renderAnnotationElement(r){const n={rect:this.getRect(0,0)};return this.hasEditedComment&&(n.popup=this.comment),r.updateEdited(n),null}}Kr=new WeakMap,is=new WeakMap,Eh=new WeakMap,Nu=new WeakMap,Ch=new WeakMap,ax=new WeakMap,Au=new WeakMap,Nm=new WeakMap,Zl=new WeakMap,xa=new WeakMap,ox=new WeakMap,rr=new WeakSet,Xb=function(r,n=!1){if(!r){this.remove();return}Q(this,Kr,r.bitmap),n||(Q(this,is,r.id),Q(this,xa,r.isSvg)),r.file&&Q(this,ax,r.file.name),ce(this,rr,nE).call(this)},Qb=function(){if(Q(this,Eh,null),this._uiManager.enableWaiting(!1),!!_(this,Au)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_(this,Kr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&_(this,Kr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},rE=function(){if(_(this,is)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(_(this,is)).then(s=>ce(this,rr,Xb).call(this,s,!0)).finally(()=>ce(this,rr,Qb).call(this));return}if(_(this,Nu)){const s=_(this,Nu);Q(this,Nu,null),this._uiManager.enableWaiting(!0),Q(this,Eh,this._uiManager.imageManager.getFromUrl(s).then(i=>ce(this,rr,Xb).call(this,i)).finally(()=>ce(this,rr,Qb).call(this)));return}if(_(this,Ch)){const s=_(this,Ch);Q(this,Ch,null),this._uiManager.enableWaiting(!0),Q(this,Eh,this._uiManager.imageManager.getFromFile(s).then(i=>ce(this,rr,Xb).call(this,i)).finally(()=>ce(this,rr,Qb).call(this)));return}const r=document.createElement("input");r.type="file",r.accept=f5.join(",");const n=this._uiManager._signal;Q(this,Eh,new Promise(s=>{r.addEventListener("change",async()=>{if(!r.files||r.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(r.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),ce(this,rr,Xb).call(this,i)}s()},{signal:n}),r.addEventListener("cancel",()=>{this.remove(),s()},{signal:n})}).finally(()=>ce(this,rr,Qb).call(this))),r.click()},nE=function(){var h;const{div:r}=this;let{width:n,height:s}=_(this,Kr);const[i,o]=this.pageDimensions,l=.75;if(this.width)n=this.width*i,s=this.height*o;else if(n>l*i||s>l*o){const f=Math.min(l*i/n,l*o/s);n*=f,s*=f}const[c,u]=this.parentDimensions;this.setDims(n*c/i,s*u/o),this._uiManager.enableWaiting(!1);const d=Q(this,Au,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=n/i,this.height=s/o,(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(r.hidden=!1),ce(this,rr,w3).call(this),_(this,ox)||(this.parent.addUndoableEditor(this),Q(this,ox,!0)),this._reportTelemetry({action:"inserted_image"}),_(this,ax)&&this.div.setAttribute("aria-description",_(this,ax)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},sE=function(r,n){const{width:s,height:i}=_(this,Kr);let o=s,l=i,c=_(this,Kr);for(;o>2*r||l>2*n;){const u=o,d=l;o>2*r&&(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 h=new OffscreenCanvas(o,l);h.getContext("2d").drawImage(c,0,0,u,d,0,0,o,l),c=h.transferToImageBitmap()}return c},w3=function(){const[r,n]=this.parentDimensions,{width:s,height:i}=this,o=new _c,l=Math.ceil(s*r*o.sx),c=Math.ceil(i*n*o.sy),u=_(this,Au);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;const d=_(this,xa)?_(this,Kr):ce(this,rr,sE).call(this,l,c),h=u.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(d,0,0,d.width,d.height,0,0,l,c)},iE=function(r){if(r){if(_(this,xa)){const i=this._uiManager.imageManager.getSvgUrl(_(this,is));if(i)return i}const n=document.createElement("canvas");return{width:n.width,height:n.height}=_(this,Kr),n.getContext("2d").drawImage(_(this,Kr),0,0),n.toDataURL()}if(_(this,xa)){const[n,s]=this.pageDimensions,i=Math.round(this.width*n*sf.PDF_TO_CSS_UNITS),o=Math.round(this.height*s*sf.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(i,o);return l.getContext("2d").drawImage(_(this,Kr),0,0,_(this,Kr).width,_(this,Kr).height,0,0,i,o),l.transferToImageBitmap()}return structuredClone(_(this,Kr))},kfe=function(r){var l;const{pageIndex:n,accessibilityData:{altText:s}}=this._initialData,i=r.pageIndex===n,o=(((l=r.accessibilityData)==null?void 0:l.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&o,isSameAltText:o}},Le(b3,"_type","stamp"),Le(b3,"_editorType",kt.STAMP);var Am,lx,Jl,kh,Eu,ba,Th,cx,Em,Ko,Cu,as,ku,Ph,ux,ht,Oh,Yr,Tfe,Al,j3,S3,aE;const Mo=class Mo{constructor({uiManager:e,pageIndex:r,div:n,structTreeLayer:s,accessibilityManager:i,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:d}){se(this,Yr);se(this,Am);se(this,lx,!1);se(this,Jl,null);se(this,kh,null);se(this,Eu,null);se(this,ba,new Map);se(this,Th,!1);se(this,cx,!1);se(this,Em,!1);se(this,Ko,null);se(this,Cu,null);se(this,as,null);se(this,ku,null);se(this,Ph,null);se(this,ux,-1);se(this,ht);const h=[..._(Mo,Oh).values()];if(!Mo._initialized){Mo._initialized=!0;for(const f of h)f.initialize(d,e)}e.registerEditorTypes(h),Q(this,ht,e),this.pageIndex=r,this.div=n,Q(this,Am,i),Q(this,Jl,o),this.viewport=u,Q(this,as,c),this.drawLayer=l,this._structTree=s,_(this,ht).addLayer(this)}get isEmpty(){return _(this,ba).size===0}get isInvisible(){return this.isEmpty&&_(this,ht).getMode()===kt.NONE}updateToolbar(e){_(this,ht).updateToolbar(e)}updateMode(e=_(this,ht).getMode()){switch(ce(this,Yr,aE).call(this),e){case kt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case kt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case kt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:r}=this.div;for(const n of _(Mo,Oh).values())r.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){var r;return e===((r=_(this,as))==null?void 0:r.div)}setEditingState(e){_(this,ht).setEditingState(e)}addCommands(e){_(this,ht).addCommands(e)}cleanUndoStack(e){_(this,ht).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var r;(r=_(this,Jl))==null||r.div.classList.toggle("disabled",!e)}async enable(){var n;Q(this,Em,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(n=_(this,Ph))==null||n.abort(),Q(this,Ph,null);const e=new Set;for(const s of _(this,ba).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(_(this,ht).removeChangedExistingAnnotation(s),e.add(s.annotationElementId));if(!_(this,Jl)){Q(this,Em,!1);return}const r=_(this,Jl).getEditableAnnotations();for(const s of r){if(s.hide(),_(this,ht).isDeletedAnnotationElement(s.data.id)||e.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}Q(this,Em,!1)}disable(){var s;if(Q(this,cx,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),_(this,as)&&!_(this,Ph)){Q(this,Ph,new AbortController);const i=_(this,ht).combinedSignal(_(this,Ph));_(this,as).div.addEventListener("pointerdown",o=>{const{clientX:c,clientY:u,timeStamp:d}=o,h=_(this,ux);if(d-h>500){Q(this,ux,d);return}Q(this,ux,-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 g;const m=new RegExp(`^${jde}[0-9]+$`);for(const y of p)if(m.test(y.id)){g=y.id;break}if(!g)return;const v=_(this,ba).get(g);(v==null?void 0:v.annotationElementId)===null&&(o.stopPropagation(),o.preventDefault(),v.dblclick())},{signal:i,capture:!0})}const e=new Map,r=new Map;for(const i of _(this,ba).values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else r.set(i.annotationElementId,i);(s=this.getEditableAnnotation(i.annotationElementId))==null||s.show(),i.remove()}if(_(this,Jl)){const i=_(this,Jl).getEditableAnnotations();for(const o of i){const{id:l}=o.data;if(_(this,ht).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let c=r.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=e.get(l),c&&(_(this,ht).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}ce(this,Yr,aE).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const i of _(Mo,Oh).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),Q(this,cx,!1)}getEditableAnnotation(e){var r;return((r=_(this,Jl))==null?void 0:r.getEditableAnnotation(e))||null}setActiveEditor(e){_(this,ht).getActive()!==e&&_(this,ht).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=_(this,as))!=null&&e.div&&!_(this,ku)){Q(this,ku,new AbortController);const r=_(this,ht).combinedSignal(_(this,ku));_(this,as).div.addEventListener("pointerdown",ce(this,Yr,Tfe).bind(this),{signal:r}),_(this,as).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=_(this,as))!=null&&e.div&&_(this,ku)&&(_(this,ku).abort(),Q(this,ku,null),_(this,as).div.classList.remove("highlighting"))}enableClick(){if(_(this,kh))return;Q(this,kh,new AbortController);const e=_(this,ht).combinedSignal(_(this,kh));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const r=this.pointerup.bind(this);this.div.addEventListener("pointerup",r,{signal:e}),this.div.addEventListener("pointercancel",r,{signal:e})}disableClick(){var e;(e=_(this,kh))==null||e.abort(),Q(this,kh,null)}attach(e){_(this,ba).set(e.id,e);const{annotationElementId:r}=e;r&&_(this,ht).isDeletedAnnotationElement(r)&&_(this,ht).removeDeletedAnnotationElement(e)}detach(e){var r;_(this,ba).delete(e.id),(r=_(this,Am))==null||r.removePointerInTextLayer(e.contentDiv),!_(this,cx)&&e.annotationElementId&&_(this,ht).addDeletedAnnotationElement(e)}remove(e){this.detach(e),_(this,ht).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var r;e.parent!==this&&(e.parent&&e.annotationElementId&&(_(this,ht).addDeletedAnnotationElement(e.annotationElementId),Pr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(r=e.parent)==null||r.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),_(this,ht).addEditor(e),this.attach(e),!e.isAttachedToDOM){const r=e.render();this.div.append(r),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!_(this,Em)),_(this,ht).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:r}=document;e.div.contains(r)&&!_(this,Eu)&&(e._focusEventsAllowed=!1,Q(this,Eu,setTimeout(()=>{Q(this,Eu,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:_(this,ht)._signal}),r.focus())},0))),e._structTreeParentId=(n=_(this,Am))==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 r=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:r,undo:n,mustExec:!1})}getNextId(){return _(this,ht).getId()}combinedSignal(e){return _(this,ht).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=_(this,Yr,Al))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,r){this.updateToolbar(e),await _(this,ht).updateMode(e.mode);const{offsetX:n,offsetY:s}=ce(this,Yr,S3).call(this),i=this.getNextId(),o=ce(this,Yr,j3).call(this,{parent:this,id:i,x:n,y:s,uiManager:_(this,ht),isCentered:!0,...r});o&&this.add(o)}async deserialize(e){var r;return await((r=_(Mo,Oh).get(e.annotationType??e.annotationEditorType))==null?void 0:r.deserialize(e,this,_(this,ht)))||null}createAndAddNewEditor(e,r,n={}){const s=this.getNextId(),i=ce(this,Yr,j3).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:_(this,ht),isCentered:r,...n});return i&&this.add(i),i}addNewEditor(e={}){this.createAndAddNewEditor(ce(this,Yr,S3).call(this),!0,e)}setSelected(e){_(this,ht).setSelected(e)}toggleSelected(e){_(this,ht).toggleSelected(e)}unselect(e){_(this,ht).unselect(e)}pointerup(e){var s;const{isMac:r}=ks.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div||!_(this,Th)||(Q(this,Th,!1),(s=_(this,Yr,Al))!=null&&s.isDrawer&&_(this,Yr,Al).supportMultipleDrawings))return;if(!_(this,lx)){Q(this,lx,!0);return}const n=_(this,ht).getMode();if(n===kt.STAMP||n===kt.SIGNATURE){_(this,ht).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var s;if(_(this,ht).getMode()===kt.HIGHLIGHT&&this.enableTextSelection(),_(this,Th)){Q(this,Th,!1);return}const{isMac:r}=ks.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div)return;if(Q(this,Th,!0),(s=_(this,Yr,Al))!=null&&s.isDrawer){this.startDrawingSession(e);return}const n=_(this,ht).getActive();Q(this,lx,!n||n.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),_(this,Ko)){_(this,Yr,Al).startDrawing(this,_(this,ht),!1,e);return}_(this,ht).setCurrentDrawingSession(this),Q(this,Ko,new AbortController);const r=_(this,ht).combinedSignal(_(this,Ko));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(Q(this,Cu,null),this.commitOrRemove())},{signal:r}),_(this,Yr,Al).startDrawing(this,_(this,ht),!1,e)}pause(e){if(e){const{activeElement:r}=document;this.div.contains(r)&&Q(this,Cu,r);return}_(this,Cu)&&setTimeout(()=>{var r;(r=_(this,Cu))==null||r.focus(),Q(this,Cu,null)},0)}endDrawingSession(e=!1){return _(this,Ko)?(_(this,ht).setCurrentDrawingSession(null),_(this,Ko).abort(),Q(this,Ko,null),Q(this,Cu,null),_(this,Yr,Al).endDrawing(e)):null}findNewParent(e,r,n){const s=_(this,ht).findParent(r,n);return s===null||s===this?!1:(s.changeParent(e),!0)}commitOrRemove(){return _(this,Ko)?(this.endDrawingSession(),!0):!1}onScaleChanging(){_(this,Ko)&&_(this,Yr,Al).onScaleChangingWhenDrawing(this)}destroy(){var e,r;this.commitOrRemove(),((e=_(this,ht).getActive())==null?void 0:e.parent)===this&&(_(this,ht).commitOrRemove(),_(this,ht).setActiveEditor(null)),_(this,Eu)&&(clearTimeout(_(this,Eu)),Q(this,Eu,null));for(const n of _(this,ba).values())(r=_(this,Am))==null||r.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,_(this,ba).clear(),_(this,ht).removeLayer(this)}render({viewport:e}){this.viewport=e,Zm(this.div,e);for(const r of _(this,ht).getEditors(this.pageIndex))this.add(r),r.rebuild();this.updateMode()}update({viewport:e}){_(this,ht).commitOrRemove(),ce(this,Yr,aE).call(this);const r=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Zm(this.div,{rotation:n}),r!==n)for(const s of _(this,ba).values())s.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:r}=this.viewport.rawDims;return[e,r]}get scale(){return _(this,ht).viewParameters.realScale}};Am=new WeakMap,lx=new WeakMap,Jl=new WeakMap,kh=new WeakMap,Eu=new WeakMap,ba=new WeakMap,Th=new WeakMap,cx=new WeakMap,Em=new WeakMap,Ko=new WeakMap,Cu=new WeakMap,as=new WeakMap,ku=new WeakMap,Ph=new WeakMap,ux=new WeakMap,ht=new WeakMap,Oh=new WeakMap,Yr=new WeakSet,Tfe=function(e){_(this,ht).unselectAll();const{target:r}=e;if(r===_(this,as).div||(r.getAttribute("role")==="img"||r.classList.contains("endOfContent"))&&_(this,as).div.contains(r)){const{isMac:n}=ks.platform;if(e.button!==0||e.ctrlKey&&n)return;_(this,ht).showAllEditors("highlight",!0,!0),_(this,as).div.classList.add("free"),this.toggleDrawing(),hk.startHighlighting(this,_(this,ht).direction==="ltr",{target:_(this,as).div,x:e.x,y:e.y}),_(this,as).div.addEventListener("pointerup",()=>{_(this,as).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:_(this,ht)._signal}),e.preventDefault()}},Al=function(){return _(Mo,Oh).get(_(this,ht).getMode())},j3=function(e){const r=_(this,Yr,Al);return r?new r.prototype.constructor(e):null},S3=function(){const{x:e,y:r,width:n,height:s}=this.div.getBoundingClientRect(),i=Math.max(0,e),o=Math.max(0,r),l=Math.min(window.innerWidth,e+n),c=Math.min(window.innerHeight,r+s),u=(i+l)/2-e,d=(o+c)/2-r,[h,f]=this.viewport.rotation%180===0?[u,d]:[d,u];return{offsetX:h,offsetY:f}},aE=function(){for(const e of _(this,ba).values())e.isEmpty()&&e.remove()},Le(Mo,"_initialized",!1),se(Mo,Oh,new Map([n3,f3,b3,hk,x3].map(e=>[e._editorType,e])));let _3=Mo;var Yo,ci,Cm,Sj,Mk,Pfe,Sc,A3,Ofe,E3;const Un=class Un{constructor({pageIndex:e}){se(this,Sc);se(this,Yo,null);se(this,ci,new Map);se(this,Cm,new Map);this.pageIndex=e}setParent(e){if(!_(this,Yo)){Q(this,Yo,e);return}if(_(this,Yo)!==e){if(_(this,ci).size>0)for(const r of _(this,ci).values())r.remove(),e.append(r);Q(this,Yo,e)}}static get _svgFactory(){return Ut(this,"_svgFactory",new uk)}draw(e,r=!1,n=!1){const s=Jn(Un,Sj)._++,i=ce(this,Sc,A3).call(this),o=Un._svgFactory.createElement("defs");i.append(o);const l=Un._svgFactory.createElement("path");o.append(l);const c=`path_p${this.pageIndex}_${s}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),r&&_(this,Cm).set(s,l);const u=n?ce(this,Sc,Ofe).call(this,o,c):null,d=Un._svgFactory.createElement("use");return i.append(d),d.setAttribute("href",`#${c}`),this.updateProperties(i,e),_(this,ci).set(s,i),{id:s,clipPathId:`url(#${u})`}}drawOutline(e,r){const n=Jn(Un,Sj)._++,s=ce(this,Sc,A3).call(this),i=Un._svgFactory.createElement("defs");s.append(i);const o=Un._svgFactory.createElement("path");i.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke");let c;if(r){const h=Un._svgFactory.createElement("mask");i.append(h),c=`mask_p${this.pageIndex}_${n}`,h.setAttribute("id",c),h.setAttribute("maskUnits","objectBoundingBox");const f=Un._svgFactory.createElement("rect");h.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=Un._svgFactory.createElement("use");h.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=Un._svgFactory.createElement("use");s.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);const d=u.cloneNode();return s.append(d),u.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(s,e),_(this,ci).set(n,s),n}finalizeDraw(e,r){_(this,Cm).delete(e),this.updateProperties(e,r)}updateProperties(e,r){var c;if(!r)return;const{root:n,bbox:s,rootClass:i,path:o}=r,l=typeof e=="number"?_(this,ci).get(e):e;if(l){if(n&&ce(this,Sc,E3).call(this,l,n),s&&ce(c=Un,Mk,Pfe).call(c,l,s),i){const{classList:u}=l;for(const[d,h]of Object.entries(i))u.toggle(d,h)}if(o){const d=l.firstChild.firstChild;ce(this,Sc,E3).call(this,d,o)}}}updateParent(e,r){if(r===this)return;const n=_(this,ci).get(e);n&&(_(r,Yo).append(n),_(this,ci).delete(e),_(r,ci).set(e,n))}remove(e){_(this,Cm).delete(e),_(this,Yo)!==null&&(_(this,ci).get(e).remove(),_(this,ci).delete(e))}destroy(){Q(this,Yo,null);for(const e of _(this,ci).values())e.remove();_(this,ci).clear(),_(this,Cm).clear()}};Yo=new WeakMap,ci=new WeakMap,Cm=new WeakMap,Sj=new WeakMap,Mk=new WeakSet,Pfe=function(e,[r,n,s,i]){const{style:o}=e;o.top=`${100*n}%`,o.left=`${100*r}%`,o.width=`${100*s}%`,o.height=`${100*i}%`},Sc=new WeakSet,A3=function(){const e=Un._svgFactory.create(1,1,!0);return _(this,Yo).append(e),e.setAttribute("aria-hidden",!0),e},Ofe=function(e,r){const n=Un._svgFactory.createElement("clipPath");e.append(n);const s=`clip_${r}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");const i=Un._svgFactory.createElement("use");return n.append(i),i.setAttribute("href",`#${r}`),i.classList.add("clip"),s},E3=function(e,r){for(const[n,s]of Object.entries(r))s===null?e.removeAttribute(n):e.setAttribute(n,s)},se(Un,Mk),se(Un,Sj,0);let N3=Un;globalThis._pdfjsTestingUtils={HighlightOutliner:i3};globalThis.pdfjsLib={AbortException:nf,AnnotationEditorLayer:_3,AnnotationEditorParamsType:Kt,AnnotationEditorType:kt,AnnotationEditorUIManager:Jm,AnnotationLayer:e3,AnnotationMode:Rd,AnnotationType:kn,build:act,ColorPicker:lk,createValidAbsoluteUrl:Sde,DOMSVGFactory:uk,DrawLayer:N3,FeatureTest:ks,fetchData:dS,getDocument:Che,getFilenameFromUrl:Jot,getPdfFilenameFromUrl:elt,getRGB:H2,getUuid:Ede,getXfaPageViewport:rlt,GlobalWorkerOptions:nc,ImageKind:TA,InvalidPDFException:d5,isDataScheme:z2,isPdfFile:V8,isValidExplicitDest:flt,MathClamp:di,noContextMenu:_o,normalizeUnicode:Xot,OPS:nk,OutputScale:_c,PasswordResponses:Uot,PDFDataRangeTransport:khe,PDFDateString:ik,PDFWorker:H1,PermissionFlag:Bot,PixelsPerInch:sf,RenderingCancelledException:W8,ResponseException:sk,setLayerDimensions:Zm,shadow:Ut,SignatureExtractor:Tu,stopEvent:On,SupportedImageMimeTypes:f5,TextLayer:U1,TouchManager:ok,updateUrlHash:Nde,Util:ft,VerbosityLevel:$2,version:Ohe,XfaLayer:Rhe};nc.workerSrc=`https://unpkg.com/pdfjs-dist@${Ohe}/build/pdf.worker.min.mjs`;function kct({open:t,onOpenChange:e,pdfUrl:r,title:n}){const[s,i]=S.useState(null),[o,l]=S.useState(1),[c,u]=S.useState(0),[d,h]=S.useState(1),[f,p]=S.useState(!0),[g,m]=S.useState(null),[v,y]=S.useState(!0),[x,b]=S.useState(!1),[w,j]=S.useState([]),[N,C]=S.useState([]),k=S.useRef(null),E=S.useRef([]),M=S.useRef(null);S.useEffect(()=>{if(!t||!r)return;p(!0),m(null),i(null),j([]),C([]),l(1),(async()=>{try{const F=await Che(r).promise;i(F),u(F.numPages),p(!1)}catch(L){console.error("Error loading PDF:",L),m("Failed to load PDF. Please try again."),p(!1)}})()},[t,r]),S.useEffect(()=>{if(!s||N.length>0)return;(async()=>{const L=[];for(let F=1;F<=s.numPages;F++)try{const W=await s.getPage(F),X=W.getViewport({scale:d}),oe=document.createElement("canvas"),le=oe.getContext("2d");if(!le)continue;oe.height=X.height,oe.width=X.width,await W.render({canvasContext:le,viewport:X,canvas:oe}).promise,L.push(oe.toDataURL("image/png",.9))}catch(W){console.error(`Error rendering page ${F}:`,W)}C(L)})()},[s,d]),S.useEffect(()=>{!s||!t||C([])},[d]),S.useEffect(()=>{if(!s||w.length>0)return;(async()=>{const L=[];for(let F=1;F<=Math.min(s.numPages,50);F++)try{const W=await s.getPage(F),X=W.getViewport({scale:.2}),oe=document.createElement("canvas"),le=oe.getContext("2d");if(!le)continue;oe.height=X.height,oe.width=X.width,await W.render({canvasContext:le,viewport:X,canvas:oe}).promise,L.push(oe.toDataURL())}catch(W){console.error(`Error generating thumbnail for page ${F}:`,W)}j(L)})()},[s,w.length]),S.useEffect(()=>{const $=M.current;if(!$||N.length===0)return;const L=()=>{const F=$.scrollTop,W=$.clientHeight;for(let X=0;X<E.current.length;X++){const oe=E.current[X];if(!oe)continue;const le=oe.offsetTop,B=oe.offsetHeight,R=le+B/2;if(R>F&&R<F+W){l(X+1);break}}};return $.addEventListener("scroll",L),()=>$.removeEventListener("scroll",L)},[N]);const z=S.useCallback($=>{const L=E.current[$-1];L&&M.current&&(L.scrollIntoView({behavior:"smooth",block:"start"}),l($))},[]),I=()=>{o>1&&z(o-1)},q=()=>{o<c&&z(o+1)},A=$=>{const L=parseInt($.target.value);L>=1&&L<=c&&z(L)},U=$=>{if($.key==="Enter"){const L=parseInt($.target.value);L>=1&&L<=c&&z(L)}},K=()=>h($=>Math.min($+.25,3)),G=()=>h($=>Math.max($-.25,.5)),Y=()=>{if(k.current&&s){const $=k.current.clientWidth-48;s.getPage(1).then(L=>{const F=L.getViewport({scale:1});h($/F.width)})}},H=()=>{const $=document.createElement("a");$.href=r,$.download=n||"document.pdf",$.click()};return S.useEffect(()=>{if(!t)return;const $=L=>{L.key==="ArrowLeft"&&I(),L.key==="ArrowRight"&&q(),(L.key==="+"||L.key==="=")&&K(),L.key==="-"&&G()};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,o,c]),a.jsx(Vr,{open:t,onOpenChange:e,children:a.jsxs(Rr,{className:Oe("p-0 gap-0 overflow-hidden",x?"max-w-[100vw] h-[100vh] rounded-none":"max-w-6xl h-[90vh]"),children:[a.jsx(Mr,{className:"px-4 py-3 border-b bg-muted/30",children:a.jsx(Dr,{className:"text-base font-medium truncate pr-8",children:n||"PDF Document"})}),a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/20 backdrop-blur-sm",children:[a.jsx(ve,{variant:"ghost",size:"sm",onClick:()=>y(!v),className:"h-8 w-8 p-0",children:v?a.jsx(Zxe,{className:"h-4 w-4"}):a.jsx(Jxe,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ve,{variant:"ghost",size:"sm",onClick:I,disabled:o<=1,className:"h-8 w-8 p-0",children:a.jsx(Nxe,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[a.jsx(Be,{type:"number",min:1,max:c,value:o,onChange:A,onKeyDown:U,className:"w-14 h-7 text-center text-sm [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"}),a.jsxs("span",{className:"text-muted-foreground",children:["of ",c]})]}),a.jsx(ve,{variant:"ghost",size:"sm",onClick:q,disabled:o>=c,className:"h-8 w-8 p-0",children:a.jsx(IJ,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ve,{variant:"ghost",size:"sm",onClick:G,disabled:d<=.5,className:"h-8 w-8 p-0",children:a.jsx(f0e,{className:"h-4 w-4"})}),a.jsxs(ve,{variant:"ghost",size:"sm",onClick:Y,className:"h-8 px-2 text-xs",children:[Math.round(d*100),"%"]}),a.jsx(ve,{variant:"ghost",size:"sm",onClick:K,disabled:d>=3,className:"h-8 w-8 p-0",children:a.jsx(h0e,{className:"h-4 w-4"})}),a.jsx("div",{className:"w-px h-5 bg-border mx-1"}),a.jsx(ve,{variant:"ghost",size:"sm",onClick:H,className:"h-8 w-8 p-0",children:a.jsx(fo,{className:"h-4 w-4"})}),a.jsx(ve,{variant:"ghost",size:"sm",onClick:()=>b(!x),className:"h-8 w-8 p-0",children:x?a.jsx(Xxe,{className:"h-4 w-4"}):a.jsx(Wxe,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",ref:k,children:[v&&a.jsx("div",{className:"w-32 border-r bg-muted/10 flex-shrink-0",children:a.jsx(Yj,{className:"h-full",children:a.jsxs("div",{className:"p-2 space-y-2",children:[w.map(($,L)=>a.jsxs("button",{onClick:()=>z(L+1),className:Oe("w-full rounded-lg border-2 overflow-hidden transition-all",o===L+1?"border-primary shadow-md":"border-transparent hover:border-muted-foreground/30"),children:[a.jsx("img",{src:$,alt:`Page ${L+1}`,className:"w-full"}),a.jsx("div",{className:"text-xs text-muted-foreground py-1",children:L+1})]},L)),w.length===0&&!f&&a.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"Loading thumbnails..."})]})})}),a.jsx("div",{ref:M,className:"flex-1 overflow-auto bg-muted/5",children:f?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(Et,{className:"h-8 w-8 animate-spin text-primary"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading PDF..."})]})}):g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-destructive mb-2",children:g}),a.jsx(ve,{variant:"outline",onClick:()=>e(!1),children:"Close"})]})}):N.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(Et,{className:"h-8 w-8 animate-spin text-primary"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Rendering pages..."})]})}):a.jsx("div",{className:"flex flex-col items-center gap-4 p-6",children:N.map(($,L)=>a.jsxs("div",{ref:F=>E.current[L]=F,className:"relative",children:[a.jsx("img",{src:$,alt:`Page ${L+1}`,className:"shadow-lg rounded-sm max-w-full"}),a.jsxs("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 bg-muted/80 backdrop-blur-sm px-2 py-0.5 rounded text-xs text-muted-foreground",children:["Page ",L+1]})]},L))})})]})]})})}function Tct({documentId:t}){const[e,r]=S.useState(null),[n,s]=S.useState(0),[i,o]=S.useState(""),[l,c]=S.useState(!1),[u,d]=S.useState(!0),[h,f]=S.useState(!1);S.useEffect(()=>{p()},[t]);const p=async()=>{var C;d(!0);const[w,j]=await Promise.all([be.from("pages").select("page_number").eq("document_id",t).order("page_number",{ascending:!0}).limit(1).maybeSingle(),be.from("pages").select("id",{count:"exact",head:!0}).eq("document_id",t)]),N=((C=w.data)==null?void 0:C.page_number)??null;r(N),s(j.count??0),o(N!=null?String(N):""),d(!1)},g=parseInt(i,10),m=!isNaN(g)&&i.trim()!=="",v=m&&e!=null?g-e:0,y=e!=null&&e!==1,x=()=>{if(v===0){Fe.info("No correction needed — the start page is already correct.");return}f(!0)},b=async()=>{f(!1),c(!0);try{const{data:w,error:j}=await be.from("pages").select("id, page_number").eq("document_id",t);if(j)throw j;if(!w||w.length===0){Fe.error("No pages found for this document.");return}const N=w.map(M=>be.from("pages").update({page_number:(M.page_number??0)+v}).eq("id",M.id)),k=(await Promise.all(N)).filter(M=>M.error);if(k.length>0){console.error("Some page updates failed:",k),Fe.error(`${k.length} page(s) could not be updated.`);return}const E=v>0?"+":"";Fe.success(`Page numbers corrected (Offset: ${E}${v})`),await p()}catch(w){console.error("Page correction error:",w),Fe.error("Error correcting page numbers.")}finally{c(!1)}};return u?a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[a.jsx(Ks,{className:"w-4 h-4 animate-spin"}),"Loading page data..."]})]}):n===0?null:a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold",children:"Correct Original Page Numbers"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"If this PDF is an excerpt (e.g. from a journal), enter the real page number of the first PDF page."})]}),y&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/30 p-2 rounded-md",children:[a.jsx(Pa,{className:"w-3.5 h-3.5 shrink-0 text-destructive"}),"Pages already shifted — first page is currently ",e,"."]}),a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(_e,{htmlFor:"page-start",className:"text-xs",children:"PDF page 1 corresponds to original page:"}),a.jsx(Be,{id:"page-start",type:"number",value:i,onChange:w=>o(w.target.value),placeholder:"e.g. 413",className:"h-9"})]}),a.jsx(ve,{size:"sm",onClick:x,disabled:!m||v===0||l,className:"h-9",children:l?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):"Correct Pages"})]}),m&&v!==0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[n," page(s) will be shifted by ",v>0?"+":"",v,". Page ",e," → ",g,", Page ",(e??0)+n-1," → ",g+n-1,"."]})]}),a.jsx(wi,{open:h,onOpenChange:f,children:a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Correct Page Numbers?"}),a.jsxs(ti,{children:["All ",n," page(s) will be shifted by ",v>0?"+":"",v,". Page ",e," becomes ",g,", Page ",(e??0)+n-1," becomes ",g+n-1,". This cannot be easily undone."]})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:b,children:"Correct Pages"})]})]})})]})}function Pct({documents:t,documentPages:e,onDocumentDeleted:r,currentPage:n,itemsPerPage:s,totalItems:i,onPageChange:o}){const l=wr(),{userProfile:c}=Pt(),[u,d]=S.useState(new Set),[h,f]=S.useState({}),[p,g]=S.useState(new Set),[m,v]=S.useState(new Set),[y,x]=S.useState(""),[b,w]=S.useState(!1),[j,N]=S.useState(null);S.useEffect(()=>{IT(t,"documents").then(f)},[t]);const C=H=>{var F,W,X,oe;const $=H.book_title;if($)return $;const L=H.bib_meta;if(!L)return null;if(L.title&&typeof L.title=="string")return L.title;if((F=L.google_books_data)!=null&&F.title)return L.google_books_data.title;if((X=(W=L.crossref_data)==null?void 0:W.crossref_metadata)!=null&&X.title){const le=L.crossref_data.crossref_metadata.title;return Array.isArray(le)?le[0]:le}if((oe=L.crossref_payload)!=null&&oe.title){const le=L.crossref_payload.title;return Array.isArray(le)?le[0]:le}return null},k=async H=>{const $=t.find(L=>L.id===H);if($){d(L=>new Set(L).add(H));try{const{error:L}=await be.from("summaries").delete().eq("document_id",H).eq("user_id",c==null?void 0:c.id);if(L)throw L;const{error:F}=await be.from("documents").delete().eq("id",H).eq("user_id",c==null?void 0:c.id);if(F)throw F;try{$.storage_path&&await be.storage.from("documents").remove([$.storage_path])}catch(W){console.warn("Could not delete file from storage:",W)}Fe.success("Document deleted successfully"),r()}catch(L){console.error("Delete error:",L),Fe.error("Error deleting. Please try again.")}finally{d(L=>{const F=new Set(L);return F.delete(H),F})}}},E=async(H,$)=>{try{await navigator.clipboard.writeText(H),g(L=>new Set(L).add($)),Fe.success("Citation copied to clipboard"),setTimeout(()=>{g(L=>{const F=new Set(L);return F.delete($),F})},2e3)}catch{Fe.error("Error copying to clipboard")}},M=(H,$)=>{v(L=>new Set(L).add(H)),x($)},z=async H=>{try{const{error:$}=await be.from("documents").update({citation_apa:y}).eq("id",H).eq("user_id",c==null?void 0:c.id);if($)throw $;Fe.success("Citation updated successfully"),r(),v(L=>{const F=new Set(L);return F.delete(H),F})}catch($){console.error("Save citation error:",$),Fe.error("Error saving citation")}},I=H=>{v($=>{const L=new Set($);return L.delete(H),L}),x("")},q=H=>h[H.id]||null,A=H=>e[H]||!1?a.jsx(gt,{className:"bg-green-100 text-green-800 hover:bg-green-200",children:"Completed"}):a.jsx(gt,{variant:"secondary",children:"open"}),U=H=>new Date(H).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),K=Math.ceil(i/s),G=(n-1)*s+1,Y=Math.min(n*s,i);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Pages"}),a.jsx(yt,{children:"ISBN/DOI"}),a.jsx(yt,{children:"Index Status"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(H=>{const $=u.has(H.id),L=p.has(H.id),F=m.has(H.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Ir,{className:"w-4 h-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-sm",children:H.original_filename||H.title}),(()=>{const W=C(H),X=H.original_filename||H.title||"";if(W&&W!==X){const oe=W.length>70?W.substring(0,70)+"...":W;return a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(nz,{className:"w-3 h-3"}),oe]})}return null})()]})]})}),a.jsxs(vt,{className:"text-muted-foreground",children:[H.page_count||"?"," Pages"]}),a.jsx(vt,{className:"text-muted-foreground",children:H.isbn?`ISBN: ${H.isbn}`:H.doi?`DOI: ${H.doi}`:"–"}),a.jsx(vt,{children:A(H.id)}),a.jsx(vt,{className:"text-muted-foreground",children:U(H.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>{q(H)?(N(H),w(!0)):Fe.error("PDF URL not available")},children:a.jsx(Yi,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View PDF"})})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx("a",{href:q(H)||"#",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center w-8 h-8 p-0 rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground",onClick:W=>{q(H)||(W.preventDefault(),Fe.error("PDF URL not available"))},children:a.jsx(i0,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open in New Tab"})})]}),a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",disabled:!H.citation_apa,children:a.jsx(a0,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:H.citation_apa?"View APA Citation":"No citation available"})})]}),a.jsxs(Rr,{className:"max-w-lg",children:[a.jsxs(Mr,{children:[a.jsxs(Dr,{className:"flex items-center gap-2",children:[a.jsx(nz,{className:"w-5 h-5"}),"Book Information"]}),a.jsx(g0,{children:"Automatically detected data for this document"})]}),H.bib_meta&&(()=>{var ye,ae,de,ge,we,je,Se,Ue,Ae,fe,Ee,Ce,Ge;const W=H.bib_meta,X=W==null?void 0:W.google_books_data,oe=W==null?void 0:W.crossref_payload,le=W==null?void 0:W.crossref_data,B=oe||le,R=(W==null?void 0:W.method)==="manual_entry"||(W==null?void 0:W.method)==="parsed_paste",ee=((ye=B==null?void 0:B.author)==null?void 0:ye.map(dt=>`${dt.given||""} ${dt.family||""}`.trim()).join(", "))||((ae=le==null?void 0:le.authors)==null?void 0:ae.join(", ")),te=((we=(ge=(de=B==null?void 0:B.issued)==null?void 0:de["date-parts"])==null?void 0:ge[0])==null?void 0:we.join("-"))||((Ue=(Se=(je=B==null?void 0:B.published)==null?void 0:je["date-parts"])==null?void 0:Se[0])==null?void 0:Ue.join("-"))||(le==null?void 0:le.year),Z=Array.isArray(B==null?void 0:B.title)?B.title[0]:B==null?void 0:B.title,J=Array.isArray(B==null?void 0:B["container-title"])?B["container-title"][0]:(B==null?void 0:B["container-title"])||(le==null?void 0:le.journal),he=(B==null?void 0:B.page)||(le==null?void 0:le.pages),P=((Ae=B==null?void 0:B.ISBN)==null?void 0:Ae[0])||((Ee=(fe=le==null?void 0:le.crossref_metadata)==null?void 0:fe.ISBN)==null?void 0:Ee[0]),ie=(B==null?void 0:B.type)||((Ce=le==null?void 0:le.crossref_metadata)==null?void 0:Ce.type),V=R?W.title:(X==null?void 0:X.title)||Z,O=R?Array.isArray(W.authors)?W.authors.join(", "):W.authors:((Ge=X==null?void 0:X.authors)==null?void 0:Ge.join(", "))||ee,T=R?W.publisher:(X==null?void 0:X.publisher)||(B==null?void 0:B.publisher),D=R?W.published_year:(X==null?void 0:X.publishedDate)||te,ne=R?W.pages:he||(X==null?void 0:X.pageCount),ue=R?W.edition:null,re=R?W.language:null,pe=R?W.series:null,xe=R?W.type:ie;return a.jsxs("div",{className:"space-y-2 p-4 bg-muted/50 rounded-lg border",children:[V&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Title:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:V})]}),xe&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Type:"}),a.jsx("span",{className:"text-sm font-medium text-right capitalize",children:String(xe).replace("-"," ")})]}),O&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Author(s):"}),a.jsx("span",{className:"text-sm font-medium text-right",children:O})]}),J&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Journal:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:J})]}),T&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Publisher:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:T})]}),D&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Published:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:D})]}),ue&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Edition:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:ue})]}),((B==null?void 0:B.volume)||(B==null?void 0:B.issue))&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Volume/Issue:"}),a.jsxs("span",{className:"text-sm font-medium text-right",children:[(B==null?void 0:B.volume)&&`Vol. ${B.volume}`,(B==null?void 0:B.volume)&&(B==null?void 0:B.issue)&&", ",(B==null?void 0:B.issue)&&`Issue ${B.issue}`]})]}),ne&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Pages:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:ne})]}),re&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Language:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:re})]}),pe&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Series:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:pe})]}),(P||(X==null?void 0:X.isbn)||H.isbn)&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"ISBN:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:P||(X==null?void 0:X.isbn)||H.isbn})]}),(H.doi||(B==null?void 0:B.DOI)||(B==null?void 0:B.doi))&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"DOI:"}),a.jsx("a",{href:`https://doi.org/${(H.doi||(B==null?void 0:B.DOI)||(B==null?void 0:B.doi)).replace("https://doi.org/","")}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-primary hover:underline text-right break-all",children:(H.doi||(B==null?void 0:B.DOI)||(B==null?void 0:B.doi)).replace("https://doi.org/","")})]}),(B==null?void 0:B.ISSN)&&!R&&a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"ISSN:"}),a.jsx("span",{className:"text-sm font-medium text-right",children:Array.isArray(B.ISSN)?B.ISSN[0]:B.ISSN})]}),(W==null?void 0:W.method)&&a.jsxs("div",{className:"flex justify-between gap-4 pt-2 border-t border-border/50 mt-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Source:"}),a.jsx(gt,{variant:"secondary",className:"text-xs",children:W.method==="manual_entry"?"Manual Entry":W.method==="parsed_paste"?"Parsed Paste":W.method==="crossref"?"CrossRef":W.method==="google_books"?"Google Books":W.method})]})]})})(),!H.bib_meta&&a.jsx("div",{className:"p-4 bg-muted/50 rounded-lg border text-center text-sm text-muted-foreground",children:'No metadata available. Click "Detect APA" to fetch data.'}),a.jsx(Tct,{documentId:H.id}),a.jsx(Es,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold",children:"APA-7 Citation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically detected citation for this document"})]}),F?a.jsxs("div",{className:"space-y-3",children:[a.jsx(Wt,{value:y,onChange:W=>x(W.target.value),className:"min-h-[100px] text-sm",placeholder:"Edit APA citation..."}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ve,{onClick:()=>z(H.id),size:"sm",className:"flex items-center gap-2",children:[a.jsx(mD,{className:"w-4 h-4"}),"Save"]}),a.jsxs(ve,{onClick:()=>I(H.id),size:"sm",variant:"outline",className:"flex items-center gap-2",children:[a.jsx(Rs,{className:"w-4 h-4"}),"Cancel"]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"p-4 bg-muted rounded-lg",children:a.jsx("p",{className:"text-sm leading-relaxed",children:H.citation_apa||"No citation available"})}),H.citation_apa&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ve,{onClick:()=>E(H.citation_apa,H.id),variant:L?"default":"outline",className:"flex items-center gap-2",children:L?"Copied!":"Copy"}),a.jsxs(ve,{onClick:()=>M(H.id,H.citation_apa),variant:"outline",className:"flex items-center gap-2",children:[a.jsx(UJ,{className:"w-4 h-4"}),"Edit"]})]})]})]})]})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>l(`/reference-checker?document=${H.id}`),children:a.jsx(pl,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Check with Reference Checker"})})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:$,children:$?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Document"}),a.jsxs(ti,{children:['Are you sure you want to delete "',H.original_filename||H.title,'"? This action cannot be undone.']})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>k(H.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},H.id)})})]}),K>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[G,"-",Y," of ",i," Documents"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>o(n-1),disabled:n===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>o(n+1),disabled:n===K,children:"Next"})]})]}),a.jsx(kct,{open:b,onOpenChange:w,pdfUrl:j&&h[j.id]||"",title:(j==null?void 0:j.title)||(j==null?void 0:j.original_filename)||"PDF Document"})]})}function dK(t){return!t||!t.length?"- –":t.map(e=>`- ${e}`).join(`
`)}function hK(t){if(!t)return"";const e=t.intro?`${t.intro}

`:"",r=(t.questions??[]).map((n,s)=>{const i=(n.probes??[]).map(l=>`    - ${l}`).join(`
`),o=n.maps_to_rq?` *(zu ${n.maps_to_rq})*`:"";return`${s+1}. **${n.question}**${o}
${i?`
${i}
`:""}`}).join(`

`);return`${e}${r}`}function Oct(t){const e=(t==null?void 0:t.meta)??{},r=(t==null?void 0:t.participant_interview)??{},n=(t==null?void 0:t.expert_interview)??{},s=(t==null?void 0:t.notes)??{},i=e.title||"Research Setup",o=(e.derived_research_questions??[]).map(l=>`- ${l}`).join(`
`);return[`# ${i}`,"",`**Objective:** ${e.aim??"–"}`,`**Degree:** ${e.degree??"–"} | **Discipline:** ${e.discipline??"–"} | **Language:** ${e.language??"–"}`,"","## Research Questions",o||"- –","","## Guidelines: Participant Interviews",hK(r)||"- –","","## Guidelines: Expert Interviews",hK(n)||"- –","","## Sampling & Criteria",`**Sampling-Strategy**
${s.sampling??"–"}`,"",`**Inclusion Criteria**
${dK(s.inclusion)}`,"",`**Exclusion Criteria**
${dK(s.exclusion)}`,"","## Ethics",s.ethics??"–","","## Piloting",s.pilot??"–"].join(`
`)}function Ict(t){let e=`# ${t.title}

`;return e+=`${t.content}

`,t.literature&&t.literature.length>0&&(e+=`## Literaturverzeichnis

`,t.literature.forEach(r=>{e+=`- ${r}
`}),e+=`
`),t.proof_of_material&&t.proof_of_material.length>0&&(e+=`## Quellennachweis

`,t.proof_of_material.forEach((r,n)=>{e+=`**[${n+1}] ${r.citation}**
`,e+=`> ${r.original_text}
`,r.page_number&&(e+=`*Seite ${r.page_number}*`),r.document_title&&(e+=` - ${r.document_title}`),e+=`

`})),e.trim()}function pk(t,e){var r,n,s,i,o;if(e==="research_setup")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);return Oct(l)}catch(l){return console.error("Failed to parse research setup data:",l),t||"Error displaying research setup data"}if(e==="topic_explorer")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);let c=`# ${l.title}

`;return l.introduction&&(c+=`## Introduction
${l.introduction}

`),l.problem&&(c+=`## Problem Statement
${l.problem}

`),l.objectives&&(c+=`## Objectives
${l.objectives}

`),(n=(r=l.original_selection)==null?void 0:r.researchQuestions)!=null&&n.length&&(c+=`## Research Questions?
`,l.original_selection.researchQuestions.forEach((u,d)=>{c+=`${d+1}. ${u}
`}),c+=`
`),(s=l.original_selection)!=null&&s.method&&(c+=`## Methodology
${l.original_selection.method}

`),(o=(i=l.original_selection)==null?void 0:i.sources)!=null&&o.length&&(c+=`## Literature Recommendations
`,l.original_selection.sources.forEach((u,d)=>{c+=`${d+1}. ${u.title}`,u.doi&&(c+=` (DOI: ${u.doi})`),u.isbn&&(c+=` (ISBN: ${u.isbn})`),c+=`
`}),c+=`
`),c.trim()}catch(l){return console.error("Failed to parse topic explorer data:",l),t||"Error displaying topic explorer data"}if(e==="thesis_builder"||e==="theory"||e==="paragraph"||e==="outline")try{if(t.trim().startsWith("#"))return t;const l=JSON.parse(t);return Ict(l)}catch(l){return console.warn("Could not parse thesis builder data:",l),t||"No content available"}return t||"No text available"}function fK(t){var e,r,n,s,i;if(t.summary_mode==="research_setup")try{return(e=t.summary_text)!=null&&e.trim().startsWith("#")?t.summary_text.split(`
`)[0].replace(/^#+\s*/,""):((r=JSON.parse(t.summary_text||"{}").meta)==null?void 0:r.title)||"Research Setup"}catch{return"Research Setup"}if(t.summary_mode==="topic_explorer")try{return(n=t.summary_text)!=null&&n.trim().startsWith("#")?t.summary_text.split(`
`)[0].replace(/^#+\s*/,""):(JSON.parse(t.summary_text||"{}").title||"Topic Explorer Struktur").replace(/^#+\s*/,"")}catch{return"Topic Explorer Struktur"}return((s=t.documents)==null?void 0:s.original_filename)||((i=t.documents)==null?void 0:i.title)||"Unbekanntes Dokument"}function pK(t){return t==="research_setup"?"Research Setup":t==="topic_explorer"?"Topic Explorer":{small:"Kurz",medium:"Mittel",large:"Lang",detailed:"Detailliert",big:"Ausführlich",deep15:"Detailliert"}[t||""]||t||""}function Rct({summaries:t,onSummaryDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{IT(t,"summaries").then(d)},[t]);const h=async x=>{c(b=>new Set(b).add(x));try{const{error:b}=await be.from("summaries").delete().eq("id",x).eq("user_id",o==null?void 0:o.id);if(b)throw b;Fe.success("Summary deleted successfully"),e()}catch(b){console.error("Delete error:",b),Fe.error("Error deleting. Please try again.")}finally{c(b=>{const w=new Set(b);return w.delete(x),w})}},f=async x=>{try{await navigator.clipboard.writeText(x),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},p=x=>new Date(x).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=x=>u[x.id]||null,m=Math.ceil(s/n),v=(r-1)*n+1,y=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(x=>{const b=l.has(x.id),w=g(x);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Ir,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:fK(x)})})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:pK(x.summary_mode||"")})}),a.jsx(vt,{className:"text-muted-foreground",children:p(x.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Summary"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:fK(x)}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Mode: ",pK(x.summary_mode||"")," | Created: ",p(x.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:pk(x.summary_text||"",x.summary_mode||"")})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>f(pk(x.summary_text||"",x.summary_mode||"")),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),w&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(w,"_blank"),children:a.jsx(i0,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:b,children:b?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Summary"}),a.jsx(ti,{children:"Are you sure you want to delete this summary? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>h(x.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},x.id)})})]}),m>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[v,"-",y," of ",s," Summaries"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===m,children:"Next"})]})]})]})}function Mct({methods:t,onMethodDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{IT(t,"summaries").then(d)},[t]);const h=async w=>{c(j=>new Set(j).add(w));try{const{error:j}=await be.from("methods").delete().eq("id",w).eq("user_id",o==null?void 0:o.id);if(j)throw j;Fe.success("Methodology deleted successfully"),e()}catch(j){console.error("Delete error:",j),Fe.error("Error deleting. Please try again.")}finally{c(j=>{const N=new Set(j);return N.delete(w),N})}},f=async w=>{try{await navigator.clipboard.writeText(w),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},p=w=>new Date(w).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=w=>u[w.id]||null,m=w=>{var j,N;return((j=w.documents)==null?void 0:j.title)||((N=w.documents)==null?void 0:N.original_filename)||w.title||"Unknown Document"},v=w=>{switch(w){case"small":return"Short";case"medium":return"Medium";case"big":return"Long";default:return"Methods"}},y=Math.ceil(s/n),x=(r-1)*n+1,b=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Title"}),a.jsx(yt,{children:"Document Sources"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(w=>{var C,k,E;const j=l.has(w.id),N=g(w);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Ir,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:((k=(C=w.method_text)==null?void 0:C.split(`
`)[0])==null?void 0:k.trim())||w.title||"Methods & Approach"})})]})}),a.jsx(vt,{className:"text-muted-foreground",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium",children:m(w)}),a.jsxs("span",{className:"text-xs",children:[((E=w.documents)==null?void 0:E.page_count)||"?"," Pages"]})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:v(w.mode||"")})}),a.jsx(vt,{className:"text-muted-foreground",children:p(w.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Methodology"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:w.title||"Methods & Approach"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Document: ",m(w)," | Mode: ",v(w.mode||"")," | Created: ",p(w.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:w.method_text||""})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>f(w.method_text||""),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),N&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(N,"_blank"),children:a.jsx(i0,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:j,children:j?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Methodology"}),a.jsx(ti,{children:"Are you sure you want to delete this methodology? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>h(w.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},w.id)})})]}),y>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[x,"-",b," of ",s," Methodology Entries"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===y,children:"Next"})]})]})]})}const Dct=({theories:t,onTheoryDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i})=>{const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),[u,d]=S.useState({});S.useEffect(()=>{IT(t,"summaries").then(d)},[t]);const h=async w=>{c(j=>new Set(j).add(w));try{const{error:j}=await be.from("theory_backgrounds").delete().eq("id",w).eq("user_id",o==null?void 0:o.id);if(j)throw j;Fe.success("Theory/Background deleted successfully"),e()}catch(j){console.error("Delete error:",j),Fe.error("Error deleting. Please try again.")}finally{c(j=>{const N=new Set(j);return N.delete(w),N})}},f=async w=>{try{await navigator.clipboard.writeText(w),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},p=w=>new Date(w).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),g=w=>u[w.id]||null,m=w=>{var j,N;return((j=w.documents)==null?void 0:j.title)||((N=w.documents)==null?void 0:N.original_filename)||"Unknown Document"},v=w=>{if(!w||w==="theory")return"Theory & Background";switch(w){case"paragraph":return"Paragraph";case"outline":return"Outline";default:return w}},y=Math.ceil(s/n),x=(r-1)*n+1,b=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Document Sources"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(w=>{var C,k,E;const j=l.has(w.id),N=g(w);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Ir,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:((k=(C=w.theory_text)==null?void 0:C.split(`
`)[0])==null?void 0:k.trim())||w.title||"Theory & Background"})})]})}),a.jsx(vt,{className:"text-muted-foreground",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium",children:m(w)}),a.jsxs("span",{className:"text-xs",children:[((E=w.documents)==null?void 0:E.page_count)||"?"," Pages"]})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:v(w.mode)})}),a.jsx(vt,{className:"text-muted-foreground",children:p(w.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Theory & Background"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:w.title||"Theory & Background"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Document: ",m(w)," | Mode: ",v(w.mode)," | Created: ",p(w.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:pk(w.theory_text||"",w.mode||"theory")})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>f(w.theory_text||""),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),N&&a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",onClick:()=>window.open(N,"_blank"),children:a.jsx(i0,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Open PDF"})})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:j,children:j?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Theory/Background"}),a.jsx(ti,{children:"Are you sure you want to delete this Theory/Background? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>h(w.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},w.id)})})]}),y>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[x,"-",b," of ",s," Theory & Background"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===y,children:"Next"})]})]})]})},Lct=({analyses:t,onAnalysisDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i})=>{const{userProfile:o}=Pt(),[l,c]=S.useState(new Set),u=async y=>{c(x=>new Set(x).add(y));try{const{error:x}=await be.from("analysis_results").delete().eq("id",y).eq("user_id",o==null?void 0:o.id);if(x)throw x;Fe.success("Analysis deleted successfully"),e()}catch(x){console.error("Delete error:",x),Fe.error("Error deleting. Please try again.")}finally{c(x=>{const b=new Set(x);return b.delete(y),b})}},d=y=>new Date(y).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=y=>{switch(y){case"small":return"Short";case"medium":return"Medium";case"big":return"Long";default:return y||"–"}},f=y=>{var x;return((x=y.categories)==null?void 0:x.category_title)||"No Category"},p=y=>{var x;return((x=y.codebooks)==null?void 0:x.title)||"No Codebook"},g=Math.ceil(s/n),m=(r-1)*n+1,v=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Codebook"}),a.jsx(yt,{children:"Mode"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(y=>{var b;const x=l.has(y.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Ir,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:f(y)})})]})}),a.jsx(vt,{className:"text-muted-foreground text-sm",children:p(y)}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:h(y.mode)})}),a.jsx(vt,{className:"text-muted-foreground",children:d(y.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Analysis"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Qualitative Analysis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:f(y)}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Codebook: ",p(y)," | Mode: ",h(y.mode)," | Created: ",d(y.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx("div",{className:"whitespace-pre-wrap",children:y.result_text||"No content available"})}),((b=y.categories)==null?void 0:b.category_conclusion)&&a.jsxs(a.Fragment,{children:[a.jsx("hr",{className:"my-6 border-border"}),a.jsxs("div",{className:"prose max-w-none",children:[a.jsxs("p",{className:"font-bold underline mb-2",children:["Fazit Kategorie: ",y.categories.category_title]}),a.jsx("p",{className:"whitespace-pre-wrap",children:y.categories.category_conclusion})]})]})]})]})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:x,children:x?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Analysis"}),a.jsx(ti,{children:"Are you sure you want to delete this analysis? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>u(y.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},y.id)})})]}),g>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[m,"-",v," of ",s," Analyses"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===g,children:"Next"})]})]})]})};function Fct({topics:t,onTopicDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){Pt();const[o,l]=S.useState(new Set),c=async g=>{l(m=>new Set(m).add(g));try{const{error:m}=await be.from("topic_explorations").delete().eq("id",g);if(m)throw m;Fe.success("Topic exploration deleted successfully"),e()}catch(m){console.error("Delete error:",m),Fe.error("Error deleting. Please try again.")}finally{l(m=>{const v=new Set(m);return v.delete(g),v})}},u=async g=>{var v,y,x,b,w,j,N,C;let m=`# ${g.title}

`;g.introduction&&(m+=`## Introduction
${g.introduction}

`),g.problem_statement&&(m+=`## Problem Statement
${g.problem_statement}

`),g.objectives&&(m+=`## Objectives
${g.objectives}

`),Array.isArray(g.research_questions)&&g.research_questions.length>0&&(m+=`## Research Questions
${g.research_questions.join(`
`)}

`),g.method&&(m+=`## Methodology
${g.method}

`),(v=g.outline_json)!=null&&v.chapters&&(m+=`## Outline
`,g.outline_json.chapters.forEach(k=>{m+=`${k.number}. ${k.title}
`,k.subchapters&&k.subchapters.forEach(E=>{m+=`   ${E.number} ${E.title}
`})}),m+=`
`),(y=g.keywords_json)!=null&&y.primary_keywords&&(m+=`## Primary Keywords
${g.keywords_json.primary_keywords.join(", ")}

`),(x=g.keywords_json)!=null&&x.german_equivalents&&(m+=`## German Keywords
${g.keywords_json.german_equivalents.join(", ")}

`),(b=g.keywords_json)!=null&&b.english_equivalents&&(m+=`## English Keywords
${g.keywords_json.english_equivalents.join(", ")}

`),(w=g.keywords_json)!=null&&w.keyword_combinations&&(m+=`## Search Combinations
`,g.keywords_json.keyword_combinations.forEach(k=>{m+=`- ${k.combination} (${k.purpose})
`}),m+=`
`),(j=g.keywords_json)!=null&&j.database_suggestions&&(m+=`## Recommended Databases
${g.keywords_json.database_suggestions.join(", ")}

`),(N=g.keywords_json)!=null&&N.known_authors&&(m+=`## Known Authors
`,g.keywords_json.known_authors.forEach(k=>{m+=`- ${k.name}: ${k.relevance}
`}),m+=`
`),(C=g.keywords_json)!=null&&C.known_works&&(m+=`## Known Works
`,g.keywords_json.known_works.forEach(k=>{m+=`- ${k.title} (${k.author}${k.year?`, ${k.year}`:""})
`}),m+=`
`);try{await navigator.clipboard.writeText(m.trim()),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},d=g=>new Date(g).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=Math.ceil(s/n),f=(r-1)*n+1,p=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Source"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(g=>{var v,y,x,b,w,j,N,C,k,E;const m=o.has(g.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(hf,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:g.title||"Untitled Topic"})})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"secondary",children:g.feature_type==="outline"?"Outline":g.feature_type==="keywords"?"Literature Keywords":"Topic Ideas"})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:g.language||"DE"})}),a.jsx(vt,{className:"text-muted-foreground",children:d(g.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:g.title})}),a.jsxs("div",{className:"space-y-6",children:[g.feature_type&&a.jsx(gt,{variant:"secondary",className:"mb-2",children:g.feature_type==="outline"?"Thesis Outline":g.feature_type==="keywords"?"Literature Keywords":"Topic Ideas"}),g.introduction&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Introduction"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.introduction})]}),g.problem_statement&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Problem Statement"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.problem_statement})]}),g.objectives&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Objectives"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.objectives})]}),g.research_questions&&Array.isArray(g.research_questions)&&g.research_questions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Questions"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.research_questions.map((M,z)=>a.jsx("li",{children:M},z))})]}),g.method&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Methodology"}),a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:g.method})]}),((v=g.outline_json)==null?void 0:v.chapters)&&g.outline_json.chapters.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Thesis Outline"}),g.outline_json.estimated_pages&&a.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Estimated pages: ",g.outline_json.estimated_pages]}),a.jsx("div",{className:"space-y-3",children:g.outline_json.chapters.map((M,z)=>a.jsxs("div",{className:"border rounded-lg p-3",children:[a.jsxs("span",{className:"font-medium",children:[M.number,". ",M.title]}),M.subchapters&&M.subchapters.length>0&&a.jsx("div",{className:"ml-4 mt-2 space-y-1 border-l-2 pl-3",children:M.subchapters.map((I,q)=>a.jsxs("div",{className:"text-sm text-muted-foreground",children:[I.number," ",I.title]},q))})]},z))}),g.outline_json.notes&&a.jsx("p",{className:"text-sm text-muted-foreground mt-3 italic",children:g.outline_json.notes})]}),((y=g.keywords_json)==null?void 0:y.primary_keywords)&&g.keywords_json.primary_keywords.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Primary Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.primary_keywords.map((M,z)=>a.jsx(gt,{variant:"secondary",children:M},z))})]}),((x=g.keywords_json)==null?void 0:x.german_equivalents)&&g.keywords_json.german_equivalents.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"German Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.german_equivalents.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((b=g.keywords_json)==null?void 0:b.english_equivalents)&&g.keywords_json.english_equivalents.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"English Keywords"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.english_equivalents.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((w=g.keywords_json)==null?void 0:w.alternative_terms)&&g.keywords_json.alternative_terms.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Alternative Terms"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.alternative_terms.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((j=g.keywords_json)==null?void 0:j.keyword_combinations)&&g.keywords_json.keyword_combinations.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Search Combinations"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.keyword_combinations.map((M,z)=>a.jsxs("div",{className:"border rounded p-2",children:[a.jsx("code",{className:"text-sm font-mono bg-muted px-1 rounded",children:M.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:M.purpose})]},z))})]}),((N=g.keywords_json)==null?void 0:N.database_suggestions)&&g.keywords_json.database_suggestions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Recommended Databases"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:g.keywords_json.database_suggestions.map((M,z)=>a.jsx(gt,{variant:"outline",children:M},z))})]}),((C=g.keywords_json)==null?void 0:C.known_authors)&&g.keywords_json.known_authors.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Authors"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.known_authors.map((M,z)=>a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:M.name}),a.jsxs("span",{className:"text-muted-foreground",children:[" - ",M.relevance]})]},z))})]}),((k=g.keywords_json)==null?void 0:k.known_works)&&g.keywords_json.known_works.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Works"}),a.jsx("div",{className:"space-y-2",children:g.keywords_json.known_works.map((M,z)=>a.jsxs("div",{className:"text-sm border rounded p-2",children:[a.jsx("span",{className:"font-medium",children:M.title}),M.year&&a.jsxs("span",{className:"text-muted-foreground",children:[" (",M.year,")"]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:M.author}),a.jsx("p",{className:"text-xs text-muted-foreground italic mt-1",children:M.relevance})]},z))})]}),((E=g.keywords_json)==null?void 0:E.search_tips)&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Search Tips"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:g.keywords_json.search_tips})]}),g.known_sources_json&&Array.isArray(g.known_sources_json)&&g.known_sources_json.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Known Sources"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.known_sources_json.map((M,z)=>a.jsx("li",{children:M.citation||M.title||JSON.stringify(M)},z))})]}),g.sources&&Array.isArray(g.sources)&&g.sources.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Sources"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:g.sources.map((M,z)=>a.jsxs("li",{children:[M.title,M.doi&&a.jsxs("span",{className:"text-xs ml-2",children:["DOI: ",M.doi]}),M.isbn&&a.jsxs("span",{className:"text-xs ml-2",children:["ISBN: ",M.isbn]})]},z))})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>u(g),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:m,children:m?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Topic Exploration"}),a.jsx(ti,{children:"Are you sure you want to delete this topic exploration? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>c(g.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},g.id)})})]}),h>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[f,"-",p," of ",s," Topics"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===h,children:"Next"})]})]})]})}function $ct({setups:t,onSetupDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){Pt();const[o,l]=S.useState(new Set),c=async m=>{l(v=>new Set(v).add(m));try{const{error:v}=await be.from("research_setups").delete().eq("id",m);if(v)throw v;Fe.success("Research setup deleted successfully"),e()}catch(v){console.error("Delete error:",v),Fe.error("Error deleting. Please try again.")}finally{l(v=>{const y=new Set(v);return y.delete(m),y})}},u=async m=>{const v=m.markdown_text||m.title;try{await navigator.clipboard.writeText(v),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},d=m=>new Date(m).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=m=>{switch(m){case"bachelor":return"Bachelor";case"master":return"Master";default:return m||"N/A"}},f=Math.ceil(s/n),p=(r-1)*n+1,g=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Discipline"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(m=>{var y;const v=o.has(m.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(kxe,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:m.title||"Untitled Setup"})})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:((y=m.language)==null?void 0:y.toUpperCase())||"N/A"})}),a.jsx(vt,{className:"text-muted-foreground",children:m.discipline||"N/A"}),a.jsx(vt,{className:"text-muted-foreground",children:d(m.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:m.title})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsx(gt,{variant:"secondary",children:h(m.degree)}),m.discipline&&a.jsx(gt,{variant:"outline",children:m.discipline}),m.language&&a.jsx(gt,{variant:"outline",children:m.language.toUpperCase()})]}),m.markdown_text?a.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:a.jsx(fc,{children:m.markdown_text})}):a.jsxs("div",{className:"space-y-4",children:[m.aim&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Aim"}),a.jsx("p",{className:"text-muted-foreground",children:m.aim})]}),m.derived_research_questions&&Array.isArray(m.derived_research_questions)&&a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Research Questions"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:m.derived_research_questions.map((x,b)=>a.jsx("li",{children:x},b))})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>u(m),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:v,children:v?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Research Setup"}),a.jsx(ti,{children:"Are you sure you want to delete this research setup? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>c(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},m.id)})})]}),f>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p,"-",g," of ",s," Setups"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===f,children:"Next"})]})]})]})}function Bct({discussions:t,onDiscussionDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const{user:o}=Pt(),[l,c]=S.useState(new Set),u=async v=>{c(y=>new Set(y).add(v));try{const{error:y}=await be.from("results_discussions").delete().eq("id",v).eq("user_id",o==null?void 0:o.id);if(y)throw y;Fe.success("Discussion deleted successfully"),e()}catch(y){console.error("Delete error:",y),Fe.error("Error deleting. Please try again.")}finally{c(y=>{const x=new Set(y);return x.delete(v),x})}},d=async v=>{try{await navigator.clipboard.writeText(v),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},h=v=>new Date(v).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),f=v=>{switch(v){case"de":return"DE";case"en":return"EN";default:return(v==null?void 0:v.toUpperCase())||"N/A"}},p=Math.ceil(s/n),g=(r-1)*n+1,m=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Language"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(v=>{const y=l.has(v.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Wm,{className:"w-4 h-4 text-primary"})}),a.jsx("div",{children:a.jsx("p",{className:"font-medium text-sm",children:v.title||"Discussion"})})]})}),a.jsx(vt,{children:a.jsx(gt,{variant:"outline",children:f(v.language)})}),a.jsx(vt,{className:"text-muted-foreground",children:h(v.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View Text"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Discussion"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:v.title||"Discussion"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Language: ",f(v.language)," | Created: ",h(v.created_at)]})]}),a.jsx("div",{className:"prose max-w-none",children:a.jsx(fc,{children:v.discussion_text||""})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>d(v.discussion_text||""),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:y,children:y?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Discussion"}),a.jsx(ti,{children:"Are you sure you want to delete this discussion? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>u(v.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},v.id)})})]}),p>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[g,"-",m," of ",s," Discussions"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===p,children:"Next"})]})]})]})}function Uct({codings:t,onCodingDeleted:e,currentPage:r,itemsPerPage:n,totalItems:s,onPageChange:i}){const[o,l]=S.useState(new Set),c=async g=>{l(m=>new Set(m).add(g));try{const{error:m}=await be.from("coding_results").delete().eq("id",g);if(m)throw m;Fe.success("Coding deleted successfully"),e()}catch(m){console.error("Delete error:",m),Fe.error("Error deleting. Please try again.")}finally{l(m=>{const v=new Set(m);return v.delete(g),v})}},u=async g=>{const m=g.result_text||g.title||"";try{await navigator.clipboard.writeText(m),Fe.success("Copied to clipboard")}catch{Fe.error("Error copying")}},d=g=>new Date(g).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}),h=Math.ceil(s/n),f=(r-1)*n+1,p=Math.min(r*n,s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{children:"Name"}),a.jsx(yt,{children:"Interviews"}),a.jsx(yt,{children:"Date"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:t.map(g=>{var v,y,x;const m=o.has(g.id);return a.jsxs(Nn,{children:[a.jsx(vt,{children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:a.jsx(Txe,{className:"w-4 h-4 text-primary"})}),a.jsx("p",{className:"font-medium text-sm",children:g.title||"Untitled Coding"})]})}),a.jsx(vt,{className:"text-muted-foreground text-sm",children:((v=g.interviews)==null?void 0:v.title)||"–"}),a.jsx(vt,{className:"text-muted-foreground",children:d(g.created_at)}),a.jsx(vt,{className:"text-right",children:a.jsx(Si,{children:a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(Vr,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(dl,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",className:"w-8 h-8 p-0",children:a.jsx(Yi,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"View"})})]}),a.jsxs(Rr,{className:"max-w-4xl max-h-[80vh] overflow-auto",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:g.title||"Coding Result"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[((y=g.codebooks)==null?void 0:y.title)&&a.jsx(gt,{variant:"secondary",children:g.codebooks.title}),((x=g.interviews)==null?void 0:x.title)&&a.jsx(gt,{variant:"outline",children:g.interviews.title}),g.language&&a.jsx(gt,{variant:"outline",children:g.language.toUpperCase()}),a.jsxs(gt,{variant:"outline",children:[g.created_segments??0," Segments"]})]}),g.result_text?a.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:a.jsx(fc,{children:g.result_text})}):a.jsx("p",{className:"text-muted-foreground",children:"No content available."}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{onClick:()=>u(g),className:"flex items-center space-x-2",children:[a.jsx(yn,{className:"w-4 h-4"}),a.jsx("span",{children:"Copy to Clipboard"})]})})]})]})]}),a.jsxs(wi,{children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0 text-destructive hover:text-destructive",disabled:m,children:m?a.jsx(Ks,{className:"w-4 h-4 animate-spin"}):a.jsx(As,{className:"w-4 h-4"})})})}),a.jsx(Vt,{children:a.jsx("p",{children:"Delete"})})]}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Coding"}),a.jsx(ti,{children:"Are you sure you want to delete this coding result? This action cannot be undone."})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>c(g.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})]},g.id)})})]}),h>1&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[f,"-",p," of ",s," Codings"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r-1),disabled:r===1,children:"Back"}),a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>i(r+1),disabled:r===h,children:"Next"})]})]})]})}function zct({onDocumentUploaded:t}){const{userProfile:e}=Pt(),[r,n]=S.useState(!1),[s,i]=S.useState("idle"),[o,l]=S.useState(null),[c,u]=S.useState(!1),d=S.useRef(null);function h(j){return j.replace(/\.pdf$/i,"").replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/Ä/g,"Ae").replace(/Ö/g,"Oe").replace(/Ü/g,"Ue").replace(/ß/g,"ss").normalize("NFKD").replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").toLowerCase().slice(0,90)}const f=j=>{if(j.type!=="application/pdf")return"Only PDF files are allowed.";const N=50*1024*1024;return j.size>N?"The file is too large. The maximum allowed size is 50MB.":j.size<1024?"The file is too small. At least 1KB is required.":null},p=S.useCallback(j=>{const N=f(j);if(N){Fe.error(N);return}l(j)},[]),g=S.useCallback(j=>{j.preventDefault(),j.stopPropagation()},[]),m=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!0)},[]),v=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!1)},[]),y=S.useCallback(j=>{j.preventDefault(),j.stopPropagation(),u(!1);const N=j.dataTransfer.files;N&&N[0]&&p(N[0])},[p]),x=j=>{var C;const N=(C=j.target.files)==null?void 0:C[0];N&&p(N)},b=()=>{l(null),d.current&&(d.current.value="")},w=async()=>{if(!(!o||!e||r)){n(!0),i("uploading");try{const j=o.name,N=h(j)||"dokument",C=`${Date.now()}-${N}.pdf`,k=`${e.id}/${C}`,{error:E}=await Ar.storage.from("documents").upload(k,o,{cacheControl:"3600",upsert:!1});if(E)throw E;const{data:M,error:z}=await Ar.from("documents").insert({user_id:e.id,title:N,original_filename:j,storage_path:k,page_count:null}).select().single();if(z)throw await Ar.storage.from("documents").remove([k]),z;i("extracting");const I=Ar.functions.invoke("ingest_document",{body:{document_id:M.id}}).catch(U=>console.error("ingest_document call failed",U)),q=Ar.functions.invoke("pdf_extract",{body:{document_id:M.id,overwrite:!0,also_block:!1}}).catch(U=>console.error("pdf_extract call failed",U)),A=Ar.functions.invoke("detect_bibliography",{body:{document_id:M.id}}).catch(U=>console.error("detect_bibliography call failed",U));await Promise.all([I,q,A]),Fe.success("PDF successfully uploaded and extracted!"),l(null),d.current&&(d.current.value=""),t()}catch(j){console.error("Upload error:",j),Fe.error("Error uploading. Please try again.")}finally{n(!1),i("idle")}}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`
          relative border-2 border-dashed rounded-lg p-6 text-center
          transition-all duration-200 h-[200px] flex flex-col items-center justify-center
          ${c?"border-primary bg-primary/5":o?"border-green-500 bg-green-50/50":"border-muted-foreground/25 hover:border-primary/50"}
          ${r?"pointer-events-none opacity-50":"cursor-pointer"}
        `,onDragEnter:m,onDragLeave:v,onDragOver:g,onDrop:y,onClick:()=>{var j;return!o&&((j=d.current)==null?void 0:j.click())},children:[o?a.jsxs("div",{className:"space-y-3",children:[a.jsx(pl,{className:"w-8 h-8 text-green-600 mx-auto"}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(Dxe,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium truncate max-w-[200px]",children:o.name}),a.jsx("button",{onClick:j=>{j.stopPropagation(),b()},className:"p-1 hover:bg-red-100 rounded-full",children:a.jsx(Rs,{className:"w-4 h-4 text-red-500"})})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(o.size/1024)," KB"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx(Qh,{className:"w-8 h-8 text-muted-foreground mx-auto"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Drag PDF or click here"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Max 50MB, PDFs Only"})]})]}),a.jsx(Be,{ref:d,type:"file",accept:".pdf",onChange:x,className:"hidden"})]}),o&&a.jsx(ve,{onClick:w,disabled:r,className:"w-full",children:r?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),s==="extracting"?"Extract text...":"Uploading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Qh,{className:"w-4 h-4 mr-2"}),"Upload PDF"]})})]})}const Hct=t=>t.title||t.original_filename||t.book_title||"",Wct=t=>{var e,r;return((e=t.documents)==null?void 0:e.title)||((r=t.documents)==null?void 0:r.original_filename)||t.summary_mode||""},Vct=t=>{var e,r,n,s;return((r=(e=t.method_text)==null?void 0:e.split(`
`)[0])==null?void 0:r.trim())||t.title||((n=t.documents)==null?void 0:n.title)||((s=t.documents)==null?void 0:s.original_filename)||""},qct=t=>{var e,r,n;return((r=(e=t.theory_text)==null?void 0:e.split(`
`)[0])==null?void 0:r.trim())||t.title||((n=t.documents)==null?void 0:n.title)||""},Gct=t=>{var e;return((e=t.codebooks)==null?void 0:e.title)||""},Kct=t=>t.title||"",Yct=t=>t.title||"",Xct=t=>t.title||"",Qct=t=>t.title||"";function Rc(t,e,r,n){let s=t;if(e){const i=e.toLowerCase();s=t.filter(o=>n(o).toLowerCase().includes(i))}return[...s].sort((i,o)=>r==="alphabetical"?n(i).localeCompare(n(o)):new Date(o.created_at).getTime()-new Date(i.created_at).getTime())}const Zct=()=>{const{user:t,loading:e}=Pt(),r=wr(),[n,s]=S.useState([]),[i,o]=S.useState(!0),[l,c]=S.useState([]),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState([]),[m,v]=S.useState([]),[y,x]=S.useState([]),[b,w]=S.useState([]),[j,N]=S.useState([]),[C,k]=S.useState({}),[E,M]=S.useState(""),[z,I]=S.useState("all"),[q,A]=S.useState("newest"),[U,K]=S.useState(1),[G,Y]=S.useState(1),[H,$]=S.useState(1),[L,F]=S.useState(1),[W,X]=S.useState(1),[oe,le]=S.useState(1),[B,R]=S.useState(1),[ee,te]=S.useState(1),[Z,J]=S.useState(1),[he,P]=S.useState(0),[ie,V]=S.useState(0),[O,T]=S.useState(0),[D,ne]=S.useState(0),[ue,re]=S.useState(0),[pe,xe]=S.useState(0),[ye,ae]=S.useState(0),[de,ge]=S.useState(0),[we,je]=S.useState(0),Se=20;S.useEffect(()=>{!t&&!e&&r("/login")},[t,e,r]),S.useEffect(()=>{t&&Ue()},[t,U,G,H,L,W,oe,B,ee,Z]);const Ue=async()=>{if(t){o(!0);try{const{count:At}=await be.from("v_documents_with_status").select("*",{count:"exact",head:!0}).eq("user_id",t.id);P(At||0);const{data:Ve,error:pt}=await be.from("v_documents_with_status").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((U-1)*Se,U*Se-1);if(pt){console.error("Error loading documents:",pt);return}s(Ve||[]);const{data:Nt,error:Ms}=await be.from("pages").select("document_id").in("document_id",(Ve||[]).map(RS=>RS.id));if(!Ms&&Nt){const RS={};Ve==null||Ve.forEach(OB=>{RS[OB.id]=Nt.some(xme=>xme.document_id===OB.id)}),k(RS)}const{count:Zn}=await be.from("summaries").select("*",{count:"exact",head:!0}).eq("user_id",t.id);V(Zn||0);const{data:ta,error:La}=await be.from("summaries").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((G-1)*Se,G*Se-1);La||c(ta||[]);const{count:Ds}=await be.from("methods").select("*",{count:"exact",head:!0}).eq("user_id",t.id);T(Ds||0);const{data:ra,error:iP}=await be.from("methods").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((H-1)*Se,H*Se-1);iP||d(ra||[]);const{count:_S}=await be.from("theory_backgrounds").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ne(_S||0);const{data:jS,error:SS}=await be.from("theory_backgrounds").select("*, documents(title, page_count, original_filename)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((L-1)*Se,L*Se-1);SS||f(jS||[]);const{count:NS}=await be.from("analysis_results").select("*",{count:"exact",head:!0}).eq("user_id",t.id);re(NS||0);const{data:AS,error:ES}=await be.from("analysis_results").select("*, codebooks(title)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((W-1)*Se,W*Se-1);ES||g(AS||[]);const{count:CS}=await be.from("topic_explorations").select("*",{count:"exact",head:!0}).eq("user_id",t.id);xe(CS||0);const{data:kS,error:TS}=await be.from("topic_explorations").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((oe-1)*Se,oe*Se-1);TS||v(kS||[]);const{count:PS}=await be.from("research_setups").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ae(PS||0);const{data:OS,error:IS}=await be.from("research_setups").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((B-1)*Se,B*Se-1);IS||x(OS||[]);const{count:wl}=await be.from("results_discussions").select("*",{count:"exact",head:!0}).eq("user_id",t.id);ge(wl||0);const{data:pme,error:mme}=await be.from("results_discussions").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).range((ee-1)*Se,ee*Se-1);mme||w(pme||[]);const{count:gme}=await be.from("coding_results").select("*",{count:"exact",head:!0}).eq("user_id",t.id);je(gme||0);const{data:yme,error:vme}=await be.from("coding_results").select("*, codebooks(title), interviews(title)").eq("user_id",t.id).order("created_at",{ascending:!1}).range((Z-1)*Se,Z*Se-1);vme||N(yme||[])}catch(At){console.error("Error in loadDocuments:",At)}finally{o(!1)}}},Ae=()=>{Ue()},fe=S.useMemo(()=>Rc(n,E,q,Hct),[n,E,q]),Ee=S.useMemo(()=>Rc(l,E,q,Wct),[l,E,q]),Ce=S.useMemo(()=>Rc(u,E,q,Vct),[u,E,q]),Ge=S.useMemo(()=>Rc(h,E,q,qct),[h,E,q]),dt=S.useMemo(()=>Rc(p,E,q,Gct),[p,E,q]),Ne=S.useMemo(()=>Rc(m,E,q,Kct),[m,E,q]),Ze=S.useMemo(()=>Rc(y,E,q,Yct),[y,E,q]),Ke=S.useMemo(()=>Rc(b,E,q,Xct),[b,E,q]),Xe=S.useMemo(()=>Rc(j,E,q,Qct),[j,E,q]),Ye=At=>z==="all"||z===At;return e||i?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"My Library"}),a.jsx("p",{className:"text-muted-foreground",children:"Overview of all uploaded PDFs and generated content"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Qh,{className:"h-5 w-5"}),"Upload PDF"]}),a.jsx(fn,{children:"Add new documents to your library"})]}),a.jsx($e,{children:a.jsx(zct,{onDocumentUploaded:Ae})})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(al,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Be,{placeholder:"Search by name...",value:E,onChange:At=>M(At.target.value),className:"pl-9"})]}),a.jsxs(it,{value:z,onValueChange:I,children:[a.jsx(rt,{className:"w-full sm:w-[240px]",children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"all",children:"All types"}),a.jsxs(Te,{value:"documents",children:["Documents (",he,")"]}),a.jsxs(Te,{value:"summaries",children:["Summaries (",ie,")"]}),a.jsxs(Te,{value:"methods",children:["Methods (",O,")"]}),a.jsxs(Te,{value:"theories",children:["Theory & Background (",D,")"]}),a.jsxs(Te,{value:"analyses",children:["Analysis (",ue,")"]}),a.jsxs(Te,{value:"topics",children:["Topic Explorations (",pe,")"]}),a.jsxs(Te,{value:"setups",children:["Research Setups (",ye,")"]}),a.jsxs(Te,{value:"discussions",children:["Discussions (",de,")"]}),a.jsxs(Te,{value:"codings",children:["Codings (",we,")"]})]})]}),a.jsxs(it,{value:q,onValueChange:At=>A(At),children:[a.jsx(rt,{className:"w-full sm:w-[180px]",children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"newest",children:"Newest first"}),a.jsx(Te,{value:"alphabetical",children:"A → Z"})]})]})]}),Ye("documents")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Documents"})}),a.jsx($e,{children:fe.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No documents found"}):a.jsx(Pct,{documents:fe,documentPages:C,onDocumentDeleted:Ae,currentPage:U,itemsPerPage:Se,totalItems:he,onPageChange:K})})]}),Ye("summaries")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Summaries"})}),a.jsx($e,{children:Ee.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No summaries found"}):a.jsx(Rct,{summaries:Ee,onSummaryDeleted:Ae,currentPage:G,itemsPerPage:Se,totalItems:ie,onPageChange:Y})})]}),Ye("methods")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Methods"})}),a.jsx($e,{children:Ce.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No methods found"}):a.jsx(Mct,{methods:Ce,onMethodDeleted:Ae,currentPage:H,itemsPerPage:Se,totalItems:O,onPageChange:$})})]}),Ye("theories")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Theory & Background"})}),a.jsx($e,{children:Ge.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No theories found"}):a.jsx(Dct,{theories:Ge,onTheoryDeleted:Ae,currentPage:L,itemsPerPage:Se,totalItems:D,onPageChange:F})})]}),Ye("analyses")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Analysis"})}),a.jsx($e,{children:dt.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No analyses found"}):a.jsx(Lct,{analyses:dt,onAnalysisDeleted:Ae,currentPage:W,itemsPerPage:Se,totalItems:ue,onPageChange:X})})]}),Ye("topics")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Topic Explorations"})}),a.jsx($e,{children:Ne.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No topic explorations found"}):a.jsx(Fct,{topics:Ne,onTopicDeleted:Ae,currentPage:oe,itemsPerPage:Se,totalItems:pe,onPageChange:le})})]}),Ye("setups")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Research Setups"})}),a.jsx($e,{children:Ze.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No research setups found"}):a.jsx($ct,{setups:Ze,onSetupDeleted:Ae,currentPage:B,itemsPerPage:Se,totalItems:ye,onPageChange:R})})]}),Ye("discussions")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Discussions"})}),a.jsx($e,{children:Ke.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No discussions found"}):a.jsx(Bct,{discussions:Ke,onDiscussionDeleted:Ae,currentPage:ee,itemsPerPage:Se,totalItems:de,onPageChange:te})})]}),Ye("codings")&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"My Codings"})}),a.jsx($e,{children:Xe.length===0?a.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No codings found"}):a.jsx(Uct,{codings:Xe,onCodingDeleted:Ae,currentPage:Z,itemsPerPage:Se,totalItems:we,onPageChange:J})})]})]})}):null};function Tc({open:t,onClose:e,remainingPoints:r}){const n=wr();return a.jsx(Vr,{open:t,onOpenChange:e,children:a.jsxs(Rr,{className:"sm:max-w-md",children:[a.jsxs(Mr,{className:"items-center text-center",children:[a.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:a.jsx(Pa,{className:"h-6 w-6 text-destructive"})}),a.jsx(Dr,{children:"Student Points exhausted"}),a.jsxs(g0,{children:["You currently have ",a.jsx("span",{className:"font-semibold text-foreground",children:Math.round(r)})," ","Student Points. You need more points to use this feature."]})]}),a.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[a.jsx(ve,{onClick:()=>{e(),n("/pricing")},children:"View Plans"}),a.jsx(ve,{variant:"outline",onClick:e,children:"Close"})]})]})})}const mK={small:{label:"Small - Brief Overview",description:"2-3 sentences, approx. 200-300 tokens"},medium:{label:"Medium - Detailed Summary",description:"1 paragraph, approx. 400-600 tokens"},big:{label:"Big - Comprehensive Analysis",description:"2-3 paragraphs, approx. 800-1200 tokens"},deep15:{label:"Deep - In-depth Analysis",description:"~15% of input, structured with introduction, key points, conclusion"}},Jct={small:1,medium:1,big:1.25,deep15:1.5};function eut({documents:t,onSummaryCreated:e}){const{userProfile:r,user:n,checkStudentPoints:s,studentPoints:i}=Pt(),[o,l]=S.useState(!1),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState(""),[g,m]=S.useState(!1),[v,y]=S.useState(null),[x,b]=S.useState(null),[w,j]=S.useState(null),[N,C]=S.useState(null),k=F=>F.replace(/[^\d,\-–\s]/g,"").trim(),E=F=>{const W=k(F);if(!W)return[];const X=[],oe=W.split(",").map(le=>le.trim());for(const le of oe)if(le.includes("–")||le.includes("-")){const[B,R]=le.split(/[–-]/).map(ee=>parseInt(ee.trim()));if(!isNaN(B)&&!isNaN(R)&&B>0&&R>0&&B<=R&&R<=1e3)for(let ee=B;ee<=R;ee++)X.includes(ee)||X.push(ee)}else{const B=parseInt(le);!isNaN(B)&&B>0&&B<=1e3&&!X.includes(B)&&X.push(B)}return X.sort((le,B)=>le-B)},M=F=>{if(!F.trim())return"Please select at least one page.";const W=E(F);if(W.length===0)return"Invalid format. Use e.g. 1-5, 8, 12";const X=t.find(oe=>oe.id===c);if(X&&X.page_count){const oe=W.filter(le=>le>X.page_count);if(oe.length>0)return`Document only has ${X.page_count} pages. Invalid pages: ${oe.join(", ")}`}return W.length>50?"Maximum 50 pages per summary.":null},z=F=>{h(F);const W=M(F);b(W)},I=t.find(F=>F.id===c),q=E(d),A=q.length,U=f?Jct[f]:1,K=Math.ceil(A*U),G=I&&A>0&&f&&r&&!x,Y=r?r.current_token_balance>=K:!1,H=async()=>{if(!s()){l(!0);return}if(!(!G||!r||!n)){m(!0),y(null),j(null),C(null);try{const{data:{session:F}}=await Ar.auth.getSession();if(!(F!=null&&F.access_token))throw new Error("No valid login found");const W=crypto.randomUUID(),{data:X,error:oe}=await Ar.functions.invoke("summarize",{body:{client_request_id:W,document_id:c,selected_pages:q,mode:f}});if(console.log("summarize response",{data:X,error:oe}),oe){C({text:oe.message||"Invoke error",isError:!0});return}if(X!=null&&X.error){const B=X.message||"Error";C({text:B,isError:!0}),Fe.error(B);return}const le=X==null?void 0:X.summary_text;if(!le){Fe.error("No summary returned");return}C({text:le,isError:!1}),y(le),j({mode:(X==null?void 0:X.summary_mode)||f,pagesCharged:(X==null?void 0:X.pages_selected)||K,remainingAfter:r.current_token_balance}),console.log("summary_id",X==null?void 0:X.summary_id),Fe.success(`Summary created successfully! ${(X==null?void 0:X.pages_selected)||K} pages processed.`),u(""),h(""),p(""),b(null),e()}catch(F){console.error("Summary generation error:",F),C({text:F.message||"Error creating summary. Please try again.",isError:!0}),F.message.includes("Plan upgraden")?Fe.error("Page limit reached – please upgrade plan.",{action:{label:"View Pricing",onClick:()=>window.open("/pricing","_blank")}}):Fe.error(F.message||"Error creating summary. Please try again.")}finally{m(!1)}}},$=async()=>{if(v)try{await navigator.clipboard.writeText(v),Fe.success("Copied to clipboard")}catch{Fe.error("Copy failed")}},L=f?mK[f]:null;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[t.length===0?a.jsxs(td,{children:[a.jsx(Pa,{className:"h-4 w-4"}),a.jsx(rd,{children:"No documents available. Upload a PDF in Step 1 first."})]}):a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"document-select",children:"Select Document"}),a.jsxs(it,{value:c,onValueChange:u,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Choose document..."})}),a.jsx(nt,{children:t.map(F=>a.jsxs(Te,{value:F.id,children:[F.title," (",F.page_count||"?"," pages)"]},F.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"summary-mode",children:"Summary Mode"}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Choose mode..."})}),a.jsx(nt,{children:Object.entries(mK).map(([F,W])=>a.jsx(Te,{value:F,children:W.label},F))})]}),L&&a.jsx("p",{className:"text-xs text-muted-foreground",children:L.description})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"page-selection",children:"Page Selection"}),a.jsx(Be,{id:"page-selection",value:d,onChange:F=>z(F.target.value),placeholder:"e.g. 2-5, 7, 12",maxLength:100,className:x?"border-destructive":""}),x?a.jsx("p",{className:"text-sm text-destructive",children:x}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Format: Individual pages (7) or ranges (2-5), separated by comma. Max. 50 pages per summary."}),q.length>0&&!x&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("p",{className:"text-sm text-primary",children:["Selected pages: ",q.join(", ")," (",A," pages)"]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["This selection will use approximately ",K," pages from your monthly limit (pages ×"," ",U," multiplier = ",K,")."]})]})]}),!Y&&A>0&&a.jsxs(td,{className:"border-destructive/50 bg-destructive/5",children:[a.jsx(Pa,{className:"h-4 w-4 text-destructive"}),a.jsxs(rd,{children:["Not enough pages available! You need ",K," pages, but only have"," ",r==null?void 0:r.current_token_balance," remaining."]})]}),a.jsx(ve,{onClick:H,disabled:!G||g,className:"w-full",children:g?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Creating summary..."]}):"➤ Summarize Now"}),(N==null?void 0:N.isError)&&a.jsx("div",{className:"border rounded-lg p-4 border-destructive/50 bg-destructive/5",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Pa,{className:"w-5 h-5 text-destructive mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx("h4",{className:"font-medium text-destructive",children:"Summary Error"}),a.jsx("p",{className:"text-sm text-destructive/80",children:N.text})]})]})})]}),v&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-lg font-semibold",children:"Summary"}),a.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[a.jsx(pl,{className:"w-4 h-4"}),a.jsx("span",{children:"Saved"})]}),w&&a.jsxs("div",{className:"text-muted-foreground",children:[w.pagesCharged," pages used • ",w.remainingAfter," remaining"]})]})]}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/20",children:a.jsx(Wt,{value:v,readOnly:!0,className:"border-none bg-transparent resize-none focus:ring-0 p-0 w-full",style:{height:"auto",minHeight:"200px",overflow:"hidden"},rows:v?v.split(`
`).length+5:10})}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(ve,{onClick:$,variant:"outline",size:"sm",children:[a.jsx(yn,{className:"w-4 h-4 mr-2"}),"Copy to Clipboard"]}),a.jsxs(ve,{variant:"outline",size:"sm",disabled:!0,children:[a.jsx(az,{className:"w-4 h-4 mr-2"}),"Export as PDF"]}),a.jsxs(ve,{variant:"outline",size:"sm",disabled:!0,children:[a.jsx(az,{className:"w-4 h-4 mr-2"}),"Export as DOCX"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>window.location.href="/documents",children:[a.jsx(i0,{className:"w-4 h-4 mr-2"}),"Open in Library"]})]})]}),a.jsx(Tc,{open:o,onClose:()=>l(!1),remainingPoints:(i==null?void 0:i.remaining)??0})]})}const tut=()=>{const{user:t,loading:e}=Pt(),r=wr(),[n,s]=S.useState([]),[i,o]=S.useState(!1);S.useEffect(()=>{!t&&!e&&r("/login")},[t,e,r]);const l=async()=>{if(t){o(!0);try{const{data:u,error:d}=await Ar.from("documents").select("id, user_id, title, original_file_url, page_count, created_at").eq("user_id",t.id).order("created_at",{ascending:!1});d?console.error("Error fetching documents:",d):s(u||[])}catch(u){console.error("Error fetching documents:",u)}finally{o(!1)}}};S.useEffect(()=>{t&&l()},[t]);const c=()=>{l()};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Summaries"}),a.jsx("p",{className:"text-muted-foreground",children:"Create summaries based on your uploaded documents"})]}),a.jsxs(Me,{className:"panze-content-card",children:[a.jsxs(qe,{children:[a.jsx(Je,{className:"flex items-center gap-3",children:"Create Summary"}),a.jsx(fn,{children:"Select a document and configure your summary options"})]}),a.jsx($e,{children:a.jsx(eut,{documents:n,onSummaryCreated:c})})]})]})}):null},gK=(t,e,r,n)=>{switch(n){case"theory":return 60;case"theory-fox40":return 60;case"methods":return 60;case"methods-fox40":return 40;case"discussion":return 30;case"conclusion":return 30;case"summary":return 20;case"supervisor":return 5;case"topic_exp":return 5;case"platform_assistant":return 2;case"analysis_r":return 10;case"codeapply":return 15;case"r_setup":return 5;default:return 0}},rut=()=>{const{user:t,loading:e}=Pt(),r=wr(),[n,s]=S.useState([]),[i,o]=S.useState([]),[l,c]=S.useState(!0),[u,d]=S.useState("all");S.useEffect(()=>{!t&&!e?r("/login"):t&&h()},[t,e,r]);const h=async()=>{try{const[x,b,w,j,N,C,k,E]=await Promise.all([be.from("summaries").select("id, summary_text, citation_style, created_at, summary_mode, documents(title)").order("created_at",{ascending:!1}),be.from("theory_backgrounds").select("id, title, theory_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("methods").select("id, title, method_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("analysis_results").select("id, result_text, citation_style, created_at, mode").order("created_at",{ascending:!1}),be.from("qualitative_summaries").select("id, title, summary_text, created_at").order("created_at",{ascending:!1}),be.from("topic_explorations").select("id, title, introduction, created_at, language").order("created_at",{ascending:!1}),be.from("research_setups").select("id, title, aim, degree, discipline, created_at").order("created_at",{ascending:!1}),be.from("usage_log").select("id, tokens_used, prompt_tokens, completion_tokens, model, source, timestamp").order("timestamp",{ascending:!1}).limit(100)]),M=[];x.data&&x.data.forEach(z=>{var I;M.push({id:z.id,type:"summary",title:((I=z.documents)==null?void 0:I.title)||"Summary",content:z.summary_text||"",created_at:z.created_at||"",citation_style:z.citation_style||void 0,mode:z.summary_mode||void 0})}),b.data&&b.data.forEach(z=>{M.push({id:z.id,type:"theory",title:z.title||"Theory Background",content:z.theory_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),w.data&&w.data.forEach(z=>{M.push({id:z.id,type:"method",title:z.title||"Methodology",content:z.method_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),j.data&&j.data.forEach(z=>{M.push({id:z.id,type:"analysis",title:"Analysis Result",content:z.result_text||"",created_at:z.created_at,citation_style:z.citation_style||void 0,mode:z.mode||void 0})}),N.data&&N.data.forEach(z=>{M.push({id:z.id,type:"qualitative",title:z.title||"Qualitative Summary",content:z.summary_text||"",created_at:z.created_at})}),C.data&&C.data.forEach(z=>{M.push({id:z.id,type:"topic_explorer",title:z.title||"Topic Exploration",content:z.introduction||"",created_at:z.created_at,mode:z.language||void 0})}),k.data&&k.data.forEach(z=>{M.push({id:z.id,type:"research_setup",title:z.title||"Research Setup",content:z.aim||"",created_at:z.created_at,mode:z.degree||void 0})}),M.sort((z,I)=>new Date(I.created_at).getTime()-new Date(z.created_at).getTime()),s(M),o(E.data||[])}catch(x){console.error("Error fetching history:",x),Fe.error("Error loading history")}finally{c(!1)}},f=async(x,b)=>{Fe.info(`Preparing ${b.toUpperCase()} export...`)},p=x=>{switch(x){case"summary":return"default";case"theory":return"secondary";case"method":return"outline";case"analysis":return"default";case"qualitative":return"secondary";case"topic_explorer":return"default";case"research_setup":return"secondary";default:return"outline"}},g=x=>{switch(x){case"summary":return"Summary";case"theory":return"Theory";case"method":return"Method";case"analysis":return"Analysis";case"qualitative":return"Qualitative";case"topic_explorer":return"Topic Explorer";case"research_setup":return"Research Setup";default:return x}},m=x=>new Date(x).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0});if(e||l)return a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t)return null;const v=i.reduce((x,b)=>x+gK(b.prompt_tokens,b.completion_tokens,b.model,b.source),0),y=i.filter(x=>new Date(x.timestamp).toDateString()===new Date().toDateString()).length;return a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"History & Exports"}),a.jsx("p",{className:"text-muted-foreground",children:"Overview of all your activities and download options"})]}),a.jsx("div",{className:"flex items-center gap-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Lxe,{className:"h-4 w-4"}),a.jsxs(it,{value:u,onValueChange:x=>d(x),children:[a.jsx(rt,{className:"w-44",children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"all",children:"All Activities"}),a.jsx(Te,{value:"generations",children:"AI Generations"}),a.jsx(Te,{value:"usage",children:"Usage History"})]})]})]})})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(jo,{className:"h-4 w-4 text-primary"}),"Total AI Generations"]})}),a.jsx($e,{children:a.jsx("div",{className:"text-3xl font-bold",children:n.length})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(tz,{className:"h-4 w-4 text-primary"}),"Student Points Used"]})}),a.jsx($e,{children:a.jsxs("div",{className:"text-3xl font-bold",children:[v.toFixed(2)," SP"]})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-sm font-medium flex items-center gap-2",children:[a.jsx(iz,{className:"h-4 w-4 text-primary"}),"Activities Today"]})}),a.jsx($e,{children:a.jsx("div",{className:"text-3xl font-bold",children:y})})]})]}),(u==="all"||u==="generations")&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold",children:"AI Generations"}),n.length===0?a.jsx(Me,{children:a.jsxs($e,{className:"text-center py-12",children:[a.jsx(Ir,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No AI generations yet"}),a.jsx("p",{className:"text-muted-foreground",children:"Start creating summaries, theories, or methodologies to see them here"})]})}):a.jsx("div",{className:"grid gap-4",children:n.map(x=>a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx("div",{className:"flex items-start justify-between",children:a.jsxs("div",{children:[a.jsx(Je,{className:"text-lg",children:x.title}),a.jsxs(fn,{className:"flex items-center gap-3 mt-2 flex-wrap",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(iz,{className:"h-4 w-4"}),m(x.created_at)]}),a.jsx(gt,{variant:p(x.type),children:g(x.type)}),x.citation_style&&a.jsx(gt,{variant:"outline",children:x.citation_style})]})]})})}),a.jsxs($e,{className:"space-y-4",children:[a.jsx("div",{className:"bg-muted/30 rounded-lg p-4",children:a.jsx("p",{className:"text-sm leading-relaxed line-clamp-3",children:x.content?pk(x.content,x.mode):"No content available"})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>f(x,"pdf"),children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"PDF"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>f(x,"docx"),children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"DOCX"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>f(x,"txt"),children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"TXT"]})]})]})]},`${x.type}-${x.id}`))})]}),(u==="all"||u==="usage")&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Usage History"}),i.length===0?a.jsx(Me,{children:a.jsxs($e,{className:"text-center py-12",children:[a.jsx(tz,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No activity recorded yet"}),a.jsx("p",{className:"text-muted-foreground",children:"Your usage history will appear here"})]})}):a.jsx(Me,{children:a.jsx($e,{className:"p-0",children:a.jsx("div",{className:"max-h-96 overflow-y-auto",children:i.map(x=>{const b=gK(x.prompt_tokens,x.completion_tokens,x.model,x.source);return a.jsxs("div",{className:"flex items-center justify-between p-4 border-b last:border-b-0",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:x.source||"Unknown"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:m(x.timestamp)})]}),a.jsxs(gt,{variant:"secondary",className:"font-mono",children:[b.toFixed(3)," SP"]})]},x.id)})})})})]})]})})};function VN(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ife={exports:{}};/*!

JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>

(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.

JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,i){function o(u,d){if(!s[u]){if(!n[u]){var h=typeof VN=="function"&&VN;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};n[u][0].call(p.exports,function(g){var m=n[u][1][g];return o(m||g)},p,p.exports,r,n,s,i)}return s[u].exports}for(var l=typeof VN=="function"&&VN,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,s){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,g,m,v=[],y=0,x=c.length,b=x,w=i.getTypeOf(c)!=="string";y<c.length;)b=x-y,h=w?(u=c[y++],d=y<x?c[y++]:0,y<x?c[y++]:0):(u=c.charCodeAt(y++),d=y<x?c.charCodeAt(y++):0,y<x?c.charCodeAt(y++):0),f=u>>2,p=(3&u)<<4|d>>4,g=1<b?(15&d)<<2|h>>6:64,m=2<b?63&h:64,v.push(l.charAt(f)+l.charAt(p)+l.charAt(g)+l.charAt(m));return v.join("")},s.decode=function(c){var u,d,h,f,p,g,m=0,v=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var x,b=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&b--,c.charAt(c.length-2)===l.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=o.uint8array?new Uint8Array(0|b):new Array(0|b);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(f=l.indexOf(c.charAt(m++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(m++)))>>2,h=(3&p)<<6|(g=l.indexOf(c.charAt(m++))),x[v++]=u,p!==64&&(x[v++]=d),g!==64&&(x[v++]=h);return x}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,h,f,p,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d[m])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(p,g){var m,v="";for(m=0;m<g;m++)v+=String.fromCharCode(255&p),p>>>=8;return v}function o(p,g,m,v,y,x){var b,w,j=p.file,N=p.compression,C=x!==u.utf8encode,k=l.transformTo("string",x(j.name)),E=l.transformTo("string",u.utf8encode(j.name)),M=j.comment,z=l.transformTo("string",x(M)),I=l.transformTo("string",u.utf8encode(M)),q=E.length!==j.name.length,A=I.length!==M.length,U="",K="",G="",Y=j.dir,H=j.date,$={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||($.crc32=p.crc32,$.compressedSize=p.compressedSize,$.uncompressedSize=p.uncompressedSize);var L=0;g&&(L|=8),C||!q&&!A||(L|=2048);var F=0,W=0;Y&&(F|=16),y==="UNIX"?(W=798,F|=function(oe,le){var B=oe;return oe||(B=le?16893:33204),(65535&B)<<16}(j.unixPermissions,Y)):(W=20,F|=function(oe){return 63&(oe||0)}(j.dosPermissions)),b=H.getUTCHours(),b<<=6,b|=H.getUTCMinutes(),b<<=5,b|=H.getUTCSeconds()/2,w=H.getUTCFullYear()-1980,w<<=4,w|=H.getUTCMonth()+1,w<<=5,w|=H.getUTCDate(),q&&(K=i(1,1)+i(d(k),4)+E,U+="up"+i(K.length,2)+K),A&&(G=i(1,1)+i(d(z),4)+I,U+="uc"+i(G.length,2)+G);var X="";return X+=`
\0`,X+=i(L,2),X+=N.magic,X+=i(b,2),X+=i(w,2),X+=i($.crc32,4),X+=i($.compressedSize,4),X+=i($.uncompressedSize,4),X+=i(k.length,2),X+=i(U.length,2),{fileRecord:h.LOCAL_FILE_HEADER+X+k+U,dirRecord:h.CENTRAL_FILE_HEADER+i(W,2)+X+i(z.length,2)+"\0\0\0\0"+i(F,4)+i(v,4)+k+U+z}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),h=r("../signature");function f(p,g,m,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var g=p.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-v-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var m=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,m=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:function(v){return h.DATA_DESCRIPTOR+i(v.crc32,4)+i(v.compressedSize,4)+i(v.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-p,v=function(y,x,b,w,j){var N=l.transformTo("string",j(w));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(y,2)+i(y,2)+i(x,4)+i(b,4)+i(N.length,2)+N}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(m){g.processChunk(m)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(m){g.error(m)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<g.length;m++)try{g[m].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var i=r("../compressions"),o=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var g=function(x,b){var w=x||b,j=i[w];if(!j)throw new Error(w+" is not a valid compression method !");return j}(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},v=p.dir,y=p.date;p._compressWorker(g,m).withStreamInfo("file",{name:f,dir:v,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function h(f){return new o.Promise(function(p,g){var m=f.decompressed.getContentWorker().pipe(new u);m.on("error",function(v){g(v)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(f,p){var g=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var v=new c(p);return v.load(m),v}).then(function(m){var v=[o.Promise.resolve(m)],y=m.files;if(p.checkCRC32)for(var x=0;x<y.length;x++)v.push(h(y[x]));return o.Promise.all(v)}).then(function(m){for(var v=m.shift(),y=v.files,x=0;x<y.length;x++){var b=y[x],w=b.fileNameStr,j=i.resolve(b.fileNameStr);g.file(j,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:p.createFolders}),b.dir||(g.file(j).unsafeOriginalName=w)}return v.zipComment.length&&(g.comment=v.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(j,N,C){var k,E=l.getTypeOf(N),M=l.extend(C||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(j=y(j)),M.createFolders&&(k=v(j))&&x.call(this,k,!0);var z=E==="string"&&M.binary===!1&&M.base64===!1;C&&C.binary!==void 0||(M.binary=!z),(N instanceof h&&N.uncompressedSize===0||M.dir||!N||N.length===0)&&(M.base64=!1,M.binary=!0,N="",M.compression="STORE",E="string");var I=null;I=N instanceof h||N instanceof c?N:g.isNode&&g.isStream(N)?new m(j,N):l.prepareContent(j,N,M.binary,M.optimizedBinaryString,M.base64);var q=new f(j,I,M);this.files[j]=q}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),h=r("./compressedObject"),f=r("./zipObject"),p=r("./generate"),g=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),v=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var N=j.lastIndexOf("/");return 0<N?j.substring(0,N):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},x=function(j,N){return N=N!==void 0?N:d.createFolders,j=y(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:N}),this.files[j]};function b(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var N,C,k;for(N in this.files)k=this.files[N],(C=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&j(C,k)},filter:function(j){var N=[];return this.forEach(function(C,k){j(C,k)&&N.push(k)}),N},file:function(j,N,C){if(arguments.length!==1)return j=this.root+j,i.call(this,j,N,C),this;if(b(j)){var k=j;return this.filter(function(M,z){return!z.dir&&k.test(M)})}var E=this.files[this.root+j];return E&&!E.dir?E:null},folder:function(j){if(!j)return this;if(b(j))return this.filter(function(E,M){return M.dir&&j.test(E)});var N=this.root+j,C=x.call(this,N),k=this.clone();return k.root=C.name,k},remove:function(j){j=this.root+j;var N=this.files[j];if(N||(j.slice(-1)!=="/"&&(j+="/"),N=this.files[j]),N&&!N.dir)delete this.files[j];else for(var C=this.filter(function(E,M){return M.name.slice(0,j.length)===j}),k=0;k<C.length;k++)delete this.files[C[k].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var N,C={};try{if((C=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var k=C.comment||this.comment||"";N=p.generateWorker(this,C,k)}catch(E){(N=new c("error")).error(E)}return new u(N,C.type||"string",C.mimeType)},generateAsync:function(j,N){return this.generateInternalStream(j).accumulate(N)},generateNodeStream:function(j,N){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(N)}};n.exports=w},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,m){return new d.Promise(function(v,y){var x=[],b=g._internalType,w=g._outputType,j=g._mimeType;g.on("data",function(N,C){x.push(N),m&&m(C)}).on("error",function(N){x=[],y(N)}).on("end",function(){try{var N=function(C,k,E){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",k),E);case"base64":return c.encode(k);default:return i.transformTo(C,k)}}(w,function(C,k){var E,M=0,z=null,I=0;for(E=0;E<k.length;E++)I+=k[E].length;switch(C){case"string":return k.join("");case"array":return Array.prototype.concat.apply([],k);case"uint8array":for(z=new Uint8Array(I),E=0;E<k.length;E++)z.set(k[E],M),M+=k[E].length;return z;case"nodebuffer":return Buffer.concat(k);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,x),j);v(N)}catch(C){y(C)}x=[]}).resume()})}function p(g,m,v){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=v,i.checkSupport(y),this._worker=g.pipe(new o(y)),g.lock()}catch(x){this._worker=new l("error"),this._worker.error(x)}}p.prototype={accumulate:function(g){return f(this,g)},on:function(g,m){var v=this;return g==="data"?this._worker.on(g,function(y){m.call(v,y.data,y.meta)}):this._worker.on(g,function(){i.delay(m,arguments,v)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(g){var m,v,y,x,b,w=g.length,j=0;for(x=0;x<w;x++)(64512&(v=g.charCodeAt(x)))==55296&&x+1<w&&(64512&(y=g.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),x++),j+=v<128?1:v<2048?2:v<65536?3:4;for(m=o.uint8array?new Uint8Array(j):new Array(j),x=b=0;b<j;x++)(64512&(v=g.charCodeAt(x)))==55296&&x+1<w&&(64512&(y=g.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),x++),v<128?m[b++]=v:(v<2048?m[b++]=192|v>>>6:(v<65536?m[b++]=224|v>>>12:(m[b++]=240|v>>>18,m[b++]=128|v>>>12&63),m[b++]=128|v>>>6&63),m[b++]=128|63&v);return m}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(g){var m,v,y,x,b=g.length,w=new Array(2*b);for(m=v=0;m<b;)if((y=g[m++])<128)w[v++]=y;else if(4<(x=u[y]))w[v++]=65533,m+=x-1;else{for(y&=x===2?31:x===3?15:7;1<x&&m<b;)y=y<<6|63&g[m++],x--;1<x?w[v++]=65533:y<65536?w[v++]=y:(y-=65536,w[v++]=55296|y>>10&1023,w[v++]=56320|1023&y)}return w.length!==v&&(w.subarray?w=w.subarray(0,v):w.length=v),i.applyFromCharCode(w)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var g=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var v=function(x,b){var w;for((b=b||x.length)>x.length&&(b=x.length),w=b-1;0<=w&&(192&x[w])==128;)w--;return w<0||w===0?b:w+u[x[w]]>b?w:b}(g),y=g;v!==g.length&&(o.uint8array?(y=g.subarray(0,v),this.leftOver=g.subarray(v,g.length)):(y=g.slice(0,v),this.leftOver=g.slice(v,g.length))),this.push({data:s.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(m){return m}function d(m,v){for(var y=0;y<m.length;++y)v[y]=255&m.charCodeAt(y);return v}r("setimmediate"),s.newBlob=function(m,v){s.checkSupport("blob");try{return new Blob([m],{type:v})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,v,y){var x=[],b=0,w=m.length;if(w<=y)return String.fromCharCode.apply(null,m);for(;b<w;)v==="array"||v==="nodebuffer"?x.push(String.fromCharCode.apply(null,m.slice(b,Math.min(b+y,w)))):x.push(String.fromCharCode.apply(null,m.subarray(b,Math.min(b+y,w)))),b+=y;return x.join("")},stringifyByChar:function(m){for(var v="",y=0;y<m.length;y++)v+=String.fromCharCode(m[y]);return v},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var v=65536,y=s.getTypeOf(m),x=!0;if(y==="uint8array"?x=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(x=h.applyCanBeUsed.nodebuffer),x)for(;1<v;)try{return h.stringifyByChunk(m,y,v)}catch{v=Math.floor(v/2)}return h.stringifyByChar(m)}function p(m,v){for(var y=0;y<m.length;y++)v[y]=m[y];return v}s.applyFromCharCode=f;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},g.array={string:f,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},g.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},g.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},s.transformTo=function(m,v){if(v=v||"",!m)return v;s.checkSupport(m);var y=s.getTypeOf(v);return g[y][m](v)},s.resolve=function(m){for(var v=m.split("/"),y=[],x=0;x<v.length;x++){var b=v[x];b==="."||b===""&&x!==0&&x!==v.length-1||(b===".."?y.pop():y.push(b))}return y.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var v,y,x="";for(y=0;y<(m||"").length;y++)x+="\\x"+((v=m.charCodeAt(y))<16?"0":"")+v.toString(16).toUpperCase();return x},s.delay=function(m,v,y){setImmediate(function(){m.apply(y||null,v||[])})},s.inherits=function(m,v){function y(){}y.prototype=v.prototype,m.prototype=new y},s.extend=function(){var m,v,y={};for(m=0;m<arguments.length;m++)for(v in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],v)&&y[v]===void 0&&(y[v]=arguments[m][v]);return y},s.prepareContent=function(m,v,y,x,b){return c.Promise.resolve(v).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,N){var C=new FileReader;C.onload=function(k){j(k.target.result)},C.onerror=function(k){N(k.target.error)},C.readAsArrayBuffer(w)}):w}).then(function(w){var j=s.getTypeOf(w);return j?(j==="arraybuffer"?w=s.transformTo("uint8array",w):j==="string"&&(b?w=o.decode(w):y&&x!==!0&&(w=function(N){return d(N,i.uint8array?new Uint8Array(N.length):new Array(N.length))}(w))),w):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===f;return this.reader.setIndex(p),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,f,p,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var g=f-p;if(0<g)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),h=r("./support");function f(p,g){this.options=p,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(v){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===v)return d[y];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var g=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,m,v,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)g=p.readInt(2),m=p.readInt(2),v=p.readData(m),this.extraFields[g]={id:g,length:m,value:v};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var y=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(g,m,v){this.name=g,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=m,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var m=null,v="string";try{if(!g)throw new Error("No output type specified.");var y=(v=g.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),m=this._decompressWorker();var x=!this._dataBinary;x&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!x&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(b){(m=new d("error")).error(b)}return new o(m,v,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(v,g,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var f=new i.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var p=[];function g(){var m,v;l=!0;for(var y=p.length;y;){for(v=p,p=[],m=-1;++m<y;)v[m]();y=p.length}l=!1}n.exports=function(m){p.push(m)!==1||l||o()}}).call(this,typeof zr<"u"?zr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==o&&m(this,y)}function f(y,x,b){this.promise=y,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function p(y,x,b){i(function(){var w;try{w=x(b)}catch(j){return l.reject(y,j)}w===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,w)})}function g(y){var x=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof x=="function")return function(){x.apply(y,arguments)}}function m(y,x){var b=!1;function w(C){b||(b=!0,l.reject(y,C))}function j(C){b||(b=!0,l.resolve(y,C))}var N=v(function(){x(j,w)});N.status==="error"&&w(N.value)}function v(y,x){var b={};try{b.value=y(x),b.status="success"}catch(w){b.status="error",b.value=w}return b}(n.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var x=this.constructor;return this.then(function(b){return x.resolve(y()).then(function(){return b})},function(b){return x.resolve(y()).then(function(){throw b})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,x){if(typeof y!="function"&&this.state===u||typeof x!="function"&&this.state===c)return this;var b=new this.constructor(o);return this.state!==d?p(b,this.state===u?y:x,this.outcome):this.queue.push(new f(b,y,x)),b},f.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},f.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},f.prototype.callRejected=function(y){l.reject(this.promise,y)},f.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,x){var b=v(g,x);if(b.status==="error")return l.reject(y,b.value);var w=b.value;if(w)m(y,w);else{y.state=u,y.outcome=x;for(var j=-1,N=y.queue.length;++j<N;)y.queue[j].callFulfilled(x)}return y},l.reject=function(y,x){y.state=c,y.outcome=x;for(var b=-1,w=y.queue.length;++b<w;)y.queue[b].callRejected(x);return y},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(o),y)},h.reject=function(y){var x=new this(o);return l.reject(x,y)},h.all=function(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=new Array(b),N=0,C=-1,k=new this(o);++C<b;)E(y[C],C);return k;function E(M,z){x.resolve(M).then(function(I){j[z]=I,++N!==b||w||(w=!0,l.resolve(k,j))},function(I){w||(w=!0,l.reject(k,I))})}},h.race=function(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=-1,N=new this(o);++j<b;)C=y[j],x.resolve(C).then(function(k){w||(w=!0,l.resolve(N,k))},function(k){w||(w=!0,l.reject(N,k))});var C;return N}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var x=this.options;x.raw&&0<x.windowBits?x.windowBits=-x.windowBits:x.gzip&&0<x.windowBits&&x.windowBits<16&&(x.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,x.level,x.method,x.windowBits,x.memLevel,x.strategy);if(b!==h)throw new Error(c[b]);if(x.header&&i.deflateSetHeader(this.strm,x.header),x.dictionary){var w;if(w=typeof x.dictionary=="string"?l.string2buf(x.dictionary):d.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==h)throw new Error(c[b]);this._dict_set=!0}}function v(y,x){var b=new m(x);if(b.push(y,!0),b.err)throw b.msg||c[b.err];return b.result}m.prototype.push=function(y,x){var b,w,j=this.strm,N=this.options.chunkSize;if(this.ended)return!1;w=x===~~x?x:x===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(N),j.next_out=0,j.avail_out=N),(b=i.deflate(j,w))!==1&&b!==h)return this.onEnd(b),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h):w!==2||(this.onEnd(h),!(j.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},s.Deflate=m,s.deflate=v,s.deflateRaw=function(y,x){return(x=x||{}).raw=!0,v(y,x)},s.gzip=function(y,x){return(x=x||{}).gzip=!0,v(y,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),h=r("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||m&&m.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=i.inflateInit2(this.strm,v.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(m,v){var y=new p(v);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(m,v){var y,x,b,w,j,N,C=this.strm,k=this.options.chunkSize,E=this.options.dictionary,M=!1;if(this.ended)return!1;x=v===~~v?v:v===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?C.input=l.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?C.input=new Uint8Array(m):C.input=m,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(k),C.next_out=0,C.avail_out=k),(y=i.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&E&&(N=typeof E=="string"?l.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,y=i.inflateSetDictionary(this.strm,N)),y===c.Z_BUF_ERROR&&M===!0&&(y=c.Z_OK,M=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&y!==c.Z_STREAM_END&&(C.avail_in!==0||x!==c.Z_FINISH&&x!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=l.utf8border(C.output,C.next_out),w=C.next_out-b,j=l.buf2string(C.output,b),C.next_out=w,C.avail_out=k-w,w&&o.arraySet(C.output,C.output,b,w,0),this.onData(j)):this.onData(o.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(M=!0)}while((0<C.avail_in||C.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(x=c.Z_FINISH),x===c.Z_FINISH?(y=i.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):x!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=g,s.inflateRaw=function(m,v){return(v=v||{}).raw=!0,g(m,v)},s.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],g.set(p,f),f+=p.length;return g}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",g=0;g<f;g++)p+=String.fromCharCode(h[g]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,g,m,v,y=h.length,x=0;for(m=0;m<y;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),x+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(x),m=v=0;v<x;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),p<128?f[v++]=p:(p<2048?f[v++]=192|p>>>6:(p<65536?f[v++]=224|p>>>12:(f[v++]=240|p>>>18,f[v++]=128|p>>>12&63),f[v++]=128|p>>>6&63),f[v++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,g=f.length;p<g;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,g,m,v,y=f||h.length,x=new Array(2*y);for(p=g=0;p<y;)if((m=h[p++])<128)x[g++]=m;else if(4<(v=c[m]))x[g++]=65533,p+=v-1;else{for(m&=v===2?31:v===3?15:7;1<v&&p<y;)m=m<<6|63&h[p++],v--;1<v?x[g++]=65533:m<65536?x[g++]=m:(m-=65536,x[g++]=55296|m>>10&1023,x[g++]=56320|1023&m)}return d(x,g)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(r,n,s){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),h=0,f=4,p=0,g=-2,m=-1,v=4,y=2,x=8,b=9,w=286,j=30,N=19,C=2*w+1,k=15,E=3,M=258,z=M+E+1,I=42,q=113,A=1,U=2,K=3,G=4;function Y(P,ie){return P.msg=d[ie],ie}function H(P){return(P<<1)-(4<P?9:0)}function $(P){for(var ie=P.length;0<=--ie;)P[ie]=0}function L(P){var ie=P.state,V=ie.pending;V>P.avail_out&&(V=P.avail_out),V!==0&&(o.arraySet(P.output,ie.pending_buf,ie.pending_out,V,P.next_out),P.next_out+=V,ie.pending_out+=V,P.total_out+=V,P.avail_out-=V,ie.pending-=V,ie.pending===0&&(ie.pending_out=0))}function F(P,ie){l._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,ie),P.block_start=P.strstart,L(P.strm)}function W(P,ie){P.pending_buf[P.pending++]=ie}function X(P,ie){P.pending_buf[P.pending++]=ie>>>8&255,P.pending_buf[P.pending++]=255&ie}function oe(P,ie){var V,O,T=P.max_chain_length,D=P.strstart,ne=P.prev_length,ue=P.nice_match,re=P.strstart>P.w_size-z?P.strstart-(P.w_size-z):0,pe=P.window,xe=P.w_mask,ye=P.prev,ae=P.strstart+M,de=pe[D+ne-1],ge=pe[D+ne];P.prev_length>=P.good_match&&(T>>=2),ue>P.lookahead&&(ue=P.lookahead);do if(pe[(V=ie)+ne]===ge&&pe[V+ne-1]===de&&pe[V]===pe[D]&&pe[++V]===pe[D+1]){D+=2,V++;do;while(pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&D<ae);if(O=M-(ae-D),D=ae-M,ne<O){if(P.match_start=ie,ue<=(ne=O))break;de=pe[D+ne-1],ge=pe[D+ne]}}while((ie=ye[ie&xe])>re&&--T!=0);return ne<=P.lookahead?ne:P.lookahead}function le(P){var ie,V,O,T,D,ne,ue,re,pe,xe,ye=P.w_size;do{if(T=P.window_size-P.lookahead-P.strstart,P.strstart>=ye+(ye-z)){for(o.arraySet(P.window,P.window,ye,ye,0),P.match_start-=ye,P.strstart-=ye,P.block_start-=ye,ie=V=P.hash_size;O=P.head[--ie],P.head[ie]=ye<=O?O-ye:0,--V;);for(ie=V=ye;O=P.prev[--ie],P.prev[ie]=ye<=O?O-ye:0,--V;);T+=ye}if(P.strm.avail_in===0)break;if(ne=P.strm,ue=P.window,re=P.strstart+P.lookahead,pe=T,xe=void 0,xe=ne.avail_in,pe<xe&&(xe=pe),V=xe===0?0:(ne.avail_in-=xe,o.arraySet(ue,ne.input,ne.next_in,xe,re),ne.state.wrap===1?ne.adler=c(ne.adler,ue,xe,re):ne.state.wrap===2&&(ne.adler=u(ne.adler,ue,xe,re)),ne.next_in+=xe,ne.total_in+=xe,xe),P.lookahead+=V,P.lookahead+P.insert>=E)for(D=P.strstart-P.insert,P.ins_h=P.window[D],P.ins_h=(P.ins_h<<P.hash_shift^P.window[D+1])&P.hash_mask;P.insert&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[D+E-1])&P.hash_mask,P.prev[D&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=D,D++,P.insert--,!(P.lookahead+P.insert<E)););}while(P.lookahead<z&&P.strm.avail_in!==0)}function B(P,ie){for(var V,O;;){if(P.lookahead<z){if(le(P),P.lookahead<z&&ie===h)return A;if(P.lookahead===0)break}if(V=0,P.lookahead>=E&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),V!==0&&P.strstart-V<=P.w_size-z&&(P.match_length=oe(P,V)),P.match_length>=E)if(O=l._tr_tally(P,P.strstart-P.match_start,P.match_length-E),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=E){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart,--P.match_length!=0;);P.strstart++}else P.strstart+=P.match_length,P.match_length=0,P.ins_h=P.window[P.strstart],P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+1])&P.hash_mask;else O=l._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++;if(O&&(F(P,!1),P.strm.avail_out===0))return A}return P.insert=P.strstart<E-1?P.strstart:E-1,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):P.last_lit&&(F(P,!1),P.strm.avail_out===0)?A:U}function R(P,ie){for(var V,O,T;;){if(P.lookahead<z){if(le(P),P.lookahead<z&&ie===h)return A;if(P.lookahead===0)break}if(V=0,P.lookahead>=E&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),P.prev_length=P.match_length,P.prev_match=P.match_start,P.match_length=E-1,V!==0&&P.prev_length<P.max_lazy_match&&P.strstart-V<=P.w_size-z&&(P.match_length=oe(P,V),P.match_length<=5&&(P.strategy===1||P.match_length===E&&4096<P.strstart-P.match_start)&&(P.match_length=E-1)),P.prev_length>=E&&P.match_length<=P.prev_length){for(T=P.strstart+P.lookahead-E,O=l._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-E),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=T&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),--P.prev_length!=0;);if(P.match_available=0,P.match_length=E-1,P.strstart++,O&&(F(P,!1),P.strm.avail_out===0))return A}else if(P.match_available){if((O=l._tr_tally(P,0,P.window[P.strstart-1]))&&F(P,!1),P.strstart++,P.lookahead--,P.strm.avail_out===0)return A}else P.match_available=1,P.strstart++,P.lookahead--}return P.match_available&&(O=l._tr_tally(P,0,P.window[P.strstart-1]),P.match_available=0),P.insert=P.strstart<E-1?P.strstart:E-1,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):P.last_lit&&(F(P,!1),P.strm.avail_out===0)?A:U}function ee(P,ie,V,O,T){this.good_length=P,this.max_lazy=ie,this.nice_length=V,this.max_chain=O,this.func=T}function te(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*C),this.dyn_dtree=new o.Buf16(2*(2*j+1)),this.bl_tree=new o.Buf16(2*(2*N+1)),$(this.dyn_ltree),$(this.dyn_dtree),$(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(k+1),this.heap=new o.Buf16(2*w+1),$(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*w+1),$(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(P){var ie;return P&&P.state?(P.total_in=P.total_out=0,P.data_type=y,(ie=P.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?I:q,P.adler=ie.wrap===2?0:1,ie.last_flush=h,l._tr_init(ie),p):Y(P,g)}function J(P){var ie=Z(P);return ie===p&&function(V){V.window_size=2*V.w_size,$(V.head),V.max_lazy_match=i[V.level].max_lazy,V.good_match=i[V.level].good_length,V.nice_match=i[V.level].nice_length,V.max_chain_length=i[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=E-1,V.match_available=0,V.ins_h=0}(P.state),ie}function he(P,ie,V,O,T,D){if(!P)return g;var ne=1;if(ie===m&&(ie=6),O<0?(ne=0,O=-O):15<O&&(ne=2,O-=16),T<1||b<T||V!==x||O<8||15<O||ie<0||9<ie||D<0||v<D)return Y(P,g);O===8&&(O=9);var ue=new te;return(P.state=ue).strm=P,ue.wrap=ne,ue.gzhead=null,ue.w_bits=O,ue.w_size=1<<ue.w_bits,ue.w_mask=ue.w_size-1,ue.hash_bits=T+7,ue.hash_size=1<<ue.hash_bits,ue.hash_mask=ue.hash_size-1,ue.hash_shift=~~((ue.hash_bits+E-1)/E),ue.window=new o.Buf8(2*ue.w_size),ue.head=new o.Buf16(ue.hash_size),ue.prev=new o.Buf16(ue.w_size),ue.lit_bufsize=1<<T+6,ue.pending_buf_size=4*ue.lit_bufsize,ue.pending_buf=new o.Buf8(ue.pending_buf_size),ue.d_buf=1*ue.lit_bufsize,ue.l_buf=3*ue.lit_bufsize,ue.level=ie,ue.strategy=D,ue.method=V,J(P)}i=[new ee(0,0,0,0,function(P,ie){var V=65535;for(V>P.pending_buf_size-5&&(V=P.pending_buf_size-5);;){if(P.lookahead<=1){if(le(P),P.lookahead===0&&ie===h)return A;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var O=P.block_start+V;if((P.strstart===0||P.strstart>=O)&&(P.lookahead=P.strstart-O,P.strstart=O,F(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-z&&(F(P,!1),P.strm.avail_out===0))return A}return P.insert=0,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):(P.strstart>P.block_start&&(F(P,!1),P.strm.avail_out),A)}),new ee(4,4,8,4,B),new ee(4,5,16,8,B),new ee(4,6,32,32,B),new ee(4,4,16,16,R),new ee(8,16,32,32,R),new ee(8,16,128,128,R),new ee(8,32,128,256,R),new ee(32,128,258,1024,R),new ee(32,258,258,4096,R)],s.deflateInit=function(P,ie){return he(P,ie,x,15,8,0)},s.deflateInit2=he,s.deflateReset=J,s.deflateResetKeep=Z,s.deflateSetHeader=function(P,ie){return P&&P.state?P.state.wrap!==2?g:(P.state.gzhead=ie,p):g},s.deflate=function(P,ie){var V,O,T,D;if(!P||!P.state||5<ie||ie<0)return P?Y(P,g):g;if(O=P.state,!P.output||!P.input&&P.avail_in!==0||O.status===666&&ie!==f)return Y(P,P.avail_out===0?-5:g);if(O.strm=P,V=O.last_flush,O.last_flush=ie,O.status===I)if(O.wrap===2)P.adler=0,W(O,31),W(O,139),W(O,8),O.gzhead?(W(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),W(O,255&O.gzhead.time),W(O,O.gzhead.time>>8&255),W(O,O.gzhead.time>>16&255),W(O,O.gzhead.time>>24&255),W(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),W(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(W(O,255&O.gzhead.extra.length),W(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(P.adler=u(P.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(W(O,0),W(O,0),W(O,0),W(O,0),W(O,0),W(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),W(O,3),O.status=q);else{var ne=x+(O.w_bits-8<<4)<<8;ne|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(ne|=32),ne+=31-ne%31,O.status=q,X(O,ne),O.strstart!==0&&(X(O,P.adler>>>16),X(O,65535&P.adler)),P.adler=1}if(O.status===69)if(O.gzhead.extra){for(T=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending!==O.pending_buf_size));)W(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){T=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending===O.pending_buf_size)){D=1;break}D=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,W(O,D)}while(D!==0);O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),D===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){T=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending===O.pending_buf_size)){D=1;break}D=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,W(O,D)}while(D!==0);O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),D===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&L(P),O.pending+2<=O.pending_buf_size&&(W(O,255&P.adler),W(O,P.adler>>8&255),P.adler=0,O.status=q)):O.status=q),O.pending!==0){if(L(P),P.avail_out===0)return O.last_flush=-1,p}else if(P.avail_in===0&&H(ie)<=H(V)&&ie!==f)return Y(P,-5);if(O.status===666&&P.avail_in!==0)return Y(P,-5);if(P.avail_in!==0||O.lookahead!==0||ie!==h&&O.status!==666){var ue=O.strategy===2?function(re,pe){for(var xe;;){if(re.lookahead===0&&(le(re),re.lookahead===0)){if(pe===h)return A;break}if(re.match_length=0,xe=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,xe&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:U}(O,ie):O.strategy===3?function(re,pe){for(var xe,ye,ae,de,ge=re.window;;){if(re.lookahead<=M){if(le(re),re.lookahead<=M&&pe===h)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=E&&0<re.strstart&&(ye=ge[ae=re.strstart-1])===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]){de=re.strstart+M;do;while(ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ae<de);re.match_length=M-(de-ae),re.match_length>re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=E?(xe=l._tr_tally(re,1,re.match_length-E),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(xe=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),xe&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:U}(O,ie):i[O.level].func(O,ie);if(ue!==K&&ue!==G||(O.status=666),ue===A||ue===K)return P.avail_out===0&&(O.last_flush=-1),p;if(ue===U&&(ie===1?l._tr_align(O):ie!==5&&(l._tr_stored_block(O,0,0,!1),ie===3&&($(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),L(P),P.avail_out===0))return O.last_flush=-1,p}return ie!==f?p:O.wrap<=0?1:(O.wrap===2?(W(O,255&P.adler),W(O,P.adler>>8&255),W(O,P.adler>>16&255),W(O,P.adler>>24&255),W(O,255&P.total_in),W(O,P.total_in>>8&255),W(O,P.total_in>>16&255),W(O,P.total_in>>24&255)):(X(O,P.adler>>>16),X(O,65535&P.adler)),L(P),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},s.deflateEnd=function(P){var ie;return P&&P.state?(ie=P.state.status)!==I&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==q&&ie!==666?Y(P,g):(P.state=null,ie===q?Y(P,-3):p):g},s.deflateSetDictionary=function(P,ie){var V,O,T,D,ne,ue,re,pe,xe=ie.length;if(!P||!P.state||(D=(V=P.state).wrap)===2||D===1&&V.status!==I||V.lookahead)return g;for(D===1&&(P.adler=c(P.adler,ie,xe,0)),V.wrap=0,xe>=V.w_size&&(D===0&&($(V.head),V.strstart=0,V.block_start=0,V.insert=0),pe=new o.Buf8(V.w_size),o.arraySet(pe,ie,xe-V.w_size,V.w_size,0),ie=pe,xe=V.w_size),ne=P.avail_in,ue=P.next_in,re=P.input,P.avail_in=xe,P.next_in=0,P.input=ie,le(V);V.lookahead>=E;){for(O=V.strstart,T=V.lookahead-(E-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[O+E-1])&V.hash_mask,V.prev[O&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=O,O++,--T;);V.strstart=O,V.lookahead=E-1,le(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=E-1,V.match_available=0,P.next_in=ue,P.input=re,P.avail_in=ne,V.wrap=D,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(i,o){var l,c,u,d,h,f,p,g,m,v,y,x,b,w,j,N,C,k,E,M,z,I,q,A,U;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),d=i.next_out,U=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,g=l.wsize,m=l.whave,v=l.wnext,y=l.window,x=l.hold,b=l.bits,w=l.lencode,j=l.distcode,N=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{b<15&&(x+=A[c++]<<b,b+=8,x+=A[c++]<<b,b+=8),k=w[x&N];t:for(;;){if(x>>>=E=k>>>24,b-=E,(E=k>>>16&255)===0)U[d++]=65535&k;else{if(!(16&E)){if(!(64&E)){k=w[(65535&k)+(x&(1<<E)-1)];continue t}if(32&E){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}M=65535&k,(E&=15)&&(b<E&&(x+=A[c++]<<b,b+=8),M+=x&(1<<E)-1,x>>>=E,b-=E),b<15&&(x+=A[c++]<<b,b+=8,x+=A[c++]<<b,b+=8),k=j[x&C];r:for(;;){if(x>>>=E=k>>>24,b-=E,!(16&(E=k>>>16&255))){if(!(64&E)){k=j[(65535&k)+(x&(1<<E)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(z=65535&k,b<(E&=15)&&(x+=A[c++]<<b,(b+=8)<E&&(x+=A[c++]<<b,b+=8)),p<(z+=x&(1<<E)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(x>>>=E,b-=E,(E=d-h)<z){if(m<(E=z-E)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(q=y,(I=0)===v){if(I+=g-E,E<M){for(M-=E;U[d++]=y[I++],--E;);I=d-z,q=U}}else if(v<E){if(I+=g+v-E,(E-=v)<M){for(M-=E;U[d++]=y[I++],--E;);if(I=0,v<M){for(M-=E=v;U[d++]=y[I++],--E;);I=d-z,q=U}}}else if(I+=v-E,E<M){for(M-=E;U[d++]=y[I++],--E;);I=d-z,q=U}for(;2<M;)U[d++]=q[I++],U[d++]=q[I++],U[d++]=q[I++],M-=3;M&&(U[d++]=q[I++],1<M&&(U[d++]=q[I++]))}else{for(I=d-z;U[d++]=U[I++],U[d++]=U[I++],U[d++]=U[I++],2<(M-=3););M&&(U[d++]=U[I++],1<M&&(U[d++]=U[I++]))}break}}break}}while(c<u&&d<f);c-=M=b>>3,x&=(1<<(b-=M<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<f?f-d+257:257-(d-f),l.hold=x,l.bits=b}},{}],49:[function(r,n,s){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,h=2,f=0,p=-2,g=1,m=852,v=592;function y(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function x(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(I){var q;return I&&I.state?(q=I.state,I.total_in=I.total_out=q.total=0,I.msg="",q.wrap&&(I.adler=1&q.wrap),q.mode=g,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new i.Buf32(m),q.distcode=q.distdyn=new i.Buf32(v),q.sane=1,q.back=-1,f):p}function w(I){var q;return I&&I.state?((q=I.state).wsize=0,q.whave=0,q.wnext=0,b(I)):p}function j(I,q){var A,U;return I&&I.state?(U=I.state,q<0?(A=0,q=-q):(A=1+(q>>4),q<48&&(q&=15)),q&&(q<8||15<q)?p:(U.window!==null&&U.wbits!==q&&(U.window=null),U.wrap=A,U.wbits=q,w(I))):p}function N(I,q){var A,U;return I?(U=new x,(I.state=U).window=null,(A=j(I,q))!==f&&(I.state=null),A):p}var C,k,E=!0;function M(I){if(E){var q;for(C=new i.Buf32(512),k=new i.Buf32(32),q=0;q<144;)I.lens[q++]=8;for(;q<256;)I.lens[q++]=9;for(;q<280;)I.lens[q++]=7;for(;q<288;)I.lens[q++]=8;for(u(d,I.lens,0,288,C,0,I.work,{bits:9}),q=0;q<32;)I.lens[q++]=5;u(h,I.lens,0,32,k,0,I.work,{bits:5}),E=!1}I.lencode=C,I.lenbits=9,I.distcode=k,I.distbits=5}function z(I,q,A,U){var K,G=I.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new i.Buf8(G.wsize)),U>=G.wsize?(i.arraySet(G.window,q,A-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(U<(K=G.wsize-G.wnext)&&(K=U),i.arraySet(G.window,q,A-U,K,G.wnext),(U-=K)?(i.arraySet(G.window,q,A-U,U,0),G.wnext=U,G.whave=G.wsize):(G.wnext+=K,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=K))),0}s.inflateReset=w,s.inflateReset2=j,s.inflateResetKeep=b,s.inflateInit=function(I){return N(I,15)},s.inflateInit2=N,s.inflate=function(I,q){var A,U,K,G,Y,H,$,L,F,W,X,oe,le,B,R,ee,te,Z,J,he,P,ie,V,O,T=0,D=new i.Buf8(4),ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return p;(A=I.state).mode===12&&(A.mode=13),Y=I.next_out,K=I.output,$=I.avail_out,G=I.next_in,U=I.input,H=I.avail_in,L=A.hold,F=A.bits,W=H,X=$,ie=f;e:for(;;)switch(A.mode){case g:if(A.wrap===0){A.mode=13;break}for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(2&A.wrap&&L===35615){D[A.check=0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0),F=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){I.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){I.msg="unknown compression method",A.mode=30;break}if(F-=4,P=8+(15&(L>>>=4)),A.wbits===0)A.wbits=P;else if(P>A.wbits){I.msg="invalid window size",A.mode=30;break}A.dmax=1<<P,I.adler=A.check=1,A.mode=512&L?10:12,F=L=0;break;case 2:for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(A.flags=L,(255&A.flags)!=8){I.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){I.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=L>>8&1),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=3;case 3:for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.head&&(A.head.time=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,D[2]=L>>>16&255,D[3]=L>>>24&255,A.check=l(A.check,D,4,0)),F=L=0,A.mode=4;case 4:for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.head&&(A.head.xflags=255&L,A.head.os=L>>8),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=5;case 5:if(1024&A.flags){for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.length=L,A.head&&(A.head.extra_len=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(H<(oe=A.length)&&(oe=H),oe&&(A.head&&(P=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,U,G,oe,P)),512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,A.length-=oe),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(H===0)break e;for(oe=0;P=U[G+oe++],A.head&&P&&A.length<65536&&(A.head.name+=String.fromCharCode(P)),P&&oe<H;);if(512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,P)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(H===0)break e;for(oe=0;P=U[G+oe++],A.head&&P&&A.length<65536&&(A.head.comment+=String.fromCharCode(P)),P&&oe<H;);if(512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,P)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L!==(65535&A.check)){I.msg="header crc mismatch",A.mode=30;break}F=L=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),I.adler=A.check=0,A.mode=12;break;case 10:for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}I.adler=A.check=y(L),F=L=0,A.mode=11;case 11:if(A.havedict===0)return I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,2;I.adler=A.check=1,A.mode=12;case 12:if(q===5||q===6)break e;case 13:if(A.last){L>>>=7&F,F-=7&F,A.mode=27;break}for(;F<3;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}switch(A.last=1&L,F-=1,3&(L>>>=1)){case 0:A.mode=14;break;case 1:if(M(A),A.mode=20,q!==6)break;L>>>=2,F-=2;break e;case 2:A.mode=17;break;case 3:I.msg="invalid block type",A.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if((65535&L)!=(L>>>16^65535)){I.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,F=L=0,A.mode=15,q===6)break e;case 15:A.mode=16;case 16:if(oe=A.length){if(H<oe&&(oe=H),$<oe&&(oe=$),oe===0)break e;i.arraySet(K,U,G,oe,Y),H-=oe,G+=oe,$-=oe,Y+=oe,A.length-=oe;break}A.mode=12;break;case 17:for(;F<14;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(A.nlen=257+(31&L),L>>>=5,F-=5,A.ndist=1+(31&L),L>>>=5,F-=5,A.ncode=4+(15&L),L>>>=4,F-=4,286<A.nlen||30<A.ndist){I.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;F<3;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.lens[ne[A.have++]]=7&L,L>>>=3,F-=3}for(;A.have<19;)A.lens[ne[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,V={bits:A.lenbits},ie=u(0,A.lens,0,19,A.lencode,0,A.work,V),A.lenbits=V.bits,ie){I.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(te<16)L>>>=R,F-=R,A.lens[A.have++]=te;else{if(te===16){for(O=R+2;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L>>>=R,F-=R,A.have===0){I.msg="invalid bit length repeat",A.mode=30;break}P=A.lens[A.have-1],oe=3+(3&L),L>>>=2,F-=2}else if(te===17){for(O=R+3;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}F-=R,P=0,oe=3+(7&(L>>>=R)),L>>>=3,F-=3}else{for(O=R+7;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}F-=R,P=0,oe=11+(127&(L>>>=R)),L>>>=7,F-=7}if(A.have+oe>A.nlen+A.ndist){I.msg="invalid bit length repeat",A.mode=30;break}for(;oe--;)A.lens[A.have++]=P}}if(A.mode===30)break;if(A.lens[256]===0){I.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,V={bits:A.lenbits},ie=u(d,A.lens,0,A.nlen,A.lencode,0,A.work,V),A.lenbits=V.bits,ie){I.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,V={bits:A.distbits},ie=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,V),A.distbits=V.bits,ie){I.msg="invalid distances set",A.mode=30;break}if(A.mode=20,q===6)break e;case 20:A.mode=21;case 21:if(6<=H&&258<=$){I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,c(I,X),Y=I.next_out,K=I.output,$=I.avail_out,G=I.next_in,U=I.input,H=I.avail_in,L=A.hold,F=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(ee&&!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.lencode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,A.length=te,ee===0){A.mode=26;break}if(32&ee){A.back=-1,A.mode=12;break}if(64&ee){I.msg="invalid literal/length code",A.mode=30;break}A.extra=15&ee,A.mode=22;case 22:if(A.extra){for(O=A.extra;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.length+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;ee=(T=A.distcode[L&(1<<A.distbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.distcode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,64&ee){I.msg="invalid distance code",A.mode=30;break}A.offset=te,A.extra=15&ee,A.mode=24;case 24:if(A.extra){for(O=A.extra;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.offset+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){I.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if($===0)break e;if(oe=X-$,A.offset>oe){if((oe=A.offset-oe)>A.whave&&A.sane){I.msg="invalid distance too far back",A.mode=30;break}le=oe>A.wnext?(oe-=A.wnext,A.wsize-oe):A.wnext-oe,oe>A.length&&(oe=A.length),B=A.window}else B=K,le=Y-A.offset,oe=A.length;for($<oe&&(oe=$),$-=oe,A.length-=oe;K[Y++]=B[le++],--oe;);A.length===0&&(A.mode=21);break;case 26:if($===0)break e;K[Y++]=A.length,$--,A.mode=21;break;case 27:if(A.wrap){for(;F<32;){if(H===0)break e;H--,L|=U[G++]<<F,F+=8}if(X-=$,I.total_out+=X,A.total+=X,X&&(I.adler=A.check=A.flags?l(A.check,K,X,Y-X):o(A.check,K,X,Y-X)),X=$,(A.flags?L:y(L))!==A.check){I.msg="incorrect data check",A.mode=30;break}F=L=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L!==(4294967295&A.total)){I.msg="incorrect length check",A.mode=30;break}F=L=0}A.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;case 32:default:return p}return I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,(A.wsize||X!==I.avail_out&&A.mode<30&&(A.mode<27||q!==4))&&z(I,I.output,I.next_out,X-I.avail_out)?(A.mode=31,-4):(W-=I.avail_in,X-=I.avail_out,I.total_in+=W,I.total_out+=X,A.total+=X,A.wrap&&X&&(I.adler=A.check=A.flags?l(A.check,K,X,I.next_out-X):o(A.check,K,X,I.next_out-X)),I.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(W==0&&X===0||q===4)&&ie===f&&(ie=-5),ie)},s.inflateEnd=function(I){if(!I||!I.state)return p;var q=I.state;return q.window&&(q.window=null),I.state=null,f},s.inflateGetHeader=function(I,q){var A;return I&&I.state&&2&(A=I.state).wrap?((A.head=q).done=!1,f):p},s.inflateSetDictionary=function(I,q){var A,U=q.length;return I&&I.state?(A=I.state).wrap!==0&&A.mode!==11?p:A.mode===11&&o(1,q,U,0)!==A.check?-3:z(I,q,U,U)?(A.mode=31,-4):(A.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(d,h,f,p,g,m,v,y){var x,b,w,j,N,C,k,E,M,z=y.bits,I=0,q=0,A=0,U=0,K=0,G=0,Y=0,H=0,$=0,L=0,F=null,W=0,X=new i.Buf16(16),oe=new i.Buf16(16),le=null,B=0;for(I=0;I<=15;I++)X[I]=0;for(q=0;q<p;q++)X[h[f+q]]++;for(K=z,U=15;1<=U&&X[U]===0;U--);if(U<K&&(K=U),U===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(A=1;A<U&&X[A]===0;A++);for(K<A&&(K=A),I=H=1;I<=15;I++)if(H<<=1,(H-=X[I])<0)return-1;if(0<H&&(d===0||U!==1))return-1;for(oe[1]=0,I=1;I<15;I++)oe[I+1]=oe[I]+X[I];for(q=0;q<p;q++)h[f+q]!==0&&(v[oe[h[f+q]]++]=q);if(C=d===0?(F=le=v,19):d===1?(F=o,W-=257,le=l,B-=257,256):(F=c,le=u,-1),I=A,N=m,Y=q=L=0,w=-1,j=($=1<<(G=K))-1,d===1&&852<$||d===2&&592<$)return 1;for(;;){for(k=I-Y,M=v[q]<C?(E=0,v[q]):v[q]>C?(E=le[B+v[q]],F[W+v[q]]):(E=96,0),x=1<<I-Y,A=b=1<<G;g[N+(L>>Y)+(b-=x)]=k<<24|E<<16|M|0,b!==0;);for(x=1<<I-1;L&x;)x>>=1;if(x!==0?(L&=x-1,L+=x):L=0,q++,--X[I]==0){if(I===U)break;I=h[f+v[q]]}if(K<I&&(L&j)!==w){for(Y===0&&(Y=K),N+=A,H=1<<(G=I-Y);G+Y<U&&!((H-=X[G+Y])<=0);)G++,H<<=1;if($+=1<<G,d===1&&852<$||d===2&&592<$)return 1;g[w=L&j]=K<<24|G<<16|N-m|0}}return L!==0&&(g[N+L]=I-Y<<24|64<<16|0),y.bits=K,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var i=r("../utils/common"),o=0,l=1;function c(T){for(var D=T.length;0<=--D;)T[D]=0}var u=0,d=29,h=256,f=h+1+d,p=30,g=19,m=2*f+1,v=15,y=16,x=7,b=256,w=16,j=17,N=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(f+2));c(z);var I=new Array(2*p);c(I);var q=new Array(512);c(q);var A=new Array(256);c(A);var U=new Array(d);c(U);var K,G,Y,H=new Array(p);function $(T,D,ne,ue,re){this.static_tree=T,this.extra_bits=D,this.extra_base=ne,this.elems=ue,this.max_length=re,this.has_stree=T&&T.length}function L(T,D){this.dyn_tree=T,this.max_code=0,this.stat_desc=D}function F(T){return T<256?q[T]:q[256+(T>>>7)]}function W(T,D){T.pending_buf[T.pending++]=255&D,T.pending_buf[T.pending++]=D>>>8&255}function X(T,D,ne){T.bi_valid>y-ne?(T.bi_buf|=D<<T.bi_valid&65535,W(T,T.bi_buf),T.bi_buf=D>>y-T.bi_valid,T.bi_valid+=ne-y):(T.bi_buf|=D<<T.bi_valid&65535,T.bi_valid+=ne)}function oe(T,D,ne){X(T,ne[2*D],ne[2*D+1])}function le(T,D){for(var ne=0;ne|=1&T,T>>>=1,ne<<=1,0<--D;);return ne>>>1}function B(T,D,ne){var ue,re,pe=new Array(v+1),xe=0;for(ue=1;ue<=v;ue++)pe[ue]=xe=xe+ne[ue-1]<<1;for(re=0;re<=D;re++){var ye=T[2*re+1];ye!==0&&(T[2*re]=le(pe[ye]++,ye))}}function R(T){var D;for(D=0;D<f;D++)T.dyn_ltree[2*D]=0;for(D=0;D<p;D++)T.dyn_dtree[2*D]=0;for(D=0;D<g;D++)T.bl_tree[2*D]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function ee(T){8<T.bi_valid?W(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function te(T,D,ne,ue){var re=2*D,pe=2*ne;return T[re]<T[pe]||T[re]===T[pe]&&ue[D]<=ue[ne]}function Z(T,D,ne){for(var ue=T.heap[ne],re=ne<<1;re<=T.heap_len&&(re<T.heap_len&&te(D,T.heap[re+1],T.heap[re],T.depth)&&re++,!te(D,ue,T.heap[re],T.depth));)T.heap[ne]=T.heap[re],ne=re,re<<=1;T.heap[ne]=ue}function J(T,D,ne){var ue,re,pe,xe,ye=0;if(T.last_lit!==0)for(;ue=T.pending_buf[T.d_buf+2*ye]<<8|T.pending_buf[T.d_buf+2*ye+1],re=T.pending_buf[T.l_buf+ye],ye++,ue===0?oe(T,re,D):(oe(T,(pe=A[re])+h+1,D),(xe=C[pe])!==0&&X(T,re-=U[pe],xe),oe(T,pe=F(--ue),ne),(xe=k[pe])!==0&&X(T,ue-=H[pe],xe)),ye<T.last_lit;);oe(T,b,D)}function he(T,D){var ne,ue,re,pe=D.dyn_tree,xe=D.stat_desc.static_tree,ye=D.stat_desc.has_stree,ae=D.stat_desc.elems,de=-1;for(T.heap_len=0,T.heap_max=m,ne=0;ne<ae;ne++)pe[2*ne]!==0?(T.heap[++T.heap_len]=de=ne,T.depth[ne]=0):pe[2*ne+1]=0;for(;T.heap_len<2;)pe[2*(re=T.heap[++T.heap_len]=de<2?++de:0)]=1,T.depth[re]=0,T.opt_len--,ye&&(T.static_len-=xe[2*re+1]);for(D.max_code=de,ne=T.heap_len>>1;1<=ne;ne--)Z(T,pe,ne);for(re=ae;ne=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Z(T,pe,1),ue=T.heap[1],T.heap[--T.heap_max]=ne,T.heap[--T.heap_max]=ue,pe[2*re]=pe[2*ne]+pe[2*ue],T.depth[re]=(T.depth[ne]>=T.depth[ue]?T.depth[ne]:T.depth[ue])+1,pe[2*ne+1]=pe[2*ue+1]=re,T.heap[1]=re++,Z(T,pe,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ge,we){var je,Se,Ue,Ae,fe,Ee,Ce=we.dyn_tree,Ge=we.max_code,dt=we.stat_desc.static_tree,Ne=we.stat_desc.has_stree,Ze=we.stat_desc.extra_bits,Ke=we.stat_desc.extra_base,Xe=we.stat_desc.max_length,Ye=0;for(Ae=0;Ae<=v;Ae++)ge.bl_count[Ae]=0;for(Ce[2*ge.heap[ge.heap_max]+1]=0,je=ge.heap_max+1;je<m;je++)Xe<(Ae=Ce[2*Ce[2*(Se=ge.heap[je])+1]+1]+1)&&(Ae=Xe,Ye++),Ce[2*Se+1]=Ae,Ge<Se||(ge.bl_count[Ae]++,fe=0,Ke<=Se&&(fe=Ze[Se-Ke]),Ee=Ce[2*Se],ge.opt_len+=Ee*(Ae+fe),Ne&&(ge.static_len+=Ee*(dt[2*Se+1]+fe)));if(Ye!==0){do{for(Ae=Xe-1;ge.bl_count[Ae]===0;)Ae--;ge.bl_count[Ae]--,ge.bl_count[Ae+1]+=2,ge.bl_count[Xe]--,Ye-=2}while(0<Ye);for(Ae=Xe;Ae!==0;Ae--)for(Se=ge.bl_count[Ae];Se!==0;)Ge<(Ue=ge.heap[--je])||(Ce[2*Ue+1]!==Ae&&(ge.opt_len+=(Ae-Ce[2*Ue+1])*Ce[2*Ue],Ce[2*Ue+1]=Ae),Se--)}}(T,D),B(pe,de,T.bl_count)}function P(T,D,ne){var ue,re,pe=-1,xe=D[1],ye=0,ae=7,de=4;for(xe===0&&(ae=138,de=3),D[2*(ne+1)+1]=65535,ue=0;ue<=ne;ue++)re=xe,xe=D[2*(ue+1)+1],++ye<ae&&re===xe||(ye<de?T.bl_tree[2*re]+=ye:re!==0?(re!==pe&&T.bl_tree[2*re]++,T.bl_tree[2*w]++):ye<=10?T.bl_tree[2*j]++:T.bl_tree[2*N]++,pe=re,de=(ye=0)===xe?(ae=138,3):re===xe?(ae=6,3):(ae=7,4))}function ie(T,D,ne){var ue,re,pe=-1,xe=D[1],ye=0,ae=7,de=4;for(xe===0&&(ae=138,de=3),ue=0;ue<=ne;ue++)if(re=xe,xe=D[2*(ue+1)+1],!(++ye<ae&&re===xe)){if(ye<de)for(;oe(T,re,T.bl_tree),--ye!=0;);else re!==0?(re!==pe&&(oe(T,re,T.bl_tree),ye--),oe(T,w,T.bl_tree),X(T,ye-3,2)):ye<=10?(oe(T,j,T.bl_tree),X(T,ye-3,3)):(oe(T,N,T.bl_tree),X(T,ye-11,7));pe=re,de=(ye=0)===xe?(ae=138,3):re===xe?(ae=6,3):(ae=7,4)}}c(H);var V=!1;function O(T,D,ne,ue){X(T,(u<<1)+(ue?1:0),3),function(re,pe,xe,ye){ee(re),W(re,xe),W(re,~xe),i.arraySet(re.pending_buf,re.window,pe,xe,re.pending),re.pending+=xe}(T,D,ne)}s._tr_init=function(T){V||(function(){var D,ne,ue,re,pe,xe=new Array(v+1);for(re=ue=0;re<d-1;re++)for(U[re]=ue,D=0;D<1<<C[re];D++)A[ue++]=re;for(A[ue-1]=re,re=pe=0;re<16;re++)for(H[re]=pe,D=0;D<1<<k[re];D++)q[pe++]=re;for(pe>>=7;re<p;re++)for(H[re]=pe<<7,D=0;D<1<<k[re]-7;D++)q[256+pe++]=re;for(ne=0;ne<=v;ne++)xe[ne]=0;for(D=0;D<=143;)z[2*D+1]=8,D++,xe[8]++;for(;D<=255;)z[2*D+1]=9,D++,xe[9]++;for(;D<=279;)z[2*D+1]=7,D++,xe[7]++;for(;D<=287;)z[2*D+1]=8,D++,xe[8]++;for(B(z,f+1,xe),D=0;D<p;D++)I[2*D+1]=5,I[2*D]=le(D,5);K=new $(z,C,h+1,f,v),G=new $(I,k,0,p,v),Y=new $(new Array(0),E,0,g,x)}(),V=!0),T.l_desc=new L(T.dyn_ltree,K),T.d_desc=new L(T.dyn_dtree,G),T.bl_desc=new L(T.bl_tree,Y),T.bi_buf=0,T.bi_valid=0,R(T)},s._tr_stored_block=O,s._tr_flush_block=function(T,D,ne,ue){var re,pe,xe=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(ye){var ae,de=4093624447;for(ae=0;ae<=31;ae++,de>>>=1)if(1&de&&ye.dyn_ltree[2*ae]!==0)return o;if(ye.dyn_ltree[18]!==0||ye.dyn_ltree[20]!==0||ye.dyn_ltree[26]!==0)return l;for(ae=32;ae<h;ae++)if(ye.dyn_ltree[2*ae]!==0)return l;return o}(T)),he(T,T.l_desc),he(T,T.d_desc),xe=function(ye){var ae;for(P(ye,ye.dyn_ltree,ye.l_desc.max_code),P(ye,ye.dyn_dtree,ye.d_desc.max_code),he(ye,ye.bl_desc),ae=g-1;3<=ae&&ye.bl_tree[2*M[ae]+1]===0;ae--);return ye.opt_len+=3*(ae+1)+5+5+4,ae}(T),re=T.opt_len+3+7>>>3,(pe=T.static_len+3+7>>>3)<=re&&(re=pe)):re=pe=ne+5,ne+4<=re&&D!==-1?O(T,D,ne,ue):T.strategy===4||pe===re?(X(T,2+(ue?1:0),3),J(T,z,I)):(X(T,4+(ue?1:0),3),function(ye,ae,de,ge){var we;for(X(ye,ae-257,5),X(ye,de-1,5),X(ye,ge-4,4),we=0;we<ge;we++)X(ye,ye.bl_tree[2*M[we]+1],3);ie(ye,ye.dyn_ltree,ae-1),ie(ye,ye.dyn_dtree,de-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,xe+1),J(T,T.dyn_ltree,T.dyn_dtree)),R(T),ue&&ee(T)},s._tr_tally=function(T,D,ne){return T.pending_buf[T.d_buf+2*T.last_lit]=D>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&D,T.pending_buf[T.l_buf+T.last_lit]=255&ne,T.last_lit++,D===0?T.dyn_ltree[2*ne]++:(T.matches++,D--,T.dyn_ltree[2*(A[ne]+h+1)]++,T.dyn_dtree[2*F(D)]++),T.last_lit===T.lit_bufsize-1},s._tr_align=function(T){X(T,2,3),oe(T,b,z),function(D){D.bi_valid===16?(W(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},g=!1,m=o.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(o);v=v&&v.setTimeout?v:o,c={}.toString.call(o.process)==="[object process]"?function(w){process.nextTick(function(){x(w)})}:function(){if(o.postMessage&&!o.importScripts){var w=!0,j=o.onmessage;return o.onmessage=function(){w=!1},o.postMessage("","*"),o.onmessage=j,w}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(w){o.postMessage(h+w,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){x(w.data)},function(w){d.port2.postMessage(w)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(w){var j=m.createElement("script");j.onreadystatechange=function(){x(w),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(w){setTimeout(x,0,w)},v.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var j=new Array(arguments.length-1),N=0;N<j.length;N++)j[N]=arguments[N+1];var C={callback:w,args:j};return p[f]=C,c(f),f++},v.clearImmediate=y}function y(w){delete p[w]}function x(w){if(g)setTimeout(x,0,w);else{var j=p[w];if(j){g=!0;try{(function(N){var C=N.callback,k=N.args;switch(k.length){case 0:C();break;case 1:C(k[0]);break;case 2:C(k[0],k[1]);break;case 3:C(k[0],k[1],k[2]);break;default:C.apply(l,k)}})(j)}finally{y(w),g=!1}}}}function b(w){w.source===o&&typeof w.data=="string"&&w.data.indexOf(h)===0&&x(+w.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof zr<"u"?zr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ife);var nut=Ife.exports;const sut=qt(nut);var Rfe={exports:{}};/* @license
Papa Parse
v5.5.3
https://github.com/mholt/PapaParse
License: MIT
*/(function(t,e){((r,n)=>{t.exports=n()})(zr,function r(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},s,i=!n.document&&!!n.postMessage,o=n.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(k){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var M=j(E);M.chunkSize=parseInt(M.chunkSize),E.step||E.chunk||(M.chunkSize=null),this._handle=new m(M),(this._handle.streamer=this)._config=M}).call(this,k),this.parseChunk=function(E,M){var z=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<z){let q=this._config.newline;q||(I=this._config.quoteChar||'"',q=this._handle.guessLineEndings(E,I)),E=[...E.split(q).slice(z)].join(q)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(I=this._config.beforeFirstChunk(E))!==void 0&&(E=I),this.isFirstChunk=!1,this._halted=!1;var z=this._partialLine+E,I=(this._partialLine="",this._handle.parse(z,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=I.meta.cursor,z=(this._finished||(this._partialLine=z.substring(E-this._baseIndex),this._baseIndex=E),I&&I.data&&(this._rowCount+=I.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)n.postMessage({results:I,workerId:u.WORKER_ID,finished:z});else if(C(this._config.chunk)&&!M){if(this._config.chunk(I,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=I=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(I.data),this._completeResults.errors=this._completeResults.errors.concat(I.errors),this._completeResults.meta=I.meta),this._completed||!z||!C(this._config.complete)||I&&I.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),z||I&&I.meta.paused||this._nextChunk(),I}this._halted=!0},this._sendError=function(E){C(this._config.error)?this._config.error(E):o&&this._config.error&&n.postMessage({workerId:u.WORKER_ID,error:E,finished:!1})}}function h(k){var E;(k=k||{}).chunkSize||(k.chunkSize=u.RemoteChunkSize),d.call(this,k),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(M){this._input=M,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=N(this._chunkLoaded,this),E.onerror=N(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var M,z=this._config.downloadRequestHeaders;for(M in z)E.setRequestHeader(M,z[M])}var I;this._config.chunkSize&&(I=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+I));try{E.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(M=>(M=M.getResponseHeader("Content-Range"))!==null?parseInt(M.substring(M.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(M){M=E.statusText||M,this._sendError(new Error(M))}}function f(k){(k=k||{}).chunkSize||(k.chunkSize=u.LocalChunkSize),d.call(this,k);var E,M,z=typeof FileReader<"u";this.stream=function(I){this._input=I,M=I.slice||I.webkitSlice||I.mozSlice,z?((E=new FileReader).onload=N(this._chunkLoaded,this),E.onerror=N(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var I=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),I=M.call(I,this._start,q)),E.readAsText(I,this._config.encoding));z||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(I){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(I.target.result)},this._chunkError=function(){this._sendError(E.error)}}function p(k){var E;d.call(this,k=k||{}),this.stream=function(M){return E=M,this._nextChunk()},this._nextChunk=function(){var M,z;if(!this._finished)return M=this._config.chunkSize,E=M?(z=E.substring(0,M),E.substring(M)):(z=E,""),this._finished=!E,this.parseChunk(z)}}function g(k){d.call(this,k=k||{});var E=[],M=!0,z=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(I){this._input=I,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){z&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):M=!0},this._streamData=N(function(I){try{E.push(typeof I=="string"?I:I.toString(this._config.encoding)),M&&(M=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(q){this._streamError(q)}},this),this._streamError=N(function(I){this._streamCleanUp(),this._sendError(I)},this),this._streamEnd=N(function(){this._streamCleanUp(),z=!0,this._streamData("")},this),this._streamCleanUp=N(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function m(k){var E,M,z,I,q=Math.pow(2,53),A=-q,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,K=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,G=this,Y=0,H=0,$=!1,L=!1,F=[],W={data:[],errors:[],meta:{}};function X(R){return k.skipEmptyLines==="greedy"?R.join("").trim()==="":R.length===1&&R[0].length===0}function oe(){if(W&&z&&(B("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),z=!1),k.skipEmptyLines&&(W.data=W.data.filter(function(Z){return!X(Z)})),le()){let Z=function(J,he){C(k.transformHeader)&&(J=k.transformHeader(J,he)),F.push(J)};if(W)if(Array.isArray(W.data[0])){for(var R=0;le()&&R<W.data.length;R++)W.data[R].forEach(Z);W.data.splice(0,1)}else W.data.forEach(Z)}function ee(Z,J){for(var he=k.header?{}:[],P=0;P<Z.length;P++){var ie=P,V=Z[P],V=((O,T)=>(D=>(k.dynamicTypingFunction&&k.dynamicTyping[D]===void 0&&(k.dynamicTyping[D]=k.dynamicTypingFunction(D)),(k.dynamicTyping[D]||k.dynamicTyping)===!0))(O)?T==="true"||T==="TRUE"||T!=="false"&&T!=="FALSE"&&((D=>{if(U.test(D)&&(D=parseFloat(D),A<D&&D<q))return 1})(T)?parseFloat(T):K.test(T)?new Date(T):T===""?null:T):T)(ie=k.header?P>=F.length?"__parsed_extra":F[P]:ie,V=k.transform?k.transform(V,ie):V);ie==="__parsed_extra"?(he[ie]=he[ie]||[],he[ie].push(V)):he[ie]=V}return k.header&&(P>F.length?B("FieldMismatch","TooManyFields","Too many fields: expected "+F.length+" fields but parsed "+P,H+J):P<F.length&&B("FieldMismatch","TooFewFields","Too few fields: expected "+F.length+" fields but parsed "+P,H+J)),he}var te;W&&(k.header||k.dynamicTyping||k.transform)&&(te=1,!W.data.length||Array.isArray(W.data[0])?(W.data=W.data.map(ee),te=W.data.length):W.data=ee(W.data,0),k.header&&W.meta&&(W.meta.fields=F),H+=te)}function le(){return k.header&&F.length===0}function B(R,ee,te,Z){R={type:R,code:ee,message:te},Z!==void 0&&(R.row=Z),W.errors.push(R)}C(k.step)&&(I=k.step,k.step=function(R){W=R,le()?oe():(oe(),W.data.length!==0&&(Y+=R.data.length,k.preview&&Y>k.preview?M.abort():(W.data=W.data[0],I(W,G))))}),this.parse=function(R,ee,te){var Z=k.quoteChar||'"',Z=(k.newline||(k.newline=this.guessLineEndings(R,Z)),z=!1,k.delimiter?C(k.delimiter)&&(k.delimiter=k.delimiter(R),W.meta.delimiter=k.delimiter):((Z=((J,he,P,ie,V)=>{var O,T,D,ne;V=V||[",","	","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var ue=0;ue<V.length;ue++){for(var re,pe=V[ue],xe=0,ye=0,ae=0,de=(D=void 0,new y({comments:ie,delimiter:pe,newline:he,preview:10}).parse(J)),ge=0;ge<de.data.length;ge++)P&&X(de.data[ge])?ae++:(re=de.data[ge].length,ye+=re,D===void 0?D=re:0<re&&(xe+=Math.abs(re-D),D=re));0<de.data.length&&(ye/=de.data.length-ae),(T===void 0||xe<=T)&&(ne===void 0||ne<ye)&&1.99<ye&&(T=xe,O=pe,ne=ye)}return{successful:!!(k.delimiter=O),bestDelimiter:O}})(R,k.newline,k.skipEmptyLines,k.comments,k.delimitersToGuess)).successful?k.delimiter=Z.bestDelimiter:(z=!0,k.delimiter=u.DefaultDelimiter),W.meta.delimiter=k.delimiter),j(k));return k.preview&&k.header&&Z.preview++,E=R,M=new y(Z),W=M.parse(E,ee,te),oe(),$?{meta:{paused:!0}}:W||{meta:{paused:!1}}},this.paused=function(){return $},this.pause=function(){$=!0,M.abort(),E=C(k.chunk)?"":E.substring(M.getCharIndex())},this.resume=function(){G.streamer._halted?($=!1,G.streamer.parseChunk(E,!0)):setTimeout(G.resume,3)},this.aborted=function(){return L},this.abort=function(){L=!0,M.abort(),W.meta.aborted=!0,C(k.complete)&&k.complete(W),E=""},this.guessLineEndings=function(J,Z){J=J.substring(0,1048576);var Z=new RegExp(v(Z)+"([^]*?)"+v(Z),"gm"),te=(J=J.replace(Z,"")).split("\r"),Z=J.split(`
`),J=1<Z.length&&Z[0].length<te[0].length;if(te.length===1||J)return`
`;for(var he=0,P=0;P<te.length;P++)te[P][0]===`
`&&he++;return he>=te.length/2?`\r
`:"\r"}}function v(k){return k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(k){var E=(k=k||{}).delimiter,M=k.newline,z=k.comments,I=k.step,q=k.preview,A=k.fastMode,U=null,K=!1,G=k.quoteChar==null?'"':k.quoteChar,Y=G;if(k.escapeChar!==void 0&&(Y=k.escapeChar),(typeof E!="string"||-1<u.BAD_DELIMITERS.indexOf(E))&&(E=","),z===E)throw new Error("Comment character same as delimiter");z===!0?z="#":(typeof z!="string"||-1<u.BAD_DELIMITERS.indexOf(z))&&(z=!1),M!==`
`&&M!=="\r"&&M!==`\r
`&&(M=`
`);var H=0,$=!1;this.parse=function(L,F,W){if(typeof L!="string")throw new Error("Input must be a string");var X=L.length,oe=E.length,le=M.length,B=z.length,R=C(I),ee=[],te=[],Z=[],J=H=0;if(!L)return xe();if(A||A!==!1&&L.indexOf(G)===-1){for(var he=L.split(M),P=0;P<he.length;P++){if(Z=he[P],H+=Z.length,P!==he.length-1)H+=M.length;else if(W)return xe();if(!z||Z.substring(0,B)!==z){if(R){if(ee=[],ne(Z.split(E)),ye(),$)return xe()}else ne(Z.split(E));if(q&&q<=P)return ee=ee.slice(0,q),xe(!0)}}return xe()}for(var ie=L.indexOf(E,H),V=L.indexOf(M,H),O=new RegExp(v(Y)+v(G),"g"),T=L.indexOf(G,H);;)if(L[H]===G)for(T=H,H++;;){if((T=L.indexOf(G,T+1))===-1)return W||te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ee.length,index:H}),re();if(T===X-1)return re(L.substring(H,T).replace(O,G));if(G===Y&&L[T+1]===Y)T++;else if(G===Y||T===0||L[T-1]!==Y){ie!==-1&&ie<T+1&&(ie=L.indexOf(E,T+1));var D=ue((V=V!==-1&&V<T+1?L.indexOf(M,T+1):V)===-1?ie:Math.min(ie,V));if(L.substr(T+1+D,oe)===E){Z.push(L.substring(H,T).replace(O,G)),L[H=T+1+D+oe]!==G&&(T=L.indexOf(G,H)),ie=L.indexOf(E,H),V=L.indexOf(M,H);break}if(D=ue(V),L.substring(T+1+D,T+1+D+le)===M){if(Z.push(L.substring(H,T).replace(O,G)),pe(T+1+D+le),ie=L.indexOf(E,H),T=L.indexOf(G,H),R&&(ye(),$))return xe();if(q&&ee.length>=q)return xe(!0);break}te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ee.length,index:H}),T++}}else if(z&&Z.length===0&&L.substring(H,H+B)===z){if(V===-1)return xe();H=V+le,V=L.indexOf(M,H),ie=L.indexOf(E,H)}else if(ie!==-1&&(ie<V||V===-1))Z.push(L.substring(H,ie)),H=ie+oe,ie=L.indexOf(E,H);else{if(V===-1)break;if(Z.push(L.substring(H,V)),pe(V+le),R&&(ye(),$))return xe();if(q&&ee.length>=q)return xe(!0)}return re();function ne(ae){ee.push(ae),J=H}function ue(ae){var de=0;return de=ae!==-1&&(ae=L.substring(T+1,ae))&&ae.trim()===""?ae.length:de}function re(ae){return W||(ae===void 0&&(ae=L.substring(H)),Z.push(ae),H=X,ne(Z),R&&ye()),xe()}function pe(ae){H=ae,ne(Z),Z=[],V=L.indexOf(M,H)}function xe(ae){if(k.header&&!F&&ee.length&&!K){var de=ee[0],ge=Object.create(null),we=new Set(de);let je=!1;for(let Se=0;Se<de.length;Se++){let Ue=de[Se];if(ge[Ue=C(k.transformHeader)?k.transformHeader(Ue,Se):Ue]){let Ae,fe=ge[Ue];for(;Ae=Ue+"_"+fe,fe++,we.has(Ae););we.add(Ae),de[Se]=Ae,ge[Ue]++,je=!0,(U=U===null?{}:U)[Ae]=Ue}else ge[Ue]=1,de[Se]=Ue;we.add(Ue)}je&&console.warn("Duplicate headers found and renamed."),K=!0}return{data:ee,errors:te,meta:{delimiter:E,linebreak:M,aborted:$,truncated:!!ae,cursor:J+(F||0),renamedHeaders:U}}}function ye(){I(xe()),ee=[],te=[]}},this.abort=function(){$=!0},this.getCharIndex=function(){return H}}function x(k){var E=k.data,M=l[E.workerId],z=!1;if(E.error)M.userError(E.error,E.file);else if(E.results&&E.results.data){var I={abort:function(){z=!0,b(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:w,resume:w};if(C(M.userStep)){for(var q=0;q<E.results.data.length&&(M.userStep({data:E.results.data[q],errors:E.results.errors,meta:E.results.meta},I),!z);q++);delete E.results}else C(M.userChunk)&&(M.userChunk(E.results,I,E.file),delete E.results)}E.finished&&!z&&b(E.workerId,E.results)}function b(k,E){var M=l[k];C(M.userComplete)&&M.userComplete(E),M.terminate(),delete l[k]}function w(){throw new Error("Not implemented.")}function j(k){if(typeof k!="object"||k===null)return k;var E,M=Array.isArray(k)?[]:{};for(E in k)M[E]=j(k[E]);return M}function N(k,E){return function(){k.apply(E,arguments)}}function C(k){return typeof k=="function"}return u.parse=function(k,E){var M=(E=E||{}).dynamicTyping||!1;if(C(M)&&(E.dynamicTypingFunction=M,M={}),E.dynamicTyping=M,E.transform=!!C(E.transform)&&E.transform,!E.worker||!u.WORKERS_SUPPORTED)return M=null,u.NODE_STREAM_INPUT,typeof k=="string"?(k=(z=>z.charCodeAt(0)!==65279?z:z.slice(1))(k),M=new(E.download?h:p)(E)):k.readable===!0&&C(k.read)&&C(k.on)?M=new g(E):(n.File&&k instanceof File||k instanceof Object)&&(M=new f(E)),M.stream(k);(M=(()=>{var z;return!!u.WORKERS_SUPPORTED&&(z=(()=>{var I=n.URL||n.webkitURL||null,q=r.toString();return u.BLOB_URL||(u.BLOB_URL=I.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",q,")();"],{type:"text/javascript"})))})(),(z=new n.Worker(z)).onmessage=x,z.id=c++,l[z.id]=z)})()).userStep=E.step,M.userChunk=E.chunk,M.userComplete=E.complete,M.userError=E.error,E.step=C(E.step),E.chunk=C(E.chunk),E.complete=C(E.complete),E.error=C(E.error),delete E.worker,M.postMessage({input:k,config:E,workerId:M.id})},u.unparse=function(k,E){var M=!1,z=!0,I=",",q=`\r
`,A='"',U=A+A,K=!1,G=null,Y=!1,H=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||u.BAD_DELIMITERS.filter(function(F){return E.delimiter.indexOf(F)!==-1}).length||(I=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(M=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(K=E.skipEmptyLines),typeof E.newline=="string"&&(q=E.newline),typeof E.quoteChar=="string"&&(A=E.quoteChar),typeof E.header=="boolean"&&(z=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");G=E.columns}E.escapeChar!==void 0&&(U=E.escapeChar+A),E.escapeFormulae instanceof RegExp?Y=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(Y=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(A),"g"));if(typeof k=="string"&&(k=JSON.parse(k)),Array.isArray(k)){if(!k.length||Array.isArray(k[0]))return $(null,k,K);if(typeof k[0]=="object")return $(G||Object.keys(k[0]),k,K)}else if(typeof k=="object")return typeof k.data=="string"&&(k.data=JSON.parse(k.data)),Array.isArray(k.data)&&(k.fields||(k.fields=k.meta&&k.meta.fields||G),k.fields||(k.fields=Array.isArray(k.data[0])?k.fields:typeof k.data[0]=="object"?Object.keys(k.data[0]):[]),Array.isArray(k.data[0])||typeof k.data[0]=="object"||(k.data=[k.data])),$(k.fields||[],k.data||[],K);throw new Error("Unable to serialize unrecognized input");function $(F,W,X){var oe="",le=(typeof F=="string"&&(F=JSON.parse(F)),typeof W=="string"&&(W=JSON.parse(W)),Array.isArray(F)&&0<F.length),B=!Array.isArray(W[0]);if(le&&z){for(var R=0;R<F.length;R++)0<R&&(oe+=I),oe+=L(F[R],R);0<W.length&&(oe+=q)}for(var ee=0;ee<W.length;ee++){var te=(le?F:W[ee]).length,Z=!1,J=le?Object.keys(W[ee]).length===0:W[ee].length===0;if(X&&!le&&(Z=X==="greedy"?W[ee].join("").trim()==="":W[ee].length===1&&W[ee][0].length===0),X==="greedy"&&le){for(var he=[],P=0;P<te;P++){var ie=B?F[P]:P;he.push(W[ee][ie])}Z=he.join("").trim()===""}if(!Z){for(var V=0;V<te;V++){0<V&&!J&&(oe+=I);var O=le&&B?F[V]:V;oe+=L(W[ee][O],V)}ee<W.length-1&&(!X||0<te&&!J)&&(oe+=q)}}return oe}function L(F,W){var X,oe;return F==null?"":F.constructor===Date?JSON.stringify(F).slice(1,25):(oe=!1,Y&&typeof F=="string"&&Y.test(F)&&(F="'"+F,oe=!0),X=F.toString().replace(H,U),(oe=oe||M===!0||typeof M=="function"&&M(F,W)||Array.isArray(M)&&M[W]||((le,B)=>{for(var R=0;R<B.length;R++)if(-1<le.indexOf(B[R]))return!0;return!1})(X,u.BAD_DELIMITERS)||-1<X.indexOf(I)||X.charAt(0)===" "||X.charAt(X.length-1)===" ")?A+X+A:X)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!i&&!!n.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=y,u.ParserHandle=m,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=p,u.ReadableStreamStreamer=g,n.jQuery&&((s=n.jQuery).fn.parse=function(k){var E=k.config||{},M=[];return this.each(function(q){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var A=0;A<this.files.length;A++)M.push({file:this.files[A],inputElem:this,instanceConfig:s.extend({},E)})}),z(),this;function z(){if(M.length===0)C(k.complete)&&k.complete();else{var q,A,U,K,G=M[0];if(C(k.before)){var Y=k.before(G.file,G.inputElem);if(typeof Y=="object"){if(Y.action==="abort")return q="AbortError",A=G.file,U=G.inputElem,K=Y.reason,void(C(k.error)&&k.error({name:q},A,U,K));if(Y.action==="skip")return void I();typeof Y.config=="object"&&(G.instanceConfig=s.extend(G.instanceConfig,Y.config))}else if(Y==="skip")return void I()}var H=G.instanceConfig.complete;G.instanceConfig.complete=function($){C(H)&&H($,G.file,G.inputElem),I()},u.parse(G.file,G.instanceConfig)}}function I(){M.splice(0,1),z()}}),o&&(n.onmessage=function(k){k=k.data,u.WORKER_ID===void 0&&k&&(u.WORKER_ID=k.workerId),typeof k.input=="string"?n.postMessage({workerId:u.WORKER_ID,results:u.parse(k.input,k.config),finished:!0}):(n.File&&k.input instanceof File||k.input instanceof Object)&&(k=u.parse(k.input,k.config))&&n.postMessage({workerId:u.WORKER_ID,results:k,finished:!0})}),(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(p.prototype)).constructor=p,(g.prototype=Object.create(d.prototype)).constructor=g,u})})(Rfe);var iut=Rfe.exports;const W1=qt(iut);function Hi(t){return t?t.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^>\s+/gm,"").replace(/^[\*\+]\s+/gm,"- ").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/\n{3,}/g,`

`).trim():""}async function aut(t,e,r){var C,k,E,M,z;const[n,s,i,o,l,c,u,d,h,f,p,g,m,v]=await Promise.all([be.from("theses").select("*").eq("user_id",t),be.from("chapters").select("*"),be.from("sections").select("*"),be.from("documents").select("id, title, original_filename, doi, isbn, citation_apa, page_count, created_at").eq("user_id",t),be.from("summaries").select("id, document_id, summary_text, summary_mode, citation_style, created_at").eq("user_id",t),be.from("theory_backgrounds").select("id, document_id, title, theory_text, mode, citation_style, created_at").eq("user_id",t),be.from("methods").select("id, document_id, title, method_text, mode, citation_style, created_at").eq("user_id",t),be.from("research_setups").select("*").eq("user_id",t),be.from("topic_explorations").select("*").eq("user_id",t),be.from("codebooks").select("*").eq("user_id",t),be.from("codebook_categories").select("*"),be.from("interviews").select("*").eq("user_id",t),be.from("coded_segments").select("*").eq("user_id",t),be.from("qualitative_summaries").select("*").eq("user_id",t)]),y=((C=n.data)==null?void 0:C.map(I=>I.id))||[],x=((k=s.data)==null?void 0:k.filter(I=>y.includes(I.thesis_id)))||[],b=x.map(I=>I.id),w=((E=i.data)==null?void 0:E.filter(I=>b.includes(I.chapter_id)))||[],j=((M=f.data)==null?void 0:M.map(I=>I.id))||[],N=((z=p.data)==null?void 0:z.filter(I=>j.includes(I.codebook_id)))||[];return{exportDate:new Date().toISOString(),version:"1.0",user:{id:t,email:e,nickname:r},thesis:{theses:n.data||[],chapters:x,sections:w},library:{documents:o.data||[],summaries:l.data||[],theoryBackgrounds:c.data||[],methods:u.data||[]},research:{researchSetups:d.data||[],topicExplorations:h.data||[]},qualitative:{codebooks:f.data||[],codebookCategories:N,interviews:g.data||[],codedSegments:m.data||[],qualitativeSummaries:v.data||[]}}}function out(t){const e=[`THESIS BACKUP
`];for(const r of t.thesis.theses){e.push(`${r.title}`),e.push(`Degree: ${r.degree==="bachelor"?"Bachelor":"Master"}`),r.due_date&&e.push(`Due Date: ${new Date(r.due_date).toLocaleDateString()}`),r.description&&e.push(`
${Hi(r.description)}`),e.push(`
---
`);const n=t.thesis.chapters.filter(s=>s.thesis_id===r.id).sort((s,i)=>s.order_index-i.order_index);for(let s=0;s<n.length;s++){const i=n[s];e.push(`${s+1}. ${i.title}
`);const o=t.thesis.sections.filter(l=>l.chapter_id===i.id).sort((l,c)=>l.order_index-c.order_index);for(let l=0;l<o.length;l++){const c=o[l],u=c.title||c.type;e.push(`${s+1}.${l+1} ${u}
`),e.push(Hi(c.content)||"[No content]"),e.push(`
`)}}e.push(`
---
`)}return e.join(`
`)}function lut(t){const e=[`SUMMARIES
`];for(const r of t.library.summaries){const n=t.library.documents.find(i=>i.id===r.document_id),s=(n==null?void 0:n.title)||(n==null?void 0:n.original_filename)||"Unknown Document";e.push(`${s}`),e.push(`Mode: ${r.summary_mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Hi(r.summary_text)||"[No summary text]"),e.push(`
---
`)}return e.join(`
`)}function cut(t){const e=[`THEORY BACKGROUNDS
`];for(const r of t.library.theoryBackgrounds)e.push(`${r.title||"Untitled"}`),e.push(`Mode: ${r.mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Hi(r.theory_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function uut(t){const e=[`METHODS
`];for(const r of t.library.methods)e.push(`${r.title||"Untitled"}`),e.push(`Mode: ${r.mode||"Standard"}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Hi(r.method_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function dut(t){const e=[`INTERVIEWS
`];for(const r of t.qualitative.interviews)e.push(`${r.title}`),r.source&&e.push(`Source: ${r.source}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Hi(r.raw_text)||"[No text]"),e.push(`
---
`);return e.join(`
`)}function hut(t){const e=[`RESEARCH SETUPS
`];for(const r of t.research.researchSetups)e.push(`${r.title}`),r.aim&&e.push(`Aim: ${Hi(r.aim)}`),r.degree&&e.push(`Degree: ${r.degree}`),r.discipline&&e.push(`Discipline: ${r.discipline}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),r.derived_research_questions&&(e.push("Research Questions"),(Array.isArray(r.derived_research_questions)?r.derived_research_questions:[]).forEach((s,i)=>{e.push(`${i+1}. ${Hi(s)}`)}),e.push("")),r.markdown_text&&(e.push("Full Content"),e.push(Hi(r.markdown_text))),e.push(`
---
`);return e.join(`
`)}function fut(t){const e=[`TOPIC EXPLORATIONS
`];for(const r of t.research.topicExplorations)e.push(`${r.title}`),r.degree_type&&e.push(`Degree: ${r.degree_type}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),r.problem_statement&&(e.push("Problem Statement"),e.push(Hi(r.problem_statement)),e.push("")),r.objectives&&(e.push("Objectives"),e.push(Hi(r.objectives)),e.push("")),r.introduction&&(e.push("Introduction"),e.push(Hi(r.introduction)),e.push("")),r.research_questions&&(e.push("Research Questions"),(Array.isArray(r.research_questions)?r.research_questions:[]).forEach((s,i)=>{e.push(`${i+1}. ${Hi(s)}`)}),e.push("")),e.push(`
---
`);return e.join(`
`)}function put(t){const e=[`QUALITATIVE SUMMARIES
`];for(const r of t.qualitative.qualitativeSummaries){const n=t.qualitative.codebooks.find(s=>s.id===r.codebook_id);e.push(`${r.title||"Untitled"}`),n&&e.push(`Codebook: ${n.title}`),e.push(`Created: ${new Date(r.created_at).toLocaleDateString()}`),e.push(""),e.push(Hi(r.summary_text)||"[No text]"),e.push(`
---
`)}return e.join(`
`)}async function mut(t,e,r){const n=r.qualitative.codebookCategories.filter(h=>h.codebook_id===t).sort((h,f)=>(h.order_index||0)-(f.order_index||0)),s=r.qualitative.codedSegments.filter(h=>h.codebook_id===t),i=[...new Set(s.map(h=>h.interview_id))],o=r.qualitative.interviews.filter(h=>i.includes(h.id)),c=[["Category","Definition","Coding Rule","Anchor Example",...o.map(h=>h.title)]];for(const h of n){const f=[(h.name||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.definition||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.coding_rule||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(h.anchor_example||"").replace(/\r?\n/g," ").replace(/"/g,'""').trim()];for(const p of o){const m=s.filter(v=>v.category_id===h.id&&v.interview_id===p.id).map(v=>v.snippet).join(" | ").replace(/"/g,'""').replace(/\r?\n/g," ").trim();f.push(m)}c.push(f)}const u=W1.unparse(c,{delimiter:";",quotes:!0,escapeFormulae:!0,newline:`\r
`});return{filename:`codebook_${e.replace(/[^a-zA-Z0-9_\-]/g,"_").substring(0,50)}.csv`,content:"\uFEFF"+u}}function gut(t){const e=new Date,r=e.toISOString().split("T")[0],n=e.toTimeString().split(":").slice(0,2).join(":");return`# Academly AI Backup

This backup contains all your data from Academly AI.

## Structure

- thesis/
  - thesis_content.txt - Your thesis drafts in readable format
  
- library/
  - summaries.txt - All document summaries
  - theory_backgrounds.txt - Theory background texts
  - methods.txt - Methodology texts
  
- research/
  - research_setups.txt - Research setup documents
  - topic_explorations.txt - Topic exploration notes
  
- qualitative/
  - interviews.txt - All interview transcripts
  - coding_summaries.txt - Qualitative analysis summaries
  - codebook_*.csv - Codebook grids (Excel compatible)

## Notes

- CSV files use semicolon (;) as delimiter for Excel compatibility
- All text files are UTF-8 encoded with BOM
- Dates are in ISO format (YYYY-MM-DD)

## Data Ownership

${t.user.nickname?`Dear ${t.user.nickname}, your`:"Your"} data belongs to you! This backup ensures you always have access to your work.

---

Generated by Academly AI
${r} ${n}
`}async function yut(t){const e=new sut;e.file("README.txt","\uFEFF"+gut(t));const r=e.folder("thesis");t.thesis.theses.length>0&&(r==null||r.file("thesis_content.txt","\uFEFF"+out(t)));const n=e.folder("library");t.library.summaries.length>0&&(n==null||n.file("summaries.txt","\uFEFF"+lut(t))),t.library.theoryBackgrounds.length>0&&(n==null||n.file("theory_backgrounds.txt","\uFEFF"+cut(t))),t.library.methods.length>0&&(n==null||n.file("methods.txt","\uFEFF"+uut(t)));const s=e.folder("research");t.research.researchSetups.length>0&&(s==null||s.file("research_setups.txt","\uFEFF"+hut(t))),t.research.topicExplorations.length>0&&(s==null||s.file("topic_explorations.txt","\uFEFF"+fut(t)));const i=e.folder("qualitative");t.qualitative.interviews.length>0&&(i==null||i.file("interviews.txt","\uFEFF"+dut(t))),t.qualitative.qualitativeSummaries.length>0&&(i==null||i.file("coding_summaries.txt","\uFEFF"+put(t)));for(const o of t.qualitative.codebooks){const l=await mut(o.id,o.title,t);i==null||i.file(l.filename,l.content)}return await e.generateAsync({type:"blob",compression:"DEFLATE"})}const vut=[{value:"education",label:{de:"Bildungswissenschaften",en:"Education"}},{value:"arts_humanities",label:{de:"Kunst & Geisteswissenschaften",en:"Arts & Humanities"}},{value:"social_sciences",label:{de:"Sozialwissenschaften",en:"Social Sciences"}},{value:"business",label:{de:"Wirtschaftswissenschaften",en:"Business & Economics"}},{value:"law",label:{de:"Rechtswissenschaften",en:"Law"}},{value:"natural_sciences",label:{de:"Naturwissenschaften",en:"Natural Sciences"}},{value:"ict",label:{de:"Informatik & IT",en:"ICT"}},{value:"engineering",label:{de:"Ingenieurwissenschaften",en:"Engineering"}},{value:"health",label:{de:"Gesundheitswissenschaften",en:"Health Sciences"}},{value:"agriculture",label:{de:"Agrarwissenschaften",en:"Agriculture"}},{value:"services",label:{de:"Dienstleistungen",en:"Services"}}],xut=[{value:"DE",label:"🇩🇪 Deutschland"},{value:"AT",label:"🇦🇹 Österreich"},{value:"CH",label:"🇨🇭 Schweiz"},{value:"US",label:"🇺🇸 USA"},{value:"GB",label:"🇬🇧 UK"},{value:"FR",label:"🇫🇷 Frankreich"},{value:"ES",label:"🇪🇸 Spanien"},{value:"IT",label:"🇮🇹 Italien"},{value:"NL",label:"🇳🇱 Niederlande"},{value:"BE",label:"🇧🇪 Belgien"},{value:"SE",label:"🇸🇪 Schweden"},{value:"NO",label:"🇳🇴 Norwegen"},{value:"DK",label:"🇩🇰 Dänemark"},{value:"FI",label:"🇫🇮 Finnland"},{value:"PL",label:"🇵🇱 Polen"},{value:"CZ",label:"🇨🇿 Tschechien"},{value:"OTHER",label:"🌍 Andere"}],but=[{value:"bachelor",label:{de:"Bachelor",en:"Bachelor"}},{value:"master",label:{de:"Master",en:"Master"}},{value:"phd",label:{de:"Promotion/PhD",en:"PhD"}},{value:"postdoc",label:{de:"Postdoc",en:"Postdoc"}},{value:"other",label:{de:"Sonstiges",en:"Other"}}],wut=[{value:"qualitative",label:{de:"Qualitativ",en:"Qualitative"}},{value:"quantitative",label:{de:"Quantitativ",en:"Quantitative"}},{value:"mixed",label:{de:"Mixed Methods",en:"Mixed Methods"}}],_ut=[{value:"de",label:"🇩🇪 Deutsch"},{value:"en",label:"🇬🇧 English"},{value:"fr",label:"🇫🇷 Français"},{value:"es",label:"🇪🇸 Español"},{value:"it",label:"🇮🇹 Italiano"}],jut=({initialData:t,onUpdate:e,disabled:r})=>{var f;const[n,s]=S.useState(t),[i,o]=S.useState(""),l=(p,g)=>{const m={...n,[p]:g};s(m),e({[p]:g})},c=()=>{if(!i.trim())return;const p=[...n.research_interests||[],i.trim()];l("research_interests",p),o("")},u=p=>{const g=[...n.research_interests||[]];g.splice(p,1),l("research_interests",g)},d=n.preferred_language||"de",h=p=>p[d]||p.de;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Country of Study"}),a.jsxs(it,{value:n.study_country||"",onValueChange:p=>l("study_country",p),disabled:r,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select country"})}),a.jsx(nt,{children:xut.map(p=>a.jsx(Te,{value:p.value,children:p.label},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Degree Type"}),a.jsxs(it,{value:n.degree_type||"",onValueChange:p=>l("degree_type",p),disabled:r,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select degree"})}),a.jsx(nt,{children:but.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Discipline"}),a.jsxs(it,{value:n.discipline||"",onValueChange:p=>l("discipline",p),disabled:r,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Discipline auswählen"})}),a.jsx(nt,{children:vut.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"University (optional)"}),a.jsx(Be,{value:n.university||"",onChange:p=>l("university",p.target.value),placeholder:"z.B. University Stanford",disabled:r})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Primary Methodology"}),a.jsxs(it,{value:n.methodology||"",onValueChange:p=>l("methodology",p),disabled:r,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select methodology"})}),a.jsx(nt,{children:wut.map(p=>a.jsx(Te,{value:p.value,children:h(p.label)},p.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Preferred Language"}),a.jsxs(it,{value:n.preferred_language||"en",onValueChange:p=>l("preferred_language",p),disabled:r,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select language"})}),a.jsx(nt,{children:_ut.map(p=>a.jsx(Te,{value:p.value,children:p.label},p.value))})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Research Interests"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{value:i,onChange:p=>o(p.target.value),onKeyDown:p=>p.key==="Enter"&&(p.preventDefault(),c()),placeholder:"z.B. Künstliche Intelligenz",disabled:r}),a.jsx("button",{onClick:c,disabled:r||!i.trim(),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 disabled:opacity-50",children:"+"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(f=n.research_interests)==null?void 0:f.map((p,g)=>a.jsxs(gt,{variant:"secondary",className:"gap-1",children:[p,!r&&a.jsx(Rs,{className:"w-3 h-3 cursor-pointer",onClick:()=>u(g)})]},g))})]})]})},Sut=()=>{const{user:t,userProfile:e,researchProfile:r,studentPoints:n,loading:s,signOut:i,updateResearchProfile:o,uploadAvatar:l,selectPublicAvatar:c}=Pt(),{openCustomerPortal:u,loading:d}=lue(),h=wr(),[f,p]=S.useState(""),[g,m]=S.useState(""),[v,y]=S.useState(!1),[x,b]=S.useState(""),[w,j]=S.useState(""),[N,C]=S.useState(""),[k,E]=S.useState(!1),[M,z]=S.useState(null),[I,q]=S.useState(!1),[A,U]=S.useState(""),[K,G]=S.useState(!1),[Y,H]=S.useState(""),[$,L]=S.useState(!1),[F,W]=S.useState(!1),[X,oe]=S.useState(null);S.useEffect(()=>{const D=localStorage.getItem("lastBackupDate");D&&z(D)},[]),S.useEffect(()=>{(async()=>{if(!(r!=null&&r.avatar_url)){oe(null);return}const ne=await Iy(r.avatar_url);oe(ne)})()},[r==null?void 0:r.avatar_url]),S.useEffect(()=>{!t&&!s?h("/login"):t&&p(t.email||""),r!=null&&r.nickname&&m(r.nickname)},[t,r,s,h]);const le=async()=>{if(w!==N){Fe.error("Passwords do not match");return}if(w.length<6){Fe.error("Password must be at least 6 characters");return}Fe.success("Password updated successfully"),b(""),j(""),C("")},B=async()=>{if(!t||Y!==t.email){Fe.error("Please enter your email address correctly to confirm deletion");return}q(!0);try{U("Canceling subscription...");const{data:D,error:ne}=await be.functions.invoke("delete-account");if(ne)throw console.error("Delete account error:",ne),new Error(ne.message||"Failed to delete account");if(D!=null&&D.error)throw new Error(D.error);Fe.success("Account successfully deleted. Goodbye!"),await i(),h("/")}catch(D){console.error("Delete account error:",D),Fe.error("Failed to delete account: "+(D.message||"Unknown error")),q(!1),U("")}},R=()=>{G(!1),H(""),L(!1)},ee=async()=>{if(g.trim()){y(!0);try{await o({nickname:g.trim()}),Fe.success("Nickname updated")}catch{Fe.error("Failed to update nickname")}finally{y(!1)}}},te=async D=>await l(D),Z=async D=>{await c(D)},J=async D=>{try{await o(D)}catch{Fe.error("Failed to update profile")}},he=async()=>{if(t){E(!0);try{const D=await aut(t.id,t.email||"",(r==null?void 0:r.nickname)||void 0),ne=await yut(D),ue=new Date().toISOString().split("T")[0],re=r!=null&&r.nickname?`${r.nickname}_Backup_${ue}.zip`:`User_Backup_${ue}.zip`,pe=URL.createObjectURL(ne),xe=document.createElement("a");xe.href=pe,xe.download=re,document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),URL.revokeObjectURL(pe);const ye=new Date().toISOString();localStorage.setItem("lastBackupDate",ye),z(ye),Fe.success("Backup created successfully!")}catch(D){console.error("Backup error:",D),Fe.error("Failed to create backup.")}finally{E(!1)}}};if(s)return a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t||!e)return null;const P=(n==null?void 0:n.total)||0,ie=(n==null?void 0:n.used)||0,V=(n==null?void 0:n.remaining)||0,O=P>0?Math.round(ie/P*100):0,T=new Date(e.created_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Manage Account"}),a.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings and profile"})]}),a.jsx(Me,{children:a.jsx($e,{className:"pt-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[a.jsxs("div",{onClick:()=>W(!0),className:"cursor-pointer group",children:[a.jsx("div",{className:"relative w-24 h-24 rounded-full overflow-hidden bg-muted border-2 border-transparent group-hover:border-primary transition-all",children:X?a.jsx("img",{src:X,alt:"Profile",className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a.jsx(Ij,{className:"w-12 h-12 text-muted-foreground"})})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center group-hover:text-primary transition-colors",children:"Click to change"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm font-medium",children:"Profile Picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose a default avatar or upload your own (max 2MB)"})]})]}),a.jsx(Vr,{open:F,onOpenChange:W,children:a.jsxs(Rr,{className:"sm:max-w-[840px]",children:[a.jsxs(Mr,{children:[a.jsx(Dr,{children:"Choose Your Avatar"}),a.jsx(g0,{children:"Select a default avatar or upload your own"})]}),a.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:a.jsx(oue,{currentAvatarUrl:(r==null?void 0:r.avatar_url)||null,onSelectPublic:Z,onUploadCustom:te})})]})}),a.jsx(Es,{}),a.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-4",children:[a.jsxs("div",{className:"flex gap-2 flex-1",children:[a.jsx(Be,{placeholder:"Nickname (optional)",value:g,onChange:D=>m(D.target.value),className:"max-w-xs"}),a.jsx(ve,{onClick:ee,disabled:v||!g.trim(),children:"Save"})]}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[f," • Member since ",T]})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Research Profile"}),a.jsx(fn,{children:"Optional information for personalization and analytics (GDPR compliant)"})]}),a.jsx($e,{children:a.jsx(jut,{initialData:{study_country:(r==null?void 0:r.study_country)||null,degree_type:(r==null?void 0:r.degree_type)||null,discipline:(r==null?void 0:r.discipline)||null,research_interests:(r==null?void 0:r.research_interests)||null,university:(r==null?void 0:r.university)||null,methodology:(r==null?void 0:r.methodology)||null,preferred_language:(r==null?void 0:r.preferred_language)||null},onUpdate:J})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Oxe,{className:"h-5 w-5"}),"Subscription & Credits"]}),a.jsx(fn,{children:"Your plan and Student Points"})]}),a.jsx($e,{children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"Current Plan"}),a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-2xl font-bold capitalize",children:e.plan==="starter"?"Free":e.plan||"Free"}),e.subscription_status==="active"&&a.jsx(gt,{variant:"default",className:"bg-green-500/10 text-green-600 border-green-500/20",children:"Active"}),e.subscription_status==="canceled"&&a.jsx(gt,{variant:"secondary",className:"bg-amber-500/10 text-amber-600 border-amber-500/20",children:"Canceled"}),e.subscription_status==="past_due"&&a.jsx(gt,{variant:"destructive",children:"Past Due"})]}),e.subscription_ends_at&&a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:e.subscription_status==="canceled"?`Access until ${new Date(e.subscription_ends_at).toLocaleDateString("en-US")}`:`Next billing: ${new Date(e.subscription_ends_at).toLocaleDateString("en-US")}`}),a.jsx("div",{className:"flex gap-2",children:e.stripe_subscription_id?a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>u(),disabled:d,children:[d?a.jsx(Et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Manage Subscription"]}):a.jsx(ve,{variant:"outline",size:"sm",onClick:()=>h("/pricing"),children:"Upgrade Plan"})})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Student Points"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Purchased"}),a.jsxs("p",{className:"text-lg font-bold",children:[P.toLocaleString("en-US")," SP"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Used"}),a.jsxs("p",{className:"text-lg font-bold",children:[ie.toLocaleString("en-US",{maximumFractionDigits:1})," SP"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Remaining"}),a.jsxs("p",{className:"text-lg font-bold text-primary",children:[V.toLocaleString("en-US",{maximumFractionDigits:1})," SP"]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(rS,{value:O}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[O,"% used • 1 SP = $0.001"]})]})]})]})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(FF,{className:"h-5 w-5"}),"Change Password"]}),a.jsx(fn,{children:"Update your password for security"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"current-password",children:"Current Password"}),a.jsx(Be,{id:"current-password",type:"password",value:x,onChange:D=>b(D.target.value)})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"new-password",children:"New Password"}),a.jsx(Be,{id:"new-password",type:"password",value:w,onChange:D=>j(D.target.value)})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"confirm-password",children:"Confirm Password"}),a.jsx(Be,{id:"confirm-password",type:"password",value:N,onChange:D=>C(D.target.value)})]})]}),a.jsx(ve,{onClick:le,children:"Update Password"})]})]}),e.stripe_subscription_id&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Billing & Invoices"}),a.jsx(fn,{children:"Manage your payment methods and view invoices"})]}),a.jsx($e,{className:"space-y-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:a.jsx("p",{children:"Access your complete billing history and manage payment methods through the Stripe Customer Portal."})}),a.jsxs(ve,{variant:"outline",onClick:()=>u(),disabled:d,children:[d?a.jsx(Et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Open Billing Portal"]})]})})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx($xe,{className:"h-5 w-5"}),"Data Backup"]}),a.jsx(fn,{children:"Download a complete backup of all your data. Your data belongs to you."})]}),a.jsx($e,{className:"space-y-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Includes: Thesis drafts, library documents, summaries, research setups, qualitative coding data (as CSV), and all notes."}),M&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(s0,{className:"h-3 w-3"}),"Last backup:"," ",new Date(M).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(ve,{onClick:he,disabled:k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 animate-spin mr-2"}),"Creating Backup..."]}):a.jsxs(a.Fragment,{children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"Download Backup"]})})]})})]}),a.jsxs(Me,{className:"border-destructive",children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2 text-destructive",children:[a.jsx(As,{className:"h-5 w-5"}),"Danger Zone"]}),a.jsx(fn,{children:"These actions are irreversible. Please be careful."})]}),a.jsx($e,{children:a.jsxs(wi,{open:$,onOpenChange:D=>{I||(L(D),D||R())},children:[a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"destructive",children:"Delete Account"})}),a.jsxs(Qs,{className:"max-w-lg",children:[a.jsxs(Zs,{children:[a.jsxs(ei,{className:"flex items-center gap-2 text-destructive",children:[a.jsx(Pa,{className:"h-5 w-5"}),"Delete Account Permanently"]}),a.jsx(ti,{asChild:!0,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{children:["This action is ",a.jsx("strong",{className:"text-foreground",children:"irreversible"}),". The following will be permanently deleted:"]}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1",children:[a.jsx("li",{children:"All documents and PDFs"}),a.jsx("li",{children:"All summaries and analyses"}),a.jsx("li",{children:"All thesis drafts and chapters"}),a.jsx("li",{children:"Research setups and topic explorations"}),a.jsx("li",{children:"Qualitative coding data (interviews, codebooks)"}),a.jsx("li",{children:"Your profile and account data"})]}),a.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/50 p-3 rounded-md border border-amber-200 dark:border-amber-800",children:a.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[a.jsx("strong",{children:"Tip:"})," Download a backup of your data before deleting your account."]})}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(go,{id:"confirm-delete",checked:K,onCheckedChange:D=>G(D===!0),disabled:I}),a.jsx(_e,{htmlFor:"confirm-delete",className:"text-sm leading-tight cursor-pointer",children:"I understand that all my data will be permanently deleted and this action cannot be undone"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"confirm-email",children:"Type your email to confirm:"}),a.jsx(Be,{id:"confirm-email",placeholder:(t==null?void 0:t.email)||"",value:Y,onChange:D=>H(D.target.value),disabled:I,className:"font-mono text-sm"})]})]})})]}),a.jsxs(Js,{children:[a.jsx(Is,{disabled:I,children:"Cancel"}),a.jsx(ve,{variant:"destructive",onClick:B,disabled:!K||Y!==(t==null?void 0:t.email)||I,children:I?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 animate-spin mr-2"}),A||"Deleting..."]}):"Delete Account Permanently"})]})]})]})})]})]})})};async function Mfe(t){const e={kind:"generic"};try{if((t==null?void 0:t.name)==="FunctionsHttpError"&&(t==null?void 0:t.context)instanceof Response){const n=t.context,s=n.status,i=await n.clone().text(),o=i.toLowerCase();if(s===429||o.includes("429")||o.includes("tpm")||o.includes("too large")||o.includes("tokens per min")||o.includes("request too large")||o.includes("rate_limit")||o.includes("context_length_exceeded")||o.includes("maximum context length"))return{kind:"page_limit",status:s,serverMessage:i};if(s===401||s===403)return{kind:"unauthorized",status:s,serverMessage:i};try{const l=JSON.parse(i),c=l.error||l.details||l.message||"",u=c.toLowerCase();if(u.includes("429")||u.includes("tpm")||u.includes("too large")||u.includes("tokens per min")||u.includes("rate_limit"))return{kind:"page_limit",status:s,serverMessage:c}}catch{}return{kind:"generic",status:s,serverMessage:i}}const r=((t==null?void 0:t.message)||"").toLowerCase();if(r.includes("429")||r.includes("tpm")||r.includes("too large")||r.includes("tokens per min")||r.includes("request too large"))return{kind:"page_limit",serverMessage:t==null?void 0:t.message}}catch(r){console.error("Error parsing edge function error:",r)}return e}const yK=t=>t.is_extracted===!0?!0:t.page_count==null||t.extracted_pages==null?!1:t.page_count-t.extracted_pages<3;function Dfe({documents:t,selectedDocuments:e,onToggle:r,onUploadClick:n,emptyMessage:s="No documents available.",uploadLabel:i="Upload Document",className:o}){const l=wr(),[c,u]=S.useState(null),d=()=>{t.forEach(g=>{e.includes(g.id)||r(g.id)})},h=()=>{e.forEach(g=>r(g))},f=g=>{!yK(g)&&!e.includes(g.id)?u(g):r(g.id)},p=()=>{c&&l(`/pdf-extract?document=${c.id}`),u(null)};return t.length===0?a.jsx("div",{className:Oe("rounded-xl border border-border/50 bg-muted/30 p-6",o),children:a.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-3",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx(Ir,{className:"h-6 w-6 text-muted-foreground"})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s}),n&&a.jsx(ve,{variant:"outline",size:"sm",onClick:n,children:i})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Oe("space-y-3",o),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.length," of ",t.length," selected"]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsxs(ve,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:d,disabled:e.length===t.length,children:[a.jsx(Gs,{className:"h-3 w-3 mr-1"}),"All"]}),a.jsxs(ve,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:h,disabled:e.length===0,children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),"None"]})]})]}),a.jsx(Yj,{className:"h-[280px] rounded-xl border border-border/50 bg-gradient-to-b from-background to-muted/20",children:a.jsx("div",{className:"p-2 space-y-0.5",children:t.map(g=>{const m=e.includes(g.id),v=yK(g);return a.jsxs("label",{htmlFor:`doc-${g.id}`,className:Oe("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer transition-all duration-200","hover:bg-primary/5 group",m&&"bg-primary/10 border border-primary/20"),onClick:y=>{y.preventDefault(),f(g)},children:[a.jsx(go,{id:`doc-${g.id}`,checked:m,onCheckedChange:()=>f(g),className:"h-3.5 w-3.5 data-[state=checked]:bg-primary data-[state=checked]:border-primary",onClick:y=>y.stopPropagation()}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5",children:[a.jsx(Ir,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:Oe("text-xs font-medium truncate transition-colors",m?"text-foreground":"text-muted-foreground group-hover:text-foreground"),children:g.title||g.original_filename}),a.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:["(",g.page_count||"?"," pages)"]}),!v&&a.jsx(Si,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Pa,{className:"w-3 h-3 text-destructive shrink-0"})}),a.jsx(Vt,{children:a.jsxs("p",{children:["Document needs extraction (",g.extracted_pages||0,"/",g.page_count||"?",")"]})})]})})]})]},g.id)})})})]}),a.jsx(wi,{open:!!c,onOpenChange:g=>!g&&u(null),children:a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsxs(ei,{className:"flex items-center gap-2",children:[a.jsx(Pa,{className:"h-5 w-5 text-destructive"}),"Document Not Extracted"]}),a.jsxs(ti,{className:"space-y-2",children:[a.jsxs("p",{children:["The document ",a.jsxs("strong",{children:['"',(c==null?void 0:c.title)||(c==null?void 0:c.original_filename),'"']})," has not been fully extracted yet."]}),a.jsxs("p",{children:["Only ",(c==null?void 0:c.extracted_pages)||0," of ",(c==null?void 0:c.page_count)||"?"," pages have been processed. Text content from unextracted pages will not be available for AI processing."]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Please extract the document first to ensure all pages are available."})]})]}),a.jsxs(Js,{className:"flex-col sm:flex-row gap-2",children:[a.jsx(Is,{children:"Cancel"}),a.jsx(ve,{variant:"outline",onClick:()=>{c&&r(c.id),u(null)},children:"Use Anyway"}),a.jsx(Cs,{onClick:p,children:"Extract Now"})]})]})})]})}const Nut=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n,fetchStudentPoints:s}=Pt(),[i,o]=S.useState(!1),l=wr(),{toast:c}=vn(),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState({}),[m,v]=S.useState({}),[y,x]=S.useState(""),[b,w]=S.useState("small"),[j,N]=S.useState("en"),[C,k]=S.useState("fox41"),[E,M]=S.useState(null),[z,I]=S.useState("APA7"),[q,A]=S.useState(!1),[U,K]=S.useState(null),[G,Y]=S.useState(null),[H,$]=S.useState(!1),[L,F]=S.useState([]),[W,X]=S.useState(""),[oe,le]=S.useState([]),[B,R]=S.useState(!1),[ee,te]=S.useState(""),[Z,J]=S.useState(""),[he,P]=S.useState(!1);S.useEffect(()=>{!t&&!e&&l("/login")},[t,e,l]),S.useEffect(()=>{t&&(T(),ie())},[t]),S.useEffect(()=>{W?V():(le([]),te(""))},[W]);const ie=async()=>{const{data:de}=await be.from("theses").select("id, title").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});F(de||[])},V=async()=>{const{data:de}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",W).order("order_index");le(de||[])},O=async()=>{if(!(!ee||!U)){P(!0);try{const{data:de}=await be.from("sections").select("order_index").eq("chapter_id",ee).order("order_index",{ascending:!1}).limit(1),ge=de!=null&&de.length?de[0].order_index+1:0;await be.from("sections").insert({chapter_id:ee,content:U.content,title:Z.trim()||null,type:"other",order_index:ge,status:"open"}),c({title:"Successfully imported",description:"Saved as section in chapter."}),R(!1),J(""),te("")}catch{c({title:"Error with Import",variant:"destructive"})}finally{P(!1)}}},T=async()=>{try{const{data:de,error:ge}=await be.from("v_documents_with_status").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(ge)throw ge;d(de||[])}catch(de){console.error("Error loading documents:",de),c({title:"Error",description:"Could not load documents.",variant:"destructive"})}},D=async de=>{var je,Se;const{data:ge}=await be.from("pages").select("page_number").eq("document_id",de).order("page_number",{ascending:!0}).limit(1),{data:we}=await be.from("pages").select("page_number").eq("document_id",de).order("page_number",{ascending:!1}).limit(1);return{min:((je=ge==null?void 0:ge[0])==null?void 0:je.page_number)??1,max:((Se=we==null?void 0:we[0])==null?void 0:Se.page_number)??1}},ne=async de=>{if(h.includes(de))f(we=>we.filter(je=>je!==de)),g(we=>{const je={...we};return delete je[de],je}),v(we=>{const je={...we};return delete je[de],je});else{const we=await D(de);v(je=>({...je,[de]:we})),f(je=>[...je,de]),g(je=>({...je,[de]:{from:we.min,to:Math.min(we.max,we.min+14)}}))}},ue=()=>h.reduce((de,ge)=>{const we=p[ge];return we?de+(we.to-we.from+1):de},0),re=(de,ge=40)=>de.length>ge?de.substring(0,ge)+"...":de,pe=(de,ge,we)=>{const je=m[de]||{min:1,max:999},Se=p[de]||{from:je.min,to:Math.min(je.max,je.min+14)};let Ue=ge==="from"?we:Se.from,Ae=ge==="to"?we:Se.to;Ue=Math.max(je.min,Math.min(Ue,je.max)),Ae=Math.max(je.min,Math.min(Ae,je.max)),ge==="from"&&Ue>Ae&&(Ae=Ue),ge==="to"&&Ae<Ue&&(Ue=Ae),g(fe=>({...fe,[de]:{from:Ue,to:Ae}}))},xe=async()=>{var de,ge,we;if(!r()){o(!0);return}if(h.length===0){c({title:"Error",description:"Please select at least one document.",variant:"destructive"});return}if(y.length<5){c({title:"Error",description:"Topic must be at least 5 characters.",variant:"destructive"});return}A(!0);try{const je=C==="fox40"?"thesis_builder_fox40":"thesis_builder",{data:Se,error:Ue}=await be.functions.invoke(je,{body:{document_ids:h,page_ranges:p,topic:y,mode:b,language:j,citation_style:z,save_pdf:!1}});if(Ue)throw Ue;if((Se==null?void 0:Se.error)==="rate_limit"){const Ae=Se.retry_after||10;M(Ae);let fe=Ae;const Ee=setInterval(()=>{fe-=1,M(fe),fe<=0&&(clearInterval(Ee),M(null),A(!1),xe())},1e3);return}K(Se),$(!0),c({title:"Success",description:"Theory & Background generated!"}),t&&(await new Promise(Ae=>setTimeout(Ae,4e3)),await s(t.id)),Y({prompt:((de=Se==null?void 0:Se.usage)==null?void 0:de.prompt_tokens)??void 0,completion:((ge=Se==null?void 0:Se.usage)==null?void 0:ge.completion_tokens)??void 0,total:((we=Se==null?void 0:Se.usage)==null?void 0:we.total_tokens)??void 0}),$(!0),c({title:"Success",description:"Theory & Background generated!"})}catch(je){console.error("Error generating thesis:",je);const Se=await Mfe(je);Se.kind==="page_limit"?c({title:"Processing Limit Reached",description:"The document could not be processed due to page limits. Please try using fewer pages by adjusting the page selector or selecting fewer documents.",variant:"destructive"}):Se.kind==="unauthorized"?c({title:"Session Expired",description:"Your session has expired. Please log in again.",variant:"destructive"}):c({title:"Error",description:"Something went wrong while generating the text. Please try again in a moment.",variant:"destructive"})}finally{A(!1)}},ye=async de=>{try{await navigator.clipboard.writeText(de),c({title:"Copied",description:"Text copied to clipboard."})}catch{c({title:"Error",description:"Could not copy text.",variant:"destructive"})}},ae=()=>{l("/documents")};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Theory & Background"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate academic paragraphs from your documents with automatic citations."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Paragraph Configuration"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Documents *"}),a.jsx(Dfe,{documents:u,selectedDocuments:h,onToggle:ne,onUploadClick:()=>l("/summary"),emptyMessage:"No documents available.",uploadLabel:"Upload Document"})]}),h.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Page Selection"}),a.jsxs("span",{className:`text-xs ${ue()>15?"text-red-500 font-medium":"text-muted-foreground"}`,children:[ue()," / 15 pages selected"]})]}),a.jsx("div",{className:"space-y-2",children:h.map(de=>{const ge=u.find(Ae=>Ae.id===de);if(!ge)return null;const we=p[de]||{from:1,to:Math.min(ge.page_count||1,15)},je=m[de]||{min:1,max:ge.page_count||1},Se=re(ge.title||ge.original_filename||"Document"),Ue=we.to-we.from+1;return a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md",children:[a.jsx("span",{className:"text-xs text-muted-foreground flex-1 truncate",title:ge.title||ge.original_filename,children:Se}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"p."}),a.jsx(Be,{type:"number",min:je.min,max:je.max,value:we.from,onChange:Ae=>{const fe=parseInt(Ae.target.value);isNaN(fe)||g(Ee=>({...Ee,[de]:{...Ee[de],from:fe}}))},onBlur:Ae=>pe(de,"from",parseInt(Ae.target.value)||je.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"–"}),a.jsx(Be,{type:"number",min:je.min,max:je.max,value:we.to,onChange:Ae=>{const fe=parseInt(Ae.target.value);isNaN(fe)||g(Ee=>({...Ee,[de]:{...Ee[de],to:fe}}))},onBlur:Ae=>pe(de,"to",parseInt(Ae.target.value)||je.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",je.max]}),a.jsxs(gt,{variant:Ue>15?"destructive":"secondary",className:"text-xs ml-1",children:[Ue,"p"]})]})]},de)})}),ue()>15&&a.jsxs(td,{className:"border-red-500/50 bg-red-500/10",children:[a.jsx(Pa,{className:"h-4 w-4 text-red-600"}),a.jsx(rd,{className:"text-red-700 dark:text-red-400 text-xs",children:"Maximum 15 pages total across all documents. Please reduce your selection."})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"topic",children:"Topic / Research Question *"}),a.jsx(Wt,{id:"topic",value:y,onChange:de=>x(de.target.value),className:"min-h-[100px]",placeholder:"Describe your topic or research question..."}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.length,"/5 characters (minimum 5 required)"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(it,{value:b,onValueChange:w,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"small",children:"Short (300 Tokens)"}),a.jsx(Te,{value:"medium",children:"Medium (600 Tokens)"}),a.jsx(Te,{value:"big",children:"Long (1200 Tokens)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:j,onValueChange:N,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Citation Style"}),a.jsxs(it,{value:z,onValueChange:I,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"APA7",children:"APA7"}),a.jsx(Te,{value:"Harvard",children:"Harvard"}),a.jsx(Te,{value:"Chicago",children:"Chicago"}),a.jsx(Te,{value:"MLA",children:"MLA"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"AI Model"}),a.jsx(Si,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.0:"})," Faster, lower SP consumption"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.1:"})," Higher quality, more SP consumption"]})]})]})})]}),a.jsxs(it,{value:C,onValueChange:k,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"fox41",children:"Fox 4.1 — Advanced"}),a.jsx(Te,{value:"fox40",children:"Fox 4.0 — Fast"})]})]})]}),a.jsx(ve,{onClick:xe,disabled:q||h.length===0||y.length<5||ue()>15,className:"w-full",children:E!==null?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Retrying in ",E,"s..."]}):q?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):"Generate Paragraph"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx($e,{children:U?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg mb-2",children:U.title}),a.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:h.map(de=>{const ge=u.find(we=>we.id===de);return ge?a.jsx(gt,{variant:"secondary",className:"text-xs",children:ge.title||ge.original_filename},de):null})}),a.jsxs(gt,{variant:"outline",className:"text-xs",children:[b.charAt(0).toUpperCase()+b.slice(1)," | ",z," |"," ",new Date().toLocaleDateString("en-US")]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Generated Text"}),a.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap",children:U.content.split(/Originaltextstellen:|Proof of Material:|Original quotes:/)[0].split("---")[0].trim()})]}),(U.content.includes("Originaltextstellen")||U.content.includes("Proof of Material")||U.content.includes("Original quotes"))&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-semibold mb-3 flex items-center gap-2",children:[a.jsx(a0,{className:"h-4 w-4"}),"Original Quotes",a.jsx(gt,{variant:"outline",className:"text-xs font-normal",children:"Original Language"})]}),a.jsx("div",{className:"space-y-2",children:(()=>{var je,Se,Ue,Ae;let de=U.content.split("Originaltextstellen:")[1];de||(de=U.content.split("Original quotes:")[1]),de||(de=U.content.split("Proof of Material:")[1]);const ge=(Ae=(Ue=(Se=(je=de==null?void 0:de.split("---")[0])==null?void 0:je.split("=== APA7 Literatur ===")[0])==null?void 0:Se.split("## Literaturverzeichnis")[0])==null?void 0:Ue.split("## References")[0])==null?void 0:Ae.trim();if(!ge)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"No original quotes available"});const we=ge.split(/\n(?=["„]|[A-Z][a-zäöü]+,?\s+\d{4})/).filter(fe=>fe.trim());return we.length>0?we.map((fe,Ee)=>a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:fe.trim()})},Ee)):a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:ge})})})()})]})]}),(U.content.includes("Literaturverzeichnis")||U.content.includes("=== APA7 Literatur ===")||U.content.includes("References"))&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"References"}),a.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap bg-muted p-3 rounded-md text-sm",children:(()=>{let de=U.content.split("=== APA7 Literatur ===")[1];return de||(de=U.content.split("## Literaturverzeichnis")[1]),de||(de=U.content.split("## References")[1]),(de==null?void 0:de.trim())||(Array.isArray(U.literature)?U.literature.join(`
`):U.literature)})()})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>ye(U.content),children:[a.jsx(yn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>R(!0),disabled:!U,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsxs(ve,{variant:"outline",size:"sm",disabled:!0,className:"opacity-50 cursor-not-allowed",children:[a.jsx(Ir,{className:"mr-2 h-4 w-4"}),"Create PDF (disabled)"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:ae,children:[a.jsx(Ir,{className:"mr-2 h-4 w-4"}),"View in Library"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ir,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Configure the parameters on the left and click "Generate Paragraph".'})]})})]})]})]}),a.jsx(Vr,{open:B,onOpenChange:R,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Als Section importieren"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis"}),a.jsxs(it,{value:W,onValueChange:X,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis..."})}),a.jsx(nt,{children:L.map(de=>a.jsx(Te,{value:de.id,children:de.title},de.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(it,{value:ee,onValueChange:te,disabled:!W,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:W?"Select chapter...":"Select thesis first"})}),a.jsx(nt,{children:oe.map(de=>a.jsx(Te,{value:de.id,children:de.title},de.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section-Titel (optional)"}),a.jsx(Be,{value:Z,onChange:de=>J(de.target.value),placeholder:"z.B. Theoretischer Hintergrund"})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>R(!1),children:"Abbrechen"}),a.jsx(ve,{onClick:O,disabled:!ee||he,children:he?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Importiere..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Importieren"]})})]})]})}),a.jsx(Tc,{open:i,onClose:()=>o(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},Aut=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n,fetchStudentPoints:s}=Pt(),[i,o]=S.useState(!1),l=wr(),{toast:c}=vn(),[u,d]=S.useState([]),[h,f]=S.useState([]),[p,g]=S.useState({}),[m,v]=S.useState({}),[y,x]=S.useState("fox41"),[b,w]=S.useState(null),[j,N]=S.useState(""),[C,k]=S.useState("de"),[E,M]=S.useState("APA7"),[z,I]=S.useState(""),[q,A]=S.useState("small"),[U,K]=S.useState(0),[G,Y]=S.useState(null),[H,$]=S.useState(!1),[L,F]=S.useState(!1),[W,X]=S.useState(null),[oe,le]=S.useState([]),[B,R]=S.useState(""),[ee,te]=S.useState([]),[Z,J]=S.useState(!1),[he,P]=S.useState(""),[ie,V]=S.useState(""),[O,T]=S.useState(!1);S.useEffect(()=>{!t&&!e&&l("/login")},[t,e,l]),S.useEffect(()=>{t&&(we(),D())},[t]),S.useEffect(()=>{B?ne():(te([]),P(""))},[B]);const D=async()=>{const{data:Ne}=await be.from("theses").select("id, title").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});le(Ne||[])},ne=async()=>{const{data:Ne}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",B).order("order_index");te(Ne||[])},ue=async()=>{if(!(!he||!W)){T(!0);try{const{data:Ne}=await be.from("sections").select("order_index").eq("chapter_id",he).order("order_index",{ascending:!1}).limit(1),Ze=Ne!=null&&Ne.length?Ne[0].order_index+1:0;await be.from("sections").insert({chapter_id:he,content:W.content,title:ie.trim()||null,type:"other",order_index:Ze,status:"open"}),c({title:"Successfully imported",description:"Saved as section in chapter."}),J(!1),V(""),P("")}catch{c({title:"Fehler beim Import",variant:"destructive"})}finally{T(!1)}}},re={small:{wordMin:200,wordMax:380,proofSnippets:1,overheadTokens:400},medium:{wordMin:350,wordMax:700,proofSnippets:2,overheadTokens:500},big:{wordMin:650,wordMax:1e3,proofSnippets:3,overheadTokens:650}},pe=Ne=>Math.round(Ne*1.4),xe=Ne=>Math.round(Ne/4),ye=1e3;function ae(Ne,Ze,Ke){const Xe=re[Ne]??re.small,Ye=pe((Xe.wordMin+Xe.wordMax)/2),Ve=Math.max(1,Ze*Math.max(1,Ke))*ye,pt=xe(Ve),Nt=Xe.overheadTokens+pt;return{prompt:Nt,completion:Ye,total:Nt+Ye}}const de=()=>{if(h.length===0)return{tokens:{prompt:0,completion:0,total:0}};const Ne=h.map(Xe=>{var Ye;return((Ye=u.find(At=>At.id===Xe))==null?void 0:Ye.page_count)||0}),Ze=Math.max(1,Math.round(Ne.reduce((Xe,Ye)=>Xe+Ye,0)/(Ne.length||1))||5);return{tokens:ae(q,h.length,Ze)}},ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ne=>{const Ze=(crypto.getRandomValues(new Uint8Array(1))[0]&15)>>0;return(Ne==="x"?Ze:Ze&3|8).toString(16)});S.useEffect(()=>{const Ne=de();K(Ne.tokens.total)},[q,h,u]);const we=async()=>{try{const{data:Ne,error:Ze}=await be.from("v_documents_with_status").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(Ze)throw Ze;d(Ne||[])}catch(Ne){console.error("Error loading documents:",Ne),c({title:"Error",description:"Documents could not be loaded.",variant:"destructive"})}},je=async Ne=>{var Xe,Ye;const{data:Ze}=await be.from("pages").select("page_number").eq("document_id",Ne).order("page_number",{ascending:!0}).limit(1),{data:Ke}=await be.from("pages").select("page_number").eq("document_id",Ne).order("page_number",{ascending:!1}).limit(1);return{min:((Xe=Ze==null?void 0:Ze[0])==null?void 0:Xe.page_number)??1,max:((Ye=Ke==null?void 0:Ke[0])==null?void 0:Ye.page_number)??1}},Se=async Ne=>{if(h.includes(Ne))f(Ke=>Ke.filter(Xe=>Xe!==Ne)),g(Ke=>{const Xe={...Ke};return delete Xe[Ne],Xe}),v(Ke=>{const Xe={...Ke};return delete Xe[Ne],Xe});else{const Ke=await je(Ne);v(Xe=>({...Xe,[Ne]:Ke})),f(Xe=>[...Xe,Ne]),g(Xe=>({...Xe,[Ne]:{from:Ke.min,to:Math.min(Ke.max,Ke.min+14)}}))}},Ue=()=>h.reduce((Ne,Ze)=>{const Ke=p[Ze];return Ke?Ne+(Ke.to-Ke.from+1):Ne},0),Ae=(Ne,Ze=40)=>Ne.length>Ze?Ne.substring(0,Ze)+"...":Ne,fe=(Ne,Ze,Ke)=>{const Xe=m[Ne]||{min:1,max:999},Ye=p[Ne]||{from:Xe.min,to:Math.min(Xe.max,Xe.min+14)};let At=Ze==="from"?Ke:Ye.from,Ve=Ze==="to"?Ke:Ye.to;At=Math.max(Xe.min,Math.min(At,Xe.max)),Ve=Math.max(Xe.min,Math.min(Ve,Xe.max)),Ze==="from"&&At>Ve&&(Ve=At),Ze==="to"&&Ve<At&&(At=Ve),g(pt=>({...pt,[Ne]:{from:At,to:Ve}}))},Ee=async()=>{var Ne,Ze,Ke;if(!r()){o(!0);return}if(!j.trim()){c({title:"Error",description:"Please enter a topic.",variant:"destructive"});return}$(!0);try{const Xe=y==="fox40"?"methodology_builder_fox40":"methodology_builder",{data:Ye,error:At}=await be.functions.invoke(Xe,{body:{document_ids:h,page_ranges:p,topic:j.trim(),language:C,citation_style:E,own_words:z.trim(),mode:q,client_request_id:ge()}});if(At)throw At;if((Ye==null?void 0:Ye.error)==="rate_limit"){const Ve=Ye.retry_after||10;w(Ve);let pt=Ve;const Nt=setInterval(()=>{pt-=1,w(pt),pt<=0&&(clearInterval(Nt),w(null),$(!1),Ee())},1e3);return}X(Ye),Y({prompt:((Ne=Ye==null?void 0:Ye.usage)==null?void 0:Ne.prompt_tokens)??void 0,completion:((Ze=Ye==null?void 0:Ye.usage)==null?void 0:Ze.completion_tokens)??void 0,total:((Ke=Ye==null?void 0:Ye.usage)==null?void 0:Ke.total_tokens)??void 0}),t&&(await new Promise(Ve=>setTimeout(Ve,4e3)),await s(t.id)),c({title:"Success",description:Ye.saved_to_library?"Methods & Approach generated and saved to library!":"Methods & Approach was generated!"})}catch(Xe){console.error("Error generating methodology:",Xe);const Ye=await Mfe(Xe);Ye.kind==="page_limit"?c({title:"Processing Limit Reached",description:"The document could not be processed due to page limits. Please try using fewer pages by adjusting the page selector or selecting fewer documents.",variant:"destructive"}):Ye.kind==="unauthorized"?c({title:"Session Expired",description:"Your session has expired. Please log in again.",variant:"destructive"}):c({title:"Error",description:"Something went wrong while generating the text. Please try again in a moment.",variant:"destructive"})}finally{$(!1)}},Ce=async()=>{if(!(!W||!z.trim())){F(!0);try{const{data:Ne,error:Ze}=await be.functions.invoke("methodology_builder",{body:{action:"refine",draft:W,own_words:z.trim(),language:C}});if(Ze)throw Ze;X(Ne),c({title:"Success",description:"Draft has been refined and merged!"})}catch(Ne){console.error("Error refining methodology:",Ne),c({title:"Error",description:Ne.message||"Error refining the draft.",variant:"destructive"})}finally{F(!1)}}},Ge=async Ne=>{try{await navigator.clipboard.writeText(Ne),c({title:"Copied",description:"Text has been copied to clipboard."})}catch{c({title:"Error",description:"Text could not be copied.",variant:"destructive"})}},dt=()=>{l("/documents")};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Methods & Approach"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Develop a structured methodology based on your literature and your own approach."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Paragraph Configuration"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Sources (optional)"}),a.jsx(Dfe,{documents:u,selectedDocuments:h,onToggle:Se,onUploadClick:()=>l("/summary"),emptyMessage:"No documents available.",uploadLabel:"Upload Document"})]}),h.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Page Selection"}),a.jsxs("span",{className:`text-xs ${Ue()>15?"text-red-500 font-medium":"text-muted-foreground"}`,children:[Ue()," / 15 pages selected"]})]}),a.jsx("div",{className:"space-y-2",children:h.map(Ne=>{const Ze=u.find(Ve=>Ve.id===Ne);if(!Ze)return null;const Ke=m[Ne]||{min:1,max:Ze.page_count||1},Xe=p[Ne]||{from:Ke.min,to:Math.min(Ke.max,Ke.min+14)},Ye=Ae(Ze.title||Ze.original_filename||"Document"),At=Xe.to-Xe.from+1;return a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md",children:[a.jsx("span",{className:"text-xs text-muted-foreground flex-1 truncate",children:Ye}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"p."}),a.jsx(Be,{type:"number",min:Ke.min,max:Ke.max,value:Xe.from,onChange:Ve=>{const pt=parseInt(Ve.target.value);isNaN(pt)||g(Nt=>({...Nt,[Ne]:{...Nt[Ne],from:pt}}))},onBlur:Ve=>fe(Ne,"from",parseInt(Ve.target.value)||Ke.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"–"}),a.jsx(Be,{type:"number",min:Ke.min,max:Ke.max,value:Xe.to,onChange:Ve=>{const pt=parseInt(Ve.target.value);isNaN(pt)||g(Nt=>({...Nt,[Ne]:{...Nt[Ne],to:pt}}))},onBlur:Ve=>fe(Ne,"to",parseInt(Ve.target.value)||Ke.min),className:"w-14 h-7 text-xs text-center px-1"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",Ke.max]}),a.jsxs(gt,{variant:At>15?"destructive":"secondary",className:"text-xs ml-1",children:[At,"p"]})]})]},Ne)})}),Ue()>15&&a.jsxs(td,{className:"border-red-500/50 bg-red-500/10",children:[a.jsx(Pa,{className:"h-4 w-4 text-red-600"}),a.jsx(rd,{className:"text-red-700 dark:text-red-400 text-xs",children:"Maximum 15 pages total across all documents."})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"topic",children:"Topic / Focus *"}),a.jsx(Be,{id:"topic",placeholder:"e.g. Mixed-methods evaluation of burnout prevention in nursing",value:j,onChange:Ne=>N(Ne.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:C,onValueChange:k,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"DE"}),a.jsx(Te,{value:"en",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Citation Style"}),a.jsxs(it,{value:E,onValueChange:M,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsx(nt,{children:a.jsx(Te,{value:"APA7",children:"APA7"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(it,{value:q,onValueChange:A,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"small",children:"Short"}),a.jsx(Te,{value:"medium",children:"Medium"}),a.jsx(Te,{value:"big",children:"Long"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"ownProcedure",children:"Your Approach (optional)"}),a.jsx(Wt,{id:"ownProcedure",value:z,onChange:Ne=>I(Ne.target.value),className:"min-h-[120px]",placeholder:"Describe your own steps (sampling, tools, timeline, limitations, etc.)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"AI Model"}),a.jsx(Si,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.0:"})," Faster, lower SP consumption"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Fox 4.1:"})," Higher quality, more SP consumption"]})]})]})})]}),a.jsxs(it,{value:y,onValueChange:x,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"fox41",children:"Fox 4.1 — Advanced"}),a.jsx(Te,{value:"fox40",children:"Fox 4.0 — Fast"})]})]})]}),a.jsx(ve,{onClick:Ee,disabled:H||!j.trim()||Ue()>15,className:"w-full",children:b!==null?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Retrying in ",b,"s..."]}):H?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Draft..."]}):"Generate Draft"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Results"})}),a.jsx($e,{children:W?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{children:a.jsx("h3",{className:"font-semibold text-lg mb-2",children:W.title})}),a.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:a.jsx(fc,{components:{h1:({children:Ne})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:Ne}),h2:({children:Ne})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:Ne}),p:({children:Ne})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:Ne}),ul:({children:Ne})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:Ne}),ol:({children:Ne})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:Ne}),li:({children:Ne})=>a.jsx("li",{className:"mb-1",children:Ne})},children:W.content.split(/Originaltextstellen:|Proof of Material:|Original quotes:/)[0].split("---")[0].trim()})}),(W.content.includes("Originaltextstellen")||W.content.includes("Proof of Material")||W.content.includes("Original quotes"))&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-semibold mb-3 flex items-center gap-2",children:[a.jsx(a0,{className:"h-4 w-4"}),"Original Quotes",a.jsx(gt,{variant:"outline",className:"text-xs font-normal",children:"Original Language"})]}),a.jsx("div",{className:"space-y-2",children:(()=>{var Xe,Ye,At,Ve;let Ne=W.content.split("Originaltextstellen:")[1];Ne||(Ne=W.content.split("Original quotes:")[1]),Ne||(Ne=W.content.split("Proof of Material:")[1]);const Ze=(Ve=(At=(Ye=(Xe=Ne==null?void 0:Ne.split("---")[0])==null?void 0:Xe.split("=== APA7 Literatur ===")[0])==null?void 0:Ye.split("## Literaturverzeichnis")[0])==null?void 0:At.split("## References")[0])==null?void 0:Ve.trim();if(!Ze)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"No original quotes available"});const Ke=Ze.split(/\n(?=["„]|[A-Z][a-zäöü]+,?\s+\d{4})/).filter(pt=>pt.trim());return Ke.length>0?Ke.map((pt,Nt)=>a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:pt.trim()})},Nt)):a.jsx("div",{className:"bg-muted/50 border-l-4 border-primary/30 p-3 rounded-r-md",children:a.jsx("p",{className:"text-sm italic whitespace-pre-wrap",children:Ze})})})()})]})]}),a.jsx(Es,{}),W.literature&&W.literature.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"References"}),a.jsx("div",{className:"text-sm space-y-1",children:W.literature.map((Ne,Ze)=>a.jsx("div",{className:"text-sm text-muted-foreground",children:Ne},Ze))})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.trim()&&a.jsxs(ve,{variant:"outline",size:"sm",onClick:Ce,disabled:L,children:[L?a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(HJ,{className:"mr-2 h-4 w-4"}),"Refine & Merge"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>{var Ne;return Ge(`${W.title}

${W.content}

References:
${((Ne=W.literature)==null?void 0:Ne.join(`
`))||""}`)},children:[a.jsx(yn,{className:"mr-2 h-4 w-4"}),"Copy All"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>J(!0),disabled:!W,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:dt,children:[a.jsx(Ir,{className:"mr-2 h-4 w-4"}),"Go to Library"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ir,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Fill in the parameters on the left and click "Generate Draft".'})]})})]})]})]}),a.jsx(Vr,{open:Z,onOpenChange:J,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Als Section importieren"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis"}),a.jsxs(it,{value:B,onValueChange:R,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis..."})}),a.jsx(nt,{children:oe.map(Ne=>a.jsx(Te,{value:Ne.id,children:Ne.title},Ne.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(it,{value:he,onValueChange:P,disabled:!B,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:B?"Select Chapter...":"Select thesis first"})}),a.jsx(nt,{children:ee.map(Ne=>a.jsx(Te,{value:Ne.id,children:Ne.title},Ne.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Be,{value:ie,onChange:Ne=>V(Ne.target.value),placeholder:"e.g. Methodology & Approach"})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>J(!1),children:"Abbrechen"}),a.jsx(ve,{onClick:ue,disabled:!he||O,children:O?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Importiere..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Importieren"]})})]})]})}),a.jsx(Tc,{open:i,onClose:()=>o(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},Eut=["introduction","einleitung","methodology","methodik","methods","methoden","findings","ergebnisse","results","auswertung","analyse","analysis","interviews","discussion","diskussion","stand des wissens","theoretischer hintergrund","literature","literatur","theory","theorie"],Cut=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=wr(),{toast:l}=vn(),[c,u]=S.useState([]),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState([]),[v,y]=S.useState("en"),[x,b]=S.useState("medium"),[w,j]=S.useState(!1),[N,C]=S.useState(null),[k,E]=S.useState(!1),[M,z]=S.useState(""),[I,q]=S.useState(""),[A,U]=S.useState(!1);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&K()},[t]),S.useEffect(()=>{f&&(G(f),m([]),C(null))},[f]);const K=async()=>{try{const{data:X,error:oe}=await be.from("theses").select("id, title, degree").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(oe)throw oe;u(X||[]),X&&X.length>0&&!f&&p(X[0].id)}catch(X){console.error("Error loading theses:",X),l({title:"Error",description:"Could not load theses.",variant:"destructive"})}},G=async X=>{try{const{data:oe,error:le}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",X).is("parent_id",null).order("order_index",{ascending:!0});if(le)throw le;const{data:B,error:R}=await be.from("sections").select("chapter_id, word_count").in("chapter_id",(oe||[]).map(Z=>Z.id));if(R)throw R;const ee={};(B||[]).forEach(Z=>{ee[Z.chapter_id]=(ee[Z.chapter_id]||0)+Z.word_count});const te=(oe||[]).map(Z=>({...Z,word_count:ee[Z.id]||0,isRecommended:Eut.some(J=>Z.title.toLowerCase().includes(J))}));h(te)}catch(oe){console.error("Error loading chapters:",oe),l({title:"Error",description:"Could not load chapters.",variant:"destructive"})}},Y=X=>{m(oe=>oe.includes(X)?oe.filter(le=>le!==X):[...oe,X])},H=S.useMemo(()=>d.filter(X=>X.word_count>0),[d]),$=async()=>{var X;if(!r()){i(!0);return}if(g.length===0){l({title:"Error",description:"Please select at least one chapter.",variant:"destructive"});return}j(!0);try{const{data:oe,error:le}=await be.functions.invoke("discussion_builder",{body:{thesis_id:f,chapter_ids:g,language:v,mode:x}});if(le)throw le;const B=(oe==null?void 0:oe.content)||(oe==null?void 0:oe.discussion_text)||((X=oe==null?void 0:oe.data)==null?void 0:X.content);if(console.log("Discussion response:",oe),typeof B=="string")C(B);else if(B!=null&&B.discussion_text)C(B.discussion_text);else throw new Error("Invalid response format");l({title:"Success",description:"Discussion generated successfully!"})}catch(oe){console.error("Error generating discussion:",oe),l({title:"Error",description:oe.message||"Error generating discussion.",variant:"destructive"})}finally{j(!1)}},L=async()=>{if(N)try{await navigator.clipboard.writeText(N),l({title:"Copied",description:"Text copied to clipboard."})}catch{l({title:"Error",description:"Could not copy text.",variant:"destructive"})}},F=async()=>{if(!(!N||!M)){U(!0);try{const{data:X,error:oe}=await be.from("sections").select("order_index").eq("chapter_id",M).order("order_index",{ascending:!1}).limit(1);if(oe)throw oe;const le=X&&X.length>0?X[0].order_index+1:0,{error:B}=await be.from("sections").insert({chapter_id:M,content:N,title:I.trim()||null,type:"other",order_index:le,status:"open"});if(B)throw B;l({title:"Imported",description:"Discussion imported as section."}),E(!1),q(""),z("")}catch(X){console.error("Error importing section:",X),l({title:"Error",description:X.message||"Error importing.",variant:"destructive"})}finally{U(!1)}}},W={small:"Short (~500 words)",medium:"Medium (~1000 words)",big:"Long (~2000 words)"};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Discussion Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate a discussion based on your thesis chapters."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Settings"})}),a.jsxs($e,{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Thesis"}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis..."})}),a.jsx(nt,{children:c.map(X=>a.jsx(Te,{value:X.id,children:X.title},X.id))})]})]}),f&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Chapters"}),d.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters available."}):H.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters with content available."}):a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg p-3",children:d.map(X=>{const oe=X.word_count>0;return a.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg transition-colors ${oe?"hover:bg-muted/50":"opacity-50"}`,children:[a.jsx(go,{id:X.id,checked:g.includes(X.id),onCheckedChange:()=>Y(X.id),disabled:!oe}),a.jsx("label",{htmlFor:X.id,className:`flex-1 text-sm ${oe?"cursor-pointer":"cursor-not-allowed"}`,children:X.title}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[X.word_count," words"]}),X.isRecommended&&oe&&a.jsx(gt,{variant:"secondary",className:"text-xs",children:"Recommended"})]},X.id)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.length," chapter(s) selected"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:v,onValueChange:X=>y(X),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Length"}),a.jsxs(it,{value:x,onValueChange:X=>b(X),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"small",children:W.small}),a.jsx(Te,{value:"medium",children:W.medium}),a.jsx(Te,{value:"big",children:W.big})]})]})]}),a.jsx(ve,{onClick:$,disabled:w||g.length===0,className:"w-full",children:w?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Discussion..."]}):"Generate Discussion"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx($e,{children:N?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"prose prose-sm max-w-none text-sm max-h-[500px] overflow-y-auto",children:a.jsx(fc,{components:{h1:({children:X})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:X}),h2:({children:X})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:X}),h3:({children:X})=>a.jsx("h3",{className:"text-sm font-semibold mt-4 mb-2",children:X}),p:({children:X})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:X}),ul:({children:X})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:X}),ol:({children:X})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:X}),li:({children:X})=>a.jsx("li",{className:"mb-1",children:X})},children:N})}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:[a.jsxs(ve,{variant:"outline",size:"sm",onClick:L,children:[a.jsx(yn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ir,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Select a thesis and chapters, then click "Generate Discussion".'})]})})]})]})]}),a.jsx(Vr,{open:k,onOpenChange:E,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Import as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(it,{value:M,onValueChange:z,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select chapter..."})}),a.jsx(nt,{children:d.map(X=>a.jsx(Te,{value:X.id,children:X.title},X.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Be,{value:I,onChange:X=>q(X.target.value),placeholder:"e.g. Discussion of Results"})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),a.jsx(ve,{onClick:F,disabled:!M||A,children:A?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Tc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null},kut=["introduction","einleitung","methodology","methodik","methods","methoden","findings","ergebnisse","results","auswertung","analyse","analysis","interviews","discussion","diskussion","stand des wissens","theoretischer hintergrund","literature","literatur","theory","theorie","zusammenfassung","summary","conclusion"],Tut=()=>{const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=wr(),{toast:l}=vn(),[c,u]=S.useState([]),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState([]),[v,y]=S.useState("en"),[x,b]=S.useState("medium"),[w,j]=S.useState(!0),[N,C]=S.useState(!0),[k,E]=S.useState(!1),[M,z]=S.useState(null),[I,q]=S.useState(!1),[A,U]=S.useState(""),[K,G]=S.useState(""),[Y,H]=S.useState(!1);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&$()},[t]),S.useEffect(()=>{f&&(L(f),m([]),z(null))},[f]);const $=async()=>{try{const{data:R,error:ee}=await be.from("theses").select("id, title, degree").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(ee)throw ee;u(R||[]),R&&R.length>0&&!f&&p(R[0].id)}catch(R){console.error("Error loading theses:",R),l({title:"Error",description:"Could not load theses.",variant:"destructive"})}},L=async R=>{try{const{data:ee,error:te}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",R).is("parent_id",null).order("order_index",{ascending:!0});if(te)throw te;const{data:Z,error:J}=await be.from("sections").select("chapter_id, word_count").in("chapter_id",(ee||[]).map(ie=>ie.id));if(J)throw J;const he={};(Z||[]).forEach(ie=>{he[ie.chapter_id]=(he[ie.chapter_id]||0)+ie.word_count});const P=(ee||[]).map(ie=>({...ie,word_count:he[ie.id]||0,isRecommended:kut.some(V=>ie.title.toLowerCase().includes(V))}));h(P)}catch(ee){console.error("Error loading chapters:",ee),l({title:"Error",description:"Could not load chapters.",variant:"destructive"})}},F=R=>{m(ee=>ee.includes(R)?ee.filter(te=>te!==R):[...ee,R])},W=S.useMemo(()=>d.filter(R=>R.word_count>0),[d]),X=async()=>{if(!r()){i(!0);return}if(g.length===0){l({title:"Error",description:"Please select at least one chapter.",variant:"destructive"});return}E(!0);try{const{data:R,error:ee}=await be.functions.invoke("conclusion_builder",{body:{thesis_id:f,chapter_ids:g,language:v,mode:x,include_limitations:w,include_outlook:N}});if(ee)throw ee;const te=(R==null?void 0:R.conclusion_text)||(R==null?void 0:R.content);if(console.log("Conclusion response:",R),typeof te=="string")z(te);else throw new Error("Invalid response format");l({title:"Success",description:"Conclusion generated successfully!"})}catch(R){console.error("Error generating conclusion:",R),l({title:"Error",description:R.message||"Error generating conclusion.",variant:"destructive"})}finally{E(!1)}},oe=async()=>{if(M)try{await navigator.clipboard.writeText(M),l({title:"Copied",description:"Text copied to clipboard."})}catch{l({title:"Error",description:"Could not copy text.",variant:"destructive"})}},le=async()=>{if(!(!M||!A)){H(!0);try{const{data:R,error:ee}=await be.from("sections").select("order_index").eq("chapter_id",A).order("order_index",{ascending:!1}).limit(1);if(ee)throw ee;const te=R&&R.length>0?R[0].order_index+1:0,{error:Z}=await be.from("sections").insert({chapter_id:A,content:M,title:K.trim()||null,type:"other",order_index:te,status:"open"});if(Z)throw Z;l({title:"Imported",description:"Conclusion imported as section."}),q(!1),G(""),U("")}catch(R){console.error("Error importing section:",R),l({title:"Error",description:R.message||"Error importing.",variant:"destructive"})}finally{H(!1)}}},B={small:"Short (~500 words)",medium:"Medium (~1000 words)",big:"Long (~2000 words)"};return e?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Conclusion Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate a conclusion based on your thesis chapters including limitations and outlook."})]})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Settings"})}),a.jsxs($e,{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Thesis"}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis..."})}),a.jsx(nt,{children:c.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]})]}),f&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Chapters"}),d.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters available."}):W.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chapters with content available."}):a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto border rounded-lg p-3",children:d.map(R=>{const ee=R.word_count>0;return a.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg transition-colors ${ee?"hover:bg-muted/50":"opacity-50"}`,children:[a.jsx(go,{id:R.id,checked:g.includes(R.id),onCheckedChange:()=>F(R.id),disabled:!ee}),a.jsx("label",{htmlFor:R.id,className:`flex-1 text-sm ${ee?"cursor-pointer":"cursor-not-allowed"}`,children:R.title}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[R.word_count," words"]}),R.isRecommended&&ee&&a.jsx(gt,{variant:"secondary",className:"text-xs",children:"Recommended"})]},R.id)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.length," chapter(s) selected"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:v,onValueChange:R=>y(R),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{children:"Include Sections"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(go,{id:"include-limitations",checked:w,onCheckedChange:R=>j(!!R)}),a.jsx("label",{htmlFor:"include-limitations",className:"text-sm cursor-pointer",children:"Limitations (Einschränkungen der Studie)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(go,{id:"include-outlook",checked:N,onCheckedChange:R=>C(!!R)}),a.jsx("label",{htmlFor:"include-outlook",className:"text-sm cursor-pointer",children:"Ausblick / Future Research"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Length"}),a.jsxs(it,{value:x,onValueChange:R=>b(R),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"small",children:B.small}),a.jsx(Te,{value:"medium",children:B.medium}),a.jsx(Te,{value:"big",children:B.big})]})]})]}),a.jsx(ve,{onClick:X,disabled:k||g.length===0,className:"w-full",children:k?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating Conclusion..."]}):"Generate Conclusion"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Result"})}),a.jsx($e,{children:M?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"prose prose-sm max-w-none text-sm max-h-[500px] overflow-y-auto",children:a.jsx(fc,{components:{h1:({children:R})=>a.jsx("h1",{className:"text-lg font-semibold mt-6 mb-3 first:mt-0",children:R}),h2:({children:R})=>a.jsx("h2",{className:"text-base font-semibold mt-5 mb-2",children:R}),h3:({children:R})=>a.jsx("h3",{className:"text-sm font-semibold mt-4 mb-2",children:R}),p:({children:R})=>a.jsx("p",{className:"mb-3 leading-relaxed",children:R}),ul:({children:R})=>a.jsx("ul",{className:"mb-3 ml-4 list-disc",children:R}),ol:({children:R})=>a.jsx("ol",{className:"mb-3 ml-4 list-decimal",children:R}),li:({children:R})=>a.jsx("li",{className:"mb-1",children:R})},children:M})}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:[a.jsxs(ve,{variant:"outline",size:"sm",onClick:oe,children:[a.jsx(yn,{className:"mr-2 h-4 w-4"}),"Copy"]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:()=>q(!0),children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]})]})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ir,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:'Select a thesis and chapters, then click "Generate Conclusion".'})]})})]})]})]}),a.jsx(Vr,{open:I,onOpenChange:q,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Import Conclusion as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(it,{value:A,onValueChange:U,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select chapter..."})}),a.jsx(nt,{children:d.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section Title (optional)"}),a.jsx(Be,{value:K,onChange:R=>G(R.target.value),placeholder:"e.g. Conclusion"})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),a.jsx(ve,{onClick:le,disabled:!A||Y,children:Y?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Tc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null};var q2="Collapsible",[Put,Lfe]=Ln(q2),[Out,J8]=Put(q2),Ffe=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:o,...l}=t,[c,u]=Ps({prop:n,defaultProp:s??!1,onChange:o,caller:q2});return a.jsx(Out,{scope:r,disabled:i,contentId:Gi(),open:c,onOpenToggle:S.useCallback(()=>u(d=>!d),[u]),children:a.jsx(et.div,{"data-state":nB(c),"data-disabled":i?"":void 0,...l,ref:e})})});Ffe.displayName=q2;var $fe="CollapsibleTrigger",eB=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,s=J8($fe,r);return a.jsx(et.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":nB(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:e,onClick:ze(t.onClick,s.onOpenToggle)})});eB.displayName=$fe;var tB="CollapsibleContent",rB=S.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=J8(tB,t.__scopeCollapsible);return a.jsx(Xn,{present:r||s.open,children:({present:i})=>a.jsx(Iut,{...n,ref:e,present:i})})});rB.displayName=tB;var Iut=S.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:s,...i}=t,o=J8(tB,r),[l,c]=S.useState(n),u=S.useRef(null),d=jt(e,u),h=S.useRef(0),f=h.current,p=S.useRef(0),g=p.current,m=o.open||l,v=S.useRef(m),y=S.useRef(void 0);return S.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),gn(()=>{const x=u.current;if(x){y.current=y.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const b=x.getBoundingClientRect();h.current=b.height,p.current=b.width,v.current||(x.style.transitionDuration=y.current.transitionDuration,x.style.animationName=y.current.animationName),c(n)}},[o.open,n]),a.jsx(et.div,{"data-state":nB(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&s})});function nB(t){return t?"open":"closed"}var Bfe=Ffe,Rut=eB,Mut=rB,bl="Accordion",Dut=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[sB,Lut,Fut]=Tj(bl),[G2,Pyt]=Ln(bl,[Fut,Lfe]),iB=Lfe(),Ufe=me.forwardRef((t,e)=>{const{type:r,...n}=t,s=n,i=n;return a.jsx(sB.Provider,{scope:t.__scopeAccordion,children:r==="multiple"?a.jsx(zut,{...i,ref:e}):a.jsx(Uut,{...s,ref:e})})});Ufe.displayName=bl;var[zfe,$ut]=G2(bl),[Hfe,But]=G2(bl,{collapsible:!1}),Uut=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:i=!1,...o}=t,[l,c]=Ps({prop:r,defaultProp:n??"",onChange:s,caller:bl});return a.jsx(zfe,{scope:t.__scopeAccordion,value:me.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:me.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(Hfe,{scope:t.__scopeAccordion,collapsible:i,children:a.jsx(Wfe,{...o,ref:e})})})}),zut=me.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=t,[o,l]=Ps({prop:r,defaultProp:n??[],onChange:s,caller:bl}),c=me.useCallback(d=>l((h=[])=>[...h,d]),[l]),u=me.useCallback(d=>l((h=[])=>h.filter(f=>f!==d)),[l]);return a.jsx(zfe,{scope:t.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(Hfe,{scope:t.__scopeAccordion,collapsible:!0,children:a.jsx(Wfe,{...i,ref:e})})})}),[Hut,K2]=G2(bl),Wfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:i="vertical",...o}=t,l=me.useRef(null),c=jt(l,e),u=Lut(r),h=lg(s)==="ltr",f=ze(t.onKeyDown,p=>{var k;if(!Dut.includes(p.key))return;const g=p.target,m=u().filter(E=>{var M;return!((M=E.ref.current)!=null&&M.disabled)}),v=m.findIndex(E=>E.ref.current===g),y=m.length;if(v===-1)return;p.preventDefault();let x=v;const b=0,w=y-1,j=()=>{x=v+1,x>w&&(x=b)},N=()=>{x=v-1,x<b&&(x=w)};switch(p.key){case"Home":x=b;break;case"End":x=w;break;case"ArrowRight":i==="horizontal"&&(h?j():N());break;case"ArrowDown":i==="vertical"&&j();break;case"ArrowLeft":i==="horizontal"&&(h?N():j());break;case"ArrowUp":i==="vertical"&&N();break}const C=x%y;(k=m[C].ref.current)==null||k.focus()});return a.jsx(Hut,{scope:r,disabled:n,direction:s,orientation:i,children:a.jsx(sB.Slot,{scope:r,children:a.jsx(et.div,{...o,"data-orientation":i,ref:c,onKeyDown:n?void 0:f})})})}),mk="AccordionItem",[Wut,aB]=G2(mk),Vfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,value:n,...s}=t,i=K2(mk,r),o=$ut(mk,r),l=iB(r),c=Gi(),u=n&&o.value.includes(n)||!1,d=i.disabled||t.disabled;return a.jsx(Wut,{scope:r,open:u,disabled:d,triggerId:c,children:a.jsx(Bfe,{"data-orientation":i.orientation,"data-state":Qfe(u),...l,...s,ref:e,disabled:d,open:u,onOpenChange:h=>{h?o.onItemOpen(n):o.onItemClose(n)}})})});Vfe.displayName=mk;var qfe="AccordionHeader",Gfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=K2(bl,r),i=aB(qfe,r);return a.jsx(et.h3,{"data-orientation":s.orientation,"data-state":Qfe(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:e})});Gfe.displayName=qfe;var C3="AccordionTrigger",Kfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=K2(bl,r),i=aB(C3,r),o=But(C3,r),l=iB(r);return a.jsx(sB.ItemSlot,{scope:r,children:a.jsx(Rut,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...n,ref:e})})});Kfe.displayName=C3;var Yfe="AccordionContent",Xfe=me.forwardRef((t,e)=>{const{__scopeAccordion:r,...n}=t,s=K2(bl,r),i=aB(Yfe,r),o=iB(r);return a.jsx(Mut,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...n,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Xfe.displayName=Yfe;function Qfe(t){return t?"open":"closed"}var Vut=Ufe,qut=Vfe,Gut=Gfe,Zfe=Kfe,Jfe=Xfe;const epe=Vut,oB=S.forwardRef(({className:t,...e},r)=>a.jsx(qut,{ref:r,className:Oe("border-b",t),...e}));oB.displayName="AccordionItem";const lB=S.forwardRef(({className:t,children:e,...r},n)=>a.jsx(Gut,{className:"flex",children:a.jsxs(Zfe,{ref:n,className:Oe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...r,children:[e,a.jsx(ad,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));lB.displayName=Zfe.displayName;const cB=S.forwardRef(({className:t,children:e,...r},n)=>a.jsx(Jfe,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:Oe("pb-4 pt-0",t),children:e})}));cB.displayName=Jfe.displayName;var Kut=Object.defineProperty,Yut=Object.defineProperties,Xut=Object.getOwnPropertyDescriptors,vK=Object.getOwnPropertySymbols,Qut=Object.prototype.hasOwnProperty,Zut=Object.prototype.propertyIsEnumerable,k3=(t,e,r)=>e in t?Kut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zt=(t,e)=>{for(var r in e||(e={}))Qut.call(e,r)&&k3(t,r,e[r]);if(vK)for(var r of vK(e))Zut.call(e,r)&&k3(t,r,e[r]);return t},Yx=(t,e)=>Yut(t,Xut(e)),Pe=(t,e,r)=>k3(t,typeof e!="symbol"?e+"":e,r),Jut=(t,e,r)=>new Promise((n,s)=>{var i=c=>{try{l(r.next(c))}catch(u){s(u)}},o=c=>{try{l(r.throw(c))}catch(u){s(u)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,o);l((r=r.apply(t,e)).next())});class gk{constructor(e){Pe(this,"rootKey"),this.rootKey=e}}const edt=Object.seal({});class Ie extends gk{constructor(e){super(e),Pe(this,"root"),this.root=new Array}prepForXml(e){var r;e.stack.push(this);const n=this.root.map(s=>s instanceof gk?s.prepForXml(e):s).filter(s=>s!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&((r=n[0])!=null&&r._attr)?n[0]:n:edt}}addChildElement(e){return this.root.push(e),this}}class Y2 extends Ie{prepForXml(e){const r=super.prepForXml(e);if(r&&(typeof r[this.rootKey]!="object"||Object.keys(r[this.rootKey]).length))return r}}class St extends gk{constructor(e){super("_attr"),Pe(this,"xmlKeys"),this.root=e}prepForXml(e){const r={};return Object.entries(this.root).forEach(([n,s])=>{if(s!==void 0){const i=this.xmlKeys&&this.xmlKeys[n]||n;r[i]=s}}),{_attr:r}}}class X2 extends gk{constructor(e){super("_attr"),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:n})=>n!==void 0).reduce((n,{key:s,value:i})=>Yx(Zt({},n),{[s]:i}),{})}}}class xn extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}}var oc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tpe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _I={},qN={exports:{}},xK;function uB(){if(xK)return qN.exports;xK=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(j,N,C){return Function.prototype.apply.call(j,N,C)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(j){return Object.getOwnPropertyNames(j).concat(Object.getOwnPropertySymbols(j))}:r=function(j){return Object.getOwnPropertyNames(j)};function n(w){console&&console.warn&&console.warn(w)}var s=Number.isNaN||function(j){return j!==j};function i(){i.init.call(this)}qN.exports=i,qN.exports.once=y,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function l(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(w){if(typeof w!="number"||w<0||s(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");o=w}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(j){if(typeof j!="number"||j<0||s(j))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+j+".");return this._maxListeners=j,this};function c(w){return w._maxListeners===void 0?i.defaultMaxListeners:w._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(j){for(var N=[],C=1;C<arguments.length;C++)N.push(arguments[C]);var k=j==="error",E=this._events;if(E!==void 0)k=k&&E.error===void 0;else if(!k)return!1;if(k){var M;if(N.length>0&&(M=N[0]),M instanceof Error)throw M;var z=new Error("Unhandled error."+(M?" ("+M.message+")":""));throw z.context=M,z}var I=E[j];if(I===void 0)return!1;if(typeof I=="function")e(I,this,N);else for(var q=I.length,A=g(I,q),C=0;C<q;++C)e(A[C],this,N);return!0};function u(w,j,N,C){var k,E,M;if(l(N),E=w._events,E===void 0?(E=w._events=Object.create(null),w._eventsCount=0):(E.newListener!==void 0&&(w.emit("newListener",j,N.listener?N.listener:N),E=w._events),M=E[j]),M===void 0)M=E[j]=N,++w._eventsCount;else if(typeof M=="function"?M=E[j]=C?[N,M]:[M,N]:C?M.unshift(N):M.push(N),k=c(w),k>0&&M.length>k&&!M.warned){M.warned=!0;var z=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(j)+" listeners added. Use emitter.setMaxListeners() to increase limit");z.name="MaxListenersExceededWarning",z.emitter=w,z.type=j,z.count=M.length,n(z)}return w}i.prototype.addListener=function(j,N){return u(this,j,N,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(j,N){return u(this,j,N,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(w,j,N){var C={fired:!1,wrapFn:void 0,target:w,type:j,listener:N},k=d.bind(C);return k.listener=N,C.wrapFn=k,k}i.prototype.once=function(j,N){return l(N),this.on(j,h(this,j,N)),this},i.prototype.prependOnceListener=function(j,N){return l(N),this.prependListener(j,h(this,j,N)),this},i.prototype.removeListener=function(j,N){var C,k,E,M,z;if(l(N),k=this._events,k===void 0)return this;if(C=k[j],C===void 0)return this;if(C===N||C.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete k[j],k.removeListener&&this.emit("removeListener",j,C.listener||N));else if(typeof C!="function"){for(E=-1,M=C.length-1;M>=0;M--)if(C[M]===N||C[M].listener===N){z=C[M].listener,E=M;break}if(E<0)return this;E===0?C.shift():m(C,E),C.length===1&&(k[j]=C[0]),k.removeListener!==void 0&&this.emit("removeListener",j,z||N)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(j){var N,C,k;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[j]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[j]),this;if(arguments.length===0){var E=Object.keys(C),M;for(k=0;k<E.length;++k)M=E[k],M!=="removeListener"&&this.removeAllListeners(M);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=C[j],typeof N=="function")this.removeListener(j,N);else if(N!==void 0)for(k=N.length-1;k>=0;k--)this.removeListener(j,N[k]);return this};function f(w,j,N){var C=w._events;if(C===void 0)return[];var k=C[j];return k===void 0?[]:typeof k=="function"?N?[k.listener||k]:[k]:N?v(k):g(k,k.length)}i.prototype.listeners=function(j){return f(this,j,!0)},i.prototype.rawListeners=function(j){return f(this,j,!1)},i.listenerCount=function(w,j){return typeof w.listenerCount=="function"?w.listenerCount(j):p.call(w,j)},i.prototype.listenerCount=p;function p(w){var j=this._events;if(j!==void 0){var N=j[w];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function g(w,j){for(var N=new Array(j),C=0;C<j;++C)N[C]=w[C];return N}function m(w,j){for(;j+1<w.length;j++)w[j]=w[j+1];w.pop()}function v(w){for(var j=new Array(w.length),N=0;N<j.length;++N)j[N]=w[N].listener||w[N];return j}function y(w,j){return new Promise(function(N,C){function k(M){w.removeListener(j,E),C(M)}function E(){typeof w.removeListener=="function"&&w.removeListener("error",k),N([].slice.call(arguments))}b(w,j,E,{once:!0}),j!=="error"&&x(w,k,{once:!0})})}function x(w,j,N){typeof w.on=="function"&&b(w,"error",j,N)}function b(w,j,N,C){if(typeof w.on=="function")C.once?w.once(j,N):w.on(j,N);else if(typeof w.addEventListener=="function")w.addEventListener(j,function k(E){C.once&&w.removeEventListener(j,k),N(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return qN.exports}var GN={exports:{}},bK;function Cf(){return bK||(bK=1,typeof Object.create=="function"?GN.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:GN.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}),GN.exports}function tdt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rpe={exports:{}},En=rpe.exports={},kl,Tl;function T3(){throw new Error("setTimeout has not been defined")}function P3(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kl=setTimeout:kl=T3}catch{kl=T3}try{typeof clearTimeout=="function"?Tl=clearTimeout:Tl=P3}catch{Tl=P3}})();function npe(t){if(kl===setTimeout)return setTimeout(t,0);if((kl===T3||!kl)&&setTimeout)return kl=setTimeout,setTimeout(t,0);try{return kl(t,0)}catch{try{return kl.call(null,t,0)}catch{return kl.call(this,t,0)}}}function rdt(t){if(Tl===clearTimeout)return clearTimeout(t);if((Tl===P3||!Tl)&&clearTimeout)return Tl=clearTimeout,clearTimeout(t);try{return Tl(t)}catch{try{return Tl.call(null,t)}catch{return Tl.call(this,t)}}}var Mu=[],zy=!1,hp,oE=-1;function ndt(){!zy||!hp||(zy=!1,hp.length?Mu=hp.concat(Mu):oE=-1,Mu.length&&spe())}function spe(){if(!zy){var t=npe(ndt);zy=!0;for(var e=Mu.length;e;){for(hp=Mu,Mu=[];++oE<e;)hp&&hp[oE].run();oE=-1,e=Mu.length}hp=null,zy=!1,rdt(t)}}En.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Mu.push(new ipe(t,e)),Mu.length===1&&!zy&&npe(spe)};function ipe(t,e){this.fun=t,this.array=e}ipe.prototype.run=function(){this.fun.apply(null,this.array)};En.title="browser";En.browser=!0;En.env={};En.argv=[];En.version="";En.versions={};function hd(){}En.on=hd;En.addListener=hd;En.once=hd;En.off=hd;En.removeListener=hd;En.removeAllListeners=hd;En.emit=hd;En.prependListener=hd;En.prependOnceListener=hd;En.listeners=function(t){return[]};En.binding=function(t){throw new Error("process.binding is not supported")};En.cwd=function(){return"/"};En.chdir=function(t){throw new Error("process.chdir is not supported")};En.umask=function(){return 0};var sdt=rpe.exports;const $t=tdt(sdt);var jI,wK;function ape(){return wK||(wK=1,jI=uB().EventEmitter),jI}var SI={},pb={},_K;function idt(){if(_K)return pb;_K=1,pb.byteLength=l,pb.toByteArray=u,pb.fromByteArray=f;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=n.length;s<i;++s)t[s]=n[s],e[n.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(p){var g=p.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=p.indexOf("=");m===-1&&(m=g);var v=m===g?0:4-m%4;return[m,v]}function l(p){var g=o(p),m=g[0],v=g[1];return(m+v)*3/4-v}function c(p,g,m){return(g+m)*3/4-m}function u(p){var g,m=o(p),v=m[0],y=m[1],x=new r(c(p,v,y)),b=0,w=y>0?v-4:v,j;for(j=0;j<w;j+=4)g=e[p.charCodeAt(j)]<<18|e[p.charCodeAt(j+1)]<<12|e[p.charCodeAt(j+2)]<<6|e[p.charCodeAt(j+3)],x[b++]=g>>16&255,x[b++]=g>>8&255,x[b++]=g&255;return y===2&&(g=e[p.charCodeAt(j)]<<2|e[p.charCodeAt(j+1)]>>4,x[b++]=g&255),y===1&&(g=e[p.charCodeAt(j)]<<10|e[p.charCodeAt(j+1)]<<4|e[p.charCodeAt(j+2)]>>2,x[b++]=g>>8&255,x[b++]=g&255),x}function d(p){return t[p>>18&63]+t[p>>12&63]+t[p>>6&63]+t[p&63]}function h(p,g,m){for(var v,y=[],x=g;x<m;x+=3)v=(p[x]<<16&16711680)+(p[x+1]<<8&65280)+(p[x+2]&255),y.push(d(v));return y.join("")}function f(p){for(var g,m=p.length,v=m%3,y=[],x=16383,b=0,w=m-v;b<w;b+=x)y.push(h(p,b,b+x>w?w:b+x));return v===1?(g=p[m-1],y.push(t[g>>2]+t[g<<4&63]+"==")):v===2&&(g=(p[m-2]<<8)+p[m-1],y.push(t[g>>10]+t[g>>4&63]+t[g<<2&63]+"=")),y.join("")}return pb}var KN={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var jK;function adt(){return jK||(jK=1,KN.read=function(t,e,r,n,s){var i,o,l=s*8-n-1,c=(1<<l)-1,u=c>>1,d=-7,h=r?s-1:0,f=r?-1:1,p=t[e+h];for(h+=f,i=p&(1<<-d)-1,p>>=-d,d+=l;d>0;i=i*256+t[e+h],h+=f,d-=8);for(o=i&(1<<-d)-1,i>>=-d,d+=n;d>0;o=o*256+t[e+h],h+=f,d-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-u}return(p?-1:1)*o*Math.pow(2,i-n)},KN.write=function(t,e,r,n,s,i){var o,l,c,u=i*8-s-1,d=(1<<u)-1,h=d>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?e+=f/c:e+=f*Math.pow(2,1-h),e*c>=2&&(o++,c/=2),o+h>=d?(l=0,o=d):o+h>=1?(l=(e*c-1)*Math.pow(2,s),o=o+h):(l=e*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;t[r+p]=l&255,p+=g,l/=256,s-=8);for(o=o<<s|l,u+=s;u>0;t[r+p]=o&255,p+=g,o/=256,u-=8);t[r+p-g]|=m*128}),KN}/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */var SK;function Q2(){return SK||(SK=1,function(t){var e=idt(),r=adt(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=x,t.INSPECT_MAX_BYTES=50;var s=2147483647;t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=i(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var V=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(V,O),V.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(V){if(V>s)throw new RangeError('The value "'+V+'" is invalid for option "size"');var O=new Uint8Array(V);return Object.setPrototypeOf(O,l.prototype),O}function l(V,O,T){if(typeof V=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(V)}return c(V,O,T)}l.poolSize=8192;function c(V,O,T){if(typeof V=="string")return f(V,O);if(ArrayBuffer.isView(V))return g(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(he(V,ArrayBuffer)||V&&he(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(V,SharedArrayBuffer)||V&&he(V.buffer,SharedArrayBuffer)))return m(V,O,T);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var D=V.valueOf&&V.valueOf();if(D!=null&&D!==V)return l.from(D,O,T);var ne=v(V);if(ne)return ne;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return l.from(V[Symbol.toPrimitive]("string"),O,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}l.from=function(V,O,T){return c(V,O,T)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function u(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function d(V,O,T){return u(V),V<=0?o(V):O!==void 0?typeof T=="string"?o(V).fill(O,T):o(V).fill(O):o(V)}l.alloc=function(V,O,T){return d(V,O,T)};function h(V){return u(V),o(V<0?0:y(V)|0)}l.allocUnsafe=function(V){return h(V)},l.allocUnsafeSlow=function(V){return h(V)};function f(V,O){if((typeof O!="string"||O==="")&&(O="utf8"),!l.isEncoding(O))throw new TypeError("Unknown encoding: "+O);var T=b(V,O)|0,D=o(T),ne=D.write(V,O);return ne!==T&&(D=D.slice(0,ne)),D}function p(V){for(var O=V.length<0?0:y(V.length)|0,T=o(O),D=0;D<O;D+=1)T[D]=V[D]&255;return T}function g(V){if(he(V,Uint8Array)){var O=new Uint8Array(V);return m(O.buffer,O.byteOffset,O.byteLength)}return p(V)}function m(V,O,T){if(O<0||V.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(V.byteLength<O+(T||0))throw new RangeError('"length" is outside of buffer bounds');var D;return O===void 0&&T===void 0?D=new Uint8Array(V):T===void 0?D=new Uint8Array(V,O):D=new Uint8Array(V,O,T),Object.setPrototypeOf(D,l.prototype),D}function v(V){if(l.isBuffer(V)){var O=y(V.length)|0,T=o(O);return T.length===0||V.copy(T,0,0,O),T}if(V.length!==void 0)return typeof V.length!="number"||P(V.length)?o(0):p(V);if(V.type==="Buffer"&&Array.isArray(V.data))return p(V.data)}function y(V){if(V>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return V|0}function x(V){return+V!=V&&(V=0),l.alloc(+V)}l.isBuffer=function(O){return O!=null&&O._isBuffer===!0&&O!==l.prototype},l.compare=function(O,T){if(he(O,Uint8Array)&&(O=l.from(O,O.offset,O.byteLength)),he(T,Uint8Array)&&(T=l.from(T,T.offset,T.byteLength)),!l.isBuffer(O)||!l.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(O===T)return 0;for(var D=O.length,ne=T.length,ue=0,re=Math.min(D,ne);ue<re;++ue)if(O[ue]!==T[ue]){D=O[ue],ne=T[ue];break}return D<ne?-1:ne<D?1:0},l.isEncoding=function(O){switch(String(O).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(O,T){if(!Array.isArray(O))throw new TypeError('"list" argument must be an Array of Buffers');if(O.length===0)return l.alloc(0);var D;if(T===void 0)for(T=0,D=0;D<O.length;++D)T+=O[D].length;var ne=l.allocUnsafe(T),ue=0;for(D=0;D<O.length;++D){var re=O[D];if(he(re,Uint8Array))ue+re.length>ne.length?l.from(re).copy(ne,ue):Uint8Array.prototype.set.call(ne,re,ue);else if(l.isBuffer(re))re.copy(ne,ue);else throw new TypeError('"list" argument must be an Array of Buffers');ue+=re.length}return ne};function b(V,O){if(l.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||he(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);var T=V.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&T===0)return 0;for(var ne=!1;;)switch(O){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return R(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Z(V).length;default:if(ne)return D?-1:R(V).length;O=(""+O).toLowerCase(),ne=!0}}l.byteLength=b;function w(V,O,T){var D=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,O>>>=0,T<=O))return"";for(V||(V="utf8");;)switch(V){case"hex":return H(this,O,T);case"utf8":case"utf-8":return A(this,O,T);case"ascii":return G(this,O,T);case"latin1":case"binary":return Y(this,O,T);case"base64":return q(this,O,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,O,T);default:if(D)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),D=!0}}l.prototype._isBuffer=!0;function j(V,O,T){var D=V[O];V[O]=V[T],V[T]=D}l.prototype.swap16=function(){var O=this.length;if(O%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var T=0;T<O;T+=2)j(this,T,T+1);return this},l.prototype.swap32=function(){var O=this.length;if(O%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var T=0;T<O;T+=4)j(this,T,T+3),j(this,T+1,T+2);return this},l.prototype.swap64=function(){var O=this.length;if(O%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var T=0;T<O;T+=8)j(this,T,T+7),j(this,T+1,T+6),j(this,T+2,T+5),j(this,T+3,T+4);return this},l.prototype.toString=function(){var O=this.length;return O===0?"":arguments.length===0?A(this,0,O):w.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(O){if(!l.isBuffer(O))throw new TypeError("Argument must be a Buffer");return this===O?!0:l.compare(this,O)===0},l.prototype.inspect=function(){var O="",T=t.INSPECT_MAX_BYTES;return O=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(O+=" ... "),"<Buffer "+O+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(O,T,D,ne,ue){if(he(O,Uint8Array)&&(O=l.from(O,O.offset,O.byteLength)),!l.isBuffer(O))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof O);if(T===void 0&&(T=0),D===void 0&&(D=O?O.length:0),ne===void 0&&(ne=0),ue===void 0&&(ue=this.length),T<0||D>O.length||ne<0||ue>this.length)throw new RangeError("out of range index");if(ne>=ue&&T>=D)return 0;if(ne>=ue)return-1;if(T>=D)return 1;if(T>>>=0,D>>>=0,ne>>>=0,ue>>>=0,this===O)return 0;for(var re=ue-ne,pe=D-T,xe=Math.min(re,pe),ye=this.slice(ne,ue),ae=O.slice(T,D),de=0;de<xe;++de)if(ye[de]!==ae[de]){re=ye[de],pe=ae[de];break}return re<pe?-1:pe<re?1:0};function N(V,O,T,D,ne){if(V.length===0)return-1;if(typeof T=="string"?(D=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,P(T)&&(T=ne?0:V.length-1),T<0&&(T=V.length+T),T>=V.length){if(ne)return-1;T=V.length-1}else if(T<0)if(ne)T=0;else return-1;if(typeof O=="string"&&(O=l.from(O,D)),l.isBuffer(O))return O.length===0?-1:C(V,O,T,D,ne);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?ne?Uint8Array.prototype.indexOf.call(V,O,T):Uint8Array.prototype.lastIndexOf.call(V,O,T):C(V,[O],T,D,ne);throw new TypeError("val must be string, number or Buffer")}function C(V,O,T,D,ne){var ue=1,re=V.length,pe=O.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(V.length<2||O.length<2)return-1;ue=2,re/=2,pe/=2,T/=2}function xe(we,je){return ue===1?we[je]:we.readUInt16BE(je*ue)}var ye;if(ne){var ae=-1;for(ye=T;ye<re;ye++)if(xe(V,ye)===xe(O,ae===-1?0:ye-ae)){if(ae===-1&&(ae=ye),ye-ae+1===pe)return ae*ue}else ae!==-1&&(ye-=ye-ae),ae=-1}else for(T+pe>re&&(T=re-pe),ye=T;ye>=0;ye--){for(var de=!0,ge=0;ge<pe;ge++)if(xe(V,ye+ge)!==xe(O,ge)){de=!1;break}if(de)return ye}return-1}l.prototype.includes=function(O,T,D){return this.indexOf(O,T,D)!==-1},l.prototype.indexOf=function(O,T,D){return N(this,O,T,D,!0)},l.prototype.lastIndexOf=function(O,T,D){return N(this,O,T,D,!1)};function k(V,O,T,D){T=Number(T)||0;var ne=V.length-T;D?(D=Number(D),D>ne&&(D=ne)):D=ne;var ue=O.length;D>ue/2&&(D=ue/2);for(var re=0;re<D;++re){var pe=parseInt(O.substr(re*2,2),16);if(P(pe))return re;V[T+re]=pe}return re}function E(V,O,T,D){return J(R(O,V.length-T),V,T,D)}function M(V,O,T,D){return J(ee(O),V,T,D)}function z(V,O,T,D){return J(Z(O),V,T,D)}function I(V,O,T,D){return J(te(O,V.length-T),V,T,D)}l.prototype.write=function(O,T,D,ne){if(T===void 0)ne="utf8",D=this.length,T=0;else if(D===void 0&&typeof T=="string")ne=T,D=this.length,T=0;else if(isFinite(T))T=T>>>0,isFinite(D)?(D=D>>>0,ne===void 0&&(ne="utf8")):(ne=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ue=this.length-T;if((D===void 0||D>ue)&&(D=ue),O.length>0&&(D<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");for(var re=!1;;)switch(ne){case"hex":return k(this,O,T,D);case"utf8":case"utf-8":return E(this,O,T,D);case"ascii":case"latin1":case"binary":return M(this,O,T,D);case"base64":return z(this,O,T,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,O,T,D);default:if(re)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),re=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function q(V,O,T){return O===0&&T===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(O,T))}function A(V,O,T){T=Math.min(V.length,T);for(var D=[],ne=O;ne<T;){var ue=V[ne],re=null,pe=ue>239?4:ue>223?3:ue>191?2:1;if(ne+pe<=T){var xe,ye,ae,de;switch(pe){case 1:ue<128&&(re=ue);break;case 2:xe=V[ne+1],(xe&192)===128&&(de=(ue&31)<<6|xe&63,de>127&&(re=de));break;case 3:xe=V[ne+1],ye=V[ne+2],(xe&192)===128&&(ye&192)===128&&(de=(ue&15)<<12|(xe&63)<<6|ye&63,de>2047&&(de<55296||de>57343)&&(re=de));break;case 4:xe=V[ne+1],ye=V[ne+2],ae=V[ne+3],(xe&192)===128&&(ye&192)===128&&(ae&192)===128&&(de=(ue&15)<<18|(xe&63)<<12|(ye&63)<<6|ae&63,de>65535&&de<1114112&&(re=de))}}re===null?(re=65533,pe=1):re>65535&&(re-=65536,D.push(re>>>10&1023|55296),re=56320|re&1023),D.push(re),ne+=pe}return K(D)}var U=4096;function K(V){var O=V.length;if(O<=U)return String.fromCharCode.apply(String,V);for(var T="",D=0;D<O;)T+=String.fromCharCode.apply(String,V.slice(D,D+=U));return T}function G(V,O,T){var D="";T=Math.min(V.length,T);for(var ne=O;ne<T;++ne)D+=String.fromCharCode(V[ne]&127);return D}function Y(V,O,T){var D="";T=Math.min(V.length,T);for(var ne=O;ne<T;++ne)D+=String.fromCharCode(V[ne]);return D}function H(V,O,T){var D=V.length;(!O||O<0)&&(O=0),(!T||T<0||T>D)&&(T=D);for(var ne="",ue=O;ue<T;++ue)ne+=ie[V[ue]];return ne}function $(V,O,T){for(var D=V.slice(O,T),ne="",ue=0;ue<D.length-1;ue+=2)ne+=String.fromCharCode(D[ue]+D[ue+1]*256);return ne}l.prototype.slice=function(O,T){var D=this.length;O=~~O,T=T===void 0?D:~~T,O<0?(O+=D,O<0&&(O=0)):O>D&&(O=D),T<0?(T+=D,T<0&&(T=0)):T>D&&(T=D),T<O&&(T=O);var ne=this.subarray(O,T);return Object.setPrototypeOf(ne,l.prototype),ne};function L(V,O,T){if(V%1!==0||V<0)throw new RangeError("offset is not uint");if(V+O>T)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(O,T,D){O=O>>>0,T=T>>>0,D||L(O,T,this.length);for(var ne=this[O],ue=1,re=0;++re<T&&(ue*=256);)ne+=this[O+re]*ue;return ne},l.prototype.readUintBE=l.prototype.readUIntBE=function(O,T,D){O=O>>>0,T=T>>>0,D||L(O,T,this.length);for(var ne=this[O+--T],ue=1;T>0&&(ue*=256);)ne+=this[O+--T]*ue;return ne},l.prototype.readUint8=l.prototype.readUInt8=function(O,T){return O=O>>>0,T||L(O,1,this.length),this[O]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(O,T){return O=O>>>0,T||L(O,2,this.length),this[O]|this[O+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(O,T){return O=O>>>0,T||L(O,2,this.length),this[O]<<8|this[O+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(O,T){return O=O>>>0,T||L(O,4,this.length),(this[O]|this[O+1]<<8|this[O+2]<<16)+this[O+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(O,T){return O=O>>>0,T||L(O,4,this.length),this[O]*16777216+(this[O+1]<<16|this[O+2]<<8|this[O+3])},l.prototype.readIntLE=function(O,T,D){O=O>>>0,T=T>>>0,D||L(O,T,this.length);for(var ne=this[O],ue=1,re=0;++re<T&&(ue*=256);)ne+=this[O+re]*ue;return ue*=128,ne>=ue&&(ne-=Math.pow(2,8*T)),ne},l.prototype.readIntBE=function(O,T,D){O=O>>>0,T=T>>>0,D||L(O,T,this.length);for(var ne=T,ue=1,re=this[O+--ne];ne>0&&(ue*=256);)re+=this[O+--ne]*ue;return ue*=128,re>=ue&&(re-=Math.pow(2,8*T)),re},l.prototype.readInt8=function(O,T){return O=O>>>0,T||L(O,1,this.length),this[O]&128?(255-this[O]+1)*-1:this[O]},l.prototype.readInt16LE=function(O,T){O=O>>>0,T||L(O,2,this.length);var D=this[O]|this[O+1]<<8;return D&32768?D|4294901760:D},l.prototype.readInt16BE=function(O,T){O=O>>>0,T||L(O,2,this.length);var D=this[O+1]|this[O]<<8;return D&32768?D|4294901760:D},l.prototype.readInt32LE=function(O,T){return O=O>>>0,T||L(O,4,this.length),this[O]|this[O+1]<<8|this[O+2]<<16|this[O+3]<<24},l.prototype.readInt32BE=function(O,T){return O=O>>>0,T||L(O,4,this.length),this[O]<<24|this[O+1]<<16|this[O+2]<<8|this[O+3]},l.prototype.readFloatLE=function(O,T){return O=O>>>0,T||L(O,4,this.length),r.read(this,O,!0,23,4)},l.prototype.readFloatBE=function(O,T){return O=O>>>0,T||L(O,4,this.length),r.read(this,O,!1,23,4)},l.prototype.readDoubleLE=function(O,T){return O=O>>>0,T||L(O,8,this.length),r.read(this,O,!0,52,8)},l.prototype.readDoubleBE=function(O,T){return O=O>>>0,T||L(O,8,this.length),r.read(this,O,!1,52,8)};function F(V,O,T,D,ne,ue){if(!l.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>ne||O<ue)throw new RangeError('"value" argument is out of bounds');if(T+D>V.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(O,T,D,ne){if(O=+O,T=T>>>0,D=D>>>0,!ne){var ue=Math.pow(2,8*D)-1;F(this,O,T,D,ue,0)}var re=1,pe=0;for(this[T]=O&255;++pe<D&&(re*=256);)this[T+pe]=O/re&255;return T+D},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(O,T,D,ne){if(O=+O,T=T>>>0,D=D>>>0,!ne){var ue=Math.pow(2,8*D)-1;F(this,O,T,D,ue,0)}var re=D-1,pe=1;for(this[T+re]=O&255;--re>=0&&(pe*=256);)this[T+re]=O/pe&255;return T+D},l.prototype.writeUint8=l.prototype.writeUInt8=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,1,255,0),this[T]=O&255,T+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,2,65535,0),this[T]=O&255,this[T+1]=O>>>8,T+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,2,65535,0),this[T]=O>>>8,this[T+1]=O&255,T+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,4,4294967295,0),this[T+3]=O>>>24,this[T+2]=O>>>16,this[T+1]=O>>>8,this[T]=O&255,T+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,4,4294967295,0),this[T]=O>>>24,this[T+1]=O>>>16,this[T+2]=O>>>8,this[T+3]=O&255,T+4},l.prototype.writeIntLE=function(O,T,D,ne){if(O=+O,T=T>>>0,!ne){var ue=Math.pow(2,8*D-1);F(this,O,T,D,ue-1,-ue)}var re=0,pe=1,xe=0;for(this[T]=O&255;++re<D&&(pe*=256);)O<0&&xe===0&&this[T+re-1]!==0&&(xe=1),this[T+re]=(O/pe>>0)-xe&255;return T+D},l.prototype.writeIntBE=function(O,T,D,ne){if(O=+O,T=T>>>0,!ne){var ue=Math.pow(2,8*D-1);F(this,O,T,D,ue-1,-ue)}var re=D-1,pe=1,xe=0;for(this[T+re]=O&255;--re>=0&&(pe*=256);)O<0&&xe===0&&this[T+re+1]!==0&&(xe=1),this[T+re]=(O/pe>>0)-xe&255;return T+D},l.prototype.writeInt8=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,1,127,-128),O<0&&(O=255+O+1),this[T]=O&255,T+1},l.prototype.writeInt16LE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,2,32767,-32768),this[T]=O&255,this[T+1]=O>>>8,T+2},l.prototype.writeInt16BE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,2,32767,-32768),this[T]=O>>>8,this[T+1]=O&255,T+2},l.prototype.writeInt32LE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,4,2147483647,-2147483648),this[T]=O&255,this[T+1]=O>>>8,this[T+2]=O>>>16,this[T+3]=O>>>24,T+4},l.prototype.writeInt32BE=function(O,T,D){return O=+O,T=T>>>0,D||F(this,O,T,4,2147483647,-2147483648),O<0&&(O=4294967295+O+1),this[T]=O>>>24,this[T+1]=O>>>16,this[T+2]=O>>>8,this[T+3]=O&255,T+4};function W(V,O,T,D,ne,ue){if(T+D>V.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function X(V,O,T,D,ne){return O=+O,T=T>>>0,ne||W(V,O,T,4),r.write(V,O,T,D,23,4),T+4}l.prototype.writeFloatLE=function(O,T,D){return X(this,O,T,!0,D)},l.prototype.writeFloatBE=function(O,T,D){return X(this,O,T,!1,D)};function oe(V,O,T,D,ne){return O=+O,T=T>>>0,ne||W(V,O,T,8),r.write(V,O,T,D,52,8),T+8}l.prototype.writeDoubleLE=function(O,T,D){return oe(this,O,T,!0,D)},l.prototype.writeDoubleBE=function(O,T,D){return oe(this,O,T,!1,D)},l.prototype.copy=function(O,T,D,ne){if(!l.isBuffer(O))throw new TypeError("argument should be a Buffer");if(D||(D=0),!ne&&ne!==0&&(ne=this.length),T>=O.length&&(T=O.length),T||(T=0),ne>0&&ne<D&&(ne=D),ne===D||O.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),O.length-T<ne-D&&(ne=O.length-T+D);var ue=ne-D;return this===O&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(T,D,ne):Uint8Array.prototype.set.call(O,this.subarray(D,ne),T),ue},l.prototype.fill=function(O,T,D,ne){if(typeof O=="string"){if(typeof T=="string"?(ne=T,T=0,D=this.length):typeof D=="string"&&(ne=D,D=this.length),ne!==void 0&&typeof ne!="string")throw new TypeError("encoding must be a string");if(typeof ne=="string"&&!l.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);if(O.length===1){var ue=O.charCodeAt(0);(ne==="utf8"&&ue<128||ne==="latin1")&&(O=ue)}}else typeof O=="number"?O=O&255:typeof O=="boolean"&&(O=Number(O));if(T<0||this.length<T||this.length<D)throw new RangeError("Out of range index");if(D<=T)return this;T=T>>>0,D=D===void 0?this.length:D>>>0,O||(O=0);var re;if(typeof O=="number")for(re=T;re<D;++re)this[re]=O;else{var pe=l.isBuffer(O)?O:l.from(O,ne),xe=pe.length;if(xe===0)throw new TypeError('The value "'+O+'" is invalid for argument "value"');for(re=0;re<D-T;++re)this[re+T]=pe[re%xe]}return this};var le=/[^+/0-9A-Za-z-_]/g;function B(V){if(V=V.split("=")[0],V=V.trim().replace(le,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function R(V,O){O=O||1/0;for(var T,D=V.length,ne=null,ue=[],re=0;re<D;++re){if(T=V.charCodeAt(re),T>55295&&T<57344){if(!ne){if(T>56319){(O-=3)>-1&&ue.push(239,191,189);continue}else if(re+1===D){(O-=3)>-1&&ue.push(239,191,189);continue}ne=T;continue}if(T<56320){(O-=3)>-1&&ue.push(239,191,189),ne=T;continue}T=(ne-55296<<10|T-56320)+65536}else ne&&(O-=3)>-1&&ue.push(239,191,189);if(ne=null,T<128){if((O-=1)<0)break;ue.push(T)}else if(T<2048){if((O-=2)<0)break;ue.push(T>>6|192,T&63|128)}else if(T<65536){if((O-=3)<0)break;ue.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((O-=4)<0)break;ue.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return ue}function ee(V){for(var O=[],T=0;T<V.length;++T)O.push(V.charCodeAt(T)&255);return O}function te(V,O){for(var T,D,ne,ue=[],re=0;re<V.length&&!((O-=2)<0);++re)T=V.charCodeAt(re),D=T>>8,ne=T%256,ue.push(ne),ue.push(D);return ue}function Z(V){return e.toByteArray(B(V))}function J(V,O,T,D){for(var ne=0;ne<D&&!(ne+T>=O.length||ne>=V.length);++ne)O[ne+T]=V[ne];return ne}function he(V,O){return V instanceof O||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===O.name}function P(V){return V!==V}var ie=function(){for(var V="0123456789abcdef",O=new Array(256),T=0;T<16;++T)for(var D=T*16,ne=0;ne<16;++ne)O[D+ne]=V[T]+V[ne];return O}()}(SI)),SI}var NI={},AI={},EI,NK;function ope(){return NK||(NK=1,EI=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,r);if(l.value!==s||l.enumerable!==!0)return!1}return!0}),EI}var CI,AK;function dB(){if(AK)return CI;AK=1;var t=ope();return CI=function(){return t()&&!!Symbol.toStringTag},CI}var kI,EK;function lpe(){return EK||(EK=1,kI=Object),kI}var TI,CK;function odt(){return CK||(CK=1,TI=Error),TI}var PI,kK;function ldt(){return kK||(kK=1,PI=EvalError),PI}var OI,TK;function cdt(){return TK||(TK=1,OI=RangeError),OI}var II,PK;function udt(){return PK||(PK=1,II=ReferenceError),II}var RI,OK;function cpe(){return OK||(OK=1,RI=SyntaxError),RI}var MI,IK;function gS(){return IK||(IK=1,MI=TypeError),MI}var DI,RK;function ddt(){return RK||(RK=1,DI=URIError),DI}var LI,MK;function hdt(){return MK||(MK=1,LI=Math.abs),LI}var FI,DK;function fdt(){return DK||(DK=1,FI=Math.floor),FI}var $I,LK;function pdt(){return LK||(LK=1,$I=Math.max),$I}var BI,FK;function mdt(){return FK||(FK=1,BI=Math.min),BI}var UI,$K;function gdt(){return $K||($K=1,UI=Math.pow),UI}var zI,BK;function ydt(){return BK||(BK=1,zI=Math.round),zI}var HI,UK;function vdt(){return UK||(UK=1,HI=Number.isNaN||function(e){return e!==e}),HI}var WI,zK;function xdt(){if(zK)return WI;zK=1;var t=vdt();return WI=function(r){return t(r)||r===0?r:r<0?-1:1},WI}var VI,HK;function bdt(){return HK||(HK=1,VI=Object.getOwnPropertyDescriptor),VI}var qI,WK;function yS(){if(WK)return qI;WK=1;var t=bdt();if(t)try{t([],"length")}catch{t=null}return qI=t,qI}var GI,VK;function Z2(){if(VK)return GI;VK=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return GI=t,GI}var KI,qK;function wdt(){if(qK)return KI;qK=1;var t=typeof Symbol<"u"&&Symbol,e=ope();return KI=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},KI}var YI,GK;function upe(){return GK||(GK=1,YI=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),YI}var XI,KK;function dpe(){if(KK)return XI;KK=1;var t=lpe();return XI=t.getPrototypeOf||null,XI}var QI,YK;function _dt(){if(YK)return QI;YK=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",s=function(c,u){for(var d=[],h=0;h<c.length;h+=1)d[h]=c[h];for(var f=0;f<u.length;f+=1)d[f+c.length]=u[f];return d},i=function(c,u){for(var d=[],h=u,f=0;h<c.length;h+=1,f+=1)d[f]=c[h];return d},o=function(l,c){for(var u="",d=0;d<l.length;d+=1)u+=l[d],d+1<l.length&&(u+=c);return u};return QI=function(c){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(t+u);for(var d=i(arguments,1),h,f=function(){if(this instanceof h){var y=u.apply(this,s(d,arguments));return Object(y)===y?y:this}return u.apply(c,s(d,arguments))},p=r(0,u.length-d.length),g=[],m=0;m<p;m++)g[m]="$"+m;if(h=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var v=function(){};v.prototype=u.prototype,h.prototype=new v,v.prototype=null}return h},QI}var ZI,XK;function vS(){if(XK)return ZI;XK=1;var t=_dt();return ZI=Function.prototype.bind||t,ZI}var JI,QK;function hB(){return QK||(QK=1,JI=Function.prototype.call),JI}var eR,ZK;function hpe(){return ZK||(ZK=1,eR=Function.prototype.apply),eR}var tR,JK;function jdt(){return JK||(JK=1,tR=typeof Reflect<"u"&&Reflect&&Reflect.apply),tR}var rR,eY;function Sdt(){if(eY)return rR;eY=1;var t=vS(),e=hpe(),r=hB(),n=jdt();return rR=n||t.call(r,e),rR}var nR,tY;function Ndt(){if(tY)return nR;tY=1;var t=vS(),e=gS(),r=hB(),n=Sdt();return nR=function(i){if(i.length<1||typeof i[0]!="function")throw new e("a function is required");return n(t,r,i)},nR}var sR,rY;function Adt(){if(rY)return sR;rY=1;var t=Ndt(),e=yS(),r;try{r=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!r&&e&&e(Object.prototype,"__proto__"),s=Object,i=s.getPrototypeOf;return sR=n&&typeof n.get=="function"?t([n.get]):typeof i=="function"?function(l){return i(l==null?l:s(l))}:!1,sR}var iR,nY;function Edt(){if(nY)return iR;nY=1;var t=upe(),e=dpe(),r=Adt();return iR=t?function(s){return t(s)}:e?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return e(s)}:r?function(s){return r(s)}:null,iR}var aR,sY;function Cdt(){if(sY)return aR;sY=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=vS();return aR=r.call(t,e),aR}var oR,iY;function fB(){if(iY)return oR;iY=1;var t,e=lpe(),r=odt(),n=ldt(),s=cdt(),i=udt(),o=cpe(),l=gS(),c=ddt(),u=hdt(),d=fdt(),h=pdt(),f=mdt(),p=gdt(),g=ydt(),m=xdt(),v=Function,y=function(ee){try{return v('"use strict"; return ('+ee+").constructor;")()}catch{}},x=yS(),b=Z2(),w=function(){throw new l},j=x?function(){try{return arguments.callee,w}catch{try{return x(arguments,"callee").get}catch{return w}}}():w,N=wdt()(),C=Edt(),k=dpe(),E=upe(),M=hpe(),z=hB(),I={},q=typeof Uint8Array>"u"||!C?t:C(Uint8Array),A={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":N&&C?C([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":N&&C?C(C([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!N||!C?t:C(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":s,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!N||!C?t:C(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":N&&C?C(""[Symbol.iterator]()):t,"%Symbol%":N?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":j,"%TypedArray%":q,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":z,"%Function.prototype.apply%":M,"%Object.defineProperty%":b,"%Object.getPrototypeOf%":k,"%Math.abs%":u,"%Math.floor%":d,"%Math.max%":h,"%Math.min%":f,"%Math.pow%":p,"%Math.round%":g,"%Math.sign%":m,"%Reflect.getPrototypeOf%":E};if(C)try{null.error}catch(ee){var U=C(C(ee));A["%Error.prototype%"]=U}var K=function ee(te){var Z;if(te==="%AsyncFunction%")Z=y("async function () {}");else if(te==="%GeneratorFunction%")Z=y("function* () {}");else if(te==="%AsyncGeneratorFunction%")Z=y("async function* () {}");else if(te==="%AsyncGenerator%"){var J=ee("%AsyncGeneratorFunction%");J&&(Z=J.prototype)}else if(te==="%AsyncIteratorPrototype%"){var he=ee("%AsyncGenerator%");he&&C&&(Z=C(he.prototype))}return A[te]=Z,Z},G={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Y=vS(),H=Cdt(),$=Y.call(z,Array.prototype.concat),L=Y.call(M,Array.prototype.splice),F=Y.call(z,String.prototype.replace),W=Y.call(z,String.prototype.slice),X=Y.call(z,RegExp.prototype.exec),oe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,le=/\\(\\)?/g,B=function(te){var Z=W(te,0,1),J=W(te,-1);if(Z==="%"&&J!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(J==="%"&&Z!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var he=[];return F(te,oe,function(P,ie,V,O){he[he.length]=V?F(O,le,"$1"):ie||P}),he},R=function(te,Z){var J=te,he;if(H(G,J)&&(he=G[J],J="%"+he[0]+"%"),H(A,J)){var P=A[J];if(P===I&&(P=K(J)),typeof P>"u"&&!Z)throw new l("intrinsic "+te+" exists, but is not available. Please file an issue!");return{alias:he,name:J,value:P}}throw new o("intrinsic "+te+" does not exist!")};return oR=function(te,Z){if(typeof te!="string"||te.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Z!="boolean")throw new l('"allowMissing" argument must be a boolean');if(X(/^%?[^%]*%?$/,te)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var J=B(te),he=J.length>0?J[0]:"",P=R("%"+he+"%",Z),ie=P.name,V=P.value,O=!1,T=P.alias;T&&(he=T[0],L(J,$([0,1],T)));for(var D=1,ne=!0;D<J.length;D+=1){var ue=J[D],re=W(ue,0,1),pe=W(ue,-1);if((re==='"'||re==="'"||re==="`"||pe==='"'||pe==="'"||pe==="`")&&re!==pe)throw new o("property names with quotes must have matching quotes");if((ue==="constructor"||!ne)&&(O=!0),he+="."+ue,ie="%"+he+"%",H(A,ie))V=A[ie];else if(V!=null){if(!(ue in V)){if(!Z)throw new l("base intrinsic for "+te+" exists, but the property is not available.");return}if(x&&D+1>=J.length){var xe=x(V,ue);ne=!!xe,ne&&"get"in xe&&!("originalValue"in xe.get)?V=xe.get:V=V[ue]}else ne=H(V,ue),V=V[ue];ne&&!O&&(A[ie]=V)}}return V},oR}var lR={exports:{}},cR,aY;function kdt(){if(aY)return cR;aY=1;var t=Z2(),e=cpe(),r=gS(),n=yS();return cR=function(i,o,l){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,f=!!n&&n(i,o);if(t)t(i,o,{configurable:d===null&&f?f.configurable:!d,enumerable:c===null&&f?f.enumerable:!c,value:l,writable:u===null&&f?f.writable:!u});else if(h||!c&&!u&&!d)i[o]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},cR}var uR,oY;function Tdt(){if(oY)return uR;oY=1;var t=Z2(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},uR=e,uR}var dR,lY;function Pdt(){if(lY)return dR;lY=1;var t=fB(),e=kdt(),r=Tdt()(),n=yS(),s=gS(),i=t("%Math.floor%");return dR=function(l,c){if(typeof l!="function")throw new s("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||i(c)!==c)throw new s("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],d=!0,h=!0;if("length"in l&&n){var f=n(l,"length");f&&!f.configurable&&(d=!1),f&&!f.writable&&(h=!1)}return(d||h||!u)&&(r?e(l,"length",c,!0,!0):e(l,"length",c)),l},dR}var cY;function fpe(){return cY||(cY=1,function(t){var e=vS(),r=fB(),n=Pdt(),s=gS(),i=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),l=r("%Reflect.apply%",!0)||e.call(o,i),c=Z2(),u=r("%Math.max%");t.exports=function(f){if(typeof f!="function")throw new s("a function is required");var p=l(e,o,arguments);return n(p,1+u(0,f.length-(arguments.length-1)),!0)};var d=function(){return l(e,i,arguments)};c?c(t.exports,"apply",{value:d}):t.exports.apply=d}(lR)),lR.exports}var hR,uY;function ppe(){if(uY)return hR;uY=1;var t=fB(),e=fpe(),r=e(t("String.prototype.indexOf"));return hR=function(s,i){var o=t(s,!!i);return typeof o=="function"&&r(s,".prototype.")>-1?e(o):o},hR}var fR,dY;function Odt(){if(dY)return fR;dY=1;var t=dB()(),e=ppe(),r=e("Object.prototype.toString"),n=function(l){return t&&l&&typeof l=="object"&&Symbol.toStringTag in l?!1:r(l)==="[object Arguments]"},s=function(l){return n(l)?!0:l!==null&&typeof l=="object"&&typeof l.length=="number"&&l.length>=0&&r(l)!=="[object Array]"&&r(l.callee)==="[object Function]"},i=function(){return n(arguments)}();return n.isLegacyArguments=s,fR=i?n:s,fR}var pR,hY;function Idt(){if(hY)return pR;hY=1;var t=Object.prototype.toString,e=Function.prototype.toString,r=/^\s*(?:function)?\*/,n=dB()(),s=Object.getPrototypeOf,i=function(){if(!n)return!1;try{return Function("return function*() {}")()}catch{}},o;return pR=function(c){if(typeof c!="function")return!1;if(r.test(e.call(c)))return!0;if(!n){var u=t.call(c);return u==="[object GeneratorFunction]"}if(!s)return!1;if(typeof o>"u"){var d=i();o=d?s(d):!1}return s(c)===o},pR}var mR,fY;function Rdt(){if(fY)return mR;fY=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(x){x!==n&&(e=null)}else e=null;var s=/^\s*class\b/,i=function(b){try{var w=t.call(b);return s.test(w)}catch{return!1}},o=function(b){try{return i(b)?!1:(t.call(b),!0)}catch{return!1}},l=Object.prototype.toString,c="[object Object]",u="[object Function]",d="[object GeneratorFunction]",h="[object HTMLAllCollection]",f="[object HTML document.all class]",p="[object HTMLCollection]",g=typeof Symbol=="function"&&!!Symbol.toStringTag,m=!(0 in[,]),v=function(){return!1};if(typeof document=="object"){var y=document.all;l.call(y)===l.call(document.all)&&(v=function(b){if((m||!b)&&(typeof b>"u"||typeof b=="object"))try{var w=l.call(b);return(w===h||w===f||w===p||w===c)&&b("")==null}catch{}return!1})}return mR=e?function(b){if(v(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;try{e(b,null,r)}catch(w){if(w!==n)return!1}return!i(b)&&o(b)}:function(b){if(v(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;if(g)return o(b);if(i(b))return!1;var w=l.call(b);return w!==u&&w!==d&&!/^\[object HTML/.test(w)?!1:o(b)},mR}var gR,pY;function Mdt(){if(pY)return gR;pY=1;var t=Rdt(),e=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(c,u,d){for(var h=0,f=c.length;h<f;h++)r.call(c,h)&&(d==null?u(c[h],h,c):u.call(d,c[h],h,c))},s=function(c,u,d){for(var h=0,f=c.length;h<f;h++)d==null?u(c.charAt(h),h,c):u.call(d,c.charAt(h),h,c)},i=function(c,u,d){for(var h in c)r.call(c,h)&&(d==null?u(c[h],h,c):u.call(d,c[h],h,c))},o=function(c,u,d){if(!t(u))throw new TypeError("iterator must be a function");var h;arguments.length>=3&&(h=d),e.call(c)==="[object Array]"?n(c,u,h):typeof c=="string"?s(c,u,h):i(c,u,h)};return gR=o,gR}var yR,mY;function Ddt(){return mY||(mY=1,yR=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),yR}var vR,gY;function Ldt(){if(gY)return vR;gY=1;var t=Ddt(),e=typeof globalThis>"u"?oc:globalThis;return vR=function(){for(var n=[],s=0;s<t.length;s++)typeof e[t[s]]=="function"&&(n[n.length]=t[s]);return n},vR}var xR,yY;function mpe(){if(yY)return xR;yY=1;var t=Mdt(),e=Ldt(),r=fpe(),n=ppe(),s=yS(),i=n("Object.prototype.toString"),o=dB()(),l=typeof globalThis>"u"?oc:globalThis,c=e(),u=n("String.prototype.slice"),d=Object.getPrototypeOf,h=n("Array.prototype.indexOf",!0)||function(v,y){for(var x=0;x<v.length;x+=1)if(v[x]===y)return x;return-1},f={__proto__:null};o&&s&&d?t(c,function(m){var v=new l[m];if(Symbol.toStringTag in v){var y=d(v),x=s(y,Symbol.toStringTag);if(!x){var b=d(y);x=s(b,Symbol.toStringTag)}f["$"+m]=r(x.get)}}):t(c,function(m){var v=new l[m],y=v.slice||v.set;y&&(f["$"+m]=r(y))});var p=function(v){var y=!1;return t(f,function(x,b){if(!y)try{"$"+x(v)===b&&(y=u(b,1))}catch{}}),y},g=function(v){var y=!1;return t(f,function(x,b){if(!y)try{x(v),y=u(b,1)}catch{}}),y};return xR=function(v){if(!v||typeof v!="object")return!1;if(!o){var y=u(i(v),8,-1);return h(c,y)>-1?y:y!=="Object"?!1:g(v)}return s?p(v):null},xR}var bR,vY;function Fdt(){if(vY)return bR;vY=1;var t=mpe();return bR=function(r){return!!t(r)},bR}var xY;function $dt(){return xY||(xY=1,function(t){var e=Odt(),r=Idt(),n=mpe(),s=Fdt();function i(D){return D.call.bind(D)}var o=typeof BigInt<"u",l=typeof Symbol<"u",c=i(Object.prototype.toString),u=i(Number.prototype.valueOf),d=i(String.prototype.valueOf),h=i(Boolean.prototype.valueOf);if(o)var f=i(BigInt.prototype.valueOf);if(l)var p=i(Symbol.prototype.valueOf);function g(D,ne){if(typeof D!="object")return!1;try{return ne(D),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function m(D){return typeof Promise<"u"&&D instanceof Promise||D!==null&&typeof D=="object"&&typeof D.then=="function"&&typeof D.catch=="function"}t.isPromise=m;function v(D){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(D):s(D)||W(D)}t.isArrayBufferView=v;function y(D){return n(D)==="Uint8Array"}t.isUint8Array=y;function x(D){return n(D)==="Uint8ClampedArray"}t.isUint8ClampedArray=x;function b(D){return n(D)==="Uint16Array"}t.isUint16Array=b;function w(D){return n(D)==="Uint32Array"}t.isUint32Array=w;function j(D){return n(D)==="Int8Array"}t.isInt8Array=j;function N(D){return n(D)==="Int16Array"}t.isInt16Array=N;function C(D){return n(D)==="Int32Array"}t.isInt32Array=C;function k(D){return n(D)==="Float32Array"}t.isFloat32Array=k;function E(D){return n(D)==="Float64Array"}t.isFloat64Array=E;function M(D){return n(D)==="BigInt64Array"}t.isBigInt64Array=M;function z(D){return n(D)==="BigUint64Array"}t.isBigUint64Array=z;function I(D){return c(D)==="[object Map]"}I.working=typeof Map<"u"&&I(new Map);function q(D){return typeof Map>"u"?!1:I.working?I(D):D instanceof Map}t.isMap=q;function A(D){return c(D)==="[object Set]"}A.working=typeof Set<"u"&&A(new Set);function U(D){return typeof Set>"u"?!1:A.working?A(D):D instanceof Set}t.isSet=U;function K(D){return c(D)==="[object WeakMap]"}K.working=typeof WeakMap<"u"&&K(new WeakMap);function G(D){return typeof WeakMap>"u"?!1:K.working?K(D):D instanceof WeakMap}t.isWeakMap=G;function Y(D){return c(D)==="[object WeakSet]"}Y.working=typeof WeakSet<"u"&&Y(new WeakSet);function H(D){return Y(D)}t.isWeakSet=H;function $(D){return c(D)==="[object ArrayBuffer]"}$.working=typeof ArrayBuffer<"u"&&$(new ArrayBuffer);function L(D){return typeof ArrayBuffer>"u"?!1:$.working?$(D):D instanceof ArrayBuffer}t.isArrayBuffer=L;function F(D){return c(D)==="[object DataView]"}F.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&F(new DataView(new ArrayBuffer(1),0,1));function W(D){return typeof DataView>"u"?!1:F.working?F(D):D instanceof DataView}t.isDataView=W;var X=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function oe(D){return c(D)==="[object SharedArrayBuffer]"}function le(D){return typeof X>"u"?!1:(typeof oe.working>"u"&&(oe.working=oe(new X)),oe.working?oe(D):D instanceof X)}t.isSharedArrayBuffer=le;function B(D){return c(D)==="[object AsyncFunction]"}t.isAsyncFunction=B;function R(D){return c(D)==="[object Map Iterator]"}t.isMapIterator=R;function ee(D){return c(D)==="[object Set Iterator]"}t.isSetIterator=ee;function te(D){return c(D)==="[object Generator]"}t.isGeneratorObject=te;function Z(D){return c(D)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Z;function J(D){return g(D,u)}t.isNumberObject=J;function he(D){return g(D,d)}t.isStringObject=he;function P(D){return g(D,h)}t.isBooleanObject=P;function ie(D){return o&&g(D,f)}t.isBigIntObject=ie;function V(D){return l&&g(D,p)}t.isSymbolObject=V;function O(D){return J(D)||he(D)||P(D)||ie(D)||V(D)}t.isBoxedPrimitive=O;function T(D){return typeof Uint8Array<"u"&&(L(D)||le(D))}t.isAnyArrayBuffer=T,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(D){Object.defineProperty(t,D,{enumerable:!1,value:function(){throw new Error(D+" is not supported in userland")}})})}(AI)),AI}var wR,bY;function Bdt(){return bY||(bY=1,wR=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),wR}var wY;function gpe(){return wY||(wY=1,function(t){var e=Object.getOwnPropertyDescriptors||function(W){for(var X=Object.keys(W),oe={},le=0;le<X.length;le++)oe[X[le]]=Object.getOwnPropertyDescriptor(W,X[le]);return oe},r=/%[sdj%]/g;t.format=function(F){if(!j(F)){for(var W=[],X=0;X<arguments.length;X++)W.push(o(arguments[X]));return W.join(" ")}for(var X=1,oe=arguments,le=oe.length,B=String(F).replace(r,function(ee){if(ee==="%%")return"%";if(X>=le)return ee;switch(ee){case"%s":return String(oe[X++]);case"%d":return Number(oe[X++]);case"%j":try{return JSON.stringify(oe[X++])}catch{return"[Circular]"}default:return ee}}),R=oe[X];X<le;R=oe[++X])x(R)||!E(R)?B+=" "+R:B+=" "+o(R);return B},t.deprecate=function(F,W){if(typeof $t<"u"&&$t.noDeprecation===!0)return F;if(typeof $t>"u")return function(){return t.deprecate(F,W).apply(this,arguments)};var X=!1;function oe(){if(!X){if($t.throwDeprecation)throw new Error(W);$t.traceDeprecation?console.trace(W):console.error(W),X=!0}return F.apply(this,arguments)}return oe};var n={},s=/^$/;if($t.env.NODE_DEBUG){var i=$t.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+i+"$","i")}t.debuglog=function(F){if(F=F.toUpperCase(),!n[F])if(s.test(F)){var W=$t.pid;n[F]=function(){var X=t.format.apply(t,arguments);console.error("%s %d: %s",F,W,X)}}else n[F]=function(){};return n[F]};function o(F,W){var X={seen:[],stylize:c};return arguments.length>=3&&(X.depth=arguments[2]),arguments.length>=4&&(X.colors=arguments[3]),y(W)?X.showHidden=W:W&&t._extend(X,W),C(X.showHidden)&&(X.showHidden=!1),C(X.depth)&&(X.depth=2),C(X.colors)&&(X.colors=!1),C(X.customInspect)&&(X.customInspect=!0),X.colors&&(X.stylize=l),d(X,F,X.depth)}t.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(F,W){var X=o.styles[W];return X?"\x1B["+o.colors[X][0]+"m"+F+"\x1B["+o.colors[X][1]+"m":F}function c(F,W){return F}function u(F){var W={};return F.forEach(function(X,oe){W[X]=!0}),W}function d(F,W,X){if(F.customInspect&&W&&I(W.inspect)&&W.inspect!==t.inspect&&!(W.constructor&&W.constructor.prototype===W)){var oe=W.inspect(X,F);return j(oe)||(oe=d(F,oe,X)),oe}var le=h(F,W);if(le)return le;var B=Object.keys(W),R=u(B);if(F.showHidden&&(B=Object.getOwnPropertyNames(W)),z(W)&&(B.indexOf("message")>=0||B.indexOf("description")>=0))return f(W);if(B.length===0){if(I(W)){var ee=W.name?": "+W.name:"";return F.stylize("[Function"+ee+"]","special")}if(k(W))return F.stylize(RegExp.prototype.toString.call(W),"regexp");if(M(W))return F.stylize(Date.prototype.toString.call(W),"date");if(z(W))return f(W)}var te="",Z=!1,J=["{","}"];if(v(W)&&(Z=!0,J=["[","]"]),I(W)){var he=W.name?": "+W.name:"";te=" [Function"+he+"]"}if(k(W)&&(te=" "+RegExp.prototype.toString.call(W)),M(W)&&(te=" "+Date.prototype.toUTCString.call(W)),z(W)&&(te=" "+f(W)),B.length===0&&(!Z||W.length==0))return J[0]+te+J[1];if(X<0)return k(W)?F.stylize(RegExp.prototype.toString.call(W),"regexp"):F.stylize("[Object]","special");F.seen.push(W);var P;return Z?P=p(F,W,X,R,B):P=B.map(function(ie){return g(F,W,X,R,ie,Z)}),F.seen.pop(),m(P,te,J)}function h(F,W){if(C(W))return F.stylize("undefined","undefined");if(j(W)){var X="'"+JSON.stringify(W).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return F.stylize(X,"string")}if(w(W))return F.stylize(""+W,"number");if(y(W))return F.stylize(""+W,"boolean");if(x(W))return F.stylize("null","null")}function f(F){return"["+Error.prototype.toString.call(F)+"]"}function p(F,W,X,oe,le){for(var B=[],R=0,ee=W.length;R<ee;++R)Y(W,String(R))?B.push(g(F,W,X,oe,String(R),!0)):B.push("");return le.forEach(function(te){te.match(/^\d+$/)||B.push(g(F,W,X,oe,te,!0))}),B}function g(F,W,X,oe,le,B){var R,ee,te;if(te=Object.getOwnPropertyDescriptor(W,le)||{value:W[le]},te.get?te.set?ee=F.stylize("[Getter/Setter]","special"):ee=F.stylize("[Getter]","special"):te.set&&(ee=F.stylize("[Setter]","special")),Y(oe,le)||(R="["+le+"]"),ee||(F.seen.indexOf(te.value)<0?(x(X)?ee=d(F,te.value,null):ee=d(F,te.value,X-1),ee.indexOf(`
`)>-1&&(B?ee=ee.split(`
`).map(function(Z){return"  "+Z}).join(`
`).slice(2):ee=`
`+ee.split(`
`).map(function(Z){return"   "+Z}).join(`
`))):ee=F.stylize("[Circular]","special")),C(R)){if(B&&le.match(/^\d+$/))return ee;R=JSON.stringify(""+le),R.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(R=R.slice(1,-1),R=F.stylize(R,"name")):(R=R.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),R=F.stylize(R,"string"))}return R+": "+ee}function m(F,W,X){var oe=F.reduce(function(le,B){return B.indexOf(`
`)>=0,le+B.replace(/\u001b\[\d\d?m/g,"").length+1},0);return oe>60?X[0]+(W===""?"":W+`
 `)+" "+F.join(`,
  `)+" "+X[1]:X[0]+W+" "+F.join(", ")+" "+X[1]}t.types=$dt();function v(F){return Array.isArray(F)}t.isArray=v;function y(F){return typeof F=="boolean"}t.isBoolean=y;function x(F){return F===null}t.isNull=x;function b(F){return F==null}t.isNullOrUndefined=b;function w(F){return typeof F=="number"}t.isNumber=w;function j(F){return typeof F=="string"}t.isString=j;function N(F){return typeof F=="symbol"}t.isSymbol=N;function C(F){return F===void 0}t.isUndefined=C;function k(F){return E(F)&&A(F)==="[object RegExp]"}t.isRegExp=k,t.types.isRegExp=k;function E(F){return typeof F=="object"&&F!==null}t.isObject=E;function M(F){return E(F)&&A(F)==="[object Date]"}t.isDate=M,t.types.isDate=M;function z(F){return E(F)&&(A(F)==="[object Error]"||F instanceof Error)}t.isError=z,t.types.isNativeError=z;function I(F){return typeof F=="function"}t.isFunction=I;function q(F){return F===null||typeof F=="boolean"||typeof F=="number"||typeof F=="string"||typeof F=="symbol"||typeof F>"u"}t.isPrimitive=q,t.isBuffer=Bdt();function A(F){return Object.prototype.toString.call(F)}function U(F){return F<10?"0"+F.toString(10):F.toString(10)}var K=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function G(){var F=new Date,W=[U(F.getHours()),U(F.getMinutes()),U(F.getSeconds())].join(":");return[F.getDate(),K[F.getMonth()],W].join(" ")}t.log=function(){console.log("%s - %s",G(),t.format.apply(t,arguments))},t.inherits=Cf(),t._extend=function(F,W){if(!W||!E(W))return F;for(var X=Object.keys(W),oe=X.length;oe--;)F[X[oe]]=W[X[oe]];return F};function Y(F,W){return Object.prototype.hasOwnProperty.call(F,W)}var H=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(W){if(typeof W!="function")throw new TypeError('The "original" argument must be of type Function');if(H&&W[H]){var X=W[H];if(typeof X!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(X,H,{value:X,enumerable:!1,writable:!1,configurable:!0}),X}function X(){for(var oe,le,B=new Promise(function(te,Z){oe=te,le=Z}),R=[],ee=0;ee<arguments.length;ee++)R.push(arguments[ee]);R.push(function(te,Z){te?le(te):oe(Z)});try{W.apply(this,R)}catch(te){le(te)}return B}return Object.setPrototypeOf(X,Object.getPrototypeOf(W)),H&&Object.defineProperty(X,H,{value:X,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(X,e(W))},t.promisify.custom=H;function $(F,W){if(!F){var X=new Error("Promise was rejected with a falsy value");X.reason=F,F=X}return W(F)}function L(F){if(typeof F!="function")throw new TypeError('The "original" argument must be of type Function');function W(){for(var X=[],oe=0;oe<arguments.length;oe++)X.push(arguments[oe]);var le=X.pop();if(typeof le!="function")throw new TypeError("The last argument must be of type Function");var B=this,R=function(){return le.apply(B,arguments)};F.apply(this,X).then(function(ee){$t.nextTick(R.bind(null,null,ee))},function(ee){$t.nextTick($.bind(null,ee,R))})}return Object.setPrototypeOf(W,Object.getPrototypeOf(F)),Object.defineProperties(W,e(F)),W}t.callbackify=L}(NI)),NI}var _R,_Y;function Udt(){if(_Y)return _R;_Y=1;function t(f,p){var g=Object.keys(f);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(f);p&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(f,v).enumerable})),g.push.apply(g,m)}return g}function e(f){for(var p=1;p<arguments.length;p++){var g=arguments[p]!=null?arguments[p]:{};p%2?t(Object(g),!0).forEach(function(m){r(f,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(g)):t(Object(g)).forEach(function(m){Object.defineProperty(f,m,Object.getOwnPropertyDescriptor(g,m))})}return f}function r(f,p,g){return p in f?Object.defineProperty(f,p,{value:g,enumerable:!0,configurable:!0,writable:!0}):f[p]=g,f}function n(f,p){if(!(f instanceof p))throw new TypeError("Cannot call a class as a function")}function s(f,p){for(var g=0;g<p.length;g++){var m=p[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function i(f,p,g){return p&&s(f.prototype,p),f}var o=Q2(),l=o.Buffer,c=gpe(),u=c.inspect,d=u&&u.custom||"inspect";function h(f,p,g){l.prototype.copy.call(f,p,g)}return _R=function(){function f(){n(this,f),this.head=null,this.tail=null,this.length=0}return i(f,[{key:"push",value:function(g){var m={data:g,next:null};this.length>0?this.tail.next=m:this.head=m,this.tail=m,++this.length}},{key:"unshift",value:function(g){var m={data:g,next:this.head};this.length===0&&(this.tail=m),this.head=m,++this.length}},{key:"shift",value:function(){if(this.length!==0){var g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(g){if(this.length===0)return"";for(var m=this.head,v=""+m.data;m=m.next;)v+=g+m.data;return v}},{key:"concat",value:function(g){if(this.length===0)return l.alloc(0);for(var m=l.allocUnsafe(g>>>0),v=this.head,y=0;v;)h(v.data,m,y),y+=v.data.length,v=v.next;return m}},{key:"consume",value:function(g,m){var v;return g<this.head.data.length?(v=this.head.data.slice(0,g),this.head.data=this.head.data.slice(g)):g===this.head.data.length?v=this.shift():v=m?this._getString(g):this._getBuffer(g),v}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(g){var m=this.head,v=1,y=m.data;for(g-=y.length;m=m.next;){var x=m.data,b=g>x.length?x.length:g;if(b===x.length?y+=x:y+=x.slice(0,g),g-=b,g===0){b===x.length?(++v,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=x.slice(b));break}++v}return this.length-=v,y}},{key:"_getBuffer",value:function(g){var m=l.allocUnsafe(g),v=this.head,y=1;for(v.data.copy(m),g-=v.data.length;v=v.next;){var x=v.data,b=g>x.length?x.length:g;if(x.copy(m,m.length-g,0,b),g-=b,g===0){b===x.length?(++y,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=x.slice(b));break}++y}return this.length-=y,m}},{key:d,value:function(g,m){return u(this,e({},m,{depth:0,customInspect:!1}))}}]),f}(),_R}var jR,jY;function ype(){if(jY)return jR;jY=1;function t(o,l){var c=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(l?l(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,$t.nextTick(s,this,o)):$t.nextTick(s,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,function(h){!l&&h?c._writableState?c._writableState.errorEmitted?$t.nextTick(r,c):(c._writableState.errorEmitted=!0,$t.nextTick(e,c,h)):$t.nextTick(e,c,h):l?($t.nextTick(r,c),l(h)):$t.nextTick(r,c)}),this)}function e(o,l){s(o,l),r(o)}function r(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function n(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(o,l){o.emit("error",l)}function i(o,l){var c=o._readableState,u=o._writableState;c&&c.autoDestroy||u&&u.autoDestroy?o.destroy(l):o.emit("error",l)}return jR={destroy:t,undestroy:n,errorOrDestroy:i},jR}var SR={},SY;function M0(){if(SY)return SR;SY=1;function t(l,c){l.prototype=Object.create(c.prototype),l.prototype.constructor=l,l.__proto__=c}var e={};function r(l,c,u){u||(u=Error);function d(f,p,g){return typeof c=="string"?c:c(f,p,g)}var h=function(f){t(p,f);function p(g,m,v){return f.call(this,d(g,m,v))||this}return p}(u);h.prototype.name=u.name,h.prototype.code=l,e[l]=h}function n(l,c){if(Array.isArray(l)){var u=l.length;return l=l.map(function(d){return String(d)}),u>2?"one of ".concat(c," ").concat(l.slice(0,u-1).join(", "),", or ")+l[u-1]:u===2?"one of ".concat(c," ").concat(l[0]," or ").concat(l[1]):"of ".concat(c," ").concat(l[0])}else return"of ".concat(c," ").concat(String(l))}function s(l,c,u){return l.substr(0,c.length)===c}function i(l,c,u){return(u===void 0||u>l.length)&&(u=l.length),l.substring(u-c.length,u)===c}function o(l,c,u){return typeof u!="number"&&(u=0),u+c.length>l.length?!1:l.indexOf(c,u)!==-1}return r("ERR_INVALID_OPT_VALUE",function(l,c){return'The value "'+c+'" is invalid for option "'+l+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(l,c,u){var d;typeof c=="string"&&s(c,"not ")?(d="must not be",c=c.replace(/^not /,"")):d="must be";var h;if(i(l," argument"))h="The ".concat(l," ").concat(d," ").concat(n(c,"type"));else{var f=o(l,".")?"property":"argument";h='The "'.concat(l,'" ').concat(f," ").concat(d," ").concat(n(c,"type"))}return h+=". Received type ".concat(typeof u),h},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(l){return"Unknown encoding: "+l},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),SR.codes=e,SR}var NR,NY;function vpe(){if(NY)return NR;NY=1;var t=M0().codes.ERR_INVALID_OPT_VALUE;function e(n,s,i){return n.highWaterMark!=null?n.highWaterMark:s?n[i]:null}function r(n,s,i,o){var l=e(s,o,i);if(l!=null){if(!(isFinite(l)&&Math.floor(l)===l)||l<0){var c=o?i:"highWaterMark";throw new t(c,l)}return Math.floor(l)}return n.objectMode?16:16*1024}return NR={getHighWaterMark:r},NR}var AR,AY;function zdt(){if(AY)return AR;AY=1,AR=t;function t(r,n){if(e("noDeprecation"))return r;var s=!1;function i(){if(!s){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),s=!0}return r.apply(this,arguments)}return i}function e(r){try{if(!oc.localStorage)return!1}catch{return!1}var n=oc.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return AR}var ER,EY;function xpe(){if(EY)return ER;EY=1,ER=k;function t(le){var B=this;this.next=null,this.entry=null,this.finish=function(){oe(B,le)}}var e;k.WritableState=N;var r={deprecate:zdt()},n=ape(),s=Q2().Buffer,i=oc.Uint8Array||function(){};function o(le){return s.from(le)}function l(le){return s.isBuffer(le)||le instanceof i}var c=ype(),u=vpe(),d=u.getHighWaterMark,h=M0().codes,f=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_MULTIPLE_CALLBACK,m=h.ERR_STREAM_CANNOT_PIPE,v=h.ERR_STREAM_DESTROYED,y=h.ERR_STREAM_NULL_VALUES,x=h.ERR_STREAM_WRITE_AFTER_END,b=h.ERR_UNKNOWN_ENCODING,w=c.errorOrDestroy;Cf()(k,n);function j(){}function N(le,B,R){e=e||Xx(),le=le||{},typeof R!="boolean"&&(R=B instanceof e),this.objectMode=!!le.objectMode,R&&(this.objectMode=this.objectMode||!!le.writableObjectMode),this.highWaterMark=d(this,le,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ee=le.decodeStrings===!1;this.decodeStrings=!ee,this.defaultEncoding=le.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(te){K(B,te)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=le.emitClose!==!1,this.autoDestroy=!!le.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}N.prototype.getBuffer=function(){for(var B=this.bufferedRequest,R=[];B;)R.push(B),B=B.next;return R},function(){try{Object.defineProperty(N.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var C;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(B){return C.call(this,B)?!0:this!==k?!1:B&&B._writableState instanceof N}})):C=function(B){return B instanceof this};function k(le){e=e||Xx();var B=this instanceof e;if(!B&&!C.call(k,this))return new k(le);this._writableState=new N(le,this,B),this.writable=!0,le&&(typeof le.write=="function"&&(this._write=le.write),typeof le.writev=="function"&&(this._writev=le.writev),typeof le.destroy=="function"&&(this._destroy=le.destroy),typeof le.final=="function"&&(this._final=le.final)),n.call(this)}k.prototype.pipe=function(){w(this,new m)};function E(le,B){var R=new x;w(le,R),$t.nextTick(B,R)}function M(le,B,R,ee){var te;return R===null?te=new y:typeof R!="string"&&!B.objectMode&&(te=new f("chunk",["string","Buffer"],R)),te?(w(le,te),$t.nextTick(ee,te),!1):!0}k.prototype.write=function(le,B,R){var ee=this._writableState,te=!1,Z=!ee.objectMode&&l(le);return Z&&!s.isBuffer(le)&&(le=o(le)),typeof B=="function"&&(R=B,B=null),Z?B="buffer":B||(B=ee.defaultEncoding),typeof R!="function"&&(R=j),ee.ending?E(this,R):(Z||M(this,ee,le,R))&&(ee.pendingcb++,te=I(this,ee,Z,le,B,R)),te},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var le=this._writableState;le.corked&&(le.corked--,!le.writing&&!le.corked&&!le.bufferProcessing&&le.bufferedRequest&&H(this,le))},k.prototype.setDefaultEncoding=function(B){if(typeof B=="string"&&(B=B.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((B+"").toLowerCase())>-1))throw new b(B);return this._writableState.defaultEncoding=B,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function z(le,B,R){return!le.objectMode&&le.decodeStrings!==!1&&typeof B=="string"&&(B=s.from(B,R)),B}Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function I(le,B,R,ee,te,Z){if(!R){var J=z(B,ee,te);ee!==J&&(R=!0,te="buffer",ee=J)}var he=B.objectMode?1:ee.length;B.length+=he;var P=B.length<B.highWaterMark;if(P||(B.needDrain=!0),B.writing||B.corked){var ie=B.lastBufferedRequest;B.lastBufferedRequest={chunk:ee,encoding:te,isBuf:R,callback:Z,next:null},ie?ie.next=B.lastBufferedRequest:B.bufferedRequest=B.lastBufferedRequest,B.bufferedRequestCount+=1}else q(le,B,!1,he,ee,te,Z);return P}function q(le,B,R,ee,te,Z,J){B.writelen=ee,B.writecb=J,B.writing=!0,B.sync=!0,B.destroyed?B.onwrite(new v("write")):R?le._writev(te,B.onwrite):le._write(te,Z,B.onwrite),B.sync=!1}function A(le,B,R,ee,te){--B.pendingcb,R?($t.nextTick(te,ee),$t.nextTick(W,le,B),le._writableState.errorEmitted=!0,w(le,ee)):(te(ee),le._writableState.errorEmitted=!0,w(le,ee),W(le,B))}function U(le){le.writing=!1,le.writecb=null,le.length-=le.writelen,le.writelen=0}function K(le,B){var R=le._writableState,ee=R.sync,te=R.writecb;if(typeof te!="function")throw new g;if(U(R),B)A(le,R,ee,B,te);else{var Z=$(R)||le.destroyed;!Z&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&H(le,R),ee?$t.nextTick(G,le,R,Z,te):G(le,R,Z,te)}}function G(le,B,R,ee){R||Y(le,B),B.pendingcb--,ee(),W(le,B)}function Y(le,B){B.length===0&&B.needDrain&&(B.needDrain=!1,le.emit("drain"))}function H(le,B){B.bufferProcessing=!0;var R=B.bufferedRequest;if(le._writev&&R&&R.next){var ee=B.bufferedRequestCount,te=new Array(ee),Z=B.corkedRequestsFree;Z.entry=R;for(var J=0,he=!0;R;)te[J]=R,R.isBuf||(he=!1),R=R.next,J+=1;te.allBuffers=he,q(le,B,!0,B.length,te,"",Z.finish),B.pendingcb++,B.lastBufferedRequest=null,Z.next?(B.corkedRequestsFree=Z.next,Z.next=null):B.corkedRequestsFree=new t(B),B.bufferedRequestCount=0}else{for(;R;){var P=R.chunk,ie=R.encoding,V=R.callback,O=B.objectMode?1:P.length;if(q(le,B,!1,O,P,ie,V),R=R.next,B.bufferedRequestCount--,B.writing)break}R===null&&(B.lastBufferedRequest=null)}B.bufferedRequest=R,B.bufferProcessing=!1}k.prototype._write=function(le,B,R){R(new p("_write()"))},k.prototype._writev=null,k.prototype.end=function(le,B,R){var ee=this._writableState;return typeof le=="function"?(R=le,le=null,B=null):typeof B=="function"&&(R=B,B=null),le!=null&&this.write(le,B),ee.corked&&(ee.corked=1,this.uncork()),ee.ending||X(this,ee,R),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function $(le){return le.ending&&le.length===0&&le.bufferedRequest===null&&!le.finished&&!le.writing}function L(le,B){le._final(function(R){B.pendingcb--,R&&w(le,R),B.prefinished=!0,le.emit("prefinish"),W(le,B)})}function F(le,B){!B.prefinished&&!B.finalCalled&&(typeof le._final=="function"&&!B.destroyed?(B.pendingcb++,B.finalCalled=!0,$t.nextTick(L,le,B)):(B.prefinished=!0,le.emit("prefinish")))}function W(le,B){var R=$(B);if(R&&(F(le,B),B.pendingcb===0&&(B.finished=!0,le.emit("finish"),B.autoDestroy))){var ee=le._readableState;(!ee||ee.autoDestroy&&ee.endEmitted)&&le.destroy()}return R}function X(le,B,R){B.ending=!0,W(le,B),R&&(B.finished?$t.nextTick(R):le.once("finish",R)),B.ended=!0,le.writable=!1}function oe(le,B,R){var ee=le.entry;for(le.entry=null;ee;){var te=ee.callback;B.pendingcb--,te(R),ee=ee.next}B.corkedRequestsFree.next=le}return Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(B){this._writableState&&(this._writableState.destroyed=B)}}),k.prototype.destroy=c.destroy,k.prototype._undestroy=c.undestroy,k.prototype._destroy=function(le,B){B(le)},ER}var CR,CY;function Xx(){if(CY)return CR;CY=1;var t=Object.keys||function(u){var d=[];for(var h in u)d.push(h);return d};CR=o;var e=bpe(),r=xpe();Cf()(o,e);for(var n=t(r.prototype),s=0;s<n.length;s++){var i=n[s];o.prototype[i]||(o.prototype[i]=r.prototype[i])}function o(u){if(!(this instanceof o))return new o(u);e.call(this,u),r.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||$t.nextTick(c,this)}function c(u){u.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),CR}var kR={},YN={exports:{}},kY;function Hdt(){return kY||(kY=1,function(t,e){var r=Q2(),n=r.Buffer;function s(o,l){for(var c in o)l[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(s(r,e),e.Buffer=i);function i(o,l,c){return n(o,l,c)}s(n,i),i.from=function(o,l,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,l,c)},i.alloc=function(o,l,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return l!==void 0?typeof c=="string"?u.fill(l,c):u.fill(l):u.fill(0),u},i.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},i.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}}(YN,YN.exports)),YN.exports}var TY;function O3(){if(TY)return kR;TY=1;var t=Hdt().Buffer,e=t.isEncoding||function(y){switch(y=""+y,y&&y.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(y){if(!y)return"utf8";for(var x;;)switch(y){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return y;default:if(x)return;y=(""+y).toLowerCase(),x=!0}}function n(y){var x=r(y);if(typeof x!="string"&&(t.isEncoding===e||!e(y)))throw new Error("Unknown encoding: "+y);return x||y}kR.StringDecoder=s;function s(y){this.encoding=n(y);var x;switch(this.encoding){case"utf16le":this.text=h,this.end=f,x=4;break;case"utf8":this.fillLast=c,x=4;break;case"base64":this.text=p,this.end=g,x=3;break;default:this.write=m,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(x)}s.prototype.write=function(y){if(y.length===0)return"";var x,b;if(this.lastNeed){if(x=this.fillLast(y),x===void 0)return"";b=this.lastNeed,this.lastNeed=0}else b=0;return b<y.length?x?x+this.text(y,b):this.text(y,b):x||""},s.prototype.end=d,s.prototype.text=u,s.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function i(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function o(y,x,b){var w=x.length-1;if(w<b)return 0;var j=i(x[w]);return j>=0?(j>0&&(y.lastNeed=j-1),j):--w<b||j===-2?0:(j=i(x[w]),j>=0?(j>0&&(y.lastNeed=j-2),j):--w<b||j===-2?0:(j=i(x[w]),j>=0?(j>0&&(j===2?j=0:y.lastNeed=j-3),j):0))}function l(y,x,b){if((x[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&x.length>1){if((x[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&x.length>2&&(x[2]&192)!==128)return y.lastNeed=2,"�"}}function c(y){var x=this.lastTotal-this.lastNeed,b=l(this,y);if(b!==void 0)return b;if(this.lastNeed<=y.length)return y.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,x,0,y.length),this.lastNeed-=y.length}function u(y,x){var b=o(this,y,x);if(!this.lastNeed)return y.toString("utf8",x);this.lastTotal=b;var w=y.length-(b-this.lastNeed);return y.copy(this.lastChar,0,w),y.toString("utf8",x,w)}function d(y){var x=y&&y.length?this.write(y):"";return this.lastNeed?x+"�":x}function h(y,x){if((y.length-x)%2===0){var b=y.toString("utf16le",x);if(b){var w=b.charCodeAt(b.length-1);if(w>=55296&&w<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],b.slice(0,-1)}return b}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",x,y.length-1)}function f(y){var x=y&&y.length?this.write(y):"";if(this.lastNeed){var b=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,b)}return x}function p(y,x){var b=(y.length-x)%3;return b===0?y.toString("base64",x):(this.lastNeed=3-b,this.lastTotal=3,b===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",x,y.length-b))}function g(y){var x=y&&y.length?this.write(y):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function m(y){return y.toString(this.encoding)}function v(y){return y&&y.length?this.write(y):""}return kR}var TR,PY;function pB(){if(PY)return TR;PY=1;var t=M0().codes.ERR_STREAM_PREMATURE_CLOSE;function e(i){var o=!1;return function(){if(!o){o=!0;for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];i.apply(this,c)}}}function r(){}function n(i){return i.setHeader&&typeof i.abort=="function"}function s(i,o,l){if(typeof o=="function")return s(i,null,o);o||(o={}),l=e(l||r);var c=o.readable||o.readable!==!1&&i.readable,u=o.writable||o.writable!==!1&&i.writable,d=function(){i.writable||f()},h=i._writableState&&i._writableState.finished,f=function(){u=!1,h=!0,c||l.call(i)},p=i._readableState&&i._readableState.endEmitted,g=function(){c=!1,p=!0,u||l.call(i)},m=function(b){l.call(i,b)},v=function(){var b;if(c&&!p)return(!i._readableState||!i._readableState.ended)&&(b=new t),l.call(i,b);if(u&&!h)return(!i._writableState||!i._writableState.ended)&&(b=new t),l.call(i,b)},y=function(){i.req.on("finish",f)};return n(i)?(i.on("complete",f),i.on("abort",v),i.req?y():i.on("request",y)):u&&!i._writableState&&(i.on("end",d),i.on("close",d)),i.on("end",g),i.on("finish",f),o.error!==!1&&i.on("error",m),i.on("close",v),function(){i.removeListener("complete",f),i.removeListener("abort",v),i.removeListener("request",y),i.req&&i.req.removeListener("finish",f),i.removeListener("end",d),i.removeListener("close",d),i.removeListener("finish",f),i.removeListener("end",g),i.removeListener("error",m),i.removeListener("close",v)}}return TR=s,TR}var PR,OY;function Wdt(){if(OY)return PR;OY=1;var t;function e(y,x,b){return x in y?Object.defineProperty(y,x,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[x]=b,y}var r=pB(),n=Symbol("lastResolve"),s=Symbol("lastReject"),i=Symbol("error"),o=Symbol("ended"),l=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream");function d(y,x){return{value:y,done:x}}function h(y){var x=y[n];if(x!==null){var b=y[u].read();b!==null&&(y[l]=null,y[n]=null,y[s]=null,x(d(b,!1)))}}function f(y){$t.nextTick(h,y)}function p(y,x){return function(b,w){y.then(function(){if(x[o]){b(d(void 0,!0));return}x[c](b,w)},w)}}var g=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((t={get stream(){return this[u]},next:function(){var x=this,b=this[i];if(b!==null)return Promise.reject(b);if(this[o])return Promise.resolve(d(void 0,!0));if(this[u].destroyed)return new Promise(function(C,k){$t.nextTick(function(){x[i]?k(x[i]):C(d(void 0,!0))})});var w=this[l],j;if(w)j=new Promise(p(w,this));else{var N=this[u].read();if(N!==null)return Promise.resolve(d(N,!1));j=new Promise(this[c])}return this[l]=j,j}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var x=this;return new Promise(function(b,w){x[u].destroy(null,function(j){if(j){w(j);return}b(d(void 0,!0))})})}),t),g),v=function(x){var b,w=Object.create(m,(b={},e(b,u,{value:x,writable:!0}),e(b,n,{value:null,writable:!0}),e(b,s,{value:null,writable:!0}),e(b,i,{value:null,writable:!0}),e(b,o,{value:x._readableState.endEmitted,writable:!0}),e(b,c,{value:function(N,C){var k=w[u].read();k?(w[l]=null,w[n]=null,w[s]=null,N(d(k,!1))):(w[n]=N,w[s]=C)},writable:!0}),b));return w[l]=null,r(x,function(j){if(j&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=w[s];N!==null&&(w[l]=null,w[n]=null,w[s]=null,N(j)),w[i]=j;return}var C=w[n];C!==null&&(w[l]=null,w[n]=null,w[s]=null,C(d(void 0,!0))),w[o]=!0}),x.on("readable",f.bind(null,w)),w};return PR=v,PR}var OR,IY;function Vdt(){return IY||(IY=1,OR=function(){throw new Error("Readable.from is not available in the browser")}),OR}var IR,RY;function bpe(){if(RY)return IR;RY=1,IR=E;var t;E.ReadableState=k,uB().EventEmitter;var e=function(J,he){return J.listeners(he).length},r=ape(),n=Q2().Buffer,s=oc.Uint8Array||function(){};function i(Z){return n.from(Z)}function o(Z){return n.isBuffer(Z)||Z instanceof s}var l=gpe(),c;l&&l.debuglog?c=l.debuglog("stream"):c=function(){};var u=Udt(),d=ype(),h=vpe(),f=h.getHighWaterMark,p=M0().codes,g=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,v=p.ERR_METHOD_NOT_IMPLEMENTED,y=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,x,b,w;Cf()(E,r);var j=d.errorOrDestroy,N=["error","close","destroy","pause","resume"];function C(Z,J,he){if(typeof Z.prependListener=="function")return Z.prependListener(J,he);!Z._events||!Z._events[J]?Z.on(J,he):Array.isArray(Z._events[J])?Z._events[J].unshift(he):Z._events[J]=[he,Z._events[J]]}function k(Z,J,he){t=t||Xx(),Z=Z||{},typeof he!="boolean"&&(he=J instanceof t),this.objectMode=!!Z.objectMode,he&&(this.objectMode=this.objectMode||!!Z.readableObjectMode),this.highWaterMark=f(this,Z,"readableHighWaterMark",he),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Z.emitClose!==!1,this.autoDestroy=!!Z.autoDestroy,this.destroyed=!1,this.defaultEncoding=Z.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Z.encoding&&(x||(x=O3().StringDecoder),this.decoder=new x(Z.encoding),this.encoding=Z.encoding)}function E(Z){if(t=t||Xx(),!(this instanceof E))return new E(Z);var J=this instanceof t;this._readableState=new k(Z,this,J),this.readable=!0,Z&&(typeof Z.read=="function"&&(this._read=Z.read),typeof Z.destroy=="function"&&(this._destroy=Z.destroy)),r.call(this)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(J){this._readableState&&(this._readableState.destroyed=J)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(Z,J){J(Z)},E.prototype.push=function(Z,J){var he=this._readableState,P;return he.objectMode?P=!0:typeof Z=="string"&&(J=J||he.defaultEncoding,J!==he.encoding&&(Z=n.from(Z,J),J=""),P=!0),M(this,Z,J,!1,P)},E.prototype.unshift=function(Z){return M(this,Z,null,!0,!1)};function M(Z,J,he,P,ie){c("readableAddChunk",J);var V=Z._readableState;if(J===null)V.reading=!1,K(Z,V);else{var O;if(ie||(O=I(V,J)),O)j(Z,O);else if(V.objectMode||J&&J.length>0)if(typeof J!="string"&&!V.objectMode&&Object.getPrototypeOf(J)!==n.prototype&&(J=i(J)),P)V.endEmitted?j(Z,new y):z(Z,V,J,!0);else if(V.ended)j(Z,new m);else{if(V.destroyed)return!1;V.reading=!1,V.decoder&&!he?(J=V.decoder.write(J),V.objectMode||J.length!==0?z(Z,V,J,!1):H(Z,V)):z(Z,V,J,!1)}else P||(V.reading=!1,H(Z,V))}return!V.ended&&(V.length<V.highWaterMark||V.length===0)}function z(Z,J,he,P){J.flowing&&J.length===0&&!J.sync?(J.awaitDrain=0,Z.emit("data",he)):(J.length+=J.objectMode?1:he.length,P?J.buffer.unshift(he):J.buffer.push(he),J.needReadable&&G(Z)),H(Z,J)}function I(Z,J){var he;return!o(J)&&typeof J!="string"&&J!==void 0&&!Z.objectMode&&(he=new g("chunk",["string","Buffer","Uint8Array"],J)),he}E.prototype.isPaused=function(){return this._readableState.flowing===!1},E.prototype.setEncoding=function(Z){x||(x=O3().StringDecoder);var J=new x(Z);this._readableState.decoder=J,this._readableState.encoding=this._readableState.decoder.encoding;for(var he=this._readableState.buffer.head,P="";he!==null;)P+=J.write(he.data),he=he.next;return this._readableState.buffer.clear(),P!==""&&this._readableState.buffer.push(P),this._readableState.length=P.length,this};var q=1073741824;function A(Z){return Z>=q?Z=q:(Z--,Z|=Z>>>1,Z|=Z>>>2,Z|=Z>>>4,Z|=Z>>>8,Z|=Z>>>16,Z++),Z}function U(Z,J){return Z<=0||J.length===0&&J.ended?0:J.objectMode?1:Z!==Z?J.flowing&&J.length?J.buffer.head.data.length:J.length:(Z>J.highWaterMark&&(J.highWaterMark=A(Z)),Z<=J.length?Z:J.ended?J.length:(J.needReadable=!0,0))}E.prototype.read=function(Z){c("read",Z),Z=parseInt(Z,10);var J=this._readableState,he=Z;if(Z!==0&&(J.emittedReadable=!1),Z===0&&J.needReadable&&((J.highWaterMark!==0?J.length>=J.highWaterMark:J.length>0)||J.ended))return c("read: emitReadable",J.length,J.ended),J.length===0&&J.ended?R(this):G(this),null;if(Z=U(Z,J),Z===0&&J.ended)return J.length===0&&R(this),null;var P=J.needReadable;c("need readable",P),(J.length===0||J.length-Z<J.highWaterMark)&&(P=!0,c("length less than watermark",P)),J.ended||J.reading?(P=!1,c("reading or ended",P)):P&&(c("do read"),J.reading=!0,J.sync=!0,J.length===0&&(J.needReadable=!0),this._read(J.highWaterMark),J.sync=!1,J.reading||(Z=U(he,J)));var ie;return Z>0?ie=B(Z,J):ie=null,ie===null?(J.needReadable=J.length<=J.highWaterMark,Z=0):(J.length-=Z,J.awaitDrain=0),J.length===0&&(J.ended||(J.needReadable=!0),he!==Z&&J.ended&&R(this)),ie!==null&&this.emit("data",ie),ie};function K(Z,J){if(c("onEofChunk"),!J.ended){if(J.decoder){var he=J.decoder.end();he&&he.length&&(J.buffer.push(he),J.length+=J.objectMode?1:he.length)}J.ended=!0,J.sync?G(Z):(J.needReadable=!1,J.emittedReadable||(J.emittedReadable=!0,Y(Z)))}}function G(Z){var J=Z._readableState;c("emitReadable",J.needReadable,J.emittedReadable),J.needReadable=!1,J.emittedReadable||(c("emitReadable",J.flowing),J.emittedReadable=!0,$t.nextTick(Y,Z))}function Y(Z){var J=Z._readableState;c("emitReadable_",J.destroyed,J.length,J.ended),!J.destroyed&&(J.length||J.ended)&&(Z.emit("readable"),J.emittedReadable=!1),J.needReadable=!J.flowing&&!J.ended&&J.length<=J.highWaterMark,le(Z)}function H(Z,J){J.readingMore||(J.readingMore=!0,$t.nextTick($,Z,J))}function $(Z,J){for(;!J.reading&&!J.ended&&(J.length<J.highWaterMark||J.flowing&&J.length===0);){var he=J.length;if(c("maybeReadMore read 0"),Z.read(0),he===J.length)break}J.readingMore=!1}E.prototype._read=function(Z){j(this,new v("_read()"))},E.prototype.pipe=function(Z,J){var he=this,P=this._readableState;switch(P.pipesCount){case 0:P.pipes=Z;break;case 1:P.pipes=[P.pipes,Z];break;default:P.pipes.push(Z);break}P.pipesCount+=1,c("pipe count=%d opts=%j",P.pipesCount,J);var ie=(!J||J.end!==!1)&&Z!==$t.stdout&&Z!==$t.stderr,V=ie?T:ae;P.endEmitted?$t.nextTick(V):he.once("end",V),Z.on("unpipe",O);function O(de,ge){c("onunpipe"),de===he&&ge&&ge.hasUnpiped===!1&&(ge.hasUnpiped=!0,ue())}function T(){c("onend"),Z.end()}var D=L(he);Z.on("drain",D);var ne=!1;function ue(){c("cleanup"),Z.removeListener("close",xe),Z.removeListener("finish",ye),Z.removeListener("drain",D),Z.removeListener("error",pe),Z.removeListener("unpipe",O),he.removeListener("end",T),he.removeListener("end",ae),he.removeListener("data",re),ne=!0,P.awaitDrain&&(!Z._writableState||Z._writableState.needDrain)&&D()}he.on("data",re);function re(de){c("ondata");var ge=Z.write(de);c("dest.write",ge),ge===!1&&((P.pipesCount===1&&P.pipes===Z||P.pipesCount>1&&te(P.pipes,Z)!==-1)&&!ne&&(c("false write response, pause",P.awaitDrain),P.awaitDrain++),he.pause())}function pe(de){c("onerror",de),ae(),Z.removeListener("error",pe),e(Z,"error")===0&&j(Z,de)}C(Z,"error",pe);function xe(){Z.removeListener("finish",ye),ae()}Z.once("close",xe);function ye(){c("onfinish"),Z.removeListener("close",xe),ae()}Z.once("finish",ye);function ae(){c("unpipe"),he.unpipe(Z)}return Z.emit("pipe",he),P.flowing||(c("pipe resume"),he.resume()),Z};function L(Z){return function(){var he=Z._readableState;c("pipeOnDrain",he.awaitDrain),he.awaitDrain&&he.awaitDrain--,he.awaitDrain===0&&e(Z,"data")&&(he.flowing=!0,le(Z))}}E.prototype.unpipe=function(Z){var J=this._readableState,he={hasUnpiped:!1};if(J.pipesCount===0)return this;if(J.pipesCount===1)return Z&&Z!==J.pipes?this:(Z||(Z=J.pipes),J.pipes=null,J.pipesCount=0,J.flowing=!1,Z&&Z.emit("unpipe",this,he),this);if(!Z){var P=J.pipes,ie=J.pipesCount;J.pipes=null,J.pipesCount=0,J.flowing=!1;for(var V=0;V<ie;V++)P[V].emit("unpipe",this,{hasUnpiped:!1});return this}var O=te(J.pipes,Z);return O===-1?this:(J.pipes.splice(O,1),J.pipesCount-=1,J.pipesCount===1&&(J.pipes=J.pipes[0]),Z.emit("unpipe",this,he),this)},E.prototype.on=function(Z,J){var he=r.prototype.on.call(this,Z,J),P=this._readableState;return Z==="data"?(P.readableListening=this.listenerCount("readable")>0,P.flowing!==!1&&this.resume()):Z==="readable"&&!P.endEmitted&&!P.readableListening&&(P.readableListening=P.needReadable=!0,P.flowing=!1,P.emittedReadable=!1,c("on readable",P.length,P.reading),P.length?G(this):P.reading||$t.nextTick(W,this)),he},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(Z,J){var he=r.prototype.removeListener.call(this,Z,J);return Z==="readable"&&$t.nextTick(F,this),he},E.prototype.removeAllListeners=function(Z){var J=r.prototype.removeAllListeners.apply(this,arguments);return(Z==="readable"||Z===void 0)&&$t.nextTick(F,this),J};function F(Z){var J=Z._readableState;J.readableListening=Z.listenerCount("readable")>0,J.resumeScheduled&&!J.paused?J.flowing=!0:Z.listenerCount("data")>0&&Z.resume()}function W(Z){c("readable nexttick read 0"),Z.read(0)}E.prototype.resume=function(){var Z=this._readableState;return Z.flowing||(c("resume"),Z.flowing=!Z.readableListening,X(this,Z)),Z.paused=!1,this};function X(Z,J){J.resumeScheduled||(J.resumeScheduled=!0,$t.nextTick(oe,Z,J))}function oe(Z,J){c("resume",J.reading),J.reading||Z.read(0),J.resumeScheduled=!1,Z.emit("resume"),le(Z),J.flowing&&!J.reading&&Z.read(0)}E.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function le(Z){var J=Z._readableState;for(c("flow",J.flowing);J.flowing&&Z.read()!==null;);}E.prototype.wrap=function(Z){var J=this,he=this._readableState,P=!1;Z.on("end",function(){if(c("wrapped end"),he.decoder&&!he.ended){var O=he.decoder.end();O&&O.length&&J.push(O)}J.push(null)}),Z.on("data",function(O){if(c("wrapped data"),he.decoder&&(O=he.decoder.write(O)),!(he.objectMode&&O==null)&&!(!he.objectMode&&(!O||!O.length))){var T=J.push(O);T||(P=!0,Z.pause())}});for(var ie in Z)this[ie]===void 0&&typeof Z[ie]=="function"&&(this[ie]=function(T){return function(){return Z[T].apply(Z,arguments)}}(ie));for(var V=0;V<N.length;V++)Z.on(N[V],this.emit.bind(this,N[V]));return this._read=function(O){c("wrapped _read",O),P&&(P=!1,Z.resume())},this},typeof Symbol=="function"&&(E.prototype[Symbol.asyncIterator]=function(){return b===void 0&&(b=Wdt()),b(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(J){this._readableState&&(this._readableState.flowing=J)}}),E._fromList=B,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function B(Z,J){if(J.length===0)return null;var he;return J.objectMode?he=J.buffer.shift():!Z||Z>=J.length?(J.decoder?he=J.buffer.join(""):J.buffer.length===1?he=J.buffer.first():he=J.buffer.concat(J.length),J.buffer.clear()):he=J.buffer.consume(Z,J.decoder),he}function R(Z){var J=Z._readableState;c("endReadable",J.endEmitted),J.endEmitted||(J.ended=!0,$t.nextTick(ee,J,Z))}function ee(Z,J){if(c("endReadableNT",Z.endEmitted,Z.length),!Z.endEmitted&&Z.length===0&&(Z.endEmitted=!0,J.readable=!1,J.emit("end"),Z.autoDestroy)){var he=J._writableState;(!he||he.autoDestroy&&he.finished)&&J.destroy()}}typeof Symbol=="function"&&(E.from=function(Z,J){return w===void 0&&(w=Vdt()),w(E,Z,J)});function te(Z,J){for(var he=0,P=Z.length;he<P;he++)if(Z[he]===J)return he;return-1}return IR}var RR,MY;function wpe(){if(MY)return RR;MY=1,RR=l;var t=M0().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=t.ERR_TRANSFORM_WITH_LENGTH_0,i=Xx();Cf()(l,i);function o(d,h){var f=this._transformState;f.transforming=!1;var p=f.writecb;if(p===null)return this.emit("error",new r);f.writechunk=null,f.writecb=null,h!=null&&this.push(h),p(d);var g=this._readableState;g.reading=!1,(g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}function l(d){if(!(this instanceof l))return new l(d);i.call(this,d),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",c)}function c(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(h,f){u(d,h,f)}):u(this,null,null)}l.prototype.push=function(d,h){return this._transformState.needTransform=!1,i.prototype.push.call(this,d,h)},l.prototype._transform=function(d,h,f){f(new e("_transform()"))},l.prototype._write=function(d,h,f){var p=this._transformState;if(p.writecb=f,p.writechunk=d,p.writeencoding=h,!p.transforming){var g=this._readableState;(p.needTransform||g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}},l.prototype._read=function(d){var h=this._transformState;h.writechunk!==null&&!h.transforming?(h.transforming=!0,this._transform(h.writechunk,h.writeencoding,h.afterTransform)):h.needTransform=!0},l.prototype._destroy=function(d,h){i.prototype._destroy.call(this,d,function(f){h(f)})};function u(d,h,f){if(h)return d.emit("error",h);if(f!=null&&d.push(f),d._writableState.length)throw new s;if(d._transformState.transforming)throw new n;return d.push(null)}return RR}var MR,DY;function qdt(){if(DY)return MR;DY=1,MR=e;var t=wpe();Cf()(e,t);function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return e.prototype._transform=function(r,n,s){s(null,r)},MR}var DR,LY;function Gdt(){if(LY)return DR;LY=1;var t;function e(f){var p=!1;return function(){p||(p=!0,f.apply(void 0,arguments))}}var r=M0().codes,n=r.ERR_MISSING_ARGS,s=r.ERR_STREAM_DESTROYED;function i(f){if(f)throw f}function o(f){return f.setHeader&&typeof f.abort=="function"}function l(f,p,g,m){m=e(m);var v=!1;f.on("close",function(){v=!0}),t===void 0&&(t=pB()),t(f,{readable:p,writable:g},function(x){if(x)return m(x);v=!0,m()});var y=!1;return function(x){if(!v&&!y){if(y=!0,o(f))return f.abort();if(typeof f.destroy=="function")return f.destroy();m(x||new s("pipe"))}}}function c(f){f()}function u(f,p){return f.pipe(p)}function d(f){return!f.length||typeof f[f.length-1]!="function"?i:f.pop()}function h(){for(var f=arguments.length,p=new Array(f),g=0;g<f;g++)p[g]=arguments[g];var m=d(p);if(Array.isArray(p[0])&&(p=p[0]),p.length<2)throw new n("streams");var v,y=p.map(function(x,b){var w=b<p.length-1,j=b>0;return l(x,w,j,function(N){v||(v=N),N&&y.forEach(c),!w&&(y.forEach(c),m(v))})});return p.reduce(u)}return DR=h,DR}var LR,FY;function mB(){if(FY)return LR;FY=1,LR=r;var t=uB().EventEmitter,e=Cf();e(r,t),r.Readable=bpe(),r.Writable=xpe(),r.Duplex=Xx(),r.Transform=wpe(),r.PassThrough=qdt(),r.finished=pB(),r.pipeline=Gdt(),r.Stream=r;function r(){t.call(this)}return r.prototype.pipe=function(n,s){var i=this;function o(p){n.writable&&n.write(p)===!1&&i.pause&&i.pause()}i.on("data",o);function l(){i.readable&&i.resume&&i.resume()}n.on("drain",l),!n._isStdio&&(!s||s.end!==!1)&&(i.on("end",u),i.on("close",d));var c=!1;function u(){c||(c=!0,n.end())}function d(){c||(c=!0,typeof n.destroy=="function"&&n.destroy())}function h(p){if(f(),t.listenerCount(this,"error")===0)throw p}i.on("error",h),n.on("error",h);function f(){i.removeListener("data",o),n.removeListener("drain",l),i.removeListener("end",u),i.removeListener("close",d),i.removeListener("error",h),n.removeListener("error",h),i.removeListener("end",f),i.removeListener("close",f),n.removeListener("close",f)}return i.on("end",f),i.on("close",f),n.on("close",f),n.emit("pipe",i),n},LR}var $Y;function Kdt(){return $Y||($Y=1,function(t){(function(e){e.parser=function(B,R){return new n(B,R)},e.SAXParser=n,e.SAXStream=d,e.createStream=u,e.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(B,R){if(!(this instanceof n))return new n(B,R);var ee=this;i(ee),ee.q=ee.c="",ee.bufferCheckPosition=e.MAX_BUFFER_LENGTH,ee.opt=R||{},ee.opt.lowercase=ee.opt.lowercase||ee.opt.lowercasetags,ee.looseCase=ee.opt.lowercase?"toLowerCase":"toUpperCase",ee.tags=[],ee.closed=ee.closedRoot=ee.sawRoot=!1,ee.tag=ee.error=null,ee.strict=!!B,ee.noscript=!!(B||ee.opt.noscript),ee.state=E.BEGIN,ee.strictEntities=ee.opt.strictEntities,ee.ENTITIES=ee.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),ee.attribList=[],ee.opt.xmlns&&(ee.ns=Object.create(m)),ee.trackPosition=ee.opt.position!==!1,ee.trackPosition&&(ee.position=ee.line=ee.column=0),z(ee,"onready")}Object.create||(Object.create=function(B){function R(){}R.prototype=B;var ee=new R;return ee}),Object.keys||(Object.keys=function(B){var R=[];for(var ee in B)B.hasOwnProperty(ee)&&R.push(ee);return R});function s(B){for(var R=Math.max(e.MAX_BUFFER_LENGTH,10),ee=0,te=0,Z=r.length;te<Z;te++){var J=B[r[te]].length;if(J>R)switch(r[te]){case"textNode":q(B);break;case"cdata":I(B,"oncdata",B.cdata),B.cdata="";break;case"script":I(B,"onscript",B.script),B.script="";break;default:U(B,"Max buffer length exceeded: "+r[te])}ee=Math.max(ee,J)}var he=e.MAX_BUFFER_LENGTH-ee;B.bufferCheckPosition=he+B.position}function i(B){for(var R=0,ee=r.length;R<ee;R++)B[r[R]]=""}function o(B){q(B),B.cdata!==""&&(I(B,"oncdata",B.cdata),B.cdata=""),B.script!==""&&(I(B,"onscript",B.script),B.script="")}n.prototype={end:function(){K(this)},write:le,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){o(this)}};var l;try{l=mB().Stream}catch{l=function(){}}var c=e.EVENTS.filter(function(B){return B!=="error"&&B!=="end"});function u(B,R){return new d(B,R)}function d(B,R){if(!(this instanceof d))return new d(B,R);l.apply(this),this._parser=new n(B,R),this.writable=!0,this.readable=!0;var ee=this;this._parser.onend=function(){ee.emit("end")},this._parser.onerror=function(te){ee.emit("error",te),ee._parser.error=null},this._decoder=null,c.forEach(function(te){Object.defineProperty(ee,"on"+te,{get:function(){return ee._parser["on"+te]},set:function(Z){if(!Z)return ee.removeAllListeners(te),ee._parser["on"+te]=Z,Z;ee.on(te,Z)},enumerable:!0,configurable:!1})})}d.prototype=Object.create(l.prototype,{constructor:{value:d}}),d.prototype.write=function(B){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(B)){if(!this._decoder){var R=O3().StringDecoder;this._decoder=new R("utf8")}B=this._decoder.write(B)}return this._parser.write(B.toString()),this.emit("data",B),!0},d.prototype.end=function(B){return B&&B.length&&this.write(B),this._parser.end(),!0},d.prototype.on=function(B,R){var ee=this;return!ee._parser["on"+B]&&c.indexOf(B)!==-1&&(ee._parser["on"+B]=function(){var te=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);te.splice(0,0,B),ee.emit.apply(ee,te)}),l.prototype.on.call(ee,B,R)};var h="[CDATA[",f="DOCTYPE",p="http://www.w3.org/XML/1998/namespace",g="http://www.w3.org/2000/xmlns/",m={xml:p,xmlns:g},v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,x=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,b=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(B){return B===" "||B===`
`||B==="\r"||B==="	"}function j(B){return B==='"'||B==="'"}function N(B){return B===">"||w(B)}function C(B,R){return B.test(R)}function k(B,R){return!C(B,R)}var E=0;e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(B){var R=e.ENTITIES[B],ee=typeof R=="number"?String.fromCharCode(R):R;e.ENTITIES[B]=ee});for(var M in e.STATE)e.STATE[e.STATE[M]]=M;E=e.STATE;function z(B,R,ee){B[R]&&B[R](ee)}function I(B,R,ee){B.textNode&&q(B),z(B,R,ee)}function q(B){B.textNode=A(B.opt,B.textNode),B.textNode&&z(B,"ontext",B.textNode),B.textNode=""}function A(B,R){return B.trim&&(R=R.trim()),B.normalize&&(R=R.replace(/\s+/g," ")),R}function U(B,R){return q(B),B.trackPosition&&(R+=`
Line: `+B.line+`
Column: `+B.column+`
Char: `+B.c),R=new Error(R),B.error=R,z(B,"onerror",R),B}function K(B){return B.sawRoot&&!B.closedRoot&&G(B,"Unclosed root tag"),B.state!==E.BEGIN&&B.state!==E.BEGIN_WHITESPACE&&B.state!==E.TEXT&&U(B,"Unexpected end"),q(B),B.c="",B.closed=!0,z(B,"onend"),n.call(B,B.strict,B.opt),B}function G(B,R){if(typeof B!="object"||!(B instanceof n))throw new Error("bad call to strictFail");B.strict&&U(B,R)}function Y(B){B.strict||(B.tagName=B.tagName[B.looseCase]());var R=B.tags[B.tags.length-1]||B,ee=B.tag={name:B.tagName,attributes:{}};B.opt.xmlns&&(ee.ns=R.ns),B.attribList.length=0,I(B,"onopentagstart",ee)}function H(B,R){var ee=B.indexOf(":"),te=ee<0?["",B]:B.split(":"),Z=te[0],J=te[1];return R&&B==="xmlns"&&(Z="xmlns",J=""),{prefix:Z,local:J}}function $(B){if(B.strict||(B.attribName=B.attribName[B.looseCase]()),B.attribList.indexOf(B.attribName)!==-1||B.tag.attributes.hasOwnProperty(B.attribName)){B.attribName=B.attribValue="";return}if(B.opt.xmlns){var R=H(B.attribName,!0),ee=R.prefix,te=R.local;if(ee==="xmlns")if(te==="xml"&&B.attribValue!==p)G(B,"xml: prefix must be bound to "+p+`
Actual: `+B.attribValue);else if(te==="xmlns"&&B.attribValue!==g)G(B,"xmlns: prefix must be bound to "+g+`
Actual: `+B.attribValue);else{var Z=B.tag,J=B.tags[B.tags.length-1]||B;Z.ns===J.ns&&(Z.ns=Object.create(J.ns)),Z.ns[te]=B.attribValue}B.attribList.push([B.attribName,B.attribValue])}else B.tag.attributes[B.attribName]=B.attribValue,I(B,"onattribute",{name:B.attribName,value:B.attribValue});B.attribName=B.attribValue=""}function L(B,R){if(B.opt.xmlns){var ee=B.tag,te=H(B.tagName);ee.prefix=te.prefix,ee.local=te.local,ee.uri=ee.ns[te.prefix]||"",ee.prefix&&!ee.uri&&(G(B,"Unbound namespace prefix: "+JSON.stringify(B.tagName)),ee.uri=te.prefix);var Z=B.tags[B.tags.length-1]||B;ee.ns&&Z.ns!==ee.ns&&Object.keys(ee.ns).forEach(function(re){I(B,"onopennamespace",{prefix:re,uri:ee.ns[re]})});for(var J=0,he=B.attribList.length;J<he;J++){var P=B.attribList[J],ie=P[0],V=P[1],O=H(ie,!0),T=O.prefix,D=O.local,ne=T===""?"":ee.ns[T]||"",ue={name:ie,value:V,prefix:T,local:D,uri:ne};T&&T!=="xmlns"&&!ne&&(G(B,"Unbound namespace prefix: "+JSON.stringify(T)),ue.uri=T),B.tag.attributes[ie]=ue,I(B,"onattribute",ue)}B.attribList.length=0}B.tag.isSelfClosing=!!R,B.sawRoot=!0,B.tags.push(B.tag),I(B,"onopentag",B.tag),R||(!B.noscript&&B.tagName.toLowerCase()==="script"?B.state=E.SCRIPT:B.state=E.TEXT,B.tag=null,B.tagName=""),B.attribName=B.attribValue="",B.attribList.length=0}function F(B){if(!B.tagName){G(B,"Weird empty close tag."),B.textNode+="</>",B.state=E.TEXT;return}if(B.script){if(B.tagName!=="script"){B.script+="</"+B.tagName+">",B.tagName="",B.state=E.SCRIPT;return}I(B,"onscript",B.script),B.script=""}var R=B.tags.length,ee=B.tagName;B.strict||(ee=ee[B.looseCase]());for(var te=ee;R--;){var Z=B.tags[R];if(Z.name!==te)G(B,"Unexpected close tag");else break}if(R<0){G(B,"Unmatched closing tag: "+B.tagName),B.textNode+="</"+B.tagName+">",B.state=E.TEXT;return}B.tagName=ee;for(var J=B.tags.length;J-- >R;){var he=B.tag=B.tags.pop();B.tagName=B.tag.name,I(B,"onclosetag",B.tagName);var P={};for(var ie in he.ns)P[ie]=he.ns[ie];var V=B.tags[B.tags.length-1]||B;B.opt.xmlns&&he.ns!==V.ns&&Object.keys(he.ns).forEach(function(O){var T=he.ns[O];I(B,"onclosenamespace",{prefix:O,uri:T})})}R===0&&(B.closedRoot=!0),B.tagName=B.attribValue=B.attribName="",B.attribList.length=0,B.state=E.TEXT}function W(B){var R=B.entity,ee=R.toLowerCase(),te,Z="";return B.ENTITIES[R]?B.ENTITIES[R]:B.ENTITIES[ee]?B.ENTITIES[ee]:(R=ee,R.charAt(0)==="#"&&(R.charAt(1)==="x"?(R=R.slice(2),te=parseInt(R,16),Z=te.toString(16)):(R=R.slice(1),te=parseInt(R,10),Z=te.toString(10))),R=R.replace(/^0+/,""),isNaN(te)||Z.toLowerCase()!==R?(G(B,"Invalid character entity"),"&"+B.entity+";"):String.fromCodePoint(te))}function X(B,R){R==="<"?(B.state=E.OPEN_WAKA,B.startTagPosition=B.position):w(R)||(G(B,"Non-whitespace before first tag."),B.textNode=R,B.state=E.TEXT)}function oe(B,R){var ee="";return R<B.length&&(ee=B.charAt(R)),ee}function le(B){var R=this;if(this.error)throw this.error;if(R.closed)return U(R,"Cannot write after close. Assign an onready handler.");if(B===null)return K(R);typeof B=="object"&&(B=B.toString());for(var ee=0,te="";te=oe(B,ee++),R.c=te,!!te;)switch(R.trackPosition&&(R.position++,te===`
`?(R.line++,R.column=0):R.column++),R.state){case E.BEGIN:if(R.state=E.BEGIN_WHITESPACE,te==="\uFEFF")continue;X(R,te);continue;case E.BEGIN_WHITESPACE:X(R,te);continue;case E.TEXT:if(R.sawRoot&&!R.closedRoot){for(var Z=ee-1;te&&te!=="<"&&te!=="&";)te=oe(B,ee++),te&&R.trackPosition&&(R.position++,te===`
`?(R.line++,R.column=0):R.column++);R.textNode+=B.substring(Z,ee-1)}te==="<"&&!(R.sawRoot&&R.closedRoot&&!R.strict)?(R.state=E.OPEN_WAKA,R.startTagPosition=R.position):(!w(te)&&(!R.sawRoot||R.closedRoot)&&G(R,"Text data outside of root node."),te==="&"?R.state=E.TEXT_ENTITY:R.textNode+=te);continue;case E.SCRIPT:te==="<"?R.state=E.SCRIPT_ENDING:R.script+=te;continue;case E.SCRIPT_ENDING:te==="/"?R.state=E.CLOSE_TAG:(R.script+="<"+te,R.state=E.SCRIPT);continue;case E.OPEN_WAKA:if(te==="!")R.state=E.SGML_DECL,R.sgmlDecl="";else if(!w(te))if(C(v,te))R.state=E.OPEN_TAG,R.tagName=te;else if(te==="/")R.state=E.CLOSE_TAG,R.tagName="";else if(te==="?")R.state=E.PROC_INST,R.procInstName=R.procInstBody="";else{if(G(R,"Unencoded <"),R.startTagPosition+1<R.position){var J=R.position-R.startTagPosition;te=new Array(J).join(" ")+te}R.textNode+="<"+te,R.state=E.TEXT}continue;case E.SGML_DECL:(R.sgmlDecl+te).toUpperCase()===h?(I(R,"onopencdata"),R.state=E.CDATA,R.sgmlDecl="",R.cdata=""):R.sgmlDecl+te==="--"?(R.state=E.COMMENT,R.comment="",R.sgmlDecl=""):(R.sgmlDecl+te).toUpperCase()===f?(R.state=E.DOCTYPE,(R.doctype||R.sawRoot)&&G(R,"Inappropriately located doctype declaration"),R.doctype="",R.sgmlDecl=""):te===">"?(I(R,"onsgmldeclaration",R.sgmlDecl),R.sgmlDecl="",R.state=E.TEXT):(j(te)&&(R.state=E.SGML_DECL_QUOTED),R.sgmlDecl+=te);continue;case E.SGML_DECL_QUOTED:te===R.q&&(R.state=E.SGML_DECL,R.q=""),R.sgmlDecl+=te;continue;case E.DOCTYPE:te===">"?(R.state=E.TEXT,I(R,"ondoctype",R.doctype),R.doctype=!0):(R.doctype+=te,te==="["?R.state=E.DOCTYPE_DTD:j(te)&&(R.state=E.DOCTYPE_QUOTED,R.q=te));continue;case E.DOCTYPE_QUOTED:R.doctype+=te,te===R.q&&(R.q="",R.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:R.doctype+=te,te==="]"?R.state=E.DOCTYPE:j(te)&&(R.state=E.DOCTYPE_DTD_QUOTED,R.q=te);continue;case E.DOCTYPE_DTD_QUOTED:R.doctype+=te,te===R.q&&(R.state=E.DOCTYPE_DTD,R.q="");continue;case E.COMMENT:te==="-"?R.state=E.COMMENT_ENDING:R.comment+=te;continue;case E.COMMENT_ENDING:te==="-"?(R.state=E.COMMENT_ENDED,R.comment=A(R.opt,R.comment),R.comment&&I(R,"oncomment",R.comment),R.comment=""):(R.comment+="-"+te,R.state=E.COMMENT);continue;case E.COMMENT_ENDED:te!==">"?(G(R,"Malformed comment"),R.comment+="--"+te,R.state=E.COMMENT):R.state=E.TEXT;continue;case E.CDATA:te==="]"?R.state=E.CDATA_ENDING:R.cdata+=te;continue;case E.CDATA_ENDING:te==="]"?R.state=E.CDATA_ENDING_2:(R.cdata+="]"+te,R.state=E.CDATA);continue;case E.CDATA_ENDING_2:te===">"?(R.cdata&&I(R,"oncdata",R.cdata),I(R,"onclosecdata"),R.cdata="",R.state=E.TEXT):te==="]"?R.cdata+="]":(R.cdata+="]]"+te,R.state=E.CDATA);continue;case E.PROC_INST:te==="?"?R.state=E.PROC_INST_ENDING:w(te)?R.state=E.PROC_INST_BODY:R.procInstName+=te;continue;case E.PROC_INST_BODY:if(!R.procInstBody&&w(te))continue;te==="?"?R.state=E.PROC_INST_ENDING:R.procInstBody+=te;continue;case E.PROC_INST_ENDING:te===">"?(I(R,"onprocessinginstruction",{name:R.procInstName,body:R.procInstBody}),R.procInstName=R.procInstBody="",R.state=E.TEXT):(R.procInstBody+="?"+te,R.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:C(y,te)?R.tagName+=te:(Y(R),te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:(w(te)||G(R,"Invalid character in tag name"),R.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:te===">"?(L(R,!0),F(R)):(G(R,"Forward-slash in opening tag not followed by >"),R.state=E.ATTRIB);continue;case E.ATTRIB:if(w(te))continue;te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:C(v,te)?(R.attribName=te,R.attribValue="",R.state=E.ATTRIB_NAME):G(R,"Invalid attribute name");continue;case E.ATTRIB_NAME:te==="="?R.state=E.ATTRIB_VALUE:te===">"?(G(R,"Attribute without value"),R.attribValue=R.attribName,$(R),L(R)):w(te)?R.state=E.ATTRIB_NAME_SAW_WHITE:C(y,te)?R.attribName+=te:G(R,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(te==="=")R.state=E.ATTRIB_VALUE;else{if(w(te))continue;G(R,"Attribute without value"),R.tag.attributes[R.attribName]="",R.attribValue="",I(R,"onattribute",{name:R.attribName,value:""}),R.attribName="",te===">"?L(R):C(v,te)?(R.attribName=te,R.state=E.ATTRIB_NAME):(G(R,"Invalid attribute name"),R.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(w(te))continue;j(te)?(R.q=te,R.state=E.ATTRIB_VALUE_QUOTED):(G(R,"Unquoted attribute value"),R.state=E.ATTRIB_VALUE_UNQUOTED,R.attribValue=te);continue;case E.ATTRIB_VALUE_QUOTED:if(te!==R.q){te==="&"?R.state=E.ATTRIB_VALUE_ENTITY_Q:R.attribValue+=te;continue}$(R),R.q="",R.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:w(te)?R.state=E.ATTRIB:te===">"?L(R):te==="/"?R.state=E.OPEN_TAG_SLASH:C(v,te)?(G(R,"No whitespace between attributes"),R.attribName=te,R.attribValue="",R.state=E.ATTRIB_NAME):G(R,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!N(te)){te==="&"?R.state=E.ATTRIB_VALUE_ENTITY_U:R.attribValue+=te;continue}$(R),te===">"?L(R):R.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(R.tagName)te===">"?F(R):C(y,te)?R.tagName+=te:R.script?(R.script+="</"+R.tagName,R.tagName="",R.state=E.SCRIPT):(w(te)||G(R,"Invalid tagname in closing tag"),R.state=E.CLOSE_TAG_SAW_WHITE);else{if(w(te))continue;k(v,te)?R.script?(R.script+="</"+te,R.state=E.SCRIPT):G(R,"Invalid tagname in closing tag."):R.tagName=te}continue;case E.CLOSE_TAG_SAW_WHITE:if(w(te))continue;te===">"?F(R):G(R,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var he,P;switch(R.state){case E.TEXT_ENTITY:he=E.TEXT,P="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:he=E.ATTRIB_VALUE_QUOTED,P="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:he=E.ATTRIB_VALUE_UNQUOTED,P="attribValue";break}te===";"?(R[P]+=W(R),R.entity="",R.state=he):C(R.entity.length?b:x,te)?R.entity+=te:(G(R,"Invalid character in entity name"),R[P]+="&"+R.entity+te,R.entity="",R.state=he);continue;default:throw new Error(R,"Unknown state: "+R.state)}return R.position>=R.bufferCheckPosition&&s(R),R}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var B=String.fromCharCode,R=Math.floor,ee=function(){var te=16384,Z=[],J,he,P=-1,ie=arguments.length;if(!ie)return"";for(var V="";++P<ie;){var O=Number(arguments[P]);if(!isFinite(O)||O<0||O>1114111||R(O)!==O)throw RangeError("Invalid code point: "+O);O<=65535?Z.push(O):(O-=65536,J=(O>>10)+55296,he=O%1024+56320,Z.push(J,he)),(P+1===ie||Z.length>te)&&(V+=B.apply(null,Z),Z.length=0)}return V};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:ee,configurable:!0,writable:!0}):String.fromCodePoint=ee}()})(t)}(_I)),_I}var FR,BY;function gB(){return BY||(BY=1,FR={isArray:function(t){return Array.isArray?Array.isArray(t):Object.prototype.toString.call(t)==="[object Array]"}}),FR}var $R,UY;function yB(){if(UY)return $R;UY=1;var t=gB().isArray;return $R={copyOptions:function(e){var r,n={};for(r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n},ensureFlagExists:function(e,r){(!(e in r)||typeof r[e]!="boolean")&&(r[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||typeof e.spaces!="number"&&typeof e.spaces!="string")&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){(!("alwaysArray"in e)||typeof e.alwaysArray!="boolean"&&!t(e.alwaysArray))&&(e.alwaysArray=!1)},ensureKeyExists:function(e,r){(!(e+"Key"in r)||typeof r[e+"Key"]!="string")&&(r[e+"Key"]=r.compact?"_"+e:e)},checkFnExists:function(e,r){return e+"Fn"in r}},$R}var BR,zY;function _pe(){if(zY)return BR;zY=1;var t=Kdt(),e=yB(),r=gB().isArray,n,s;function i(y){return n=e.copyOptions(y),e.ensureFlagExists("ignoreDeclaration",n),e.ensureFlagExists("ignoreInstruction",n),e.ensureFlagExists("ignoreAttributes",n),e.ensureFlagExists("ignoreText",n),e.ensureFlagExists("ignoreComment",n),e.ensureFlagExists("ignoreCdata",n),e.ensureFlagExists("ignoreDoctype",n),e.ensureFlagExists("compact",n),e.ensureFlagExists("alwaysChildren",n),e.ensureFlagExists("addParent",n),e.ensureFlagExists("trim",n),e.ensureFlagExists("nativeType",n),e.ensureFlagExists("nativeTypeAttributes",n),e.ensureFlagExists("sanitize",n),e.ensureFlagExists("instructionHasAttributes",n),e.ensureFlagExists("captureSpacesBetweenElements",n),e.ensureAlwaysArrayExists(n),e.ensureKeyExists("declaration",n),e.ensureKeyExists("instruction",n),e.ensureKeyExists("attributes",n),e.ensureKeyExists("text",n),e.ensureKeyExists("comment",n),e.ensureKeyExists("cdata",n),e.ensureKeyExists("doctype",n),e.ensureKeyExists("type",n),e.ensureKeyExists("name",n),e.ensureKeyExists("elements",n),e.ensureKeyExists("parent",n),e.checkFnExists("doctype",n),e.checkFnExists("instruction",n),e.checkFnExists("cdata",n),e.checkFnExists("comment",n),e.checkFnExists("text",n),e.checkFnExists("instructionName",n),e.checkFnExists("elementName",n),e.checkFnExists("attributeName",n),e.checkFnExists("attributeValue",n),e.checkFnExists("attributes",n),n}function o(y){var x=Number(y);if(!isNaN(x))return x;var b=y.toLowerCase();return b==="true"?!0:b==="false"?!1:y}function l(y,x){var b;if(n.compact){if(!s[n[y+"Key"]]&&(r(n.alwaysArray)?n.alwaysArray.indexOf(n[y+"Key"])!==-1:n.alwaysArray)&&(s[n[y+"Key"]]=[]),s[n[y+"Key"]]&&!r(s[n[y+"Key"]])&&(s[n[y+"Key"]]=[s[n[y+"Key"]]]),y+"Fn"in n&&typeof x=="string"&&(x=n[y+"Fn"](x,s)),y==="instruction"&&("instructionFn"in n||"instructionNameFn"in n)){for(b in x)if(x.hasOwnProperty(b))if("instructionFn"in n)x[b]=n.instructionFn(x[b],b,s);else{var w=x[b];delete x[b],x[n.instructionNameFn(b,w,s)]=w}}r(s[n[y+"Key"]])?s[n[y+"Key"]].push(x):s[n[y+"Key"]]=x}else{s[n.elementsKey]||(s[n.elementsKey]=[]);var j={};if(j[n.typeKey]=y,y==="instruction"){for(b in x)if(x.hasOwnProperty(b))break;j[n.nameKey]="instructionNameFn"in n?n.instructionNameFn(b,x,s):b,n.instructionHasAttributes?(j[n.attributesKey]=x[b][n.attributesKey],"instructionFn"in n&&(j[n.attributesKey]=n.instructionFn(j[n.attributesKey],b,s))):("instructionFn"in n&&(x[b]=n.instructionFn(x[b],b,s)),j[n.instructionKey]=x[b])}else y+"Fn"in n&&(x=n[y+"Fn"](x,s)),j[n[y+"Key"]]=x;n.addParent&&(j[n.parentKey]=s),s[n.elementsKey].push(j)}}function c(y){if("attributesFn"in n&&y&&(y=n.attributesFn(y,s)),(n.trim||"attributeValueFn"in n||"attributeNameFn"in n||n.nativeTypeAttributes)&&y){var x;for(x in y)if(y.hasOwnProperty(x)&&(n.trim&&(y[x]=y[x].trim()),n.nativeTypeAttributes&&(y[x]=o(y[x])),"attributeValueFn"in n&&(y[x]=n.attributeValueFn(y[x],x,s)),"attributeNameFn"in n)){var b=y[x];delete y[x],y[n.attributeNameFn(x,y[x],s)]=b}}return y}function u(y){var x={};if(y.body&&(y.name.toLowerCase()==="xml"||n.instructionHasAttributes)){for(var b=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,w;(w=b.exec(y.body))!==null;)x[w[1]]=w[2]||w[3]||w[4];x=c(x)}if(y.name.toLowerCase()==="xml"){if(n.ignoreDeclaration)return;s[n.declarationKey]={},Object.keys(x).length&&(s[n.declarationKey][n.attributesKey]=x),n.addParent&&(s[n.declarationKey][n.parentKey]=s)}else{if(n.ignoreInstruction)return;n.trim&&(y.body=y.body.trim());var j={};n.instructionHasAttributes&&Object.keys(x).length?(j[y.name]={},j[y.name][n.attributesKey]=x):j[y.name]=y.body,l("instruction",j)}}function d(y,x){var b;if(typeof y=="object"&&(x=y.attributes,y=y.name),x=c(x),"elementNameFn"in n&&(y=n.elementNameFn(y,s)),n.compact){if(b={},!n.ignoreAttributes&&x&&Object.keys(x).length){b[n.attributesKey]={};var w;for(w in x)x.hasOwnProperty(w)&&(b[n.attributesKey][w]=x[w])}!(y in s)&&(r(n.alwaysArray)?n.alwaysArray.indexOf(y)!==-1:n.alwaysArray)&&(s[y]=[]),s[y]&&!r(s[y])&&(s[y]=[s[y]]),r(s[y])?s[y].push(b):s[y]=b}else s[n.elementsKey]||(s[n.elementsKey]=[]),b={},b[n.typeKey]="element",b[n.nameKey]=y,!n.ignoreAttributes&&x&&Object.keys(x).length&&(b[n.attributesKey]=x),n.alwaysChildren&&(b[n.elementsKey]=[]),s[n.elementsKey].push(b);b[n.parentKey]=s,s=b}function h(y){n.ignoreText||!y.trim()&&!n.captureSpacesBetweenElements||(n.trim&&(y=y.trim()),n.nativeType&&(y=o(y)),n.sanitize&&(y=y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")),l("text",y))}function f(y){n.ignoreComment||(n.trim&&(y=y.trim()),l("comment",y))}function p(y){var x=s[n.parentKey];n.addParent||delete s[n.parentKey],s=x}function g(y){n.ignoreCdata||(n.trim&&(y=y.trim()),l("cdata",y))}function m(y){n.ignoreDoctype||(y=y.replace(/^ /,""),n.trim&&(y=y.trim()),l("doctype",y))}function v(y){y.note=y}return BR=function(y,x){var b=t.parser(!0,{}),w={};if(s=w,n=i(x),b.opt={strictEntities:!0},b.onopentag=d,b.ontext=h,b.oncomment=f,b.onclosetag=p,b.onerror=v,b.oncdata=g,b.ondoctype=m,b.onprocessinginstruction=u,b.write(y).close(),w[n.elementsKey]){var j=w[n.elementsKey];delete w[n.elementsKey],w[n.elementsKey]=j,delete w.text}return w},BR}var UR,HY;function Ydt(){if(HY)return UR;HY=1;var t=yB(),e=_pe();function r(n){var s=t.copyOptions(n);return t.ensureSpacesExists(s),s}return UR=function(n,s){var i,o,l,c;return i=r(s),o=e(n,i),c="compact"in i&&i.compact?"_parent":"parent","addParent"in i&&i.addParent?l=JSON.stringify(o,function(u,d){return u===c?"_":d},i.spaces):l=JSON.stringify(o,null,i.spaces),l.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},UR}var zR,WY;function jpe(){if(WY)return zR;WY=1;var t=yB(),e=gB().isArray,r,n;function s(b){var w=t.copyOptions(b);return t.ensureFlagExists("ignoreDeclaration",w),t.ensureFlagExists("ignoreInstruction",w),t.ensureFlagExists("ignoreAttributes",w),t.ensureFlagExists("ignoreText",w),t.ensureFlagExists("ignoreComment",w),t.ensureFlagExists("ignoreCdata",w),t.ensureFlagExists("ignoreDoctype",w),t.ensureFlagExists("compact",w),t.ensureFlagExists("indentText",w),t.ensureFlagExists("indentCdata",w),t.ensureFlagExists("indentAttributes",w),t.ensureFlagExists("indentInstruction",w),t.ensureFlagExists("fullTagEmptyElement",w),t.ensureFlagExists("noQuotesForNativeAttributes",w),t.ensureSpacesExists(w),typeof w.spaces=="number"&&(w.spaces=Array(w.spaces+1).join(" ")),t.ensureKeyExists("declaration",w),t.ensureKeyExists("instruction",w),t.ensureKeyExists("attributes",w),t.ensureKeyExists("text",w),t.ensureKeyExists("comment",w),t.ensureKeyExists("cdata",w),t.ensureKeyExists("doctype",w),t.ensureKeyExists("type",w),t.ensureKeyExists("name",w),t.ensureKeyExists("elements",w),t.checkFnExists("doctype",w),t.checkFnExists("instruction",w),t.checkFnExists("cdata",w),t.checkFnExists("comment",w),t.checkFnExists("text",w),t.checkFnExists("instructionName",w),t.checkFnExists("elementName",w),t.checkFnExists("attributeName",w),t.checkFnExists("attributeValue",w),t.checkFnExists("attributes",w),t.checkFnExists("fullTagEmptyElement",w),w}function i(b,w,j){return(!j&&b.spaces?`
`:"")+Array(w+1).join(b.spaces)}function o(b,w,j){if(w.ignoreAttributes)return"";"attributesFn"in w&&(b=w.attributesFn(b,n,r));var N,C,k,E,M=[];for(N in b)b.hasOwnProperty(N)&&b[N]!==null&&b[N]!==void 0&&(E=w.noQuotesForNativeAttributes&&typeof b[N]!="string"?"":'"',C=""+b[N],C=C.replace(/"/g,"&quot;"),k="attributeNameFn"in w?w.attributeNameFn(N,C,n,r):N,M.push(w.spaces&&w.indentAttributes?i(w,j+1,!1):" "),M.push(k+"="+E+("attributeValueFn"in w?w.attributeValueFn(C,N,n,r):C)+E));return b&&Object.keys(b).length&&w.spaces&&w.indentAttributes&&M.push(i(w,j,!1)),M.join("")}function l(b,w,j){return r=b,n="xml",w.ignoreDeclaration?"":"<?xml"+o(b[w.attributesKey],w,j)+"?>"}function c(b,w,j){if(w.ignoreInstruction)return"";var N;for(N in b)if(b.hasOwnProperty(N))break;var C="instructionNameFn"in w?w.instructionNameFn(N,b[N],n,r):N;if(typeof b[N]=="object")return r=b,n=C,"<?"+C+o(b[N][w.attributesKey],w,j)+"?>";var k=b[N]?b[N]:"";return"instructionFn"in w&&(k=w.instructionFn(k,N,n,r)),"<?"+C+(k?" "+k:"")+"?>"}function u(b,w){return w.ignoreComment?"":"<!--"+("commentFn"in w?w.commentFn(b,n,r):b)+"-->"}function d(b,w){return w.ignoreCdata?"":"<![CDATA["+("cdataFn"in w?w.cdataFn(b,n,r):b.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function h(b,w){return w.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in w?w.doctypeFn(b,n,r):b)+">"}function f(b,w){return w.ignoreText?"":(b=""+b,b=b.replace(/&amp;/g,"&"),b=b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"textFn"in w?w.textFn(b,n,r):b)}function p(b,w){var j;if(b.elements&&b.elements.length)for(j=0;j<b.elements.length;++j)switch(b.elements[j][w.typeKey]){case"text":if(w.indentText)return!0;break;case"cdata":if(w.indentCdata)return!0;break;case"instruction":if(w.indentInstruction)return!0;break;case"doctype":case"comment":case"element":return!0;default:return!0}return!1}function g(b,w,j){r=b,n=b.name;var N=[],C="elementNameFn"in w?w.elementNameFn(b.name,b):b.name;N.push("<"+C),b[w.attributesKey]&&N.push(o(b[w.attributesKey],w,j));var k=b[w.elementsKey]&&b[w.elementsKey].length||b[w.attributesKey]&&b[w.attributesKey]["xml:space"]==="preserve";return k||("fullTagEmptyElementFn"in w?k=w.fullTagEmptyElementFn(b.name,b):k=w.fullTagEmptyElement),k?(N.push(">"),b[w.elementsKey]&&b[w.elementsKey].length&&(N.push(m(b[w.elementsKey],w,j+1)),r=b,n=b.name),N.push(w.spaces&&p(b,w)?`
`+Array(j+1).join(w.spaces):""),N.push("</"+C+">")):N.push("/>"),N.join("")}function m(b,w,j,N){return b.reduce(function(C,k){var E=i(w,j,N&&!C);switch(k.type){case"element":return C+E+g(k,w,j);case"comment":return C+E+u(k[w.commentKey],w);case"doctype":return C+E+h(k[w.doctypeKey],w);case"cdata":return C+(w.indentCdata?E:"")+d(k[w.cdataKey],w);case"text":return C+(w.indentText?E:"")+f(k[w.textKey],w);case"instruction":var M={};return M[k[w.nameKey]]=k[w.attributesKey]?k:k[w.instructionKey],C+(w.indentInstruction?E:"")+c(M,w,j)}},"")}function v(b,w,j){var N;for(N in b)if(b.hasOwnProperty(N))switch(N){case w.parentKey:case w.attributesKey:break;case w.textKey:if(w.indentText||j)return!0;break;case w.cdataKey:if(w.indentCdata||j)return!0;break;case w.instructionKey:if(w.indentInstruction||j)return!0;break;case w.doctypeKey:case w.commentKey:return!0;default:return!0}return!1}function y(b,w,j,N,C){r=b,n=w;var k="elementNameFn"in j?j.elementNameFn(w,b):w;if(typeof b>"u"||b===null||b==="")return"fullTagEmptyElementFn"in j&&j.fullTagEmptyElementFn(w,b)||j.fullTagEmptyElement?"<"+k+"></"+k+">":"<"+k+"/>";var E=[];if(w){if(E.push("<"+k),typeof b!="object")return E.push(">"+f(b,j)+"</"+k+">"),E.join("");b[j.attributesKey]&&E.push(o(b[j.attributesKey],j,N));var M=v(b,j,!0)||b[j.attributesKey]&&b[j.attributesKey]["xml:space"]==="preserve";if(M||("fullTagEmptyElementFn"in j?M=j.fullTagEmptyElementFn(w,b):M=j.fullTagEmptyElement),M)E.push(">");else return E.push("/>"),E.join("")}return E.push(x(b,j,N+1,!1)),r=b,n=w,w&&E.push((C?i(j,N,!1):"")+"</"+k+">"),E.join("")}function x(b,w,j,N){var C,k,E,M=[];for(k in b)if(b.hasOwnProperty(k))for(E=e(b[k])?b[k]:[b[k]],C=0;C<E.length;++C){switch(k){case w.declarationKey:M.push(l(E[C],w,j));break;case w.instructionKey:M.push((w.indentInstruction?i(w,j,N):"")+c(E[C],w,j));break;case w.attributesKey:case w.parentKey:break;case w.textKey:M.push((w.indentText?i(w,j,N):"")+f(E[C],w));break;case w.cdataKey:M.push((w.indentCdata?i(w,j,N):"")+d(E[C],w));break;case w.doctypeKey:M.push(i(w,j,N)+h(E[C],w));break;case w.commentKey:M.push(i(w,j,N)+u(E[C],w));break;default:M.push(i(w,j,N)+y(E[C],k,w,j,v(E[C],w)))}N=N&&!M.length}return M.join("")}return zR=function(b,w){w=s(w);var j=[];return r=b,n="_root_",w.compact?j.push(x(b,w,0,!0)):(b[w.declarationKey]&&j.push(l(b[w.declarationKey],w,0)),b[w.elementsKey]&&b[w.elementsKey].length&&j.push(m(b[w.elementsKey],w,0,!j.length))),j.join("")},zR}var HR,VY;function Xdt(){if(VY)return HR;VY=1;var t=jpe();return HR=function(e,r){e instanceof Buffer&&(e=e.toString());var n=null;if(typeof e=="string")try{n=JSON.parse(e)}catch{throw new Error("The JSON structure is invalid")}else n=e;return t(n,r)},HR}var WR,qY;function Qdt(){if(qY)return WR;qY=1;var t=_pe(),e=Ydt(),r=jpe(),n=Xdt();return WR={xml2js:t,xml2json:e,js2xml:r,json2xml:n},WR}var Spe=Qdt();const vB=t=>{switch(t.type){case void 0:case"element":const e=new Jdt(t.name,t.attributes),r=t.elements||[];for(const n of r){const s=vB(n);s!==void 0&&e.push(s)}return e;case"text":return t.text;default:return}};class Zdt extends St{}class Jdt extends Ie{static fromXmlString(e){const r=Spe.xml2js(e,{compact:!1});return vB(r)}constructor(e,r){super(e),r&&this.root.push(new Zdt(r))}push(e){this.root.push(e)}}class eht extends Ie{constructor(e){super(""),this._attr=e}prepForXml(e){return{_attr:this._attr}}}class Npe extends Ie{constructor(e,r){super(e),r&&(this.root=r.root)}}const Qi=t=>{if(isNaN(t))throw new Error(`Invalid value '${t}' specified. Must be an integer.`);return Math.floor(t)},J2=t=>{const e=Qi(t);if(e<0)throw new Error(`Invalid value '${t}' specified. Must be a positive integer.`);return e},Ape=(t,e)=>{const r=e*2;if(t.length!==r||isNaN(+`0x${t}`))throw new Error(`Invalid hex value '${t}'. Expected ${r} digit hex value`);return t},GY=t=>Ape(t,1),Epe=t=>{const e=t.slice(-2),r=t.substring(0,t.length-2);return`${Number(r)}${e}`},Cpe=t=>{const e=Epe(t);if(parseFloat(e)<0)throw new Error(`Invalid value '${e}' specified. Expected a positive number.`);return e},Qx=t=>{if(t==="auto")return t;const e=t.charAt(0)==="#"?t.substring(1):t;return Ape(e,3)},fp=t=>typeof t=="string"?Epe(t):Qi(t),tht=t=>typeof t=="string"?Cpe(t):J2(t),tl=t=>typeof t=="string"?Cpe(t):J2(t),rht=J2,nht=J2,sht=t=>t.toISOString();class De extends Ie{constructor(e,r=!0){super(e),r!==!0&&this.root.push(new xn({val:r}))}}class VR extends Ie{constructor(e,r){super(e),this.root.push(new xn({val:tht(r)}))}}class Lm extends Ie{constructor(e,r){super(e),this.root.push(new xn({val:r}))}}const mb=(t,e)=>new jc({name:t,attributes:{value:{key:"w:val",value:e}}});class Aw extends Ie{constructor(e,r){super(e),this.root.push(new xn({val:r}))}}class Lf extends Ie{constructor(e,r){super(e),this.root.push(r)}}class jc extends Ie{constructor({name:e,attributes:r,children:n}){super(e),r&&this.root.push(new X2(r)),n&&this.root.push(...n)}}const _n={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"};class iht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class aht extends Ie{constructor(e){super("w:jc"),this.root.push(new iht({val:e}))}}class cn extends Ie{constructor(e,{color:r,size:n,space:s,style:i}){super(e),this.root.push(new oht({style:i,color:r===void 0?void 0:Qx(r),size:n===void 0?void 0:rht(n),space:s===void 0?void 0:nht(s)}))}}class oht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{style:"w:val",color:"w:color",size:"w:sz",space:"w:space"})}}const xB={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"};class lht extends Y2{constructor(e){super("w:pBdr"),e.top&&this.root.push(new cn("w:top",e.top)),e.bottom&&this.root.push(new cn("w:bottom",e.bottom)),e.left&&this.root.push(new cn("w:left",e.left)),e.right&&this.root.push(new cn("w:right",e.right))}}class cht extends Ie{constructor(){super("w:pBdr");const e=new cn("w:bottom",{color:"auto",space:1,style:xB.SINGLE,size:6});this.root.push(e)}}class uht extends Ie{constructor({start:e,end:r,left:n,right:s,hanging:i,firstLine:o}){super("w:ind"),this.root.push(new X2({start:{key:"w:start",value:e===void 0?void 0:fp(e)},end:{key:"w:end",value:r===void 0?void 0:fp(r)},left:{key:"w:left",value:n===void 0?void 0:fp(n)},right:{key:"w:right",value:s===void 0?void 0:fp(s)},hanging:{key:"w:hanging",value:i===void 0?void 0:tl(i)},firstLine:{key:"w:firstLine",value:o===void 0?void 0:tl(o)}}))}}let dht=class extends Ie{constructor(){super("w:br")}};const bB={BEGIN:"begin",END:"end",SEPARATE:"separate"};class wB extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:fldCharType",dirty:"w:dirty"})}}class Zb extends Ie{constructor(e){super("w:fldChar"),this.root.push(new wB({type:bB.BEGIN,dirty:e}))}}class Jb extends Ie{constructor(e){super("w:fldChar"),this.root.push(new wB({type:bB.SEPARATE,dirty:e}))}}class ew extends Ie{constructor(e){super("w:fldChar"),this.root.push(new wB({type:bB.END,dirty:e}))}}const hht={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},tg={DEFAULT:"default",PRESERVE:"preserve"};class rg extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{space:"xml:space"})}}class fht extends Ie{constructor(){super("w:instrText"),this.root.push(new rg({space:tg.PRESERVE})),this.root.push("PAGE")}}class pht extends Ie{constructor(){super("w:instrText"),this.root.push(new rg({space:tg.PRESERVE})),this.root.push("NUMPAGES")}}class mht extends Ie{constructor(){super("w:instrText"),this.root.push(new rg({space:tg.PRESERVE})),this.root.push("SECTIONPAGES")}}class ght extends Ie{constructor(){super("w:instrText"),this.root.push(new rg({space:tg.PRESERVE})),this.root.push("SECTION")}}class yht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{fill:"w:fill",color:"w:color",type:"w:val"})}}class kpe extends Ie{constructor({fill:e,color:r,type:n}){super("w:shd"),this.root.push(new yht({fill:e===void 0?void 0:Qx(e),color:r===void 0?void 0:Qx(r),type:n}))}}class vht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}}const xht={DOT:"dot"};class bht extends Ie{constructor(e){super("w:em"),this.root.push(new xn({val:e}))}}class wht extends bht{constructor(e=xht.DOT){super(e)}}class _ht extends Ie{constructor(e){super("w:spacing"),this.root.push(new xn({val:fp(e)}))}}class jht extends Ie{constructor(e){super("w:color"),this.root.push(new xn({val:Qx(e)}))}}class Sht extends Ie{constructor(e){super("w:highlight"),this.root.push(new xn({val:e}))}}class Nht extends Ie{constructor(e){super("w:highlightCs"),this.root.push(new xn({val:e}))}}const Aht=t=>new jc({name:"w:lang",attributes:{value:{key:"w:val",value:t.value},eastAsia:{key:"w:eastAsia",value:t.eastAsia},bidirectional:{key:"w:bidi",value:t.bidirectional}}});class KY extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{ascii:"w:ascii",cs:"w:cs",eastAsia:"w:eastAsia",hAnsi:"w:hAnsi",hint:"w:hint"})}}class qR extends Ie{constructor(e,r){if(super("w:rFonts"),typeof e=="string"){const n=e;this.root.push(new KY({ascii:n,cs:n,eastAsia:n,hAnsi:n,hint:r}))}else{const n=e;this.root.push(new KY(n))}}}let Tpe=class extends Ie{constructor(e){super("w:vertAlign"),this.root.push(new xn({val:e}))}};class Eht extends Tpe{constructor(){super("superscript")}}class Cht extends Tpe{constructor(){super("subscript")}}const Ppe={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"};class kht extends Ie{constructor(e=Ppe.SINGLE,r){super("w:u"),this.root.push(new xn({val:e,color:r===void 0?void 0:Qx(r)}))}}class vg extends Y2{constructor(e){var r,n;if(super("w:rPr"),!e)return;e.style&&this.push(new Lm("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(new qR(e.font)):"name"in e.font?this.push(new qR(e.font.name,e.font.hint)):this.push(new qR(e.font))),e.bold!==void 0&&this.push(new De("w:b",e.bold)),(e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript)&&this.push(new De("w:bCs",(r=e.boldComplexScript)!=null?r:e.bold)),e.italics!==void 0&&this.push(new De("w:i",e.italics)),(e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript)&&this.push(new De("w:iCs",(n=e.italicsComplexScript)!=null?n:e.italics)),e.smallCaps!==void 0?this.push(new De("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new De("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new De("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new De("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new De("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new De("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new De("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new De("w:snapToGrid",e.snapToGrid)),e.vanish&&this.push(new De("w:vanish",e.vanish)),e.color&&this.push(new jht(e.color)),e.characterSpacing&&this.push(new _ht(e.characterSpacing)),e.scale!==void 0&&this.push(new Aw("w:w",e.scale)),e.kern&&this.push(new VR("w:kern",e.kern)),e.position&&this.push(new Lm("w:position",e.position)),e.size!==void 0&&this.push(new VR("w:sz",e.size));const s=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;s&&this.push(new VR("w:szCs",s)),e.highlight&&this.push(new Sht(e.highlight));const i=e.highlightComplexScript===void 0||e.highlightComplexScript===!0?e.highlight:e.highlightComplexScript;i&&this.push(new Nht(i)),e.underline&&this.push(new kht(e.underline.type,e.underline.color)),e.effect&&this.push(new Lm("w:effect",e.effect)),e.border&&this.push(new cn("w:bdr",e.border)),e.shading&&this.push(new kpe(e.shading)),e.subScript&&this.push(new Cht),e.superScript&&this.push(new Eht),e.rightToLeft!==void 0&&this.push(new De("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(new wht(e.emphasisMark.type)),e.language&&this.push(Aht(e.language)),e.specVanish&&this.push(new De("w:specVanish",e.vanish)),e.math&&this.push(new De("w:oMath",e.math)),e.revision&&this.push(new Tht(e.revision))}push(e){this.root.push(e)}}class Tht extends Ie{constructor(e){super("w:rPrChange"),this.root.push(new vht({id:e.id,author:e.author,date:e.date})),this.addChildElement(new vg(e))}}class YY extends Ie{constructor(e){var r;super("w:t"),typeof e=="string"?(this.root.push(new rg({space:tg.PRESERVE})),this.root.push(e)):(this.root.push(new rg({space:(r=e.space)!=null?r:tg.DEFAULT})),this.root.push(e.text))}}const vy={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"};class ng extends Ie{constructor(e){if(super("w:r"),Pe(this,"properties"),this.properties=new vg(e),this.root.push(this.properties),e.break)for(let r=0;r<e.break;r++)this.root.push(new dht);if(e.children)for(const r of e.children){if(typeof r=="string"){switch(r){case vy.CURRENT:this.root.push(new Zb),this.root.push(new fht),this.root.push(new Jb),this.root.push(new ew);break;case vy.TOTAL_PAGES:this.root.push(new Zb),this.root.push(new pht),this.root.push(new Jb),this.root.push(new ew);break;case vy.TOTAL_PAGES_IN_SECTION:this.root.push(new Zb),this.root.push(new mht),this.root.push(new Jb),this.root.push(new ew);break;case vy.CURRENT_SECTION:this.root.push(new Zb),this.root.push(new ght),this.root.push(new Jb),this.root.push(new ew);break;default:this.root.push(new YY(r));break}continue}this.root.push(r)}else e.text!==void 0&&this.root.push(new YY(e.text))}}class Us extends ng{constructor(e){super(typeof e=="string"?{text:e}:e)}}var GR={},gr={},KR,XY;function xS(){if(XY)return KR;XY=1,KR=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(r,n,s){if(r!=n)throw new Error(s||"Assertion failed: "+r+" != "+n)},KR}var QY;function Pc(){if(QY)return gr;QY=1;var t=xS(),e=Cf();gr.inherits=e;function r(I,q){return(I.charCodeAt(q)&64512)!==55296||q<0||q+1>=I.length?!1:(I.charCodeAt(q+1)&64512)===56320}function n(I,q){if(Array.isArray(I))return I.slice();if(!I)return[];var A=[];if(typeof I=="string")if(q){if(q==="hex")for(I=I.replace(/[^a-z0-9]+/ig,""),I.length%2!==0&&(I="0"+I),K=0;K<I.length;K+=2)A.push(parseInt(I[K]+I[K+1],16))}else for(var U=0,K=0;K<I.length;K++){var G=I.charCodeAt(K);G<128?A[U++]=G:G<2048?(A[U++]=G>>6|192,A[U++]=G&63|128):r(I,K)?(G=65536+((G&1023)<<10)+(I.charCodeAt(++K)&1023),A[U++]=G>>18|240,A[U++]=G>>12&63|128,A[U++]=G>>6&63|128,A[U++]=G&63|128):(A[U++]=G>>12|224,A[U++]=G>>6&63|128,A[U++]=G&63|128)}else for(K=0;K<I.length;K++)A[K]=I[K]|0;return A}gr.toArray=n;function s(I){for(var q="",A=0;A<I.length;A++)q+=l(I[A].toString(16));return q}gr.toHex=s;function i(I){var q=I>>>24|I>>>8&65280|I<<8&16711680|(I&255)<<24;return q>>>0}gr.htonl=i;function o(I,q){for(var A="",U=0;U<I.length;U++){var K=I[U];q==="little"&&(K=i(K)),A+=c(K.toString(16))}return A}gr.toHex32=o;function l(I){return I.length===1?"0"+I:I}gr.zero2=l;function c(I){return I.length===7?"0"+I:I.length===6?"00"+I:I.length===5?"000"+I:I.length===4?"0000"+I:I.length===3?"00000"+I:I.length===2?"000000"+I:I.length===1?"0000000"+I:I}gr.zero8=c;function u(I,q,A,U){var K=A-q;t(K%4===0);for(var G=new Array(K/4),Y=0,H=q;Y<G.length;Y++,H+=4){var $;U==="big"?$=I[H]<<24|I[H+1]<<16|I[H+2]<<8|I[H+3]:$=I[H+3]<<24|I[H+2]<<16|I[H+1]<<8|I[H],G[Y]=$>>>0}return G}gr.join32=u;function d(I,q){for(var A=new Array(I.length*4),U=0,K=0;U<I.length;U++,K+=4){var G=I[U];q==="big"?(A[K]=G>>>24,A[K+1]=G>>>16&255,A[K+2]=G>>>8&255,A[K+3]=G&255):(A[K+3]=G>>>24,A[K+2]=G>>>16&255,A[K+1]=G>>>8&255,A[K]=G&255)}return A}gr.split32=d;function h(I,q){return I>>>q|I<<32-q}gr.rotr32=h;function f(I,q){return I<<q|I>>>32-q}gr.rotl32=f;function p(I,q){return I+q>>>0}gr.sum32=p;function g(I,q,A){return I+q+A>>>0}gr.sum32_3=g;function m(I,q,A,U){return I+q+A+U>>>0}gr.sum32_4=m;function v(I,q,A,U,K){return I+q+A+U+K>>>0}gr.sum32_5=v;function y(I,q,A,U){var K=I[q],G=I[q+1],Y=U+G>>>0,H=(Y<U?1:0)+A+K;I[q]=H>>>0,I[q+1]=Y}gr.sum64=y;function x(I,q,A,U){var K=q+U>>>0,G=(K<q?1:0)+I+A;return G>>>0}gr.sum64_hi=x;function b(I,q,A,U){var K=q+U;return K>>>0}gr.sum64_lo=b;function w(I,q,A,U,K,G,Y,H){var $=0,L=q;L=L+U>>>0,$+=L<q?1:0,L=L+G>>>0,$+=L<G?1:0,L=L+H>>>0,$+=L<H?1:0;var F=I+A+K+Y+$;return F>>>0}gr.sum64_4_hi=w;function j(I,q,A,U,K,G,Y,H){var $=q+U+G+H;return $>>>0}gr.sum64_4_lo=j;function N(I,q,A,U,K,G,Y,H,$,L){var F=0,W=q;W=W+U>>>0,F+=W<q?1:0,W=W+G>>>0,F+=W<G?1:0,W=W+H>>>0,F+=W<H?1:0,W=W+L>>>0,F+=W<L?1:0;var X=I+A+K+Y+$+F;return X>>>0}gr.sum64_5_hi=N;function C(I,q,A,U,K,G,Y,H,$,L){var F=q+U+G+H+L;return F>>>0}gr.sum64_5_lo=C;function k(I,q,A){var U=q<<32-A|I>>>A;return U>>>0}gr.rotr64_hi=k;function E(I,q,A){var U=I<<32-A|q>>>A;return U>>>0}gr.rotr64_lo=E;function M(I,q,A){return I>>>A}gr.shr64_hi=M;function z(I,q,A){var U=I<<32-A|q>>>A;return U>>>0}return gr.shr64_lo=z,gr}var YR={},ZY;function bS(){if(ZY)return YR;ZY=1;var t=Pc(),e=xS();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return YR.BlockHash=r,r.prototype.update=function(s,i){if(s=t.toArray(s,i),this.pending?this.pending=this.pending.concat(s):this.pending=s,this.pendingTotal+=s.length,this.pending.length>=this._delta8){s=this.pending;var o=s.length%this._delta8;this.pending=s.slice(s.length-o,s.length),this.pending.length===0&&(this.pending=null),s=t.join32(s,0,s.length-o,this.endian);for(var l=0;l<s.length;l+=this._delta32)this._update(s,l,l+this._delta32)}return this},r.prototype.digest=function(s){return this.update(this._pad()),e(this.pending===null),this._digest(s)},r.prototype._pad=function(){var s=this.pendingTotal,i=this._delta8,o=i-(s+this.padLength)%i,l=new Array(o+this.padLength);l[0]=128;for(var c=1;c<o;c++)l[c]=0;if(s<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)l[c++]=0;l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=s>>>24&255,l[c++]=s>>>16&255,l[c++]=s>>>8&255,l[c++]=s&255}else for(l[c++]=s&255,l[c++]=s>>>8&255,l[c++]=s>>>16&255,l[c++]=s>>>24&255,l[c++]=0,l[c++]=0,l[c++]=0,l[c++]=0,u=8;u<this.padLength;u++)l[c++]=0;return l},YR}var Ff={},Nl={},JY;function Ope(){if(JY)return Nl;JY=1;var t=Pc(),e=t.rotr32;function r(d,h,f,p){if(d===0)return n(h,f,p);if(d===1||d===3)return i(h,f,p);if(d===2)return s(h,f,p)}Nl.ft_1=r;function n(d,h,f){return d&h^~d&f}Nl.ch32=n;function s(d,h,f){return d&h^d&f^h&f}Nl.maj32=s;function i(d,h,f){return d^h^f}Nl.p32=i;function o(d){return e(d,2)^e(d,13)^e(d,22)}Nl.s0_256=o;function l(d){return e(d,6)^e(d,11)^e(d,25)}Nl.s1_256=l;function c(d){return e(d,7)^e(d,18)^d>>>3}Nl.g0_256=c;function u(d){return e(d,17)^e(d,19)^d>>>10}return Nl.g1_256=u,Nl}var XR,eX;function Pht(){if(eX)return XR;eX=1;var t=Pc(),e=bS(),r=Ope(),n=t.rotl32,s=t.sum32,i=t.sum32_5,o=r.ft_1,l=e.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(u,l),XR=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(h,f){for(var p=this.W,g=0;g<16;g++)p[g]=h[f+g];for(;g<p.length;g++)p[g]=n(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);var m=this.h[0],v=this.h[1],y=this.h[2],x=this.h[3],b=this.h[4];for(g=0;g<p.length;g++){var w=~~(g/20),j=i(n(m,5),o(w,v,y,x),b,p[g],c[w]);b=x,x=y,y=n(v,30),v=m,m=j}this.h[0]=s(this.h[0],m),this.h[1]=s(this.h[1],v),this.h[2]=s(this.h[2],y),this.h[3]=s(this.h[3],x),this.h[4]=s(this.h[4],b)},u.prototype._digest=function(h){return h==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},XR}var QR,tX;function Ipe(){if(tX)return QR;tX=1;var t=Pc(),e=bS(),r=Ope(),n=xS(),s=t.sum32,i=t.sum32_4,o=t.sum32_5,l=r.ch32,c=r.maj32,u=r.s0_256,d=r.s1_256,h=r.g0_256,f=r.g1_256,p=e.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;p.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}return t.inherits(m,p),QR=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(y,x){for(var b=this.W,w=0;w<16;w++)b[w]=y[x+w];for(;w<b.length;w++)b[w]=i(f(b[w-2]),b[w-7],h(b[w-15]),b[w-16]);var j=this.h[0],N=this.h[1],C=this.h[2],k=this.h[3],E=this.h[4],M=this.h[5],z=this.h[6],I=this.h[7];for(n(this.k.length===b.length),w=0;w<b.length;w++){var q=o(I,d(E),l(E,M,z),this.k[w],b[w]),A=s(u(j),c(j,N,C));I=z,z=M,M=E,E=s(k,q),k=C,C=N,N=j,j=s(q,A)}this.h[0]=s(this.h[0],j),this.h[1]=s(this.h[1],N),this.h[2]=s(this.h[2],C),this.h[3]=s(this.h[3],k),this.h[4]=s(this.h[4],E),this.h[5]=s(this.h[5],M),this.h[6]=s(this.h[6],z),this.h[7]=s(this.h[7],I)},m.prototype._digest=function(y){return y==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},QR}var ZR,rX;function Oht(){if(rX)return ZR;rX=1;var t=Pc(),e=Ipe();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return t.inherits(r,e),ZR=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(s){return s==="hex"?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")},ZR}var JR,nX;function Rpe(){if(nX)return JR;nX=1;var t=Pc(),e=bS(),r=xS(),n=t.rotr64_hi,s=t.rotr64_lo,i=t.shr64_hi,o=t.shr64_lo,l=t.sum64,c=t.sum64_hi,u=t.sum64_lo,d=t.sum64_4_hi,h=t.sum64_4_lo,f=t.sum64_5_hi,p=t.sum64_5_lo,g=e.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}t.inherits(v,g),JR=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(A,U){for(var K=this.W,G=0;G<32;G++)K[G]=A[U+G];for(;G<K.length;G+=2){var Y=z(K[G-4],K[G-3]),H=I(K[G-4],K[G-3]),$=K[G-14],L=K[G-13],F=E(K[G-30],K[G-29]),W=M(K[G-30],K[G-29]),X=K[G-32],oe=K[G-31];K[G]=d(Y,H,$,L,F,W,X,oe),K[G+1]=h(Y,H,$,L,F,W,X,oe)}},v.prototype._update=function(A,U){this._prepareBlock(A,U);var K=this.W,G=this.h[0],Y=this.h[1],H=this.h[2],$=this.h[3],L=this.h[4],F=this.h[5],W=this.h[6],X=this.h[7],oe=this.h[8],le=this.h[9],B=this.h[10],R=this.h[11],ee=this.h[12],te=this.h[13],Z=this.h[14],J=this.h[15];r(this.k.length===K.length);for(var he=0;he<K.length;he+=2){var P=Z,ie=J,V=C(oe,le),O=k(oe,le),T=y(oe,le,B,R,ee),D=x(oe,le,B,R,ee,te),ne=this.k[he],ue=this.k[he+1],re=K[he],pe=K[he+1],xe=f(P,ie,V,O,T,D,ne,ue,re,pe),ye=p(P,ie,V,O,T,D,ne,ue,re,pe);P=j(G,Y),ie=N(G,Y),V=b(G,Y,H,$,L),O=w(G,Y,H,$,L,F);var ae=c(P,ie,V,O),de=u(P,ie,V,O);Z=ee,J=te,ee=B,te=R,B=oe,R=le,oe=c(W,X,xe,ye),le=u(X,X,xe,ye),W=L,X=F,L=H,F=$,H=G,$=Y,G=c(xe,ye,ae,de),Y=u(xe,ye,ae,de)}l(this.h,0,G,Y),l(this.h,2,H,$),l(this.h,4,L,F),l(this.h,6,W,X),l(this.h,8,oe,le),l(this.h,10,B,R),l(this.h,12,ee,te),l(this.h,14,Z,J)},v.prototype._digest=function(A){return A==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")};function y(q,A,U,K,G){var Y=q&U^~q&G;return Y<0&&(Y+=4294967296),Y}function x(q,A,U,K,G,Y){var H=A&K^~A&Y;return H<0&&(H+=4294967296),H}function b(q,A,U,K,G){var Y=q&U^q&G^U&G;return Y<0&&(Y+=4294967296),Y}function w(q,A,U,K,G,Y){var H=A&K^A&Y^K&Y;return H<0&&(H+=4294967296),H}function j(q,A){var U=n(q,A,28),K=n(A,q,2),G=n(A,q,7),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function N(q,A){var U=s(q,A,28),K=s(A,q,2),G=s(A,q,7),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function C(q,A){var U=n(q,A,14),K=n(q,A,18),G=n(A,q,9),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function k(q,A){var U=s(q,A,14),K=s(q,A,18),G=s(A,q,9),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function E(q,A){var U=n(q,A,1),K=n(q,A,8),G=i(q,A,7),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function M(q,A){var U=s(q,A,1),K=s(q,A,8),G=o(q,A,7),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function z(q,A){var U=n(q,A,19),K=n(A,q,29),G=i(q,A,6),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}function I(q,A){var U=s(q,A,19),K=s(A,q,29),G=o(q,A,6),Y=U^K^G;return Y<0&&(Y+=4294967296),Y}return JR}var eM,sX;function Iht(){if(sX)return eM;sX=1;var t=Pc(),e=Rpe();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return t.inherits(r,e),eM=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(s){return s==="hex"?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")},eM}var iX;function Rht(){return iX||(iX=1,Ff.sha1=Pht(),Ff.sha224=Oht(),Ff.sha256=Ipe(),Ff.sha384=Iht(),Ff.sha512=Rpe()),Ff}var tM={},aX;function Mht(){if(aX)return tM;aX=1;var t=Pc(),e=bS(),r=t.rotl32,n=t.sum32,s=t.sum32_3,i=t.sum32_4,o=e.BlockHash;function l(){if(!(this instanceof l))return new l;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(l,o),tM.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(v,y){for(var x=this.h[0],b=this.h[1],w=this.h[2],j=this.h[3],N=this.h[4],C=x,k=b,E=w,M=j,z=N,I=0;I<80;I++){var q=n(r(i(x,c(I,b,w,j),v[h[I]+y],u(I)),p[I]),N);x=N,N=j,j=r(w,10),w=b,b=q,q=n(r(i(C,c(79-I,k,E,M),v[f[I]+y],d(I)),g[I]),z),C=z,z=M,M=r(E,10),E=k,k=q}q=s(this.h[1],w,M),this.h[1]=s(this.h[2],j,z),this.h[2]=s(this.h[3],N,C),this.h[3]=s(this.h[4],x,k),this.h[4]=s(this.h[0],b,E),this.h[0]=q},l.prototype._digest=function(v){return v==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function c(m,v,y,x){return m<=15?v^y^x:m<=31?v&y|~v&x:m<=47?(v|~y)^x:m<=63?v&x|y&~x:v^(y|~x)}function u(m){return m<=15?0:m<=31?1518500249:m<=47?1859775393:m<=63?2400959708:2840853838}function d(m){return m<=15?1352829926:m<=31?1548603684:m<=47?1836072691:m<=63?2053994217:0}var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];return tM}var rM,oX;function Dht(){if(oX)return rM;oX=1;var t=Pc(),e=xS();function r(n,s,i){if(!(this instanceof r))return new r(n,s,i);this.Hash=n,this.blockSize=n.blockSize/8,this.outSize=n.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(s,i))}return rM=r,r.prototype._init=function(s){s.length>this.blockSize&&(s=new this.Hash().update(s).digest()),e(s.length<=this.blockSize);for(var i=s.length;i<this.blockSize;i++)s.push(0);for(i=0;i<s.length;i++)s[i]^=54;for(this.inner=new this.Hash().update(s),i=0;i<s.length;i++)s[i]^=106;this.outer=new this.Hash().update(s)},r.prototype.update=function(s,i){return this.inner.update(s,i),this},r.prototype.digest=function(s){return this.outer.update(this.inner.digest()),this.outer.digest(s)},rM}var lX;function Lht(){return lX||(lX=1,function(t){var e=t;e.utils=Pc(),e.common=bS(),e.sha=Rht(),e.ripemd=Mht(),e.hmac=Dht(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(GR)),GR}Lht();let Fht="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",$ht=(t,e=21)=>(r=e)=>{let n="",s=r|0;for(;s--;)n+=t[Math.random()*t.length|0];return n},Bht=(t=21)=>{let e="",r=t|0;for(;r--;)e+=Fht[Math.random()*64|0];return e};const Po=t=>Math.floor(t*72*20),_B=(t=0)=>{let e=t;return()=>++e},Uht=()=>_B(),zht=()=>_B(1),Hht=()=>_B(),Wht=()=>Bht().toLowerCase(),gb=t=>$ht("1234567890abcdef",t)(),Vht=()=>`${gb(8)}-${gb(4)}-${gb(4)}-${gb(4)}-${gb(12)}`;class qht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns"})}}class Ght extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"Id",type:"Type",target:"Target",targetMode:"TargetMode"})}}const Kht={EXTERNAL:"External"};class Yht extends Ie{constructor(e,r,n,s){super("Relationship"),this.root.push(new Ght({id:e,type:r,target:n,targetMode:s}))}}class xg extends Ie{constructor(){super("Relationships"),this.root.push(new qht({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}createRelationship(e,r,n,s){const i=new Yht(`rId${e}`,r,n,s);return this.root.push(i),i}get RelationshipCount(){return this.root.length-1}}class Xht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}}class Qht extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}}class Zht extends Ie{constructor({id:e,initials:r,author:n,date:s=new Date,children:i}){super("w:comment"),this.root.push(new Xht({id:e,initials:r,author:n,date:s.toISOString()}));for(const o of i)this.root.push(o)}}class Jht extends Ie{constructor({children:e}){super("w:comments"),Pe(this,"relationships"),this.root.push(new Qht({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));for(const r of e)this.root.push(new Zht(r));this.relationships=new xg}get Relationships(){return this.relationships}}const eft={COLUMN:"column",PAGE:"page"};class tft extends Ie{constructor(e){super("w:br"),this.root.push(new xn({type:e}))}}class cX extends ng{constructor(){super({}),this.root.push(new tft(eft.PAGE))}}class rft extends Ie{constructor(){super("w:pageBreakBefore")}}const I3={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"};class nft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{after:"w:after",before:"w:before",line:"w:line",lineRule:"w:lineRule",beforeAutoSpacing:"w:beforeAutospacing",afterAutoSpacing:"w:afterAutospacing"})}}class sft extends Ie{constructor(e){super("w:spacing"),this.root.push(new nft(e))}}const nM={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"};let XN=class extends Ie{constructor(e){super("w:pStyle"),this.root.push(new xn({val:e}))}};class ift extends Ie{constructor(e){super("w:tabs");for(const r of e)this.root.push(new oft(r))}}const uX={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"};class aft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val",pos:"w:pos",leader:"w:leader"})}}class oft extends Ie{constructor({type:e,position:r,leader:n}){super("w:tab"),this.root.push(new aft({val:e,pos:r,leader:n}))}}class sM extends Ie{constructor(e,r){super("w:numPr"),this.root.push(new lft(r)),this.root.push(new cft(e))}}class lft extends Ie{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new xn({val:e}))}}class cft extends Ie{constructor(e){super("w:numId"),this.root.push(new xn({val:typeof e=="string"?`{${e}}`:e}))}}class Mpe extends Ie{constructor(){super(...arguments),Pe(this,"fileChild",Symbol())}}class uft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}}class dft extends Ie{constructor(e,r,n){super("w:hyperlink"),Pe(this,"linkId"),this.linkId=r;const s={history:1,anchor:n||void 0,id:n?void 0:`rId${this.linkId}`},i=new uft(s);this.root.push(i),e.forEach(o=>{this.root.push(o)})}}class hft extends Ie{constructor(e){super("w:externalHyperlink"),this.options=e}}class fft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id",name:"w:name"})}}class pft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{id:"w:id"})}}class mft{constructor(e){Pe(this,"bookmarkUniqueNumericId",Hht()),Pe(this,"start"),Pe(this,"children"),Pe(this,"end");const r=this.bookmarkUniqueNumericId();this.start=new gft(e.id,r),this.children=e.children,this.end=new yft(r)}}class gft extends Ie{constructor(e,r){super("w:bookmarkStart");const n=new fft({name:e,id:r});this.root.push(n)}}class yft extends Ie{constructor(e){super("w:bookmarkEnd");const r=new pft({id:e});this.root.push(r)}}class vft extends Ie{constructor(e){super("w:outlineLvl"),this.level=e,this.root.push(new xn({val:e}))}}const xft={TOP:"top",CENTER:"center",BOTTOM:"bottom"};Yx(Zt({},xft),{BOTH:"both"});class bft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{verticalAlign:"w:val"})}}class wft extends Ie{constructor(e){super("w:vAlign"),this.root.push(new bft({verticalAlign:e}))}}class _ft extends Ie{constructor({space:e,count:r,separate:n,equalWidth:s,children:i}){super("w:cols"),this.root.push(new X2({space:{key:"w:space",value:e===void 0?void 0:tl(e)},count:{key:"w:num",value:r===void 0?void 0:Qi(r)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:s}})),!s&&i&&i.forEach(o=>this.addChildElement(o))}}const jft=({type:t,linePitch:e,charSpace:r})=>new jc({name:"w:docGrid",attributes:{type:{key:"w:type",value:t},linePitch:{key:"w:linePitch",value:Qi(e)},charSpace:{key:"w:charSpace",value:r?Qi(r):void 0}}}),Hy={DEFAULT:"default",FIRST:"first",EVEN:"even"};class Sft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",id:"r:id"})}}const dX={HEADER:"w:headerReference",FOOTER:"w:footerReference"};class iM extends Ie{constructor(e,r){super(e),this.root.push(new Sft({type:r.type||Hy.DEFAULT,id:`rId${r.id}`}))}}const Nft=({countBy:t,start:e,restart:r,distance:n})=>new jc({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:t===void 0?void 0:Qi(t)},start:{key:"w:start",value:e===void 0?void 0:Qi(e)},restart:{key:"w:restart",value:r},distance:{key:"w:distance",value:n===void 0?void 0:tl(n)}}});class hX extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}}class Aft extends Y2{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new hX({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new hX({})),e.pageBorderTop&&this.root.push(new cn("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(new cn("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(new cn("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(new cn("w:right",e.pageBorderRight))}}class Eft extends Ie{constructor(e,r,n,s,i,o,l){super("w:pgMar"),this.root.push(new X2({top:{key:"w:top",value:fp(e)},right:{key:"w:right",value:tl(r)},bottom:{key:"w:bottom",value:fp(n)},left:{key:"w:left",value:tl(s)},header:{key:"w:header",value:tl(i)},footer:{key:"w:footer",value:tl(o)},gutter:{key:"w:gutter",value:tl(l)}}))}}class Cft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{start:"w:start",formatType:"w:fmt",separator:"w:chapSep"})}}class kft extends Ie{constructor({start:e,formatType:r,separator:n}){super("w:pgNumType"),this.root.push(new Cft({start:e===void 0?void 0:Qi(e),formatType:r,separator:n}))}}const R3={PORTRAIT:"portrait",LANDSCAPE:"landscape"},Tft=({width:t,height:e,orientation:r,code:n})=>{const s=tl(t),i=tl(e);return new jc({name:"w:pgSz",attributes:{width:{key:"w:w",value:r===R3.LANDSCAPE?i:s},height:{key:"w:h",value:r===R3.LANDSCAPE?s:i},orientation:{key:"w:orient",value:r},code:{key:"w:code",value:n}}})};class Pft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class Oft extends Ie{constructor(e){super("w:textDirection"),this.root.push(new Pft({val:e}))}}class Ift extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class Rft extends Ie{constructor(e){super("w:type"),this.root.push(new Ift({val:e}))}}const $f={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},aM={WIDTH:11906,HEIGHT:16838,ORIENTATION:R3.PORTRAIT};class Mft extends Ie{constructor({page:{size:{width:e=aM.WIDTH,height:r=aM.HEIGHT,orientation:n=aM.ORIENTATION}={},margin:{top:s=$f.TOP,right:i=$f.RIGHT,bottom:o=$f.BOTTOM,left:l=$f.LEFT,header:c=$f.HEADER,footer:u=$f.FOOTER,gutter:d=$f.GUTTER}={},pageNumbers:h={},borders:f,textDirection:p}={},grid:{linePitch:g=360,charSpace:m,type:v}={},headerWrapperGroup:y={},footerWrapperGroup:x={},lineNumbers:b,titlePage:w,verticalAlign:j,column:N,type:C}={}){super("w:sectPr"),this.addHeaderFooterGroup(dX.HEADER,y),this.addHeaderFooterGroup(dX.FOOTER,x),C&&this.root.push(new Rft(C)),this.root.push(Tft({width:e,height:r,orientation:n})),this.root.push(new Eft(s,i,o,l,c,u,d)),f&&this.root.push(new Aft(f)),b&&this.root.push(Nft(b)),this.root.push(new kft(h)),N&&this.root.push(new _ft(N)),j&&this.root.push(new wft(j)),w!==void 0&&this.root.push(new De("w:titlePg",w)),p&&this.root.push(new Oft(p)),this.root.push(jft({linePitch:g,charSpace:m,type:v}))}addHeaderFooterGroup(e,r){r.default&&this.root.push(new iM(e,{type:Hy.DEFAULT,id:r.default.View.ReferenceId})),r.first&&this.root.push(new iM(e,{type:Hy.FIRST,id:r.first.View.ReferenceId})),r.even&&this.root.push(new iM(e,{type:Hy.EVEN,id:r.even.View.ReferenceId}))}}class Dft extends Ie{constructor(){super("w:body"),Pe(this,"sections",[])}addSection(e){const r=this.sections.pop();this.root.push(this.createSectionParagraph(r)),this.sections.push(new Mft(e))}prepForXml(e){return this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop())),super.prepForXml(e)}push(e){this.root.push(e)}createSectionParagraph(e){const r=new $r({}),n=new Zx({});return n.push(e),r.addChildElement(n),r}}const fX={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"};class eP extends St{constructor(e,r){super(Zt({Ignorable:r},Object.fromEntries(e.map(n=>[n,fX[n]])))),Pe(this,"xmlKeys",Zt({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(fX).map(n=>[n,`xmlns:${n}`]))))}}class Lft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}}class Fft extends Ie{constructor(e){super("w:background"),this.root.push(new Lft({color:e.color===void 0?void 0:Qx(e.color),themeColor:e.themeColor,themeShade:e.themeShade===void 0?void 0:GY(e.themeShade),themeTint:e.themeTint===void 0?void 0:GY(e.themeTint)}))}}class $ft extends Ie{constructor(e){super("w:document"),Pe(this,"body"),this.root.push(new eP(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new Dft,e.background&&this.root.push(new Fft(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}}class Dpe{constructor(e){Pe(this,"document"),Pe(this,"relationships"),this.document=new $ft(e),this.relationships=new xg}get View(){return this.document}get Relationships(){return this.relationships}}class Bft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class Uft extends Ie{constructor(){super("w:wordWrap"),this.root.push(new Bft({val:0}))}}const zft=t=>{var e,r;return new jc({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:t.anchorLock},dropCap:{key:"w:dropCap",value:t.dropCap},width:{key:"w:w",value:t.width},height:{key:"w:h",value:t.height},x:{key:"w:x",value:t.position?t.position.x:void 0},y:{key:"w:y",value:t.position?t.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:t.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:t.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(e=t.space)==null?void 0:e.horizontal},spaceVertical:{key:"w:vSpace",value:(r=t.space)==null?void 0:r.vertical},rule:{key:"w:hRule",value:t.rule},alignmentX:{key:"w:xAlign",value:t.alignment?t.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:t.alignment?t.alignment.y:void 0},lines:{key:"w:lines",value:t.lines},wrap:{key:"w:wrap",value:t.wrap}}})};class Zx extends Y2{constructor(e){var r,n;if(super("w:pPr"),Pe(this,"numberingReferences",[]),!e)return this;e.heading&&this.push(new XN(e.heading)),e.bullet&&this.push(new XN("ListParagraph")),e.numbering&&!e.style&&!e.heading&&(e.numbering.custom||this.push(new XN("ListParagraph"))),e.style&&this.push(new XN(e.style)),e.keepNext!==void 0&&this.push(new De("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new De("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new rft),e.frame&&this.push(zft(e.frame)),e.widowControl!==void 0&&this.push(new De("w:widowControl",e.widowControl)),e.bullet&&this.push(new sM(1,e.bullet.level)),e.numbering?(this.numberingReferences.push({reference:e.numbering.reference,instance:(r=e.numbering.instance)!=null?r:0}),this.push(new sM(`${e.numbering.reference}-${(n=e.numbering.instance)!=null?n:0}`,e.numbering.level))):e.numbering===!1&&this.push(new sM(0,0)),e.border&&this.push(new lht(e.border)),e.thematicBreak&&this.push(new cht),e.shading&&this.push(new kpe(e.shading)),e.wordWrap&&this.push(new Uft),e.overflowPunctuation&&this.push(new De("w:overflowPunct",e.overflowPunctuation));const s=[...e.rightTabStop!==void 0?[{type:uX.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:uX.LEFT,position:e.leftTabStop}]:[]];s.length>0&&this.push(new ift(s)),e.bidirectional!==void 0&&this.push(new De("w:bidi",e.bidirectional)),e.spacing&&this.push(new sft(e.spacing)),e.indent&&this.push(new uht(e.indent)),e.contextualSpacing!==void 0&&this.push(new De("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(new aht(e.alignment)),e.outlineLevel!==void 0&&this.push(new vft(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new De("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new De("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new vg(e.run))}push(e){this.root.push(e)}prepForXml(e){if(e.viewWrapper instanceof Dpe)for(const r of this.numberingReferences)e.file.Numbering.createConcreteNumberingInstance(r.reference,r.instance);return super.prepForXml(e)}}class $r extends Mpe{constructor(e){if(super("w:p"),Pe(this,"properties"),typeof e=="string")return this.properties=new Zx({}),this.root.push(this.properties),this.root.push(new Us(e)),this;if(this.properties=new Zx(e),this.root.push(this.properties),e.text&&this.root.push(new Us(e.text)),e.children)for(const r of e.children){if(r instanceof mft){this.root.push(r.start);for(const n of r.children)this.root.push(n);this.root.push(r.end);continue}this.root.push(r)}}prepForXml(e){for(const r of this.root)if(r instanceof hft){const n=this.root.indexOf(r),s=new dft(r.options.children,Wht());e.viewWrapper.Relationships.createRelationship(s.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",r.options.link,Kht.EXTERNAL),this.root[n]=s}return super.prepForXml(e)}addRunToFront(e){return this.root.splice(1,0,e),this}}const Mg={style:xB.NONE,size:0,color:"auto"},Dg={style:xB.SINGLE,size:4,color:"auto"};class Hft extends Ie{constructor(e){super("w:tblBorders"),e.top?this.root.push(new cn("w:top",e.top)):this.root.push(new cn("w:top",Dg)),e.left?this.root.push(new cn("w:left",e.left)):this.root.push(new cn("w:left",Dg)),e.bottom?this.root.push(new cn("w:bottom",e.bottom)):this.root.push(new cn("w:bottom",Dg)),e.right?this.root.push(new cn("w:right",e.right)):this.root.push(new cn("w:right",Dg)),e.insideHorizontal?this.root.push(new cn("w:insideH",e.insideHorizontal)):this.root.push(new cn("w:insideH",Dg)),e.insideVertical?this.root.push(new cn("w:insideV",e.insideVertical)):this.root.push(new cn("w:insideV",Dg))}}Pe(Hft,"NONE",{top:Mg,bottom:Mg,left:Mg,right:Mg,insideHorizontal:Mg,insideVertical:Mg});class Wft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}}class Vft extends Ie{constructor(){super("Properties"),this.root.push(new Wft({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}}class qft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns"})}}class Gft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{contentType:"ContentType",extension:"Extension"})}}class Mc extends Ie{constructor(e,r){super("Default"),this.root.push(new Gft({contentType:e,extension:r}))}}class Kft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{contentType:"ContentType",partName:"PartName"})}}class za extends Ie{constructor(e,r){super("Override"),this.root.push(new Kft({contentType:e,partName:r}))}}class Yft extends Ie{constructor(){super("Types"),this.root.push(new qft({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(new Mc("image/png","png")),this.root.push(new Mc("image/jpeg","jpeg")),this.root.push(new Mc("image/jpeg","jpg")),this.root.push(new Mc("image/bmp","bmp")),this.root.push(new Mc("image/gif","gif")),this.root.push(new Mc("image/svg+xml","svg")),this.root.push(new Mc("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(new Mc("application/xml","xml")),this.root.push(new Mc("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(new za("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addFooter(e){this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addHeader(e){this.root.push(new za("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}}class Xft extends Ie{constructor(e){super("cp:coreProperties"),this.root.push(new eP(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new Lf("dc:title",e.title)),e.subject&&this.root.push(new Lf("dc:subject",e.subject)),e.creator&&this.root.push(new Lf("dc:creator",e.creator)),e.keywords&&this.root.push(new Lf("cp:keywords",e.keywords)),e.description&&this.root.push(new Lf("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new Lf("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new Lf("cp:revision",String(e.revision))),this.root.push(new pX("dcterms:created")),this.root.push(new pX("dcterms:modified"))}}class Qft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"xsi:type"})}}class pX extends Ie{constructor(e){super(e),this.root.push(new Qft({type:"dcterms:W3CDTF"})),this.root.push(sht(new Date))}}class Zft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}}class Jft extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{fmtid:"fmtid",pid:"pid",name:"name"})}}class ept extends Ie{constructor(e,r){super("property"),this.root.push(new Jft({fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:r.name})),this.root.push(new tpt(r.value))}}class tpt extends Ie{constructor(e){super("vt:lpwstr"),this.root.push(e)}}class rpt extends Ie{constructor(e){super("Properties"),Pe(this,"nextId"),Pe(this,"properties",[]),this.root.push(new Zft({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(const r of e)this.addCustomProperty(r)}prepForXml(e){return this.properties.forEach(r=>this.root.push(r)),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new ept(this.nextId++,e))}}const QN=({id:t,fontKey:e,subsetted:r},n)=>new jc({name:n,attributes:Zt({id:{key:"r:id",value:t}},e?{fontKey:{key:"w:fontKey",value:`{${e}}`}}:{}),children:[...r?[new De("w:subsetted",r)]:[]]}),npt=({name:t,altName:e,panose1:r,charset:n,family:s,notTrueType:i,pitch:o,sig:l,embedRegular:c,embedBold:u,embedItalic:d,embedBoldItalic:h})=>new jc({name:"w:font",attributes:{name:{key:"w:name",value:t}},children:[...e?[mb("w:altName",e)]:[],...r?[mb("w:panose1",r)]:[],...n?[mb("w:charset",n)]:[],mb("w:family",s),...i?[new De("w:notTrueType",i)]:[],mb("w:pitch",o),...l?[new jc({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:l.usb0},usb1:{key:"w:usb1",value:l.usb1},usb2:{key:"w:usb2",value:l.usb2},usb3:{key:"w:usb3",value:l.usb3},csb0:{key:"w:csb0",value:l.csb0},csb1:{key:"w:csb1",value:l.csb1}}})]:[],...c?[QN(c,"w:embedRegular")]:[],...u?[QN(u,"w:embedBold")]:[],...d?[QN(d,"w:embedItalic")]:[],...h?[QN(h,"w:embedBoldItalic")]:[]]}),spt=({name:t,index:e,fontKey:r,characterSet:n})=>npt({name:t,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:n,family:"auto",pitch:"variable",embedRegular:{fontKey:r,id:`rId${e}`}}),ipt=t=>new jc({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:t.map((e,r)=>spt({name:e.name,index:r+1,fontKey:e.fontKey}))});class apt{constructor(e){Pe(this,"fontTable"),Pe(this,"relationships"),Pe(this,"fontOptionsWithKey",[]),this.options=e,this.fontOptionsWithKey=e.map(r=>Yx(Zt({},r),{fontKey:Vht()})),this.fontTable=ipt(this.fontOptionsWithKey),this.relationships=new xg;for(let r=0;r<e.length;r++)this.relationships.createRelationship(r+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/${e[r].name}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}}class opt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}}let lpt=class extends Npe{constructor(e,r){super("w:ftr",r),Pe(this,"refId"),this.refId=e,r||this.root.push(new opt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}};class cpt{constructor(e,r,n){Pe(this,"footer"),Pe(this,"relationships"),this.media=e,this.footer=new lpt(r,n),this.relationships=new xg}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}}class upt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",id:"w:id"})}}class dpt extends Ie{constructor(){super("w:footnoteRef")}}class hpt extends ng{constructor(){super({style:"FootnoteReference"}),this.root.push(new dpt)}}const mX={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"};class oM extends Ie{constructor(e){super("w:footnote"),this.root.push(new upt({type:e.type,id:e.id}));for(let r=0;r<e.children.length;r++){const n=e.children[r];r===0&&n.addRunToFront(new hpt),this.root.push(n)}}}class fpt extends Ie{constructor(){super("w:continuationSeparator")}}class ppt extends ng{constructor(){super({}),this.root.push(new fpt)}}class mpt extends Ie{constructor(){super("w:separator")}}class gpt extends ng{constructor(){super({}),this.root.push(new mpt)}}class ypt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}}class vpt extends Ie{constructor(){super("w:footnotes"),this.root.push(new ypt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));const e=new oM({id:-1,type:mX.SEPERATOR,children:[new $r({spacing:{after:0,line:240,lineRule:I3.AUTO},children:[new gpt]})]});this.root.push(e);const r=new oM({id:0,type:mX.CONTINUATION_SEPERATOR,children:[new $r({spacing:{after:0,line:240,lineRule:I3.AUTO},children:[new ppt]})]});this.root.push(r)}createFootNote(e,r){const n=new oM({id:e,children:r});this.root.push(n)}}class xpt{constructor(){Pe(this,"footnotess"),Pe(this,"relationships"),this.footnotess=new vpt,this.relationships=new xg}get View(){return this.footnotess}get Relationships(){return this.relationships}}class bpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}}let wpt=class extends Npe{constructor(e,r){super("w:hdr",r),Pe(this,"refId"),this.refId=e,r||this.root.push(new bpt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}};class _pt{constructor(e,r,n){Pe(this,"header"),Pe(this,"relationships"),this.media=e,this.header=new wpt(r,n),this.relationships=new xg}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}}class jpt{constructor(){Pe(this,"map"),this.map=new Map}addImage(e,r){this.map.set(e,r)}get Array(){return Array.from(this.map.values())}}const Dc={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"};class Spt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w15:tentative"})}}class Npt extends Ie{constructor(e){super("w:numFmt"),this.root.push(new xn({val:e}))}}class Apt extends Ie{constructor(e){super("w:lvlText"),this.root.push(new xn({val:e}))}}class Ept extends Ie{constructor(e){super("w:lvlJc"),this.root.push(new xn({val:e}))}}class Cpt extends Ie{constructor(e){super("w:suff"),this.root.push(new xn({val:e}))}}class kpt extends Ie{constructor(){super("w:isLgl")}}class Tpt extends Ie{constructor({level:e,format:r,text:n,alignment:s=_n.START,start:i=1,style:o,suffix:l,isLegalNumberingStyle:c}){if(super("w:lvl"),Pe(this,"paragraphProperties"),Pe(this,"runProperties"),this.root.push(new Aw("w:start",Qi(i))),r&&this.root.push(new Npt(r)),l&&this.root.push(new Cpt(l)),c&&this.root.push(new kpt),n&&this.root.push(new Apt(n)),this.root.push(new Ept(s)),this.paragraphProperties=new Zx(o&&o.paragraph),this.runProperties=new vg(o&&o.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new Spt({ilvl:Qi(e),tentative:1}))}}class Ppt extends Tpt{}class Opt extends Ie{constructor(e){super("w:multiLevelType"),this.root.push(new xn({val:e}))}}class Ipt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}}class gX extends Ie{constructor(e,r){super("w:abstractNum"),Pe(this,"id"),this.root.push(new Ipt({abstractNumId:Qi(e),restartNumberingAfterBreak:0})),this.root.push(new Opt("hybridMultilevel")),this.id=e;for(const n of r)this.root.push(new Ppt(n))}}class Rpt extends Ie{constructor(e){super("w:abstractNumId"),this.root.push(new xn({val:e}))}}class Mpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{numId:"w:numId"})}}class yX extends Ie{constructor(e){if(super("w:num"),Pe(this,"numId"),Pe(this,"reference"),Pe(this,"instance"),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.root.push(new Mpt({numId:Qi(e.numId)})),this.root.push(new Rpt(Qi(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(const r of e.overrideLevels)this.root.push(new Lpt(r.num,r.start))}}class Dpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{ilvl:"w:ilvl"})}}class Lpt extends Ie{constructor(e,r){super("w:lvlOverride"),this.root.push(new Dpt({ilvl:e})),r!==void 0&&this.root.push(new $pt(r))}}class Fpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class $pt extends Ie{constructor(e){super("w:startOverride"),this.root.push(new Fpt({val:e}))}}class Bpt extends Ie{constructor(e){super("w:numbering"),Pe(this,"abstractNumberingMap",new Map),Pe(this,"concreteNumberingMap",new Map),Pe(this,"referenceConfigMap",new Map),Pe(this,"abstractNumUniqueNumericId",Uht()),Pe(this,"concreteNumUniqueNumericId",zht()),this.root.push(new eP(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));const r=new gX(this.abstractNumUniqueNumericId(),[{level:0,format:Dc.BULLET,text:"●",alignment:_n.LEFT,style:{paragraph:{indent:{left:Po(.5),hanging:Po(.25)}}}},{level:1,format:Dc.BULLET,text:"○",alignment:_n.LEFT,style:{paragraph:{indent:{left:Po(1),hanging:Po(.25)}}}},{level:2,format:Dc.BULLET,text:"■",alignment:_n.LEFT,style:{paragraph:{indent:{left:2160,hanging:Po(.25)}}}},{level:3,format:Dc.BULLET,text:"●",alignment:_n.LEFT,style:{paragraph:{indent:{left:2880,hanging:Po(.25)}}}},{level:4,format:Dc.BULLET,text:"○",alignment:_n.LEFT,style:{paragraph:{indent:{left:3600,hanging:Po(.25)}}}},{level:5,format:Dc.BULLET,text:"■",alignment:_n.LEFT,style:{paragraph:{indent:{left:4320,hanging:Po(.25)}}}},{level:6,format:Dc.BULLET,text:"●",alignment:_n.LEFT,style:{paragraph:{indent:{left:5040,hanging:Po(.25)}}}},{level:7,format:Dc.BULLET,text:"●",alignment:_n.LEFT,style:{paragraph:{indent:{left:5760,hanging:Po(.25)}}}},{level:8,format:Dc.BULLET,text:"●",alignment:_n.LEFT,style:{paragraph:{indent:{left:6480,hanging:Po(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new yX({numId:1,abstractNumId:r.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",r);for(const n of e.config)this.abstractNumberingMap.set(n.reference,new gX(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){for(const r of this.abstractNumberingMap.values())this.root.push(r);for(const r of this.concreteNumberingMap.values())this.root.push(r);return super.prepForXml(e)}createConcreteNumberingInstance(e,r){const n=this.abstractNumberingMap.get(e);if(!n)return;const s=`${e}-${r}`;if(this.concreteNumberingMap.has(s))return;const i=this.referenceConfigMap.get(e),o=i&&i[0].start,l={numId:this.concreteNumUniqueNumericId(),abstractNumId:n.id,reference:e,instance:r,overrideLevels:[o&&Number.isInteger(o)?{num:0,start:o}:{num:0,start:1}]};this.concreteNumberingMap.set(s,new yX(l))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}}class Upt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{version:"w:val",name:"w:name",uri:"w:uri"})}}class zpt extends Ie{constructor(e){super("w:compatSetting"),this.root.push(new Upt({version:e,uri:"http://schemas.microsoft.com/office/word",name:"compatibilityMode"}))}}class Hpt extends Ie{constructor(e){super("w:compat"),e.version&&this.root.push(new zpt(e.version)),e.useSingleBorderforContiguousCells&&this.root.push(new De("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new De("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new De("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new De("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new De("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new De("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new De("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new De("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new De("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new De("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new De("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new De("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new De("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new De("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new De("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new De("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new De("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new De("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new De("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new De("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new De("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new De("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new De("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new De("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new De("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new De("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new De("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new De("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new De("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new De("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new De("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new De("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new De("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new De("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new De("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new De("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new De("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new De("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new De("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new De("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new De("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new De("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new De("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new De("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new De("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new De("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new De("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new De("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new De("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new De("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new De("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new De("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new De("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new De("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new De("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new De("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new De("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new De("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new De("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new De("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new De("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new De("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new De("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new De("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new De("w:cachedColBalance",e.cachedColumnBalance))}}class Wpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}}class Vpt extends Ie{constructor(e){var r,n,s,i,o,l,c,u;super("w:settings"),this.root.push(new Wpt({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new De("w:displayBackgroundShape",!0)),e.trackRevisions!==void 0&&this.root.push(new De("w:trackRevisions",e.trackRevisions)),e.evenAndOddHeaders!==void 0&&this.root.push(new De("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new De("w:updateFields",e.updateFields)),e.defaultTabStop!==void 0&&this.root.push(new Aw("w:defaultTabStop",e.defaultTabStop)),((r=e.hyphenation)==null?void 0:r.autoHyphenation)!==void 0&&this.root.push(new De("w:autoHyphenation",e.hyphenation.autoHyphenation)),((n=e.hyphenation)==null?void 0:n.hyphenationZone)!==void 0&&this.root.push(new Aw("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)==null?void 0:s.consecutiveHyphenLimit)!==void 0&&this.root.push(new Aw("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)==null?void 0:i.doNotHyphenateCaps)!==void 0&&this.root.push(new De("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),this.root.push(new Hpt(Yx(Zt({},(o=e.compatibility)!=null?o:{}),{version:(u=(c=(l=e.compatibility)==null?void 0:l.version)!=null?c:e.compatibilityModeVersion)!=null?u:15})))}}class Lpe extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{val:"w:val"})}}class qpt extends Ie{constructor(e){super("w:name"),this.root.push(new Lpe({val:e}))}}class Gpt extends Ie{constructor(e){super("w:uiPriority"),this.root.push(new Lpe({val:Qi(e)}))}}class Kpt extends St{constructor(){super(...arguments),Pe(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}}class Fpe extends Ie{constructor(e,r){super("w:style"),this.root.push(new Kpt(e)),r.name&&this.root.push(new qpt(r.name)),r.basedOn&&this.root.push(new Lm("w:basedOn",r.basedOn)),r.next&&this.root.push(new Lm("w:next",r.next)),r.link&&this.root.push(new Lm("w:link",r.link)),r.uiPriority!==void 0&&this.root.push(new Gpt(r.uiPriority)),r.semiHidden!==void 0&&this.root.push(new De("w:semiHidden",r.semiHidden)),r.unhideWhenUsed!==void 0&&this.root.push(new De("w:unhideWhenUsed",r.unhideWhenUsed)),r.quickFormat!==void 0&&this.root.push(new De("w:qFormat",r.quickFormat))}}class tP extends Fpe{constructor(e){super({type:"paragraph",styleId:e.id},e),Pe(this,"paragraphProperties"),Pe(this,"runProperties"),this.paragraphProperties=new Zx(e.paragraph),this.runProperties=new vg(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}}class rP extends Fpe{constructor(e){super({type:"character",styleId:e.id},Zt({uiPriority:99,unhideWhenUsed:!0},e)),Pe(this,"runProperties"),this.runProperties=new vg(e.run),this.root.push(this.runProperties)}}class kf extends tP{constructor(e){super(Zt({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}}class Ypt extends kf{constructor(e){super(Zt({id:"Title",name:"Title"},e))}}class Xpt extends kf{constructor(e){super(Zt({id:"Heading1",name:"Heading 1"},e))}}class Qpt extends kf{constructor(e){super(Zt({id:"Heading2",name:"Heading 2"},e))}}class Zpt extends kf{constructor(e){super(Zt({id:"Heading3",name:"Heading 3"},e))}}class Jpt extends kf{constructor(e){super(Zt({id:"Heading4",name:"Heading 4"},e))}}class emt extends kf{constructor(e){super(Zt({id:"Heading5",name:"Heading 5"},e))}}class tmt extends kf{constructor(e){super(Zt({id:"Heading6",name:"Heading 6"},e))}}class rmt extends kf{constructor(e){super(Zt({id:"Strong",name:"Strong"},e))}}class nmt extends tP{constructor(e){super(Zt({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}}class smt extends tP{constructor(e){super(Zt({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:I3.AUTO}},run:{size:20}},e))}}class imt extends rP{constructor(e){super(Zt({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}}class amt extends rP{constructor(e){super(Zt({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}}class omt extends rP{constructor(e){super(Zt({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:Ppe.SINGLE}}},e))}}class M3 extends Ie{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(const r of e.importedStyles)this.root.push(r);if(e.paragraphStyles)for(const r of e.paragraphStyles)this.root.push(new tP(r));if(e.characterStyles)for(const r of e.characterStyles)this.root.push(new rP(r))}}class lmt extends Ie{constructor(e){super("w:pPrDefault"),this.root.push(new Zx(e))}}class cmt extends Ie{constructor(e){super("w:rPrDefault"),this.root.push(new vg(e))}}class umt extends Ie{constructor(e){super("w:docDefaults"),Pe(this,"runPropertiesDefaults"),Pe(this,"paragraphPropertiesDefaults"),this.runPropertiesDefaults=new cmt(e.run),this.paragraphPropertiesDefaults=new lmt(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}}class dmt{newInstance(e){const r=Spe.xml2js(e,{compact:!1});let n;for(const o of r.elements||[])o.name==="w:styles"&&(n=o);if(n===void 0)throw new Error("can not find styles element");const s=n.elements||[];return new M3({initialStyles:new eht(n.attributes),importedStyles:s.map(o=>vB(o))})}}class vX{newInstance(e={}){var r;return{initialStyles:new eP(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new umt((r=e.document)!=null?r:{}),new Ypt(Zt({run:{size:56}},e.title)),new Xpt(Zt({run:{color:"2E74B5",size:32}},e.heading1)),new Qpt(Zt({run:{color:"2E74B5",size:26}},e.heading2)),new Zpt(Zt({run:{color:"1F4D78",size:24}},e.heading3)),new Jpt(Zt({run:{color:"2E74B5",italics:!0}},e.heading4)),new emt(Zt({run:{color:"2E74B5"}},e.heading5)),new tmt(Zt({run:{color:"1F4D78"}},e.heading6)),new rmt(Zt({run:{bold:!0}},e.strong)),new nmt(e.listParagraph||{}),new omt(e.hyperlink||{}),new imt(e.footnoteReference||{}),new smt(e.footnoteText||{}),new amt(e.footnoteTextChar||{})]}}}let hmt=class{constructor(e){Pe(this,"currentRelationshipId",1),Pe(this,"documentWrapper"),Pe(this,"headers",[]),Pe(this,"footers",[]),Pe(this,"coreProperties"),Pe(this,"numbering"),Pe(this,"media"),Pe(this,"fileRelationships"),Pe(this,"footnotesWrapper"),Pe(this,"settings"),Pe(this,"contentTypes"),Pe(this,"customProperties"),Pe(this,"appProperties"),Pe(this,"styles"),Pe(this,"comments"),Pe(this,"fontWrapper");var r,n,s,i,o,l,c,u,d,h,f,p;if(this.coreProperties=new Xft(Yx(Zt({},e),{creator:(r=e.creator)!=null?r:"Un-named",revision:(n=e.revision)!=null?n:1,lastModifiedBy:(s=e.lastModifiedBy)!=null?s:"Un-named"})),this.numbering=new Bpt(e.numbering?e.numbering:{config:[]}),this.comments=new Jht((i=e.comments)!=null?i:{children:[]}),this.fileRelationships=new xg,this.customProperties=new rpt((o=e.customProperties)!=null?o:[]),this.appProperties=new Vft,this.footnotesWrapper=new xpt,this.contentTypes=new Yft,this.documentWrapper=new Dpe({background:e.background}),this.settings=new Vpt({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(l=e.features)==null?void 0:l.trackRevisions,updateFields:(c=e.features)==null?void 0:c.updateFields,defaultTabStop:e.defaultTabStop,hyphenation:{autoHyphenation:(u=e.hyphenation)==null?void 0:u.autoHyphenation,hyphenationZone:(d=e.hyphenation)==null?void 0:d.hyphenationZone,consecutiveHyphenLimit:(h=e.hyphenation)==null?void 0:h.consecutiveHyphenLimit,doNotHyphenateCaps:(f=e.hyphenation)==null?void 0:f.doNotHyphenateCaps}}),this.media=new jpt,e.externalStyles!==void 0){const g=new dmt;this.styles=g.newInstance(e.externalStyles)}else if(e.styles){const m=new vX().newInstance(e.styles.default);this.styles=new M3(Zt(Zt({},m),e.styles))}else{const g=new vX;this.styles=new M3(g.newInstance())}this.addDefaultRelationships();for(const g of e.sections)this.addSection(g);if(e.footnotes)for(const g in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(g),e.footnotes[g].children);this.fontWrapper=new apt((p=e.fonts)!=null?p:[])}addSection({headers:e={},footers:r={},children:n,properties:s}){this.documentWrapper.View.Body.addSection(Yx(Zt({},s),{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:r.default?this.createFooter(r.default):void 0,first:r.first?this.createFooter(r.first):void 0,even:r.even?this.createFooter(r.even):void 0}}));for(const i of n)this.documentWrapper.View.add(i)}createHeader(e){const r=new _pt(this.media,this.currentRelationshipId++);for(const n of e.options.children)r.add(n);return this.addHeaderToDocument(r),r}createFooter(e){const r=new cpt(this.media,this.currentRelationshipId++);for(const n of e.options.children)r.add(n);return this.addFooterToDocument(r),r}addHeaderToDocument(e,r=Hy.DEFAULT){this.headers.push({header:e,type:r}),this.documentWrapper.Relationships.createRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,r=Hy.DEFAULT){this.footers.push({footer:e,type:r}),this.documentWrapper.Relationships.createRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.createRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.createRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.createRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.createRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.createRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml")}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get FontTable(){return this.fontWrapper}};class fmt extends Ie{constructor(e={}){super("w:instrText"),Pe(this,"properties"),this.properties=e,this.root.push(new rg({space:tg.PRESERVE}));let r="TOC";if(this.properties.captionLabel&&(r=`${r} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(r=`${r} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(r=`${r} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(r=`${r} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(r=`${r} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(r=`${r} \\h`),this.properties.tcFieldLevelRange&&(r=`${r} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(r=`${r} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(r=`${r} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(r=`${r} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(r=`${r} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){const n=this.properties.stylesWithLevels.map(s=>`${s.styleName},${s.level}`).join(",");r=`${r} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(r=`${r} \\u`),this.properties.preserveTabInEntries&&(r=`${r} \\w`),this.properties.preserveNewLineInEntries&&(r=`${r} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(r=`${r} \\z`),this.root.push(r)}}class pmt extends Ie{constructor(){super("w:sdtContent")}}class mmt extends Ie{constructor(e){super("w:sdtPr"),e&&this.root.push(new Lm("w:alias",e))}}class gmt extends Mpe{constructor(e="Table of Contents",r){super("w:sdt"),this.root.push(new mmt(e));const n=new pmt,s=new $r({children:[new ng({children:[new Zb(!0),new fmt(r),new Jb]})]});n.addChildElement(s);const i=new $r({children:[new ng({children:[new ew]})]});n.addChildElement(i),this.root.push(n)}}class ymt{constructor(e={children:[]}){Pe(this,"options"),this.options=e}}class vmt{constructor(e={children:[]}){Pe(this,"options"),this.options=e}}var xmt=mB();function ZN(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lM={exports:{}},xX;function bmt(){return xX||(xX=1,function(t,e){(function(r){t.exports=r()})(function(){return function r(n,s,i){function o(u,d){if(!s[u]){if(!n[u]){var h=typeof ZN=="function"&&ZN;if(!d&&h)return h(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};n[u][0].call(p.exports,function(g){var m=n[u][1][g];return o(m||g)},p,p.exports,r,n,s,i)}return s[u].exports}for(var l=typeof ZN=="function"&&ZN,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,s){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,d,h,f,p,g,m,v=[],y=0,x=c.length,b=x,w=i.getTypeOf(c)!=="string";y<c.length;)b=x-y,h=w?(u=c[y++],d=y<x?c[y++]:0,y<x?c[y++]:0):(u=c.charCodeAt(y++),d=y<x?c.charCodeAt(y++):0,y<x?c.charCodeAt(y++):0),f=u>>2,p=(3&u)<<4|d>>4,g=1<b?(15&d)<<2|h>>6:64,m=2<b?63&h:64,v.push(l.charAt(f)+l.charAt(p)+l.charAt(g)+l.charAt(m));return v.join("")},s.decode=function(c){var u,d,h,f,p,g,m=0,v=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var x,b=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&b--,c.charAt(c.length-2)===l.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=o.uint8array?new Uint8Array(0|b):new Array(0|b);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(f=l.indexOf(c.charAt(m++)))>>4,d=(15&f)<<4|(p=l.indexOf(c.charAt(m++)))>>2,h=(3&p)<<6|(g=l.indexOf(c.charAt(m++))),x[v++]=u,p!==64&&(x[v++]=d),g!==64&&(x[v++]=h);return x}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,h,f,p,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,f){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d[m])];return-1^u}(0|c,l,l.length,0):function(u,d,h,f){var p=o,g=f+h;u^=-1;for(var m=f;m<g;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},s.compressWorker=function(h){return new d("Deflate",h)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(p,g){var m,v="";for(m=0;m<g;m++)v+=String.fromCharCode(255&p),p>>>=8;return v}function o(p,g,m,v,y,x){var b,w,j=p.file,N=p.compression,C=x!==u.utf8encode,k=l.transformTo("string",x(j.name)),E=l.transformTo("string",u.utf8encode(j.name)),M=j.comment,z=l.transformTo("string",x(M)),I=l.transformTo("string",u.utf8encode(M)),q=E.length!==j.name.length,A=I.length!==M.length,U="",K="",G="",Y=j.dir,H=j.date,$={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||($.crc32=p.crc32,$.compressedSize=p.compressedSize,$.uncompressedSize=p.uncompressedSize);var L=0;g&&(L|=8),C||!q&&!A||(L|=2048);var F=0,W=0;Y&&(F|=16),y==="UNIX"?(W=798,F|=function(oe,le){var B=oe;return oe||(B=le?16893:33204),(65535&B)<<16}(j.unixPermissions,Y)):(W=20,F|=function(oe){return 63&(oe||0)}(j.dosPermissions)),b=H.getUTCHours(),b<<=6,b|=H.getUTCMinutes(),b<<=5,b|=H.getUTCSeconds()/2,w=H.getUTCFullYear()-1980,w<<=4,w|=H.getUTCMonth()+1,w<<=5,w|=H.getUTCDate(),q&&(K=i(1,1)+i(d(k),4)+E,U+="up"+i(K.length,2)+K),A&&(G=i(1,1)+i(d(z),4)+I,U+="uc"+i(G.length,2)+G);var X="";return X+=`
\0`,X+=i(L,2),X+=N.magic,X+=i(b,2),X+=i(w,2),X+=i($.crc32,4),X+=i($.compressedSize,4),X+=i($.uncompressedSize,4),X+=i(k.length,2),X+=i(U.length,2),{fileRecord:h.LOCAL_FILE_HEADER+X+k+U,dirRecord:h.CENTRAL_FILE_HEADER+i(W,2)+X+i(z.length,2)+"\0\0\0\0"+i(F,4)+i(v,4)+k+U+z}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),h=r("../signature");function f(p,g,m,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(p){var g=p.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-v-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var m=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,m=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:function(v){return h.DATA_DESCRIPTOR+i(v.crc32,4)+i(v.compressedSize,4)+i(v.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-p,v=function(y,x,b,w,j){var N=l.transformTo("string",j(w));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(y,2)+i(y,2)+i(x,4)+i(b,4)+i(N.length,2)+N}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(m){g.processChunk(m)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(m){g.error(m)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<g.length;m++)try{g[m].error(p)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,s){var i=r("../compressions"),o=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{l.forEach(function(f,p){h++;var g=function(x,b){var w=x||b,j=i[w];if(!j)throw new Error(w+" is not a valid compression method !");return j}(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},v=p.dir,y=p.date;p._compressWorker(g,m).withStreamInfo("file",{name:f,dir:v,date:y,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(f){d.error(f)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function h(f){return new o.Promise(function(p,g){var m=f.decompressed.getContentWorker().pipe(new u);m.on("error",function(v){g(v)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}n.exports=function(f,p){var g=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var v=new c(p);return v.load(m),v}).then(function(m){var v=[o.Promise.resolve(m)],y=m.files;if(p.checkCRC32)for(var x=0;x<y.length;x++)v.push(h(y[x]));return o.Promise.all(v)}).then(function(m){for(var v=m.shift(),y=v.files,x=0;x<y.length;x++){var b=y[x],w=b.fileNameStr,j=i.resolve(b.fileNameStr);g.file(j,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:p.createFolders}),b.dir||(g.file(j).unsafeOriginalName=w)}return v.zipComment.length&&(g.comment=v.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(h,f){d.push(h)||d._helper.pause(),u&&u(f)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(j,N,C){var k,E=l.getTypeOf(N),M=l.extend(C||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(j=y(j)),M.createFolders&&(k=v(j))&&x.call(this,k,!0);var z=E==="string"&&M.binary===!1&&M.base64===!1;C&&C.binary!==void 0||(M.binary=!z),(N instanceof h&&N.uncompressedSize===0||M.dir||!N||N.length===0)&&(M.base64=!1,M.binary=!0,N="",M.compression="STORE",E="string");var I=null;I=N instanceof h||N instanceof c?N:g.isNode&&g.isStream(N)?new m(j,N):l.prepareContent(j,N,M.binary,M.optimizedBinaryString,M.base64);var q=new f(j,I,M);this.files[j]=q}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),h=r("./compressedObject"),f=r("./zipObject"),p=r("./generate"),g=r("./nodejsUtils"),m=r("./nodejs/NodejsStreamInputAdapter"),v=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var N=j.lastIndexOf("/");return 0<N?j.substring(0,N):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},x=function(j,N){return N=N!==void 0?N:d.createFolders,j=y(j),this.files[j]||i.call(this,j,null,{dir:!0,createFolders:N}),this.files[j]};function b(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var N,C,k;for(N in this.files)k=this.files[N],(C=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&j(C,k)},filter:function(j){var N=[];return this.forEach(function(C,k){j(C,k)&&N.push(k)}),N},file:function(j,N,C){if(arguments.length!==1)return j=this.root+j,i.call(this,j,N,C),this;if(b(j)){var k=j;return this.filter(function(M,z){return!z.dir&&k.test(M)})}var E=this.files[this.root+j];return E&&!E.dir?E:null},folder:function(j){if(!j)return this;if(b(j))return this.filter(function(E,M){return M.dir&&j.test(E)});var N=this.root+j,C=x.call(this,N),k=this.clone();return k.root=C.name,k},remove:function(j){j=this.root+j;var N=this.files[j];if(N||(j.slice(-1)!=="/"&&(j+="/"),N=this.files[j]),N&&!N.dir)delete this.files[j];else for(var C=this.filter(function(E,M){return M.name.slice(0,j.length)===j}),k=0;k<C.length;k++)delete this.files[C[k].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var N,C={};try{if((C=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var k=C.comment||this.comment||"";N=p.generateWorker(this,C,k)}catch(E){(N=new c("error")).error(E)}return new u(N,C.type||"string",C.mimeType)},generateAsync:function(j,N){return this.generateInternalStream(j).accumulate(N)},generateNodeStream:function(j,N){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(N)}};n.exports=w},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),h=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new d(i.transformTo("uint8array",h)):new l(i.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,m){return new d.Promise(function(v,y){var x=[],b=g._internalType,w=g._outputType,j=g._mimeType;g.on("data",function(N,C){x.push(N),m&&m(C)}).on("error",function(N){x=[],y(N)}).on("end",function(){try{var N=function(C,k,E){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",k),E);case"base64":return c.encode(k);default:return i.transformTo(C,k)}}(w,function(C,k){var E,M=0,z=null,I=0;for(E=0;E<k.length;E++)I+=k[E].length;switch(C){case"string":return k.join("");case"array":return Array.prototype.concat.apply([],k);case"uint8array":for(z=new Uint8Array(I),E=0;E<k.length;E++)z.set(k[E],M),M+=k[E].length;return z;case"nodebuffer":return Buffer.concat(k);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,x),j);v(N)}catch(C){y(C)}x=[]}).resume()})}function p(g,m,v){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=v,i.checkSupport(y),this._worker=g.pipe(new o(y)),g.lock()}catch(x){this._worker=new l("error"),this._worker.error(x)}}p.prototype={accumulate:function(g){return f(this,g)},on:function(g,m){var v=this;return g==="data"?this._worker.on(g,function(y){m.call(v,y.data,y.meta)}):this._worker.on(g,function(){i.delay(m,arguments,v)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):function(g){var m,v,y,x,b,w=g.length,j=0;for(x=0;x<w;x++)(64512&(v=g.charCodeAt(x)))==55296&&x+1<w&&(64512&(y=g.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),x++),j+=v<128?1:v<2048?2:v<65536?3:4;for(m=o.uint8array?new Uint8Array(j):new Array(j),x=b=0;b<j;x++)(64512&(v=g.charCodeAt(x)))==55296&&x+1<w&&(64512&(y=g.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(y-56320),x++),v<128?m[b++]=v:(v<2048?m[b++]=192|v>>>6:(v<65536?m[b++]=224|v>>>12:(m[b++]=240|v>>>18,m[b++]=128|v>>>12&63),m[b++]=128|v>>>6&63),m[b++]=128|63&v);return m}(p)},s.utf8decode=function(p){return o.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(g){var m,v,y,x,b=g.length,w=new Array(2*b);for(m=v=0;m<b;)if((y=g[m++])<128)w[v++]=y;else if(4<(x=u[y]))w[v++]=65533,m+=x-1;else{for(y&=x===2?31:x===3?15:7;1<x&&m<b;)y=y<<6|63&g[m++],x--;1<x?w[v++]=65533:y<65536?w[v++]=y:(y-=65536,w[v++]=55296|y>>10&1023,w[v++]=56320|1023&y)}return w.length!==v&&(w.subarray?w=w.subarray(0,v):w.length=v),i.applyFromCharCode(w)}(p=i.transformTo(o.uint8array?"uint8array":"array",p))},i.inherits(h,c),h.prototype.processChunk=function(p){var g=i.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var v=function(x,b){var w;for((b=b||x.length)>x.length&&(b=x.length),w=b-1;0<=w&&(192&x[w])==128;)w--;return w<0||w===0?b:w+u[x[w]]>b?w:b}(g),y=g;v!==g.length&&(o.uint8array?(y=g.subarray(0,v),this.leftOver=g.subarray(v,g.length)):(y=g.slice(0,v),this.leftOver=g.slice(v,g.length))),this.push({data:s.utf8decode(y),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,i.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(m){return m}function d(m,v){for(var y=0;y<m.length;++y)v[y]=255&m.charCodeAt(y);return v}r("setimmediate"),s.newBlob=function(m,v){s.checkSupport("blob");try{return new Blob([m],{type:v})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,v,y){var x=[],b=0,w=m.length;if(w<=y)return String.fromCharCode.apply(null,m);for(;b<w;)v==="array"||v==="nodebuffer"?x.push(String.fromCharCode.apply(null,m.slice(b,Math.min(b+y,w)))):x.push(String.fromCharCode.apply(null,m.subarray(b,Math.min(b+y,w)))),b+=y;return x.join("")},stringifyByChar:function(m){for(var v="",y=0;y<m.length;y++)v+=String.fromCharCode(m[y]);return v},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var v=65536,y=s.getTypeOf(m),x=!0;if(y==="uint8array"?x=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(x=h.applyCanBeUsed.nodebuffer),x)for(;1<v;)try{return h.stringifyByChunk(m,y,v)}catch{v=Math.floor(v/2)}return h.stringifyByChar(m)}function p(m,v){for(var y=0;y<m.length;y++)v[y]=m[y];return v}s.applyFromCharCode=f;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},g.array={string:f,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},g.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},g.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},s.transformTo=function(m,v){if(v=v||"",!m)return v;s.checkSupport(m);var y=s.getTypeOf(v);return g[y][m](v)},s.resolve=function(m){for(var v=m.split("/"),y=[],x=0;x<v.length;x++){var b=v[x];b==="."||b===""&&x!==0&&x!==v.length-1||(b===".."?y.pop():y.push(b))}return y.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var v,y,x="";for(y=0;y<(m||"").length;y++)x+="\\x"+((v=m.charCodeAt(y))<16?"0":"")+v.toString(16).toUpperCase();return x},s.delay=function(m,v,y){setImmediate(function(){m.apply(y||null,v||[])})},s.inherits=function(m,v){function y(){}y.prototype=v.prototype,m.prototype=new y},s.extend=function(){var m,v,y={};for(m=0;m<arguments.length;m++)for(v in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],v)&&y[v]===void 0&&(y[v]=arguments[m][v]);return y},s.prepareContent=function(m,v,y,x,b){return c.Promise.resolve(v).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,N){var C=new FileReader;C.onload=function(k){j(k.target.result)},C.onerror=function(k){N(k.target.error)},C.readAsArrayBuffer(w)}):w}).then(function(w){var j=s.getTypeOf(w);return j?(j==="arraybuffer"?w=s.transformTo("uint8array",w):j==="string"&&(b?w=o.decode(w):y&&x!==!0&&(w=function(N){return d(N,i.uint8array?new Uint8Array(N.length):new Array(N.length))}(w))),w):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===f;return this.reader.setIndex(p),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",p=o.transformTo(f,h);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,f,p,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[h]={id:h,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,f;for(h=0;h<this.files.length;h++)f=this.files[h],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var g=f-p;if(0<g)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),h=r("./support");function f(p,g){this.options=p,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(v){for(var y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===v)return d[y];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var g=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,m,v,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)g=p.readInt(2),m=p.readInt(2),v=p.readData(m),this.extraFields[g]={id:g,length:m,value:v};p.setIndex(y)},handleUTF8:function(){var p=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=o.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var y=o.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=i(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(g,m,v){this.name=g,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=m,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var m=null,v="string";try{if(!g)throw new Error("No output type specified.");var y=(v=g.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),m=this._decompressWorker();var x=!this._dataBinary;x&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!x&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(b){(m=new d("error")).error(b)}return new o(m,v,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(v,g,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<h.length;p++)i.prototype[h[p]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),o=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var f=new i.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var p=[];function g(){var m,v;l=!0;for(var y=p.length;y;){for(v=p,p=[],m=-1;++m<y;)v[m]();y=p.length}l=!1}n.exports=function(m){p.push(m)!==1||l||o()}}).call(this,typeof oc<"u"?oc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==o&&m(this,y)}function f(y,x,b){this.promise=y,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function p(y,x,b){i(function(){var w;try{w=x(b)}catch(j){return l.reject(y,j)}w===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,w)})}function g(y){var x=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof x=="function")return function(){x.apply(y,arguments)}}function m(y,x){var b=!1;function w(C){b||(b=!0,l.reject(y,C))}function j(C){b||(b=!0,l.resolve(y,C))}var N=v(function(){x(j,w)});N.status==="error"&&w(N.value)}function v(y,x){var b={};try{b.value=y(x),b.status="success"}catch(w){b.status="error",b.value=w}return b}(n.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var x=this.constructor;return this.then(function(b){return x.resolve(y()).then(function(){return b})},function(b){return x.resolve(y()).then(function(){throw b})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,x){if(typeof y!="function"&&this.state===u||typeof x!="function"&&this.state===c)return this;var b=new this.constructor(o);return this.state!==d?p(b,this.state===u?y:x,this.outcome):this.queue.push(new f(b,y,x)),b},f.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},f.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},f.prototype.callRejected=function(y){l.reject(this.promise,y)},f.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},l.resolve=function(y,x){var b=v(g,x);if(b.status==="error")return l.reject(y,b.value);var w=b.value;if(w)m(y,w);else{y.state=u,y.outcome=x;for(var j=-1,N=y.queue.length;++j<N;)y.queue[j].callFulfilled(x)}return y},l.reject=function(y,x){y.state=c,y.outcome=x;for(var b=-1,w=y.queue.length;++b<w;)y.queue[b].callRejected(x);return y},h.resolve=function(y){return y instanceof this?y:l.resolve(new this(o),y)},h.reject=function(y){var x=new this(o);return l.reject(x,y)},h.all=function(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=new Array(b),N=0,C=-1,k=new this(o);++C<b;)E(y[C],C);return k;function E(M,z){x.resolve(M).then(function(I){j[z]=I,++N!==b||w||(w=!0,l.resolve(k,j))},function(I){w||(w=!0,l.reject(k,I))})}},h.race=function(y){var x=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=y.length,w=!1;if(!b)return this.resolve([]);for(var j=-1,N=new this(o);++j<b;)C=y[j],x.resolve(C).then(function(k){w||(w=!0,l.resolve(N,k))},function(k){w||(w=!0,l.reject(N,k))});var C;return N}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});var x=this.options;x.raw&&0<x.windowBits?x.windowBits=-x.windowBits:x.gzip&&0<x.windowBits&&x.windowBits<16&&(x.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,x.level,x.method,x.windowBits,x.memLevel,x.strategy);if(b!==h)throw new Error(c[b]);if(x.header&&i.deflateSetHeader(this.strm,x.header),x.dictionary){var w;if(w=typeof x.dictionary=="string"?l.string2buf(x.dictionary):d.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==h)throw new Error(c[b]);this._dict_set=!0}}function v(y,x){var b=new m(x);if(b.push(y,!0),b.err)throw b.msg||c[b.err];return b.result}m.prototype.push=function(y,x){var b,w,j=this.strm,N=this.options.chunkSize;if(this.ended)return!1;w=x===~~x?x:x===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(N),j.next_out=0,j.avail_out=N),(b=i.deflate(j,w))!==1&&b!==h)return this.onEnd(b),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h):w!==2||(this.onEnd(h),!(j.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},s.Deflate=m,s.deflate=v,s.deflateRaw=function(y,x){return(x=x||{}).raw=!0,v(y,x)},s.gzip=function(y,x){return(x=x||{}).gzip=!0,v(y,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),h=r("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||m&&m.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=i.inflateInit2(this.strm,v.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(m,v){var y=new p(v);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(m,v){var y,x,b,w,j,N,C=this.strm,k=this.options.chunkSize,E=this.options.dictionary,M=!1;if(this.ended)return!1;x=v===~~v?v:v===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?C.input=l.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?C.input=new Uint8Array(m):C.input=m,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(k),C.next_out=0,C.avail_out=k),(y=i.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&E&&(N=typeof E=="string"?l.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,y=i.inflateSetDictionary(this.strm,N)),y===c.Z_BUF_ERROR&&M===!0&&(y=c.Z_OK,M=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&y!==c.Z_STREAM_END&&(C.avail_in!==0||x!==c.Z_FINISH&&x!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=l.utf8border(C.output,C.next_out),w=C.next_out-b,j=l.buf2string(C.output,b),C.next_out=w,C.avail_out=k-w,w&&o.arraySet(C.output,C.output,b,w,0),this.onData(j)):this.onData(o.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(M=!0)}while((0<C.avail_in||C.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(x=c.Z_FINISH),x===c.Z_FINISH?(y=i.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):x!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=p,s.inflate=g,s.inflateRaw=function(m,v){return(v=v||{}).raw=!0,g(m,v)},s.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,h,f){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){var u,d,h,f,p,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=f=0,d=c.length;u<d;u++)p=c[u],g.set(p,f),f+=p.length;return g}},l={arraySet:function(c,u,d,h,f){for(var p=0;p<h;p++)c[f+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,f){if(f<65537&&(h.subarray&&l||!h.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",g=0;g<f;g++)p+=String.fromCharCode(h[g]);return p}c[254]=c[254]=1,s.string2buf=function(h){var f,p,g,m,v,y=h.length,x=0;for(m=0;m<y;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),x+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(x),m=v=0;v<x;m++)(64512&(p=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),m++),p<128?f[v++]=p:(p<2048?f[v++]=192|p>>>6:(p<65536?f[v++]=224|p>>>12:(f[v++]=240|p>>>18,f[v++]=128|p>>>12&63),f[v++]=128|p>>>6&63),f[v++]=128|63&p);return f},s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,g=f.length;p<g;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,g,m,v,y=f||h.length,x=new Array(2*y);for(p=g=0;p<y;)if((m=h[p++])<128)x[g++]=m;else if(4<(v=c[m]))x[g++]=65533,p+=v-1;else{for(m&=v===2?31:v===3?15:7;1<v&&p<y;)m=m<<6|63&h[p++],v--;1<v?x[g++]=65533:m<65536?x[g++]=m:(m-=65536,x[g++]=55296|m>>10&1023,x[g++]=56320|1023&m)}return d(x,g)},s.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,h=u+c;o^=-1;for(var f=u;f<h;f++)o=o>>>8^d[255&(o^l[f])];return-1^o}},{}],46:[function(r,n,s){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),h=0,f=4,p=0,g=-2,m=-1,v=4,y=2,x=8,b=9,w=286,j=30,N=19,C=2*w+1,k=15,E=3,M=258,z=M+E+1,I=42,q=113,A=1,U=2,K=3,G=4;function Y(P,ie){return P.msg=d[ie],ie}function H(P){return(P<<1)-(4<P?9:0)}function $(P){for(var ie=P.length;0<=--ie;)P[ie]=0}function L(P){var ie=P.state,V=ie.pending;V>P.avail_out&&(V=P.avail_out),V!==0&&(o.arraySet(P.output,ie.pending_buf,ie.pending_out,V,P.next_out),P.next_out+=V,ie.pending_out+=V,P.total_out+=V,P.avail_out-=V,ie.pending-=V,ie.pending===0&&(ie.pending_out=0))}function F(P,ie){l._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,ie),P.block_start=P.strstart,L(P.strm)}function W(P,ie){P.pending_buf[P.pending++]=ie}function X(P,ie){P.pending_buf[P.pending++]=ie>>>8&255,P.pending_buf[P.pending++]=255&ie}function oe(P,ie){var V,O,T=P.max_chain_length,D=P.strstart,ne=P.prev_length,ue=P.nice_match,re=P.strstart>P.w_size-z?P.strstart-(P.w_size-z):0,pe=P.window,xe=P.w_mask,ye=P.prev,ae=P.strstart+M,de=pe[D+ne-1],ge=pe[D+ne];P.prev_length>=P.good_match&&(T>>=2),ue>P.lookahead&&(ue=P.lookahead);do if(pe[(V=ie)+ne]===ge&&pe[V+ne-1]===de&&pe[V]===pe[D]&&pe[++V]===pe[D+1]){D+=2,V++;do;while(pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&pe[++D]===pe[++V]&&D<ae);if(O=M-(ae-D),D=ae-M,ne<O){if(P.match_start=ie,ue<=(ne=O))break;de=pe[D+ne-1],ge=pe[D+ne]}}while((ie=ye[ie&xe])>re&&--T!=0);return ne<=P.lookahead?ne:P.lookahead}function le(P){var ie,V,O,T,D,ne,ue,re,pe,xe,ye=P.w_size;do{if(T=P.window_size-P.lookahead-P.strstart,P.strstart>=ye+(ye-z)){for(o.arraySet(P.window,P.window,ye,ye,0),P.match_start-=ye,P.strstart-=ye,P.block_start-=ye,ie=V=P.hash_size;O=P.head[--ie],P.head[ie]=ye<=O?O-ye:0,--V;);for(ie=V=ye;O=P.prev[--ie],P.prev[ie]=ye<=O?O-ye:0,--V;);T+=ye}if(P.strm.avail_in===0)break;if(ne=P.strm,ue=P.window,re=P.strstart+P.lookahead,pe=T,xe=void 0,xe=ne.avail_in,pe<xe&&(xe=pe),V=xe===0?0:(ne.avail_in-=xe,o.arraySet(ue,ne.input,ne.next_in,xe,re),ne.state.wrap===1?ne.adler=c(ne.adler,ue,xe,re):ne.state.wrap===2&&(ne.adler=u(ne.adler,ue,xe,re)),ne.next_in+=xe,ne.total_in+=xe,xe),P.lookahead+=V,P.lookahead+P.insert>=E)for(D=P.strstart-P.insert,P.ins_h=P.window[D],P.ins_h=(P.ins_h<<P.hash_shift^P.window[D+1])&P.hash_mask;P.insert&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[D+E-1])&P.hash_mask,P.prev[D&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=D,D++,P.insert--,!(P.lookahead+P.insert<E)););}while(P.lookahead<z&&P.strm.avail_in!==0)}function B(P,ie){for(var V,O;;){if(P.lookahead<z){if(le(P),P.lookahead<z&&ie===h)return A;if(P.lookahead===0)break}if(V=0,P.lookahead>=E&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),V!==0&&P.strstart-V<=P.w_size-z&&(P.match_length=oe(P,V)),P.match_length>=E)if(O=l._tr_tally(P,P.strstart-P.match_start,P.match_length-E),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=E){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart,--P.match_length!=0;);P.strstart++}else P.strstart+=P.match_length,P.match_length=0,P.ins_h=P.window[P.strstart],P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+1])&P.hash_mask;else O=l._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++;if(O&&(F(P,!1),P.strm.avail_out===0))return A}return P.insert=P.strstart<E-1?P.strstart:E-1,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):P.last_lit&&(F(P,!1),P.strm.avail_out===0)?A:U}function R(P,ie){for(var V,O,T;;){if(P.lookahead<z){if(le(P),P.lookahead<z&&ie===h)return A;if(P.lookahead===0)break}if(V=0,P.lookahead>=E&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),P.prev_length=P.match_length,P.prev_match=P.match_start,P.match_length=E-1,V!==0&&P.prev_length<P.max_lazy_match&&P.strstart-V<=P.w_size-z&&(P.match_length=oe(P,V),P.match_length<=5&&(P.strategy===1||P.match_length===E&&4096<P.strstart-P.match_start)&&(P.match_length=E-1)),P.prev_length>=E&&P.match_length<=P.prev_length){for(T=P.strstart+P.lookahead-E,O=l._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-E),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=T&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+E-1])&P.hash_mask,V=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),--P.prev_length!=0;);if(P.match_available=0,P.match_length=E-1,P.strstart++,O&&(F(P,!1),P.strm.avail_out===0))return A}else if(P.match_available){if((O=l._tr_tally(P,0,P.window[P.strstart-1]))&&F(P,!1),P.strstart++,P.lookahead--,P.strm.avail_out===0)return A}else P.match_available=1,P.strstart++,P.lookahead--}return P.match_available&&(O=l._tr_tally(P,0,P.window[P.strstart-1]),P.match_available=0),P.insert=P.strstart<E-1?P.strstart:E-1,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):P.last_lit&&(F(P,!1),P.strm.avail_out===0)?A:U}function ee(P,ie,V,O,T){this.good_length=P,this.max_lazy=ie,this.nice_length=V,this.max_chain=O,this.func=T}function te(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*C),this.dyn_dtree=new o.Buf16(2*(2*j+1)),this.bl_tree=new o.Buf16(2*(2*N+1)),$(this.dyn_ltree),$(this.dyn_dtree),$(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(k+1),this.heap=new o.Buf16(2*w+1),$(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*w+1),$(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(P){var ie;return P&&P.state?(P.total_in=P.total_out=0,P.data_type=y,(ie=P.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?I:q,P.adler=ie.wrap===2?0:1,ie.last_flush=h,l._tr_init(ie),p):Y(P,g)}function J(P){var ie=Z(P);return ie===p&&function(V){V.window_size=2*V.w_size,$(V.head),V.max_lazy_match=i[V.level].max_lazy,V.good_match=i[V.level].good_length,V.nice_match=i[V.level].nice_length,V.max_chain_length=i[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=E-1,V.match_available=0,V.ins_h=0}(P.state),ie}function he(P,ie,V,O,T,D){if(!P)return g;var ne=1;if(ie===m&&(ie=6),O<0?(ne=0,O=-O):15<O&&(ne=2,O-=16),T<1||b<T||V!==x||O<8||15<O||ie<0||9<ie||D<0||v<D)return Y(P,g);O===8&&(O=9);var ue=new te;return(P.state=ue).strm=P,ue.wrap=ne,ue.gzhead=null,ue.w_bits=O,ue.w_size=1<<ue.w_bits,ue.w_mask=ue.w_size-1,ue.hash_bits=T+7,ue.hash_size=1<<ue.hash_bits,ue.hash_mask=ue.hash_size-1,ue.hash_shift=~~((ue.hash_bits+E-1)/E),ue.window=new o.Buf8(2*ue.w_size),ue.head=new o.Buf16(ue.hash_size),ue.prev=new o.Buf16(ue.w_size),ue.lit_bufsize=1<<T+6,ue.pending_buf_size=4*ue.lit_bufsize,ue.pending_buf=new o.Buf8(ue.pending_buf_size),ue.d_buf=1*ue.lit_bufsize,ue.l_buf=3*ue.lit_bufsize,ue.level=ie,ue.strategy=D,ue.method=V,J(P)}i=[new ee(0,0,0,0,function(P,ie){var V=65535;for(V>P.pending_buf_size-5&&(V=P.pending_buf_size-5);;){if(P.lookahead<=1){if(le(P),P.lookahead===0&&ie===h)return A;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var O=P.block_start+V;if((P.strstart===0||P.strstart>=O)&&(P.lookahead=P.strstart-O,P.strstart=O,F(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-z&&(F(P,!1),P.strm.avail_out===0))return A}return P.insert=0,ie===f?(F(P,!0),P.strm.avail_out===0?K:G):(P.strstart>P.block_start&&(F(P,!1),P.strm.avail_out),A)}),new ee(4,4,8,4,B),new ee(4,5,16,8,B),new ee(4,6,32,32,B),new ee(4,4,16,16,R),new ee(8,16,32,32,R),new ee(8,16,128,128,R),new ee(8,32,128,256,R),new ee(32,128,258,1024,R),new ee(32,258,258,4096,R)],s.deflateInit=function(P,ie){return he(P,ie,x,15,8,0)},s.deflateInit2=he,s.deflateReset=J,s.deflateResetKeep=Z,s.deflateSetHeader=function(P,ie){return P&&P.state?P.state.wrap!==2?g:(P.state.gzhead=ie,p):g},s.deflate=function(P,ie){var V,O,T,D;if(!P||!P.state||5<ie||ie<0)return P?Y(P,g):g;if(O=P.state,!P.output||!P.input&&P.avail_in!==0||O.status===666&&ie!==f)return Y(P,P.avail_out===0?-5:g);if(O.strm=P,V=O.last_flush,O.last_flush=ie,O.status===I)if(O.wrap===2)P.adler=0,W(O,31),W(O,139),W(O,8),O.gzhead?(W(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),W(O,255&O.gzhead.time),W(O,O.gzhead.time>>8&255),W(O,O.gzhead.time>>16&255),W(O,O.gzhead.time>>24&255),W(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),W(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(W(O,255&O.gzhead.extra.length),W(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(P.adler=u(P.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(W(O,0),W(O,0),W(O,0),W(O,0),W(O,0),W(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),W(O,3),O.status=q);else{var ne=x+(O.w_bits-8<<4)<<8;ne|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(ne|=32),ne+=31-ne%31,O.status=q,X(O,ne),O.strstart!==0&&(X(O,P.adler>>>16),X(O,65535&P.adler)),P.adler=1}if(O.status===69)if(O.gzhead.extra){for(T=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending!==O.pending_buf_size));)W(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){T=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending===O.pending_buf_size)){D=1;break}D=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,W(O,D)}while(D!==0);O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),D===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){T=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),L(P),T=O.pending,O.pending===O.pending_buf_size)){D=1;break}D=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,W(O,D)}while(D!==0);O.gzhead.hcrc&&O.pending>T&&(P.adler=u(P.adler,O.pending_buf,O.pending-T,T)),D===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&L(P),O.pending+2<=O.pending_buf_size&&(W(O,255&P.adler),W(O,P.adler>>8&255),P.adler=0,O.status=q)):O.status=q),O.pending!==0){if(L(P),P.avail_out===0)return O.last_flush=-1,p}else if(P.avail_in===0&&H(ie)<=H(V)&&ie!==f)return Y(P,-5);if(O.status===666&&P.avail_in!==0)return Y(P,-5);if(P.avail_in!==0||O.lookahead!==0||ie!==h&&O.status!==666){var ue=O.strategy===2?function(re,pe){for(var xe;;){if(re.lookahead===0&&(le(re),re.lookahead===0)){if(pe===h)return A;break}if(re.match_length=0,xe=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,xe&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:U}(O,ie):O.strategy===3?function(re,pe){for(var xe,ye,ae,de,ge=re.window;;){if(re.lookahead<=M){if(le(re),re.lookahead<=M&&pe===h)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=E&&0<re.strstart&&(ye=ge[ae=re.strstart-1])===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]){de=re.strstart+M;do;while(ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ye===ge[++ae]&&ae<de);re.match_length=M-(de-ae),re.match_length>re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=E?(xe=l._tr_tally(re,1,re.match_length-E),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(xe=l._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),xe&&(F(re,!1),re.strm.avail_out===0))return A}return re.insert=0,pe===f?(F(re,!0),re.strm.avail_out===0?K:G):re.last_lit&&(F(re,!1),re.strm.avail_out===0)?A:U}(O,ie):i[O.level].func(O,ie);if(ue!==K&&ue!==G||(O.status=666),ue===A||ue===K)return P.avail_out===0&&(O.last_flush=-1),p;if(ue===U&&(ie===1?l._tr_align(O):ie!==5&&(l._tr_stored_block(O,0,0,!1),ie===3&&($(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),L(P),P.avail_out===0))return O.last_flush=-1,p}return ie!==f?p:O.wrap<=0?1:(O.wrap===2?(W(O,255&P.adler),W(O,P.adler>>8&255),W(O,P.adler>>16&255),W(O,P.adler>>24&255),W(O,255&P.total_in),W(O,P.total_in>>8&255),W(O,P.total_in>>16&255),W(O,P.total_in>>24&255)):(X(O,P.adler>>>16),X(O,65535&P.adler)),L(P),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},s.deflateEnd=function(P){var ie;return P&&P.state?(ie=P.state.status)!==I&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==q&&ie!==666?Y(P,g):(P.state=null,ie===q?Y(P,-3):p):g},s.deflateSetDictionary=function(P,ie){var V,O,T,D,ne,ue,re,pe,xe=ie.length;if(!P||!P.state||(D=(V=P.state).wrap)===2||D===1&&V.status!==I||V.lookahead)return g;for(D===1&&(P.adler=c(P.adler,ie,xe,0)),V.wrap=0,xe>=V.w_size&&(D===0&&($(V.head),V.strstart=0,V.block_start=0,V.insert=0),pe=new o.Buf8(V.w_size),o.arraySet(pe,ie,xe-V.w_size,V.w_size,0),ie=pe,xe=V.w_size),ne=P.avail_in,ue=P.next_in,re=P.input,P.avail_in=xe,P.next_in=0,P.input=ie,le(V);V.lookahead>=E;){for(O=V.strstart,T=V.lookahead-(E-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[O+E-1])&V.hash_mask,V.prev[O&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=O,O++,--T;);V.strstart=O,V.lookahead=E-1,le(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=E-1,V.match_available=0,P.next_in=ue,P.input=re,P.avail_in=ne,V.wrap=D,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(i,o){var l,c,u,d,h,f,p,g,m,v,y,x,b,w,j,N,C,k,E,M,z,I,q,A,U;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),d=i.next_out,U=i.output,h=d-(o-i.avail_out),f=d+(i.avail_out-257),p=l.dmax,g=l.wsize,m=l.whave,v=l.wnext,y=l.window,x=l.hold,b=l.bits,w=l.lencode,j=l.distcode,N=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{b<15&&(x+=A[c++]<<b,b+=8,x+=A[c++]<<b,b+=8),k=w[x&N];t:for(;;){if(x>>>=E=k>>>24,b-=E,(E=k>>>16&255)===0)U[d++]=65535&k;else{if(!(16&E)){if(!(64&E)){k=w[(65535&k)+(x&(1<<E)-1)];continue t}if(32&E){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}M=65535&k,(E&=15)&&(b<E&&(x+=A[c++]<<b,b+=8),M+=x&(1<<E)-1,x>>>=E,b-=E),b<15&&(x+=A[c++]<<b,b+=8,x+=A[c++]<<b,b+=8),k=j[x&C];r:for(;;){if(x>>>=E=k>>>24,b-=E,!(16&(E=k>>>16&255))){if(!(64&E)){k=j[(65535&k)+(x&(1<<E)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(z=65535&k,b<(E&=15)&&(x+=A[c++]<<b,(b+=8)<E&&(x+=A[c++]<<b,b+=8)),p<(z+=x&(1<<E)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(x>>>=E,b-=E,(E=d-h)<z){if(m<(E=z-E)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(q=y,(I=0)===v){if(I+=g-E,E<M){for(M-=E;U[d++]=y[I++],--E;);I=d-z,q=U}}else if(v<E){if(I+=g+v-E,(E-=v)<M){for(M-=E;U[d++]=y[I++],--E;);if(I=0,v<M){for(M-=E=v;U[d++]=y[I++],--E;);I=d-z,q=U}}}else if(I+=v-E,E<M){for(M-=E;U[d++]=y[I++],--E;);I=d-z,q=U}for(;2<M;)U[d++]=q[I++],U[d++]=q[I++],U[d++]=q[I++],M-=3;M&&(U[d++]=q[I++],1<M&&(U[d++]=q[I++]))}else{for(I=d-z;U[d++]=U[I++],U[d++]=U[I++],U[d++]=U[I++],2<(M-=3););M&&(U[d++]=U[I++],1<M&&(U[d++]=U[I++]))}break}}break}}while(c<u&&d<f);c-=M=b>>3,x&=(1<<(b-=M<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<f?f-d+257:257-(d-f),l.hold=x,l.bits=b}},{}],49:[function(r,n,s){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,h=2,f=0,p=-2,g=1,m=852,v=592;function y(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function x(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(I){var q;return I&&I.state?(q=I.state,I.total_in=I.total_out=q.total=0,I.msg="",q.wrap&&(I.adler=1&q.wrap),q.mode=g,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new i.Buf32(m),q.distcode=q.distdyn=new i.Buf32(v),q.sane=1,q.back=-1,f):p}function w(I){var q;return I&&I.state?((q=I.state).wsize=0,q.whave=0,q.wnext=0,b(I)):p}function j(I,q){var A,U;return I&&I.state?(U=I.state,q<0?(A=0,q=-q):(A=1+(q>>4),q<48&&(q&=15)),q&&(q<8||15<q)?p:(U.window!==null&&U.wbits!==q&&(U.window=null),U.wrap=A,U.wbits=q,w(I))):p}function N(I,q){var A,U;return I?(U=new x,(I.state=U).window=null,(A=j(I,q))!==f&&(I.state=null),A):p}var C,k,E=!0;function M(I){if(E){var q;for(C=new i.Buf32(512),k=new i.Buf32(32),q=0;q<144;)I.lens[q++]=8;for(;q<256;)I.lens[q++]=9;for(;q<280;)I.lens[q++]=7;for(;q<288;)I.lens[q++]=8;for(u(d,I.lens,0,288,C,0,I.work,{bits:9}),q=0;q<32;)I.lens[q++]=5;u(h,I.lens,0,32,k,0,I.work,{bits:5}),E=!1}I.lencode=C,I.lenbits=9,I.distcode=k,I.distbits=5}function z(I,q,A,U){var K,G=I.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new i.Buf8(G.wsize)),U>=G.wsize?(i.arraySet(G.window,q,A-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(U<(K=G.wsize-G.wnext)&&(K=U),i.arraySet(G.window,q,A-U,K,G.wnext),(U-=K)?(i.arraySet(G.window,q,A-U,U,0),G.wnext=U,G.whave=G.wsize):(G.wnext+=K,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=K))),0}s.inflateReset=w,s.inflateReset2=j,s.inflateResetKeep=b,s.inflateInit=function(I){return N(I,15)},s.inflateInit2=N,s.inflate=function(I,q){var A,U,K,G,Y,H,$,L,F,W,X,oe,le,B,R,ee,te,Z,J,he,P,ie,V,O,T=0,D=new i.Buf8(4),ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return p;(A=I.state).mode===12&&(A.mode=13),Y=I.next_out,K=I.output,$=I.avail_out,G=I.next_in,U=I.input,H=I.avail_in,L=A.hold,F=A.bits,W=H,X=$,ie=f;e:for(;;)switch(A.mode){case g:if(A.wrap===0){A.mode=13;break}for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(2&A.wrap&&L===35615){D[A.check=0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0),F=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){I.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){I.msg="unknown compression method",A.mode=30;break}if(F-=4,P=8+(15&(L>>>=4)),A.wbits===0)A.wbits=P;else if(P>A.wbits){I.msg="invalid window size",A.mode=30;break}A.dmax=1<<P,I.adler=A.check=1,A.mode=512&L?10:12,F=L=0;break;case 2:for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(A.flags=L,(255&A.flags)!=8){I.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){I.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=L>>8&1),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=3;case 3:for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.head&&(A.head.time=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,D[2]=L>>>16&255,D[3]=L>>>24&255,A.check=l(A.check,D,4,0)),F=L=0,A.mode=4;case 4:for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.head&&(A.head.xflags=255&L,A.head.os=L>>8),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0,A.mode=5;case 5:if(1024&A.flags){for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.length=L,A.head&&(A.head.extra_len=L),512&A.flags&&(D[0]=255&L,D[1]=L>>>8&255,A.check=l(A.check,D,2,0)),F=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(H<(oe=A.length)&&(oe=H),oe&&(A.head&&(P=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,U,G,oe,P)),512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,A.length-=oe),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(H===0)break e;for(oe=0;P=U[G+oe++],A.head&&P&&A.length<65536&&(A.head.name+=String.fromCharCode(P)),P&&oe<H;);if(512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,P)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(H===0)break e;for(oe=0;P=U[G+oe++],A.head&&P&&A.length<65536&&(A.head.comment+=String.fromCharCode(P)),P&&oe<H;);if(512&A.flags&&(A.check=l(A.check,U,oe,G)),H-=oe,G+=oe,P)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;F<16;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L!==(65535&A.check)){I.msg="header crc mismatch",A.mode=30;break}F=L=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),I.adler=A.check=0,A.mode=12;break;case 10:for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}I.adler=A.check=y(L),F=L=0,A.mode=11;case 11:if(A.havedict===0)return I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,2;I.adler=A.check=1,A.mode=12;case 12:if(q===5||q===6)break e;case 13:if(A.last){L>>>=7&F,F-=7&F,A.mode=27;break}for(;F<3;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}switch(A.last=1&L,F-=1,3&(L>>>=1)){case 0:A.mode=14;break;case 1:if(M(A),A.mode=20,q!==6)break;L>>>=2,F-=2;break e;case 2:A.mode=17;break;case 3:I.msg="invalid block type",A.mode=30}L>>>=2,F-=2;break;case 14:for(L>>>=7&F,F-=7&F;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if((65535&L)!=(L>>>16^65535)){I.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,F=L=0,A.mode=15,q===6)break e;case 15:A.mode=16;case 16:if(oe=A.length){if(H<oe&&(oe=H),$<oe&&(oe=$),oe===0)break e;i.arraySet(K,U,G,oe,Y),H-=oe,G+=oe,$-=oe,Y+=oe,A.length-=oe;break}A.mode=12;break;case 17:for(;F<14;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(A.nlen=257+(31&L),L>>>=5,F-=5,A.ndist=1+(31&L),L>>>=5,F-=5,A.ncode=4+(15&L),L>>>=4,F-=4,286<A.nlen||30<A.ndist){I.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;F<3;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.lens[ne[A.have++]]=7&L,L>>>=3,F-=3}for(;A.have<19;)A.lens[ne[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,V={bits:A.lenbits},ie=u(0,A.lens,0,19,A.lencode,0,A.work,V),A.lenbits=V.bits,ie){I.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(te<16)L>>>=R,F-=R,A.lens[A.have++]=te;else{if(te===16){for(O=R+2;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L>>>=R,F-=R,A.have===0){I.msg="invalid bit length repeat",A.mode=30;break}P=A.lens[A.have-1],oe=3+(3&L),L>>>=2,F-=2}else if(te===17){for(O=R+3;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}F-=R,P=0,oe=3+(7&(L>>>=R)),L>>>=3,F-=3}else{for(O=R+7;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}F-=R,P=0,oe=11+(127&(L>>>=R)),L>>>=7,F-=7}if(A.have+oe>A.nlen+A.ndist){I.msg="invalid bit length repeat",A.mode=30;break}for(;oe--;)A.lens[A.have++]=P}}if(A.mode===30)break;if(A.lens[256]===0){I.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,V={bits:A.lenbits},ie=u(d,A.lens,0,A.nlen,A.lencode,0,A.work,V),A.lenbits=V.bits,ie){I.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,V={bits:A.distbits},ie=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,V),A.distbits=V.bits,ie){I.msg="invalid distances set",A.mode=30;break}if(A.mode=20,q===6)break e;case 20:A.mode=21;case 21:if(6<=H&&258<=$){I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,c(I,X),Y=I.next_out,K=I.output,$=I.avail_out,G=I.next_in,U=I.input,H=I.avail_in,L=A.hold,F=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;ee=(T=A.lencode[L&(1<<A.lenbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(ee&&!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.lencode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,A.length=te,ee===0){A.mode=26;break}if(32&ee){A.back=-1,A.mode=12;break}if(64&ee){I.msg="invalid literal/length code",A.mode=30;break}A.extra=15&ee,A.mode=22;case 22:if(A.extra){for(O=A.extra;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.length+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;ee=(T=A.distcode[L&(1<<A.distbits)-1])>>>16&255,te=65535&T,!((R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(!(240&ee)){for(Z=R,J=ee,he=te;ee=(T=A.distcode[he+((L&(1<<Z+J)-1)>>Z)])>>>16&255,te=65535&T,!(Z+(R=T>>>24)<=F);){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}L>>>=Z,F-=Z,A.back+=Z}if(L>>>=R,F-=R,A.back+=R,64&ee){I.msg="invalid distance code",A.mode=30;break}A.offset=te,A.extra=15&ee,A.mode=24;case 24:if(A.extra){for(O=A.extra;F<O;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}A.offset+=L&(1<<A.extra)-1,L>>>=A.extra,F-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){I.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if($===0)break e;if(oe=X-$,A.offset>oe){if((oe=A.offset-oe)>A.whave&&A.sane){I.msg="invalid distance too far back",A.mode=30;break}le=oe>A.wnext?(oe-=A.wnext,A.wsize-oe):A.wnext-oe,oe>A.length&&(oe=A.length),B=A.window}else B=K,le=Y-A.offset,oe=A.length;for($<oe&&(oe=$),$-=oe,A.length-=oe;K[Y++]=B[le++],--oe;);A.length===0&&(A.mode=21);break;case 26:if($===0)break e;K[Y++]=A.length,$--,A.mode=21;break;case 27:if(A.wrap){for(;F<32;){if(H===0)break e;H--,L|=U[G++]<<F,F+=8}if(X-=$,I.total_out+=X,A.total+=X,X&&(I.adler=A.check=A.flags?l(A.check,K,X,Y-X):o(A.check,K,X,Y-X)),X=$,(A.flags?L:y(L))!==A.check){I.msg="incorrect data check",A.mode=30;break}F=L=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;F<32;){if(H===0)break e;H--,L+=U[G++]<<F,F+=8}if(L!==(4294967295&A.total)){I.msg="incorrect length check",A.mode=30;break}F=L=0}A.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;case 32:default:return p}return I.next_out=Y,I.avail_out=$,I.next_in=G,I.avail_in=H,A.hold=L,A.bits=F,(A.wsize||X!==I.avail_out&&A.mode<30&&(A.mode<27||q!==4))&&z(I,I.output,I.next_out,X-I.avail_out)?(A.mode=31,-4):(W-=I.avail_in,X-=I.avail_out,I.total_in+=W,I.total_out+=X,A.total+=X,A.wrap&&X&&(I.adler=A.check=A.flags?l(A.check,K,X,I.next_out-X):o(A.check,K,X,I.next_out-X)),I.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(W==0&&X===0||q===4)&&ie===f&&(ie=-5),ie)},s.inflateEnd=function(I){if(!I||!I.state)return p;var q=I.state;return q.window&&(q.window=null),I.state=null,f},s.inflateGetHeader=function(I,q){var A;return I&&I.state&&2&(A=I.state).wrap?((A.head=q).done=!1,f):p},s.inflateSetDictionary=function(I,q){var A,U=q.length;return I&&I.state?(A=I.state).wrap!==0&&A.mode!==11?p:A.mode===11&&o(1,q,U,0)!==A.check?-3:z(I,q,U,U)?(A.mode=31,-4):(A.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(d,h,f,p,g,m,v,y){var x,b,w,j,N,C,k,E,M,z=y.bits,I=0,q=0,A=0,U=0,K=0,G=0,Y=0,H=0,$=0,L=0,F=null,W=0,X=new i.Buf16(16),oe=new i.Buf16(16),le=null,B=0;for(I=0;I<=15;I++)X[I]=0;for(q=0;q<p;q++)X[h[f+q]]++;for(K=z,U=15;1<=U&&X[U]===0;U--);if(U<K&&(K=U),U===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(A=1;A<U&&X[A]===0;A++);for(K<A&&(K=A),I=H=1;I<=15;I++)if(H<<=1,(H-=X[I])<0)return-1;if(0<H&&(d===0||U!==1))return-1;for(oe[1]=0,I=1;I<15;I++)oe[I+1]=oe[I]+X[I];for(q=0;q<p;q++)h[f+q]!==0&&(v[oe[h[f+q]]++]=q);if(C=d===0?(F=le=v,19):d===1?(F=o,W-=257,le=l,B-=257,256):(F=c,le=u,-1),I=A,N=m,Y=q=L=0,w=-1,j=($=1<<(G=K))-1,d===1&&852<$||d===2&&592<$)return 1;for(;;){for(k=I-Y,M=v[q]<C?(E=0,v[q]):v[q]>C?(E=le[B+v[q]],F[W+v[q]]):(E=96,0),x=1<<I-Y,A=b=1<<G;g[N+(L>>Y)+(b-=x)]=k<<24|E<<16|M|0,b!==0;);for(x=1<<I-1;L&x;)x>>=1;if(x!==0?(L&=x-1,L+=x):L=0,q++,--X[I]==0){if(I===U)break;I=h[f+v[q]]}if(K<I&&(L&j)!==w){for(Y===0&&(Y=K),N+=A,H=1<<(G=I-Y);G+Y<U&&!((H-=X[G+Y])<=0);)G++,H<<=1;if($+=1<<G,d===1&&852<$||d===2&&592<$)return 1;g[w=L&j]=K<<24|G<<16|N-m|0}}return L!==0&&(g[N+L]=I-Y<<24|64<<16|0),y.bits=K,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var i=r("../utils/common"),o=0,l=1;function c(T){for(var D=T.length;0<=--D;)T[D]=0}var u=0,d=29,h=256,f=h+1+d,p=30,g=19,m=2*f+1,v=15,y=16,x=7,b=256,w=16,j=17,N=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(f+2));c(z);var I=new Array(2*p);c(I);var q=new Array(512);c(q);var A=new Array(256);c(A);var U=new Array(d);c(U);var K,G,Y,H=new Array(p);function $(T,D,ne,ue,re){this.static_tree=T,this.extra_bits=D,this.extra_base=ne,this.elems=ue,this.max_length=re,this.has_stree=T&&T.length}function L(T,D){this.dyn_tree=T,this.max_code=0,this.stat_desc=D}function F(T){return T<256?q[T]:q[256+(T>>>7)]}function W(T,D){T.pending_buf[T.pending++]=255&D,T.pending_buf[T.pending++]=D>>>8&255}function X(T,D,ne){T.bi_valid>y-ne?(T.bi_buf|=D<<T.bi_valid&65535,W(T,T.bi_buf),T.bi_buf=D>>y-T.bi_valid,T.bi_valid+=ne-y):(T.bi_buf|=D<<T.bi_valid&65535,T.bi_valid+=ne)}function oe(T,D,ne){X(T,ne[2*D],ne[2*D+1])}function le(T,D){for(var ne=0;ne|=1&T,T>>>=1,ne<<=1,0<--D;);return ne>>>1}function B(T,D,ne){var ue,re,pe=new Array(v+1),xe=0;for(ue=1;ue<=v;ue++)pe[ue]=xe=xe+ne[ue-1]<<1;for(re=0;re<=D;re++){var ye=T[2*re+1];ye!==0&&(T[2*re]=le(pe[ye]++,ye))}}function R(T){var D;for(D=0;D<f;D++)T.dyn_ltree[2*D]=0;for(D=0;D<p;D++)T.dyn_dtree[2*D]=0;for(D=0;D<g;D++)T.bl_tree[2*D]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function ee(T){8<T.bi_valid?W(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function te(T,D,ne,ue){var re=2*D,pe=2*ne;return T[re]<T[pe]||T[re]===T[pe]&&ue[D]<=ue[ne]}function Z(T,D,ne){for(var ue=T.heap[ne],re=ne<<1;re<=T.heap_len&&(re<T.heap_len&&te(D,T.heap[re+1],T.heap[re],T.depth)&&re++,!te(D,ue,T.heap[re],T.depth));)T.heap[ne]=T.heap[re],ne=re,re<<=1;T.heap[ne]=ue}function J(T,D,ne){var ue,re,pe,xe,ye=0;if(T.last_lit!==0)for(;ue=T.pending_buf[T.d_buf+2*ye]<<8|T.pending_buf[T.d_buf+2*ye+1],re=T.pending_buf[T.l_buf+ye],ye++,ue===0?oe(T,re,D):(oe(T,(pe=A[re])+h+1,D),(xe=C[pe])!==0&&X(T,re-=U[pe],xe),oe(T,pe=F(--ue),ne),(xe=k[pe])!==0&&X(T,ue-=H[pe],xe)),ye<T.last_lit;);oe(T,b,D)}function he(T,D){var ne,ue,re,pe=D.dyn_tree,xe=D.stat_desc.static_tree,ye=D.stat_desc.has_stree,ae=D.stat_desc.elems,de=-1;for(T.heap_len=0,T.heap_max=m,ne=0;ne<ae;ne++)pe[2*ne]!==0?(T.heap[++T.heap_len]=de=ne,T.depth[ne]=0):pe[2*ne+1]=0;for(;T.heap_len<2;)pe[2*(re=T.heap[++T.heap_len]=de<2?++de:0)]=1,T.depth[re]=0,T.opt_len--,ye&&(T.static_len-=xe[2*re+1]);for(D.max_code=de,ne=T.heap_len>>1;1<=ne;ne--)Z(T,pe,ne);for(re=ae;ne=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Z(T,pe,1),ue=T.heap[1],T.heap[--T.heap_max]=ne,T.heap[--T.heap_max]=ue,pe[2*re]=pe[2*ne]+pe[2*ue],T.depth[re]=(T.depth[ne]>=T.depth[ue]?T.depth[ne]:T.depth[ue])+1,pe[2*ne+1]=pe[2*ue+1]=re,T.heap[1]=re++,Z(T,pe,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ge,we){var je,Se,Ue,Ae,fe,Ee,Ce=we.dyn_tree,Ge=we.max_code,dt=we.stat_desc.static_tree,Ne=we.stat_desc.has_stree,Ze=we.stat_desc.extra_bits,Ke=we.stat_desc.extra_base,Xe=we.stat_desc.max_length,Ye=0;for(Ae=0;Ae<=v;Ae++)ge.bl_count[Ae]=0;for(Ce[2*ge.heap[ge.heap_max]+1]=0,je=ge.heap_max+1;je<m;je++)Xe<(Ae=Ce[2*Ce[2*(Se=ge.heap[je])+1]+1]+1)&&(Ae=Xe,Ye++),Ce[2*Se+1]=Ae,Ge<Se||(ge.bl_count[Ae]++,fe=0,Ke<=Se&&(fe=Ze[Se-Ke]),Ee=Ce[2*Se],ge.opt_len+=Ee*(Ae+fe),Ne&&(ge.static_len+=Ee*(dt[2*Se+1]+fe)));if(Ye!==0){do{for(Ae=Xe-1;ge.bl_count[Ae]===0;)Ae--;ge.bl_count[Ae]--,ge.bl_count[Ae+1]+=2,ge.bl_count[Xe]--,Ye-=2}while(0<Ye);for(Ae=Xe;Ae!==0;Ae--)for(Se=ge.bl_count[Ae];Se!==0;)Ge<(Ue=ge.heap[--je])||(Ce[2*Ue+1]!==Ae&&(ge.opt_len+=(Ae-Ce[2*Ue+1])*Ce[2*Ue],Ce[2*Ue+1]=Ae),Se--)}}(T,D),B(pe,de,T.bl_count)}function P(T,D,ne){var ue,re,pe=-1,xe=D[1],ye=0,ae=7,de=4;for(xe===0&&(ae=138,de=3),D[2*(ne+1)+1]=65535,ue=0;ue<=ne;ue++)re=xe,xe=D[2*(ue+1)+1],++ye<ae&&re===xe||(ye<de?T.bl_tree[2*re]+=ye:re!==0?(re!==pe&&T.bl_tree[2*re]++,T.bl_tree[2*w]++):ye<=10?T.bl_tree[2*j]++:T.bl_tree[2*N]++,pe=re,de=(ye=0)===xe?(ae=138,3):re===xe?(ae=6,3):(ae=7,4))}function ie(T,D,ne){var ue,re,pe=-1,xe=D[1],ye=0,ae=7,de=4;for(xe===0&&(ae=138,de=3),ue=0;ue<=ne;ue++)if(re=xe,xe=D[2*(ue+1)+1],!(++ye<ae&&re===xe)){if(ye<de)for(;oe(T,re,T.bl_tree),--ye!=0;);else re!==0?(re!==pe&&(oe(T,re,T.bl_tree),ye--),oe(T,w,T.bl_tree),X(T,ye-3,2)):ye<=10?(oe(T,j,T.bl_tree),X(T,ye-3,3)):(oe(T,N,T.bl_tree),X(T,ye-11,7));pe=re,de=(ye=0)===xe?(ae=138,3):re===xe?(ae=6,3):(ae=7,4)}}c(H);var V=!1;function O(T,D,ne,ue){X(T,(u<<1)+(ue?1:0),3),function(re,pe,xe,ye){ee(re),W(re,xe),W(re,~xe),i.arraySet(re.pending_buf,re.window,pe,xe,re.pending),re.pending+=xe}(T,D,ne)}s._tr_init=function(T){V||(function(){var D,ne,ue,re,pe,xe=new Array(v+1);for(re=ue=0;re<d-1;re++)for(U[re]=ue,D=0;D<1<<C[re];D++)A[ue++]=re;for(A[ue-1]=re,re=pe=0;re<16;re++)for(H[re]=pe,D=0;D<1<<k[re];D++)q[pe++]=re;for(pe>>=7;re<p;re++)for(H[re]=pe<<7,D=0;D<1<<k[re]-7;D++)q[256+pe++]=re;for(ne=0;ne<=v;ne++)xe[ne]=0;for(D=0;D<=143;)z[2*D+1]=8,D++,xe[8]++;for(;D<=255;)z[2*D+1]=9,D++,xe[9]++;for(;D<=279;)z[2*D+1]=7,D++,xe[7]++;for(;D<=287;)z[2*D+1]=8,D++,xe[8]++;for(B(z,f+1,xe),D=0;D<p;D++)I[2*D+1]=5,I[2*D]=le(D,5);K=new $(z,C,h+1,f,v),G=new $(I,k,0,p,v),Y=new $(new Array(0),E,0,g,x)}(),V=!0),T.l_desc=new L(T.dyn_ltree,K),T.d_desc=new L(T.dyn_dtree,G),T.bl_desc=new L(T.bl_tree,Y),T.bi_buf=0,T.bi_valid=0,R(T)},s._tr_stored_block=O,s._tr_flush_block=function(T,D,ne,ue){var re,pe,xe=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(ye){var ae,de=4093624447;for(ae=0;ae<=31;ae++,de>>>=1)if(1&de&&ye.dyn_ltree[2*ae]!==0)return o;if(ye.dyn_ltree[18]!==0||ye.dyn_ltree[20]!==0||ye.dyn_ltree[26]!==0)return l;for(ae=32;ae<h;ae++)if(ye.dyn_ltree[2*ae]!==0)return l;return o}(T)),he(T,T.l_desc),he(T,T.d_desc),xe=function(ye){var ae;for(P(ye,ye.dyn_ltree,ye.l_desc.max_code),P(ye,ye.dyn_dtree,ye.d_desc.max_code),he(ye,ye.bl_desc),ae=g-1;3<=ae&&ye.bl_tree[2*M[ae]+1]===0;ae--);return ye.opt_len+=3*(ae+1)+5+5+4,ae}(T),re=T.opt_len+3+7>>>3,(pe=T.static_len+3+7>>>3)<=re&&(re=pe)):re=pe=ne+5,ne+4<=re&&D!==-1?O(T,D,ne,ue):T.strategy===4||pe===re?(X(T,2+(ue?1:0),3),J(T,z,I)):(X(T,4+(ue?1:0),3),function(ye,ae,de,ge){var we;for(X(ye,ae-257,5),X(ye,de-1,5),X(ye,ge-4,4),we=0;we<ge;we++)X(ye,ye.bl_tree[2*M[we]+1],3);ie(ye,ye.dyn_ltree,ae-1),ie(ye,ye.dyn_dtree,de-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,xe+1),J(T,T.dyn_ltree,T.dyn_dtree)),R(T),ue&&ee(T)},s._tr_tally=function(T,D,ne){return T.pending_buf[T.d_buf+2*T.last_lit]=D>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&D,T.pending_buf[T.l_buf+T.last_lit]=255&ne,T.last_lit++,D===0?T.dyn_ltree[2*ne]++:(T.matches++,D--,T.dyn_ltree[2*(A[ne]+h+1)]++,T.dyn_dtree[2*F(D)]++),T.last_lit===T.lit_bufsize-1},s._tr_align=function(T){X(T,2,3),oe(T,b,z),function(D){D.bi_valid===16?(W(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,h,f=1,p={},g=!1,m=o.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(o);v=v&&v.setTimeout?v:o,c={}.toString.call(o.process)==="[object process]"?function(w){$t.nextTick(function(){x(w)})}:function(){if(o.postMessage&&!o.importScripts){var w=!0,j=o.onmessage;return o.onmessage=function(){w=!1},o.postMessage("","*"),o.onmessage=j,w}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(w){o.postMessage(h+w,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){x(w.data)},function(w){d.port2.postMessage(w)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(w){var j=m.createElement("script");j.onreadystatechange=function(){x(w),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(w){setTimeout(x,0,w)},v.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var j=new Array(arguments.length-1),N=0;N<j.length;N++)j[N]=arguments[N+1];var C={callback:w,args:j};return p[f]=C,c(f),f++},v.clearImmediate=y}function y(w){delete p[w]}function x(w){if(g)setTimeout(x,0,w);else{var j=p[w];if(j){g=!0;try{(function(N){var C=N.callback,k=N.args;switch(k.length){case 0:C();break;case 1:C(k[0]);break;case 2:C(k[0],k[1]);break;case 3:C(k[0],k[1],k[2]);break;default:C.apply(l,k)}})(j)}finally{y(w),g=!1}}}}function b(w){w.source===o&&typeof w.data=="string"&&w.data.indexOf(h)===0&&x(+w.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof oc<"u"?oc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(lM)),lM.exports}var wmt=bmt();const _mt=tpe(wmt);var yb={exports:{}},cM,bX;function jmt(){if(bX)return cM;bX=1;var t={"&":"&amp;",'"':"&quot;","'":"&apos;","<":"&lt;",">":"&gt;"};function e(r){return r&&r.replace?r.replace(/([&"<>'])/g,function(n,s){return t[s]}):r}return cM=e,cM}var wX;function Smt(){if(wX)return yb.exports;wX=1;var t=jmt(),e=mB().Stream,r="    ";function n(u,d){typeof d!="object"&&(d={indent:d});var h=d.stream?new e:null,f="",p=!1,g=d.indent?d.indent===!0?r:d.indent:"",m=!0;function v(j){m?$t.nextTick(j):j()}function y(j,N){if(N!==void 0&&(f+=N),j&&!p&&(h=h||new e,p=!0),j&&p){var C=f;v(function(){h.emit("data",C)}),f=""}}function x(j,N){l(y,o(j,g,g?1:0),N)}function b(){if(h){var j=f;v(function(){h.emit("data",j),h.emit("end"),h.readable=!1,h.emit("close")})}}function w(j){var N=j.encoding||"UTF-8",C={version:"1.0",encoding:N};j.standalone&&(C.standalone=j.standalone),x({"?xml":{_attr:C}}),f=f.replace("/>","?>")}return v(function(){m=!1}),d.declaration&&w(d.declaration),u&&u.forEach?u.forEach(function(j,N){var C;N+1===u.length&&(C=b),x(j,C)}):x(u,b),h?(h.readable=!0,h):f}function s(){var u=Array.prototype.slice.call(arguments),d={_elem:o(u)};return d.push=function(h){if(!this.append)throw new Error("not assigned to a parent!");var f=this,p=this._elem.indent;l(this.append,o(h,p,this._elem.icount+(p?1:0)),function(){f.append(!0)})},d.close=function(h){h!==void 0&&this.push(h),this.end&&this.end()},d}function i(u,d){return new Array(d||0).join(u||"")}function o(u,d,h){h=h||0;var f=i(d,h),p,g=u,m=!1;if(typeof u=="object"){var v=Object.keys(u);if(p=v[0],g=u[p],g&&g._elem)return g._elem.name=p,g._elem.icount=h,g._elem.indent=d,g._elem.indents=f,g._elem.interrupt=g,g._elem}var y=[],x=[],b;function w(j){var N=Object.keys(j);N.forEach(function(C){y.push(c(C,j[C]))})}switch(typeof g){case"object":if(g===null)break;g._attr&&w(g._attr),g._cdata&&x.push(("<![CDATA["+g._cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")+"]]>"),g.forEach&&(b=!1,x.push(""),g.forEach(function(j){if(typeof j=="object"){var N=Object.keys(j)[0];N=="_attr"?w(j._attr):x.push(o(j,d,h+1))}else x.pop(),b=!0,x.push(t(j))}),b||x.push(""));break;default:x.push(t(g))}return{name:p,interrupt:m,attributes:y,content:x,icount:h,indents:f,indent:d}}function l(u,d,h){if(typeof d!="object")return u(!1,d);var f=d.interrupt?1:d.content.length;function p(){for(;d.content.length;){var m=d.content.shift();if(m!==void 0){if(g(m))return;l(u,m)}}u(!1,(f>1?d.indents:"")+(d.name?"</"+d.name+">":"")+(d.indent&&!h?`
`:"")),h&&h()}function g(m){return m.interrupt?(m.interrupt.append=u,m.interrupt.end=p,m.interrupt=!1,u(!0),!0):!1}if(u(!1,d.indents+(d.name?"<"+d.name:"")+(d.attributes.length?" "+d.attributes.join(" "):"")+(f?d.name?">":"":d.name?"/>":"")+(d.indent&&f>1?`
`:"")),!f)return u(!1,d.indent?`
`:"");g(d)||p()}function c(u,d){return u+'="'+t(d)+'"'}return yb.exports=n,yb.exports.element=yb.exports.Element=s,yb.exports}var Nmt=Smt();const an=tpe(Nmt),vb=0,uM=32,Amt=32,Emt=(t,e)=>{const r=e.replace(/-/g,"");if(r.length!==Amt)throw new Error(`Error: Cannot extract GUID from font filename: ${e}`);const s=r.replace(/(..)/g,"$1 ").trim().split(" ").map(c=>parseInt(c,16));s.reverse();const o=t.slice(vb,uM).map((c,u)=>c^s[u%s.length]),l=new Uint8Array(vb+o.length+Math.max(0,t.length-uM));return l.set(t.slice(0,vb)),l.set(o,vb),l.set(t.slice(uM),vb+o.length),l};class Cmt{format(e,r={stack:[]}){const n=e.prepForXml(r);if(n)return n;throw Error("XMLComponent did not format correctly")}}class kmt{replace(e,r,n){let s=e;return r.forEach((i,o)=>{s=s.replace(new RegExp(`{${i.fileName}}`,"g"),(n+o).toString())}),s}getMediaData(e,r){return r.Array.filter(n=>e.search(`{${n.fileName}}`)>0)}}class Tmt{replace(e,r){let n=e;for(const s of r)n=n.replace(new RegExp(`{${s.reference}-${s.instance}}`,"g"),s.numId.toString());return n}}class Pmt{constructor(){Pe(this,"formatter"),Pe(this,"imageReplacer"),Pe(this,"numberingReplacer"),this.formatter=new Cmt,this.imageReplacer=new kmt,this.numberingReplacer=new Tmt}compile(e,r,n=[]){const s=new _mt,i=this.xmlifyFile(e,r),o=new Map(Object.entries(i));for(const[,l]of o)if(Array.isArray(l))for(const c of l)s.file(c.path,c.data);else s.file(l.path,l.data);for(const l of n)s.file(l.path,l.data);for(const l of e.Media.Array)l.type!=="svg"?s.file(`word/media/${l.fileName}`,l.data):(s.file(`word/media/${l.fileName}`,l.data),s.file(`word/media/${l.fallback.fileName}`,l.fallback.data));for(const{data:l,name:c,fontKey:u}of e.FontTable.fontOptionsWithKey){const[d]=c.split(".");s.file(`word/fonts/${d}.odttf`,Emt(l,u))}return s}xmlifyFile(e,r){const n=e.Document.Relationships.RelationshipCount+1,s=an(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=e.Comments.Relationships.RelationshipCount+1,o=an(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),l=this.imageReplacer.getMediaData(s,e.Media),c=this.imageReplacer.getMediaData(o,e.Media);return{Relationships:{data:(l.forEach((u,d)=>{e.Document.Relationships.createRelationship(n+d,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${u.fileName}`)}),e.Document.Relationships.createRelationship(e.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),an(this.formatter.format(e.Document.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}})),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{const u=this.imageReplacer.replace(s,l,n);return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{const u=an(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:an(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:an(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:an(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((u,d)=>{const h=an(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(h,e.Media).forEach((p,g)=>{u.Relationships.createRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${p.fileName}`)}),{data:an(this.formatter.format(u.Relationships,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${d+1}.xml.rels`}}),FooterRelationships:e.Footers.map((u,d)=>{const h=an(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(h,e.Media).forEach((p,g)=>{u.Relationships.createRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${p.fileName}`)}),{data:an(this.formatter.format(u.Relationships,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${d+1}.xml.rels`}}),Headers:e.Headers.map((u,d)=>{const h=an(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),f=this.imageReplacer.getMediaData(h,e.Media),p=this.imageReplacer.replace(h,f,0);return{data:this.numberingReplacer.replace(p,e.Numbering.ConcreteNumbering),path:`word/header${d+1}.xml`}}),Footers:e.Footers.map((u,d)=>{const h=an(this.formatter.format(u.View,{viewWrapper:u,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),f=this.imageReplacer.getMediaData(h,e.Media),p=this.imageReplacer.replace(h,f,0);return{data:this.numberingReplacer.replace(p,e.Numbering.ConcreteNumbering),path:`word/footer${d+1}.xml`}}),ContentTypes:{data:an(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:an(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:an(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:an(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/footnotes.xml"},FootNotesRelationships:{data:an(this.formatter.format(e.FootNotes.Relationships,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/_rels/footnotes.xml.rels"},Settings:{data:an(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{const u=this.imageReplacer.replace(o,c,i);return this.numberingReplacer.replace(u,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(c.forEach((u,d)=>{e.Comments.Relationships.createRelationship(i+d,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${u.fileName}`)}),an(this.formatter.format(e.Comments.Relationships,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}})),path:"word/_rels/comments.xml.rels"},FontTable:{data:an(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:an(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:r,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}}}}const Omt={NONE:"",WITH_2_BLANKS:"  ",WITH_4_BLANKS:"    ",WITH_TAB:"	"},_X=t=>t===!0?Omt.WITH_2_BLANKS:t===!1?void 0:t,$pe=class Yg{static pack(e,r,n){return Jut(this,arguments,function*(s,i,o,l=[]){return this.compiler.compile(s,_X(o),l).generateAsync({type:i,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})})}static toString(e,r,n=[]){return Yg.pack(e,"string",r,n)}static toBuffer(e,r,n=[]){return Yg.pack(e,"nodebuffer",r,n)}static toBase64String(e,r,n=[]){return Yg.pack(e,"base64",r,n)}static toBlob(e,r,n=[]){return Yg.pack(e,"blob",r,n)}static toArrayBuffer(e,r,n=[]){return Yg.pack(e,"arraybuffer",r,n)}static toStream(e,r,n=[]){const s=new xmt.Stream;return this.compiler.compile(e,_X(r),n).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then(o=>{s.emit("data",o),s.emit("end")}),s}};Pe($pe,"compiler",new Pmt);let Imt=$pe;function Bpe(t){if(!t)return[];const e=/\(([A-ZÀ-ÖØ-Þa-zà-öø-ÿ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+(?:\s(?:et\s+al\.|&\s+[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+))?(?:,?\s*[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+)*(?:\s*&\s*[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+)?),\s*(\d{4})(?:,\s*(?:p\.|pp\.|S\.)\s*[\d–\-]+)?\)/g,r=[],n=new Set;let s;for(;(s=e.exec(t))!==null;){const o=s[1].trim(),l=parseInt(s[2]),c=`${o.toLowerCase()}|${l}`;n.has(c)||(n.add(c),r.push({authors:o,year:l,raw:s[0]}))}const i=new RegExp("(?<![(\\w])([A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+(?:\\s(?:et\\s+al\\.|&\\s+[A-ZÀ-ÖØ-Þ][A-Za-zÀ-ÖØ-Þà-öø-ÿ''-]+))?)\\s+\\((\\d{4})(?:,\\s*(?:p\\.|pp\\.|S\\.)\\s*[\\d\\u2013-]+\\.?)?\\)","g");for(;(s=i.exec(t))!==null;){const o=s[1].trim(),l=parseInt(s[2]),c=`${o.toLowerCase()}|${l}`;n.has(c)||(n.add(c),r.push({authors:o,year:l,raw:s[0]}))}return r}function Rmt(t){return t.replace(/\s+et\s+al\.?/i,"").replace(/\s*&\s*.+$/,"").trim().split(/[\s,]/)[0].toLowerCase()}function Mmt(t,e){if(!e||!Array.isArray(e)||e.length===0)return!1;const r=Rmt(t);return r?e.some(n=>{var s,i,o;if(typeof n=="string"){if(((s=n.split(/,\s*/)[0])==null?void 0:s.trim().toLowerCase())===r)return!0;const u=n.trim().split(/\s+/);if(((i=u[u.length-1])==null?void 0:i.toLowerCase())===r)return!0}return typeof n=="object"&&n!==null&&((o=n.family)==null?void 0:o.toLowerCase())===r}):!1}function Upe(t,e){var s,i,o,l,c,u,d,h,f,p,g,m;const r=[],n=[];for(const v of t){let y=!1;for(const x of e){const b=x.bib_meta;if(!b)continue;const w=b.published_year||b.year||((s=b.crossref_data)==null?void 0:s.year)||((u=(c=(l=(o=(i=b.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.issued)==null?void 0:l["date-parts"])==null?void 0:c[0])==null?void 0:u[0])||((d=b.google_books_data)!=null&&d.publishedDate?parseInt(String(b.google_books_data.publishedDate).substring(0,4)):null);if(!w||parseInt(String(w))!==v.year)continue;const j=b.authors||((h=b.crossref_data)==null?void 0:h.authors)||((f=b.crossref_payload)==null?void 0:f.author)||((g=(p=b.crossref_data)==null?void 0:p.crossref_metadata)==null?void 0:g.author)||((m=b.google_books_data)==null?void 0:m.authors);if(Mmt(v.authors,j)){r.push({citation:v,documentId:x.id,citationApa:x.citation_apa||`${v.authors} (${v.year}). ${x.title||"Untitled"}.`,title:x.title||void 0}),y=!0;break}}y||n.push(v)}return{matched:r,unmatched:n}}function zpe(t){const e=new Set,r=[];for(const n of t.matched)e.has(n.citationApa)||(e.add(n.citationApa),r.push(n.citationApa));for(const n of t.unmatched){const s=`${n.authors} (${n.year}). [Source not found in library]`;e.has(s)||(e.add(s),r.push(s))}return r.sort((n,s)=>n.localeCompare(s))}function Hpe(t,e){const r=t.flatMap(s=>s.sections.map(i=>i.content)).join(`
`),n=Bpe(r);return Upe(n,e)}function Dmt(t,e){const r=Bpe(t);return Upe(r,e)}const Wpe={intro:"Introduction",problem:"Problem Statement",goal:"Objectives",theory:"Theory",method:"Methodology",results:"Results",findings:"Findings",discussion:"Discussion",conclusion:"Conclusion",literature:"Literature Review",references:"References",other:"Other"};function Vpe(t){return t?t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/`(.+?)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/\[(.+?)\]\((.+?)\)/g,"$1").replace(/!\[.*?\]\((.+?)\)/g,"").replace(/^>\s+/gm,"").replace(/^[-*_]{3,}$/gm,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\n{3,}/g,`

`).trim():""}function Lmt(t,e){const r=[];if(r.push("=".repeat(60)),r.push(""),r.push(e.thesisTitle.toUpperCase()),r.push(""),r.push("=".repeat(60)),r.push(""),e.authorName&&r.push(`Author: ${e.authorName}`),e.institution&&r.push(`Institution: ${e.institution}`),e.degreeProgram&&r.push(`Degree: ${e.degreeProgram}`),e.supervisor&&r.push(`Supervisor: ${e.supervisor}`),e.submissionDate){const o=new Date(e.submissionDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});r.push(`Submission Date: ${o}`)}r.push(""),r.push("-".repeat(60)),r.push("");let n=0;const s=[...t.chapters].sort((o,l)=>o.order_index-l.order_index);if(s.forEach((o,l)=>{r.push(`${l+1}. ${o.title.toUpperCase()}`),r.push(""),o.sections&&o.sections.length>0?[...o.sections].sort((u,d)=>u.order_index-d.order_index).forEach((u,d)=>{const h=u.title||Wpe[u.type]||u.type;if(r.push(`   ${l+1}.${d+1} ${h}`),r.push(""),u.content&&u.content.trim()){const p=Vpe(u.content).split(`
`).map(g=>`      ${g}`).join(`
`);r.push(p),n+=u.word_count||0}else r.push("      [No content yet]");r.push("")}):(r.push("   [No sections yet]"),r.push("")),r.push("-".repeat(60)),r.push("")}),e.includeLiterature&&t.documents&&t.documents.length>0){const o=Hpe(t.chapters,t.documents),l=zpe(o);if(l.length>0){const c=s.length+1;r.push(`${c}. REFERENCES`),r.push(""),l.forEach(u=>{r.push(`      ${u}`),r.push("")}),r.push("-".repeat(60)),r.push("")}}const i=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});return r.push(`Exported on: ${i}`),r.push(`Total words: ${n.toLocaleString()}`),r.join(`
`)}async function Fmt(t,e){const r=[];if(r.push(new $r({children:[],spacing:{after:2400}})),r.push(new $r({children:[new Us({text:e.thesisTitle,bold:!0,size:56})],alignment:_n.CENTER,spacing:{after:400}})),e.degreeProgram&&r.push(new $r({children:[new Us({text:e.degreeProgram,size:28,italics:!0})],alignment:_n.CENTER,spacing:{after:800}})),e.authorName&&(r.push(new $r({children:[new Us({text:"Submitted by",size:24})],alignment:_n.CENTER,spacing:{after:100}})),r.push(new $r({children:[new Us({text:e.authorName,bold:!0,size:28})],alignment:_n.CENTER,spacing:{after:400}}))),e.institution&&r.push(new $r({children:[new Us({text:e.institution,size:24})],alignment:_n.CENTER,spacing:{after:200}})),e.supervisor&&r.push(new $r({children:[new Us({text:`Supervisor: ${e.supervisor}`,size:24})],alignment:_n.CENTER,spacing:{after:200}})),e.submissionDate){const i=new Date(e.submissionDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});r.push(new $r({children:[new Us({text:i,size:24})],alignment:_n.CENTER,spacing:{after:400}}))}r.push(new $r({children:[new cX]})),e.includeTableOfContents&&(r.push(new $r({children:[new Us({text:"TABLE OF CONTENTS",bold:!0,size:28})],alignment:_n.CENTER,spacing:{after:400}})),r.push(new $r({children:[new Us({text:"[Update this Table of Contents in Word: Right-click → Update Field]",italics:!0,size:20,color:"888888"})],alignment:_n.CENTER,spacing:{after:200}})),r.push(new gmt("Table of Contents",{hyperlink:!0,headingStyleRange:"1-3"})),r.push(new $r({children:[new cX]})));const n=[...t.chapters].sort((i,o)=>i.order_index-o.order_index);if(n.forEach((i,o)=>{r.push(new $r({text:`${o+1}. ${i.title}`,heading:nM.HEADING_1,spacing:{before:400,after:200}})),i.sections&&i.sections.length>0&&[...i.sections].sort((c,u)=>c.order_index-u.order_index).forEach((c,u)=>{const d=c.title||Wpe[c.type]||c.type;r.push(new $r({text:`${o+1}.${u+1} ${d}`,heading:nM.HEADING_2,spacing:{before:300,after:150}})),c.content&&c.content.trim()?Vpe(c.content).split(`

`).forEach(p=>{p.trim()&&r.push(new $r({children:[new Us({text:p.trim(),size:24})],spacing:{after:200}}))}):r.push(new $r({children:[new Us({text:"[No content yet]",italics:!0,color:"888888",size:24})],spacing:{after:200}}))})}),e.includeLiterature&&t.documents&&t.documents.length>0){const i=Hpe(t.chapters,t.documents),o=zpe(i);o.length>0&&(r.push(new $r({text:`${n.length+1}. References`,heading:nM.HEADING_1,spacing:{before:400,after:200}})),o.forEach(l=>{r.push(new $r({children:[new Us({text:l,size:24})],spacing:{after:120},indent:{left:720,hanging:720}}))}))}const s=new hmt({features:{updateFields:!0},styles:{paragraphStyles:[{id:"Heading1",name:"Heading 1",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:32,bold:!0},paragraph:{spacing:{before:400,after:200}}},{id:"Heading2",name:"Heading 2",basedOn:"Normal",next:"Normal",quickFormat:!0,run:{size:28,bold:!0},paragraph:{spacing:{before:300,after:150}}}]},sections:[{properties:{page:{pageNumbers:e.includePageNumbers?{start:1,formatType:hht.DECIMAL}:void 0}},headers:{default:new ymt({children:[new $r({alignment:_n.LEFT,children:[new Us({text:"Academly.ai",size:18,color:"666666",italics:!0})]})]})},footers:e.includePageNumbers?{default:new vmt({children:[new $r({alignment:_n.CENTER,children:[new Us({children:["Page ",vy.CURRENT," of ",vy.TOTAL_PAGES],size:20})]})]})}:void 0,children:r}]});return await Imt.toBlob(s)}function qpe(t,e){const r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function $mt(t,e){const r="\uFEFF",n=new Blob([r+t],{type:"text/plain;charset=utf-8"});qpe(n,e)}function Bmt({open:t,onOpenChange:e,thesisData:r,defaultAuthorName:n="",defaultInstitution:s="",defaultDegreeProgram:i="",documents:o=[]}){const[l,c]=S.useState("docx"),[u,d]=S.useState(!1),[h,f]=S.useState(""),[p,g]=S.useState(""),[m,v]=S.useState(""),[y,x]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(""),[C,k]=S.useState(!0),[E,M]=S.useState(!0),[z,I]=S.useState(!0);S.useEffect(()=>{if(t&&r){f(r.thesis.title||""),g(n),v(s);const K=r.thesis.degree==="bachelor"?"Bachelor":"Master";x(i||`${K} Thesis`),r.thesis.due_date?N(r.thesis.due_date.split("T")[0]):N(new Date().toISOString().split("T")[0])}},[t,r,n,s,i]);const q=async()=>{if(r){d(!0);try{const K={format:l,thesisTitle:h,authorName:p||void 0,institution:m||void 0,degreeProgram:y||void 0,supervisor:b||void 0,submissionDate:j||void 0,includePageNumbers:C,includeTableOfContents:E,includeLiterature:z},G=z&&o.length>0?{...r,documents:o}:r,Y=h.replace(/[^a-zA-Z0-9äöüÄÖÜß\s-]/g,"_").trim(),H=new Date().toISOString().split("T")[0];switch(l){case"txt":{const $=Lmt(G,K);$mt($,`${Y}_${H}.txt`);break}case"docx":{const $=await Fmt(G,K);qpe($,`${Y}_${H}.docx`);break}case"pdf":{console.warn("PDF export not yet implemented");break}}e(!1)}catch(K){console.error("Export error:",K)}finally{d(!1)}}},A=[{value:"txt",label:"TXT",icon:a.jsx(Ir,{className:"h-5 w-5"}),description:"Plain text, no formatting",disabled:!1},{value:"docx",label:"DOCX",icon:a.jsx(Rxe,{className:"h-5 w-5"}),description:"Word document with styles",disabled:!1},{value:"pdf",label:"PDF",icon:a.jsx(t0e,{className:"h-5 w-5"}),description:"Coming soon",disabled:!0}],U=l==="docx"||l==="pdf";return a.jsx(Vr,{open:t,onOpenChange:e,children:a.jsxs(Rr,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto",children:[a.jsxs(Mr,{children:[a.jsx(Dr,{children:"Export Thesis"}),a.jsx(g0,{children:"Choose export format and customize the template"})]}),a.jsxs("div",{className:"space-y-6 py-4",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Format"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:A.map(K=>a.jsxs("button",{type:"button",onClick:()=>!K.disabled&&c(K.value),disabled:K.disabled,className:Oe("flex flex-col items-center gap-2 p-4 rounded-lg border-2 transition-all",K.disabled&&"opacity-50 cursor-not-allowed",!K.disabled&&l===K.value?"border-primary bg-primary/5":K.disabled?"border-border":"border-border hover:border-primary/50"),children:[a.jsx("div",{className:Oe("p-2 rounded-full",!K.disabled&&l===K.value?"bg-primary text-primary-foreground":"bg-muted"),children:K.icon}),a.jsx("span",{className:"font-medium text-sm",children:K.label}),a.jsx("span",{className:"text-xs text-muted-foreground text-center",children:K.description})]},K.value))})]}),U&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Template Settings"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"thesis-title",className:"text-xs text-muted-foreground",children:"Thesis Title"}),a.jsx(Be,{id:"thesis-title",value:h,onChange:K=>f(K.target.value),placeholder:"Enter thesis title"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"author-name",className:"text-xs text-muted-foreground",children:"Author Name"}),a.jsx(Be,{id:"author-name",value:p,onChange:K=>g(K.target.value),placeholder:"Your name"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"institution",className:"text-xs text-muted-foreground",children:"Institution"}),a.jsx(Be,{id:"institution",value:m,onChange:K=>v(K.target.value),placeholder:"University name"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"degree-program",className:"text-xs text-muted-foreground",children:"Degree / Program"}),a.jsx(Be,{id:"degree-program",value:y,onChange:K=>x(K.target.value),placeholder:"e.g., Master of Science"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"supervisor",className:"text-xs text-muted-foreground",children:"Supervisor"}),a.jsx(Be,{id:"supervisor",value:b,onChange:K=>w(K.target.value),placeholder:"Prof. Dr. Name"})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"submission-date",className:"text-xs text-muted-foreground",children:"Submission Date"}),a.jsx(Be,{id:"submission-date",type:"date",value:j,onChange:K=>N(K.target.value)})]})]})]}),a.jsx(Es,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_e,{className:"text-sm font-medium",children:"Layout Options"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(go,{id:"page-numbers",checked:C,onCheckedChange:K=>k(K===!0)}),a.jsx(_e,{htmlFor:"page-numbers",className:"text-sm font-normal cursor-pointer",children:"Include page numbers"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(go,{id:"toc",checked:E,onCheckedChange:K=>M(K===!0)}),a.jsx(_e,{htmlFor:"toc",className:"text-sm font-normal cursor-pointer",children:"Include table of contents"})]})]})]})]}),a.jsx(Es,{}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(go,{id:"literature",checked:z,onCheckedChange:K=>I(K===!0)}),a.jsx(_e,{htmlFor:"literature",className:"text-sm font-normal cursor-pointer",children:"Auto-generate Literature from citations"})]})]}),a.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx(ve,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),a.jsx(ve,{onClick:q,disabled:u||!r,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"Download"]})})]})]})})}var nP="Popover",[Gpe,Fyt]=Ln(nP,[ff]),wS=ff(),[Umt,Tf]=Gpe(nP),Kpe=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=wS(e),c=S.useRef(null),[u,d]=S.useState(!1),[h,f]=Ps({prop:n,defaultProp:s??!1,onChange:i,caller:nP});return a.jsx(iT,{...l,children:a.jsx(Umt,{scope:e,contentId:Gi(),triggerRef:c,open:h,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>d(!0),[]),onCustomAnchorRemove:S.useCallback(()=>d(!1),[]),modal:o,children:r})})};Kpe.displayName=nP;var Ype="PopoverAnchor",zmt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(Ype,r),i=wS(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return S.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(Mj,{...i,...n,ref:e})});zmt.displayName=Ype;var Xpe="PopoverTrigger",Qpe=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(Xpe,r),i=wS(r),o=jt(e,s.triggerRef),l=a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":rme(s.open),...n,ref:o,onClick:ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(Mj,{asChild:!0,...i,children:l})});Qpe.displayName=Xpe;var jB="PopoverPortal",[Hmt,Wmt]=Gpe(jB,{forceMount:void 0}),Zpe=t=>{const{__scopePopover:e,forceMount:r,children:n,container:s}=t,i=Tf(jB,e);return a.jsx(Hmt,{scope:e,forceMount:r,children:a.jsx(Xn,{present:r||i.open,children:a.jsx(n0,{asChild:!0,container:s,children:n})})})};Zpe.displayName=jB;var Jx="PopoverContent",Jpe=S.forwardRef((t,e)=>{const r=Wmt(Jx,t.__scopePopover),{forceMount:n=r.forceMount,...s}=t,i=Tf(Jx,t.__scopePopover);return a.jsx(Xn,{present:n||i.open,children:i.modal?a.jsx(qmt,{...s,ref:e}):a.jsx(Gmt,{...s,ref:e})})});Jpe.displayName=Jx;var Vmt=Xh("PopoverContent.RemoveScroll"),qmt=S.forwardRef((t,e)=>{const r=Tf(Jx,t.__scopePopover),n=S.useRef(null),s=jt(e,n),i=S.useRef(!1);return S.useEffect(()=>{const o=n.current;if(o)return bT(o)},[]),a.jsx(zj,{as:Vmt,allowPinchZoom:!0,children:a.jsx(eme,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ze(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ze(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Gmt=S.forwardRef((t,e)=>{const r=Tf(Jx,t.__scopePopover),n=S.useRef(!1),s=S.useRef(!1);return a.jsx(eme,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),eme=S.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...h}=t,f=Tf(Jx,r),p=wS(r);return xT(),a.jsx(Bj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(ag,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(aT,{"data-state":rme(f.open),role:"dialog",id:f.contentId,...p,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),tme="PopoverClose",Kmt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=Tf(tme,r);return a.jsx(et.button,{type:"button",...n,ref:e,onClick:ze(t.onClick,()=>s.onOpenChange(!1))})});Kmt.displayName=tme;var Ymt="PopoverArrow",Xmt=S.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,s=wS(r);return a.jsx(oT,{...s,...n,ref:e})});Xmt.displayName=Ymt;function rme(t){return t?"open":"closed"}var Qmt=Kpe,Zmt=Qpe,Jmt=Zpe,nme=Jpe;const egt=Qmt,tgt=Zmt,sme=S.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},s)=>a.jsx(Jmt,{children:a.jsx(nme,{ref:s,align:e,sideOffset:r,className:Oe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));sme.displayName=nme.displayName;function rgt({content:t,documents:e}){const r=S.useMemo(()=>!t||e.length===0?{matched:[],unmatched:[]}:Dmt(t,e),[t,e]),n=r.matched.length+r.unmatched.length;if(n===0)return null;const i=r.unmatched.length===0?"bg-green-500":"bg-yellow-500";return a.jsxs(egt,{children:[a.jsx(tgt,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:o=>o.stopPropagation(),className:"flex items-center gap-1 shrink-0",title:`${r.matched.length}/${n} citations matched`,children:[a.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${i}`}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.matched.length,"/",n]})]})}),a.jsx(sme,{className:"w-80 p-3",align:"start",onClick:o=>o.stopPropagation(),children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Citations in this section"}),r.matched.length>0&&a.jsx("div",{className:"space-y-1",children:r.matched.map((o,l)=>a.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[a.jsx(Gs,{className:"h-3.5 w-3.5 text-green-500 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:o.citation.raw}),o.title&&a.jsx("p",{className:"text-muted-foreground truncate",children:o.title})]})]},l))}),r.unmatched.length>0&&a.jsx("div",{className:"space-y-1",children:r.unmatched.map((o,l)=>a.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[a.jsx(Rs,{className:"h-3.5 w-3.5 text-red-500 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:o.raw}),a.jsx("p",{className:"text-muted-foreground",children:"Not found — add via Citation Manager"})]})]},l))})]})})]})}const jX={intro:"Introduction",problem:"Problem Statement",goal:"Objectives",theory:"Theory",method:"Methodology",results:"Results",findings:"Findings",discussion:"Discussion",conclusion:"Conclusion",literature:"Literature Review",references:"References",other:"Other"},SX={open:"secondary",in_progress:"warning",done:"success"},NX={open:"Open",in_progress:"In Progress",done:"Done"},ngt=["Introduction","Literature Review","Methodology","Findings","Discussion","Conclusion","References"],sgt=()=>{const{user:t,loading:e,researchProfile:r}=Pt(),n=wr(),{toast:s}=vn(),[i,o]=S.useState([]),[l,c]=S.useState(""),[u,d]=S.useState(null),[h,f]=S.useState(0),[p,g]=S.useState([]),[m,v]=S.useState({}),[y,x]=S.useState([]),[b,w]=S.useState(!1),[j,N]=S.useState(!1),[C,k]=S.useState(!1),[E,M]=S.useState(!1),[z,I]=S.useState(!1),[q,A]=S.useState([]),[U,K]=S.useState({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),[G,Y]=S.useState({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),[H,$]=S.useState(""),[L,F]=S.useState(!1),[W,X]=S.useState(null),[oe,le]=S.useState([]);S.useEffect(()=>{!t&&!e&&n("/login")},[t,e,n]),S.useEffect(()=>{t&&(B(),R())},[t]),S.useEffect(()=>{if(l){ee();const ae=i.find(de=>de.id===l);d(ae||null),ae&&Y({title:ae.title,degree:ae.degree,description:ae.description||"",due_date:ae.due_date||"",target_word_count:ae.target_word_count||15e3})}},[l,i]);const B=async()=>{w(!0);try{const{data:ae,error:de}=await be.from("theses").select("id, title, degree, description, due_date, target_word_count, created_at").order("created_at",{ascending:!1});if(de)throw de;o(ae||[])}catch(ae){console.error("Error loading theses:",ae),s({title:"Error",description:"Failed to load theses.",variant:"destructive"})}finally{w(!1)}},R=async()=>{try{const{data:ae,error:de}=await be.from("documents").select("id, title, citation_apa, bib_meta").eq("user_id",t==null?void 0:t.id);if(de)throw de;le(ae||[])}catch(ae){console.error("Error loading documents for citation matching:",ae)}},ee=async()=>{if(l){N(!0);try{const{data:ae,error:de}=await be.from("v_thesis_progress").select("thesis_progress").eq("thesis_id",l).single();de&&de.code!=="PGRST116"?console.error("Error loading thesis progress:",de):f((ae==null?void 0:ae.thesis_progress)||0);const{data:ge,error:we}=await be.from("chapters").select("*").eq("thesis_id",l).is("parent_id",null).order("order_index",{ascending:!0}).order("created_at",{ascending:!0});if(we)throw we;const je=(ge==null?void 0:ge.map(Ae=>Ae.id))||[];if(je.length>0){const{data:Ae,error:fe}=await be.from("v_chapter_progress").select("chapter_id, computed_progress").in("chapter_id",je);fe&&console.error("Error loading chapter progress:",fe);const Ee=(ge==null?void 0:ge.map(Ce=>{var Ge;return{...Ce,computed_progress:((Ge=Ae==null?void 0:Ae.find(dt=>dt.chapter_id===Ce.id))==null?void 0:Ge.computed_progress)||0}}))||[];g(Ee)}else g([]);const{data:Se,error:Ue}=await be.from("progress_log").select("*").eq("thesis_id",l).order("timestamp",{ascending:!1}).limit(10);Ue?console.error("Error loading progress log:",Ue):x(Se||[])}catch(ae){console.error("Error loading thesis data:",ae),s({title:"Error",description:"Failed to load data.",variant:"destructive"})}finally{N(!1)}}},te=async ae=>{try{const{data:de,error:ge}=await be.from("sections").select("*").eq("chapter_id",ae).order("order_index",{ascending:!0}).order("created_at",{ascending:!0});if(ge)throw ge;v(we=>({...we,[ae]:de||[]}))}catch(de){console.error("Error loading sections:",de),s({title:"Error",description:"Failed to load sections.",variant:"destructive"})}},Z=async ae=>{const{data:de,error:ge}=await be.from("v_chapter_progress").select("chapter_id, computed_progress").eq("chapter_id",ae).single();!ge&&de&&g(we=>we.map(je=>je.id===ae?{...je,computed_progress:de.computed_progress}:je))},J=async()=>{if(!U.title.trim()){s({title:"Error",description:"Title is required.",variant:"destructive"});return}try{const{data:ae,error:de}=await be.from("theses").insert({user_id:t==null?void 0:t.id,title:U.title,degree:U.degree,description:U.description||null,due_date:U.due_date||null,target_word_count:U.target_word_count}).select("id").single();if(de)throw de;const{error:ge}=await be.rpc("seed_default_chapters",{p_thesis:ae.id});if(ge)throw ge;s({title:"Success",description:"Thesis created with default chapters."}),K({title:"",degree:"bachelor",description:"",due_date:"",target_word_count:15e3}),k(!1),await B(),c(ae.id)}catch(ae){console.error("Error creating thesis:",ae),s({title:"Error",description:ae.message||"Failed to create thesis.",variant:"destructive"})}},he=async()=>{if(!G.title.trim()){s({title:"Error",description:"Title is required.",variant:"destructive"});return}try{const{error:ae}=await be.from("theses").update({title:G.title,degree:G.degree,description:G.description||null,due_date:G.due_date||null,target_word_count:G.target_word_count}).eq("id",l);if(ae)throw ae;s({title:"Success",description:"Thesis updated successfully."}),M(!1),await B()}catch(ae){console.error("Error updating thesis:",ae),s({title:"Error",description:ae.message||"Failed to update thesis.",variant:"destructive"})}},P=async()=>{try{const{error:ae}=await be.from("theses").delete().eq("id",l);if(ae)throw ae;s({title:"Success",description:"Thesis deleted successfully."}),c(""),d(null),await B()}catch(ae){console.error("Error deleting thesis:",ae),s({title:"Error",description:ae.message||"Failed to delete thesis.",variant:"destructive"})}},ie=async(ae,de,ge)=>{if(l)try{const we=de?p.find(Ue=>Ue.id===de):null,je=ge??((we==null?void 0:we.computed_progress)||0);await be.from("progress_log").insert({thesis_id:l,chapter_id:de||null,completed:je,note:ae});const{data:Se}=await be.from("progress_log").select("*").eq("thesis_id",l).order("timestamp",{ascending:!1}).limit(10);Se&&x(Se)}catch(we){console.error("Error logging activity:",we)}},V=async ae=>{try{const de=p.length>0?Math.max(...p.map(we=>we.order_index)):0,{error:ge}=await be.from("chapters").insert({thesis_id:l,title:ae,order_index:de+10,status:"open"});if(ge)throw ge;s({title:"Success",description:"Chapter added successfully."}),await ie(`Chapter "${ae}" added`,void 0,0),$(""),I(!1),await ee()}catch(de){console.error("Error adding chapter:",de),s({title:"Error",description:de.message||"Failed to add chapter.",variant:"destructive"})}},O=async ae=>{const de=p.find(we=>we.id===ae),ge=(de==null?void 0:de.title)||"Chapter";try{const{error:we}=await be.from("chapters").delete().eq("id",ae);if(we)throw we;s({title:"Success",description:"Chapter deleted successfully."}),await ie(`Chapter "${ge}" removed`),await ee()}catch(we){console.error("Error deleting chapter:",we),s({title:"Error",description:we.message||"Failed to delete chapter.",variant:"destructive"})}},T=async(ae,de)=>{try{const{error:ge}=await be.from("chapters").update({title:de}).eq("id",ae);if(ge)throw ge;g(we=>we.map(je=>je.id===ae?{...je,title:de}:je))}catch(ge){console.error("Error updating chapter title:",ge),s({title:"Error",description:"Failed to update chapter title.",variant:"destructive"})}},D=async(ae,de="other")=>{const ge=p.find(je=>je.id===ae),we=(ge==null?void 0:ge.title)||"Chapter";try{const je=m[ae]||[],Se=je.length>0?Math.max(...je.map(Ae=>Ae.order_index)):0,{error:Ue}=await be.from("sections").insert({chapter_id:ae,type:de,status:"open",content:"",order_index:Se+1});if(Ue)throw Ue;s({title:"Success",description:"Section added."}),await te(ae),await Z(ae),await ie(`Section added to "${we}"`,ae)}catch(je){console.error("Error creating section:",je),s({title:"Error",description:"Failed to create section.",variant:"destructive"})}},ne=async(ae,de)=>{const ge=Object.values(m).flat().find(Ue=>Ue.id===ae),we=ge?p.find(Ue=>Ue.id===ge.chapter_id):null,je=(ge==null?void 0:ge.title)||jX[(ge==null?void 0:ge.type)||"other"],Se=(we==null?void 0:we.title)||"Chapter";try{const{error:Ue}=await be.from("sections").update(de).eq("id",ae);if(Ue)throw Ue;if(ge&&(await te(ge.chapter_id),await Z(ge.chapter_id),de.status&&de.status!==ge.status)){const Ae=de.status==="done"?"completed":de.status==="in_progress"?"in progress":"reopened";await ie(`"${je}" ${Ae} in "${Se}"`,ge.chapter_id)}}catch(Ue){console.error("Error updating section:",Ue),s({title:"Error",description:"Failed to update section.",variant:"destructive"})}},ue=async ae=>{const de=Object.values(m).flat().find(Se=>Se.id===ae);if(!de)return;const ge=p.find(Se=>Se.id===de.chapter_id),we=de.title||jX[de.type],je=(ge==null?void 0:ge.title)||"Chapter";try{const{error:Se}=await be.from("sections").delete().eq("id",ae);if(Se)throw Se;s({title:"Success",description:"Section deleted."}),await te(de.chapter_id),await Z(de.chapter_id),await ie(`"${we}" removed from "${je}"`,de.chapter_id)}catch(Se){console.error("Error deleting section:",Se),s({title:"Error",description:"Failed to delete section.",variant:"destructive"})}},re=ae=>ae+1,pe=(ae,de)=>`${ae+1}.${de+1}`,xe=()=>{const ae=p.map(de=>de.title.toLowerCase());return ngt.filter(de=>!ae.includes(de.toLowerCase()))},ye=ae=>ae?ae.includes("completed")?a.jsx(pl,{className:"h-4 w-4 text-green-500"}):ae.includes("in progress")?a.jsx(s0,{className:"h-4 w-4 text-yellow-500"}):ae.includes("added")?a.jsx(Exe,{className:"h-4 w-4 text-blue-500"}):ae.includes("removed")||ae.includes("reopened")?a.jsx(Axe,{className:"h-4 w-4 text-red-500"}):a.jsx(pD,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(pD,{className:"h-4 w-4 text-muted-foreground"});return e||b?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Thesis Builder"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Manage your thesis with structured chapters and sections."})]})}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Select or Create Thesis"})}),a.jsx($e,{children:a.jsxs("div",{className:"flex gap-4 flex-wrap",children:[a.jsxs("div",{className:"flex-1 min-w-[200px]",children:[a.jsx(_e,{htmlFor:"thesis-select",children:"Existing Thesis"}),a.jsxs(it,{value:l,onValueChange:c,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis..."})}),a.jsx(nt,{children:i.map(ae=>a.jsxs(Te,{value:ae.id,children:[ae.title," (",ae.degree,")"]},ae.id))})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs(Vr,{open:C,onOpenChange:k,children:[a.jsx(dl,{asChild:!0,children:a.jsxs(ve,{children:[a.jsx(sc,{className:"mr-2 h-4 w-4"}),"New Thesis"]})}),a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Create New Thesis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"title",children:"Title *"}),a.jsx(Be,{id:"title",value:U.title,onChange:ae=>K(de=>({...de,title:ae.target.value})),placeholder:"Thesis title"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"degree",children:"Degree"}),a.jsxs(it,{value:U.degree,onValueChange:ae=>K(de=>({...de,degree:ae})),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"description",children:"Description (optional)"}),a.jsx(Wt,{id:"description",value:U.description,onChange:ae=>K(de=>({...de,description:ae.target.value})),placeholder:"Brief description of the thesis"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"due_date",children:"Due Date (optional)"}),a.jsx(Be,{id:"due_date",type:"date",value:U.due_date,onChange:ae=>K(de=>({...de,due_date:ae.target.value}))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"target_word_count",children:"Target Word Count"}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"right",className:"max-w-[260px] text-xs leading-relaxed",children:[a.jsx("p",{className:"font-medium mb-1",children:"Approximate page count (A4, 12pt, 1.5 spacing):"}),a.jsxs("ul",{className:"space-y-0.5",children:[a.jsx("li",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("li",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("li",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("li",{children:"~15,000 words ≈ 55–60 pages"})]})]})]})]}),a.jsx(Be,{id:"target_word_count",type:"number",min:"1000",step:"500",value:U.target_word_count,onChange:ae=>K(de=>({...de,target_word_count:parseInt(ae.target.value)||15e3})),placeholder:"15000"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ve,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),a.jsx(ve,{onClick:J,children:"Create"})]})]})]})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ve,{variant:"outline",size:"icon",onClick:async()=>{if(!u)return;const ae={...m};for(const ge of p)if(!ae[ge.id]){const{data:we}=await be.from("sections").select("*").eq("chapter_id",ge.id).order("order_index");ae[ge.id]=we||[]}const de={thesis:u,chapters:p.map(ge=>({title:ge.title,order_index:ge.order_index,status:ge.status,sections:(ae[ge.id]||[]).map(we=>({title:we.title,type:we.type,content:we.content,status:we.status,word_count:we.word_count,order_index:we.order_index}))}))};X(de),F(!0)},title:"Export Thesis",children:a.jsx(fo,{className:"h-4 w-4"})}),a.jsxs(Vr,{open:E,onOpenChange:M,children:[a.jsx(dl,{asChild:!0,children:a.jsx(ve,{variant:"outline",size:"icon",children:a.jsx(UJ,{className:"h-4 w-4"})})}),a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Edit Thesis"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-title",children:"Title *"}),a.jsx(Be,{id:"edit-title",value:G.title,onChange:ae=>Y(de=>({...de,title:ae.target.value})),placeholder:"Thesis title"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-degree",children:"Degree"}),a.jsxs(it,{value:G.degree,onValueChange:ae=>Y(de=>({...de,degree:ae})),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-description",children:"Description (optional)"}),a.jsx(Wt,{id:"edit-description",value:G.description,onChange:ae=>Y(de=>({...de,description:ae.target.value})),placeholder:"Brief description of the thesis"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"edit-due_date",children:"Due Date (optional)"}),a.jsx(Be,{id:"edit-due_date",type:"date",value:G.due_date,onChange:ae=>Y(de=>({...de,due_date:ae.target.value}))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"edit-target_word_count",children:"Target Word Count"}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"right",className:"max-w-[260px] text-xs leading-relaxed",children:[a.jsx("p",{className:"font-medium mb-1",children:"Approximate page count (A4, 12pt, 1.5 spacing):"}),a.jsxs("ul",{className:"space-y-0.5",children:[a.jsx("li",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("li",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("li",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("li",{children:"~15,000 words ≈ 55–60 pages"})]})]})]})]}),a.jsx(Be,{id:"edit-target_word_count",type:"number",min:"1000",step:"500",value:G.target_word_count,onChange:ae=>Y(de=>({...de,target_word_count:parseInt(ae.target.value)||15e3})),placeholder:"15000"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ve,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),a.jsx(ve,{onClick:he,children:"Save Changes"})]})]})]})]}),a.jsxs(wi,{children:[a.jsx(wo,{asChild:!0,children:a.jsx(ve,{variant:"destructive",size:"icon",children:a.jsx(As,{className:"h-4 w-4"})})}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Thesis?"}),a.jsxs(ti,{children:['This will permanently delete the thesis "',u==null?void 0:u.title,'" and all its chapters and sections. This action cannot be undone.']})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})]})})]}),l&&a.jsxs(a.Fragment,{children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(o0e,{className:"h-5 w-5"}),"Overall Progress"]})}),a.jsx($e,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(h),"%"]})]}),a.jsx(rS,{value:h,className:"h-2"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Me,{children:[a.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(xi,{className:"h-5 w-5"}),"Chapters"]}),a.jsxs(Ore,{children:[a.jsx(Ire,{asChild:!0,children:a.jsxs(ve,{variant:"outline",size:"sm",children:[a.jsx(sc,{className:"mr-2 h-4 w-4"}),"Add Chapter"]})}),a.jsxs(b6,{align:"end",children:[xe().map(ae=>a.jsx(Oy,{onClick:()=>V(ae),children:ae},ae)),xe().length>0&&a.jsx(w6,{}),a.jsxs(Oy,{onClick:()=>I(!0),children:[a.jsx(sc,{className:"mr-2 h-4 w-4"}),"Custom Chapter..."]})]})]})]}),a.jsx($e,{children:j?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Et,{className:"h-6 w-6 animate-spin"})}):p.length===0?a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No chapters yet. Add your first chapter above."}):a.jsx(epe,{type:"multiple",value:q,onValueChange:A,className:"space-y-2",children:p.map((ae,de)=>{var ge;return a.jsxs(oB,{value:ae.id,className:"border rounded-lg px-4",children:[a.jsx(lB,{className:"hover:no-underline",onClick:()=>{m[ae.id]||te(ae.id)},children:a.jsxs("div",{className:"flex items-center justify-between w-full mr-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-muted-foreground font-mono text-sm",children:[re(de),"."]}),a.jsx(Be,{value:ae.title,onChange:we=>{g(je=>je.map(Se=>Se.id===ae.id?{...Se,title:we.target.value}:Se))},onBlur:we=>T(ae.id,we.target.value),onClick:we=>we.stopPropagation(),className:"h-8 w-auto min-w-[150px] font-medium"}),a.jsx(gt,{variant:SX[ae.status],children:NX[ae.status]})]}),a.jsxs("div",{className:"flex items-center gap-2",onClick:we=>we.stopPropagation(),children:[a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(ae.computed_progress||0),"%"]}),a.jsxs(wi,{children:[a.jsx(wo,{asChild:!0,children:a.jsx(ve,{size:"sm",variant:"ghost",children:a.jsx(As,{className:"h-4 w-4"})})}),a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsx(ei,{children:"Delete Chapter?"}),a.jsxs(ti,{children:['This will delete "',ae.title,'" and all its sections. This action cannot be undone.']})]}),a.jsxs(Js,{children:[a.jsx(Is,{children:"Cancel"}),a.jsx(Cs,{onClick:()=>O(ae.id),className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})]})]})]})}),a.jsx(cB,{children:a.jsxs("div",{className:"space-y-4 pt-4",children:[a.jsx("div",{className:"space-y-3",children:(ge=m[ae.id])==null?void 0:ge.map((we,je)=>a.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("span",{className:"text-muted-foreground font-mono text-sm min-w-[40px]",children:pe(de,je)}),a.jsx(Be,{value:we.title||"",onChange:Se=>{v(Ue=>{var Ae;return{...Ue,[ae.id]:((Ae=Ue[ae.id])==null?void 0:Ae.map(fe=>fe.id===we.id?{...fe,title:Se.target.value}:fe))||[]}})},onBlur:Se=>ne(we.id,{title:Se.target.value||null}),placeholder:"Section title (optional)",className:"h-8 flex-1"}),a.jsx(rgt,{content:we.content,documents:oe})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gt,{variant:SX[we.status],children:NX[we.status]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[we.word_count," words"]}),a.jsx("div",{onClick:Se=>Se.stopPropagation(),children:a.jsxs(it,{value:we.status,onValueChange:Se=>ne(we.id,{status:Se}),children:[a.jsx(rt,{className:"w-32 h-8",children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"open",children:"Open"}),a.jsx(Te,{value:"in_progress",children:"In Progress"}),a.jsx(Te,{value:"done",children:"Done"})]})]})}),a.jsx(ve,{size:"sm",variant:"ghost",onClick:Se=>{Se.stopPropagation(),ue(we.id)},children:a.jsx(As,{className:"h-4 w-4"})})]})]}),a.jsx(Wt,{value:we.content,onChange:Se=>{const Ue=Se.target.value;v(Ae=>{var fe;return{...Ae,[ae.id]:((fe=Ae[ae.id])==null?void 0:fe.map(Ee=>Ee.id===we.id?{...Ee,content:Ue}:Ee))||[]}})},onBlur:Se=>ne(we.id,{content:Se.currentTarget.value}),placeholder:"Section content...",className:"min-h-[120px]"})]},we.id))}),a.jsxs(ve,{variant:"outline",onClick:()=>D(ae.id),className:"w-full",children:[a.jsx(sc,{className:"mr-2 h-4 w-4"}),"Add Section"]})]})})]},ae.id)})})})]})}),a.jsx("div",{children:a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Ir,{className:"h-5 w-5"}),"Recent Activities"]})}),a.jsx($e,{children:a.jsx("div",{className:"space-y-3",children:y.length===0?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activities yet"}):y.map(ae=>a.jsxs("div",{className:"flex items-start gap-3 py-2",children:[ye(ae.note),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:ae.note||`${Math.round(ae.completed)}% completed`}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(ae.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]},ae.id))})})]})})]})]}),a.jsx(Vr,{open:z,onOpenChange:I,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Add Custom Chapter"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"chapter-title",children:"Chapter Title *"}),a.jsx(Be,{id:"chapter-title",value:H,onChange:ae=>$(ae.target.value),placeholder:"e.g., Appendix, Acknowledgements"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(ve,{variant:"outline",onClick:()=>{$(""),I(!1)},children:"Cancel"}),a.jsx(ve,{onClick:()=>{H.trim()&&V(H.trim())},disabled:!H.trim(),children:"Add Chapter"})]})]})]})}),a.jsx(Bmt,{open:L,onOpenChange:F,thesisData:W,defaultAuthorName:(r==null?void 0:r.nickname)||"",defaultInstitution:(r==null?void 0:r.university)||"",defaultDegreeProgram:r!=null&&r.degree_type?`${r.degree_type==="bachelor"?"Bachelor":"Master"} Thesis`:"",documents:oe})]})}):null};function igt(){return a.jsx(FD,{to:"/topic-explorer/ideas",replace:!0})}function agt(){const{toast:t}=vn(),e=wr(),{checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),[o,l]=S.useState("EN"),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState(!1),[g,m]=S.useState([]),[v,y]=S.useState(null),[x,b]=S.useState({title:"",introduction:"",problemStatement:"",objectives:""}),w=async()=>{if(!r()){i(!0);return}p(!0);try{const{data:{session:C}}=await be.auth.getSession();if(!(C!=null&&C.access_token))throw new Error("No authentication token found");const E=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_explorer",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C.access_token}`},body:JSON.stringify({action:"suggest",topic:c,context:d,language:o})})).json();if(E.error)throw new Error(E.error);const M=(E.suggestions||[]).map((z,I)=>{var q;return{id:((q=crypto.randomUUID)==null?void 0:q.call(crypto))||String(I),title:z.title,researchQuestions:z.research_questions??z.researchQuestions??[],method:z.method,relevance:z.relevance,sources:Array.isArray(z.sources)?z.sources:[]}});m(M)}catch(C){console.error("Error generating suggestions:",C),t({title:"Generation Error",description:"The suggestions could not be generated.",variant:"destructive"})}finally{p(!1)}},j=async C=>{y(C);try{const{data:{session:k}}=await be.auth.getSession();if(!(k!=null&&k.access_token))throw new Error("No authentication token found");const E={action:"structure",selection:C,language:o,original_topic:c,original_context:d,save:!0},z=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_explorer",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k.access_token}`},body:JSON.stringify(E)})).json();if(z.error)throw new Error(z.error);const I=z.structure||z;b({title:I.title||C.title,introduction:I.introduction||"",problemStatement:I.problem||"",objectives:I.objectives||""}),z.summary_id&&t({title:"Saved",description:"Saved to My Library under My Topic Explorations."})}catch(k){console.error("Error generating structure:",k),t({title:"Structure Error",description:"The structure could not be generated.",variant:"destructive"})}},N=C=>{navigator.clipboard.writeText(C).then(()=>{t({title:"Copied!",description:"Text has been copied to clipboard."})})};return a.jsxs(lr,{showSidebar:!0,pageTitle:"Topic Ideas",children:[a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Topic Ideas"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate structured topic suggestions for your research"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-5 w-5 text-primary"}),"Generate Topic Suggestions"]}),a.jsx(fn,{children:"Enter your basic idea and receive structured suggestions"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Working Title / Topic Idea"}),a.jsx(Be,{placeholder:"e.g., AI in Education",value:c,onChange:C=>u(C.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(R0,{type:"single",value:o,onValueChange:C=>C&&l(C),children:[a.jsx(hl,{value:"DE",children:"DE"}),a.jsx(hl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Description / Context"}),a.jsx(Wt,{placeholder:"Describe program, scope, methodology, context...",value:d,onChange:C=>h(C.target.value),rows:3})]}),a.jsx(ve,{onClick:w,disabled:!c.trim()||f,className:"w-full",children:f?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Suggestions..."]}):"Generate Suggestions"})]})]}),g.length>0&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Topic Suggestions"}),a.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:g.map(C=>a.jsxs(Me,{className:"hover:border-primary/50 transition-colors",children:[a.jsx(qe,{children:a.jsx(Je,{className:"text-lg",children:C.title})}),a.jsxs($e,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Research Questions:"}),a.jsx("ul",{className:"text-sm text-muted-foreground space-y-1",children:(C.researchQuestions||[]).map((k,E)=>a.jsxs("li",{children:["• ",k]},E))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Method:"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:C.method})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Relevance:"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:C.relevance})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm text-foreground mb-1",children:"Initial Sources:"}),a.jsx("div",{className:"space-y-1",children:(C.sources||[]).map((k,E)=>a.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:k.title}),k.doi&&a.jsxs("span",{className:"block",children:["DOI: ",k.doi]}),k.isbn&&a.jsxs("span",{className:"block",children:["ISBN: ",k.isbn]})]},E))})]}),a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx(ve,{size:"sm",onClick:()=>j(C),className:"flex-1",children:"Select"}),a.jsx(ve,{size:"sm",variant:"outline",onClick:()=>N(JSON.stringify(C,null,2)),children:a.jsx(yn,{className:"h-4 w-4"})})]})]})]},C.id))})]}),v&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(xi,{className:"h-5 w-5 text-primary"}),"Basic Structure"]}),a.jsx(fn,{children:"Your topic idea has been saved to My Library under My Topic Explorations."})]}),a.jsx($e,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs(td,{children:[a.jsx(pl,{className:"h-4 w-4"}),a.jsx(z8,{children:"Saved successfully"}),a.jsxs(rd,{className:"flex items-center justify-between",children:[a.jsx("span",{children:"Your topic idea is available in My Library. You can continue by creating an outline."}),a.jsxs(ve,{size:"sm",variant:"outline",className:"ml-4 shrink-0",onClick:()=>e("/topic-explorer/outline"),children:["Go to Outline Generator",a.jsx(uc,{className:"h-4 w-4 ml-1"})]})]})]}),a.jsx("div",{className:"bg-muted/30 p-6 rounded-lg",children:a.jsxs("div",{className:"space-y-4 text-foreground",children:[a.jsx("div",{children:a.jsx("h2",{className:"text-xl font-bold mb-2",children:x.title})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Introduction:"}),a.jsx("p",{className:"whitespace-pre-wrap mb-4",children:x.introduction})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Problem Statement:"}),a.jsx("p",{className:"whitespace-pre-wrap mb-4",children:x.problemStatement})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Objectives:"}),a.jsx("p",{className:"whitespace-pre-wrap",children:x.objectives})]}),(v==null?void 0:v.researchQuestions)&&v.researchQuestions.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Research Questions:"}),a.jsx("ul",{className:"space-y-1",children:v.researchQuestions.map((C,k)=>a.jsxs("li",{className:"whitespace-pre-wrap",children:["• ",C]},k))})]}),(v==null?void 0:v.method)&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Methodology:"}),a.jsx("p",{className:"whitespace-pre-wrap",children:v.method})]}),(v==null?void 0:v.sources)&&v.sources.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Literature Tips:"}),a.jsx("ol",{className:"list-decimal list-inside space-y-2",children:v.sources.map((C,k)=>a.jsxs("li",{className:"text-sm",children:[a.jsx("span",{children:C.title}),C.doi&&a.jsxs("span",{className:"block text-muted-foreground ml-5",children:["DOI: ",C.doi]}),C.isbn&&a.jsxs("span",{className:"block text-muted-foreground ml-5",children:["ISBN: ",C.isbn]})]},k))})]})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(ve,{variant:"outline",onClick:()=>{let C=`${x.title}

Introduction:
${x.introduction}

Problem Statement:
${x.problemStatement}

Objectives:
${x.objectives}`;v!=null&&v.researchQuestions&&v.researchQuestions.length>0&&(C+=`

Research Questions:
${v.researchQuestions.map((k,E)=>`${E+1}. ${k}`).join(`
`)}`),v!=null&&v.method&&(C+=`

Methodology:
${v.method}`),v!=null&&v.sources&&v.sources.length>0&&(C+=`

Literature Tips:
${v.sources.map((k,E)=>`${E+1}. ${k.title}${k.doi?` (DOI: ${k.doi})`:""}${k.isbn?` (ISBN: ${k.isbn})`:""}`).join(`
`)}`),N(C)},children:[a.jsx(yn,{className:"h-4 w-4 mr-2"}),"Copy"]})})]})})]})]}),a.jsx(Tc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]})}const SB=Bfe,NB=eB,AB=rB;function ogt(){const{toast:t}=vn(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState("bachelor"),[u,d]=S.useState(""),[h,f]=S.useState(!1),[p,g]=S.useState(null),[m,v]=S.useState(""),[y,x]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(""),[C,k]=S.useState(!1),[E,M]=S.useState([]),[z,I]=S.useState(""),[q,A]=S.useState(!0);S.useEffect(()=>{U()},[]);const U=async()=>{try{const{data:{session:H}}=await be.auth.getSession();if(!H)return;const{data:$,error:L}=await be.from("topic_explorations").select("id, title, research_questions, introduction, problem_statement, objectives, method, created_at").eq("user_id",H.user.id).eq("feature_type","topic_ideas").order("created_at",{ascending:!1});if(L)throw L;M($||[])}catch(H){console.error("Error loading explorations:",H)}finally{A(!1)}},K=()=>{if(!z)return;const H=E.find($=>$.id===z);if(H){if(s(H.title||""),H.research_questions){const $=Array.isArray(H.research_questions)?H.research_questions:[];o($.join(`
`))}H.introduction&&v(H.introduction),H.problem_statement&&x(H.problem_statement),H.objectives&&w(H.objectives),H.method&&N(H.method),(H.introduction||H.problem_statement||H.objectives||H.method)&&k(!0),t({title:"Imported",description:"Data has been imported"})}},G=async()=>{if(n.trim()){f(!0);try{const{data:{session:H}}=await be.auth.getSession();if(!(H!=null&&H.access_token))throw new Error("No authentication token found");const L=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${H.access_token}`},body:JSON.stringify({action:"outline",title:n.trim(),research_questions:i.split(`
`).filter(F=>F.trim()),language:e,degree_type:l,target_word_count:u?parseInt(u):void 0,topic_context:{introduction:m.trim()||void 0,problem_statement:y.trim()||void 0,objectives:b.trim()||void 0,methodology:j.trim()||void 0}})})).json();if(L.error)throw new Error(L.error);g(L.outline),t({title:"Outline Generated",description:"Your outline has been saved to My Library under My Topic Explorations."})}catch(H){console.error("Error generating outline:",H),t({title:"Error",description:"The outline could not be generated.",variant:"destructive"})}finally{f(!1)}}},Y=()=>{if(!p)return;let H=`${p.title}

`;H+=`TABLE OF CONTENTS

`,p.chapters.forEach($=>{H+=`${$.number} ${$.title}`,$.estimated_pages&&(H+=` (~${$.estimated_pages} pages)`),H+=`
`,$.subchapters&&$.subchapters.forEach(L=>{H+=`  ${L.number} ${L.title}`,L.estimated_pages&&(H+=` (~${L.estimated_pages} pages)`),H+=`
`})}),H+=`
Estimated Total Pages: ~${p.total_estimated_pages}`,p.notes&&(H+=`

Notes:
${p.notes}`),navigator.clipboard.writeText(H),t({title:"Copied!",description:"Outline has been copied to clipboard."})};return a.jsx(lr,{showSidebar:!0,pageTitle:"Outline Generator",children:a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Outline Generator"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Create a detailed outline for your scientific work"})]}),a.jsx(Me,{children:a.jsx($e,{className:"pt-6",children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(it,{value:z,onValueChange:I,children:[a.jsx(rt,{className:"flex-1",children:a.jsx(at,{placeholder:q?"Loading...":"Select a topic..."})}),a.jsx(nt,{children:E.map(H=>a.jsx(Te,{value:H.id,children:H.title},H.id))})]}),a.jsx(ve,{onClick:K,disabled:!z,variant:"secondary",children:"Import Topic"})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Ir,{className:"h-5 w-5 text-primary"}),"Generate Outline"]}),a.jsx(fn,{children:"Create a detailed outline for your scientific work"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Be,{placeholder:"e.g., AI in Education",value:n,onChange:H=>s(H.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(R0,{type:"single",value:e,onValueChange:H=>H&&r(H),children:[a.jsx(hl,{value:"DE",children:"DE"}),a.jsx(hl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Wt,{placeholder:"One question per line...",value:i,onChange:H=>o(H.target.value),rows:3})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Degree Type"}),a.jsxs(it,{value:l,onValueChange:c,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"}),a.jsx(Te,{value:"phd",children:"PhD / Dissertation"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Target Word Count (optional)"}),a.jsx(Si,{children:a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(Hm,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),a.jsxs(Vt,{side:"top",className:"max-w-xs text-xs space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"Approximate page equivalents:"}),a.jsx("p",{children:"~3,000 words ≈ 10–12 pages"}),a.jsx("p",{children:"~5,000 words ≈ 18–20 pages"}),a.jsx("p",{children:"~10,000 words ≈ 35–40 pages"}),a.jsx("p",{children:"~15,000 words ≈ 55–60 pages"}),a.jsx("p",{className:"text-muted-foreground pt-1",children:"Based on ~275 words/page (A4, 12pt, 1.5 spacing)"})]})]})})]}),a.jsx(Be,{type:"number",placeholder:"e.g., 15000",value:u,onChange:H=>d(H.target.value)})]})]}),a.jsxs(SB,{open:C,onOpenChange:k,children:[a.jsx(NB,{asChild:!0,children:a.jsxs(ve,{variant:"ghost",className:"w-full justify-between p-3 h-auto border border-dashed border-border hover:bg-muted/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(jo,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:e==="DE"?"Erweiterter Kontext (optional)":"Advanced Context (optional)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e==="DE"?"Für bessere Ergebnisse":"For better results"}),a.jsx(ad,{className:`h-4 w-4 transition-transform ${C?"rotate-180":""}`})]})]})}),a.jsxs(AB,{className:"pt-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Einleitung":"Introduction"}),a.jsx(Wt,{placeholder:e==="DE"?"Kurze Einführung in das Thema...":"Brief introduction to the topic...",value:m,onChange:H=>v(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Problemstellung":"Problem Statement"}),a.jsx(Wt,{placeholder:e==="DE"?"Das Forschungsproblem...":"The research problem...",value:y,onChange:H=>x(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Ziele (ein Ziel pro Zeile)":"Objectives (one per line)"}),a.jsx(Wt,{placeholder:e==="DE"?`Ziel 1
Ziel 2
Ziel 3`:`Objective 1
Objective 2
Objective 3`,value:b,onChange:H=>w(H.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Methodischer Ansatz":"Methodology"}),a.jsx(Wt,{placeholder:e==="DE"?"z.B. RCT, Qualitative Interviews, Systematic Review...":"e.g., RCT, Qualitative Interviews, Systematic Review...",value:j,onChange:H=>N(H.target.value),rows:2})]})]})]}),a.jsx(ve,{onClick:G,disabled:!n.trim()||h,className:"w-full",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Outline..."]}):"Generate Outline"})]})]}),p&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Je,{children:p.title}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:Y,children:[a.jsx(yn,{className:"h-4 w-4 mr-2"}),"Copy"]})]}),a.jsxs(fn,{children:["Estimated pages: ~",p.total_estimated_pages]})]}),a.jsxs($e,{children:[a.jsx(epe,{type:"multiple",className:"w-full",children:p.chapters.map((H,$)=>a.jsxs(oB,{value:`chapter-${$}`,children:[a.jsx(lB,{className:"hover:no-underline",children:a.jsxs("div",{className:"flex items-center gap-3 text-left",children:[a.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:H.number}),a.jsx("span",{className:"font-medium",children:H.title}),H.estimated_pages&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["(~",H.estimated_pages," p.)"]})]})}),a.jsx(cB,{children:a.jsxs("div",{className:"pl-8 space-y-3",children:[H.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:H.description}),H.subchapters&&H.subchapters.length>0&&a.jsx("div",{className:"space-y-2",children:H.subchapters.map((L,F)=>a.jsxs("div",{className:"flex items-start gap-3 py-1",children:[a.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:L.number}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium",children:L.title}),L.estimated_pages&&a.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["(~",L.estimated_pages," p.)"]}),L.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:L.description})]})]},F))})]})})]},$))}),p.notes&&a.jsxs("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg",children:[a.jsx("h4",{className:"font-medium text-sm mb-2",children:"Notes"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:p.notes})]})]})]})]})})}function lgt(){const{toast:t}=vn(),[e,r]=S.useState("EN"),[n,s]=S.useState(""),[i,o]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(!1),[h,f]=S.useState(null),[p,g]=S.useState(""),[m,v]=S.useState(""),[y,x]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(!1),[C,k]=S.useState(""),[E,M]=S.useState(!1),[z,I]=S.useState([]),[q,A]=S.useState(new Set),[U,K]=S.useState([]),[G,Y]=S.useState(""),[H,$]=S.useState(!0);S.useEffect(()=>{L()},[]);const L=async()=>{try{const{data:{session:R}}=await be.auth.getSession();if(!R)return;const{data:ee,error:te}=await be.from("topic_explorations").select("id, title, research_questions, outline_json, introduction, problem_statement, objectives, method, created_at").eq("user_id",R.user.id).eq("feature_type","topic_ideas").order("created_at",{ascending:!1});if(te)throw te;K(ee||[])}catch(R){console.error("Error loading explorations:",R)}finally{$(!1)}},F=()=>{if(!G)return;const R=U.find(ee=>ee.id===G);if(R){if(s(R.title||""),R.research_questions){const ee=Array.isArray(R.research_questions)?R.research_questions:[];o(ee.join(`
`))}if(R.outline_json){const ee=R.outline_json;if(ee.chapters){const te=ee.chapters.map(Z=>`${Z.number} ${Z.title}`).join(`
`);c(te)}}R.introduction&&g(R.introduction),R.problem_statement&&v(R.problem_statement),R.objectives&&x(R.objectives),R.method&&w(R.method),(R.introduction||R.problem_statement||R.objectives||R.method)&&N(!0),t({title:"Imported",description:"Data has been imported"})}},W=async()=>{var R,ee;if(n.trim()){d(!0);try{const{data:{session:te}}=await be.auth.getSession();if(!(te!=null&&te.access_token))throw new Error("No authentication token found");const J=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${te.access_token}`},body:JSON.stringify({action:"keywords",title:n.trim(),research_questions:i.split(`
`).filter(he=>he.trim()),outline:l.trim()||void 0,language:e,topic_context:{introduction:p.trim()||void 0,problem_statement:m.trim()||void 0,objectives:y.trim()||void 0,methodology:b.trim()||void 0}})})).json();if(J.error)throw new Error(J.error);f(J.keywords),((ee=(R=J.keywords)==null?void 0:R.keyword_combinations)==null?void 0:ee.length)>0&&k(J.keywords.keyword_combinations[0].combination),t({title:"Keywords Generated",description:"The literature keywords have been successfully generated."})}catch(te){console.error("Error generating keywords:",te),t({title:"Error",description:"The keywords could not be generated.",variant:"destructive"})}finally{d(!1)}}},X=R=>{navigator.clipboard.writeText(R),t({title:"Copied!",description:"Text has been copied to clipboard."})},oe=()=>{if(!h)return;const R=h.keyword_combinations||[],ee=h.known_authors||[],te=h.known_works||[],Z=h.database_suggestions||[];let J=`LITERATURE KEYWORDS

`;J+=`Search Combinations:
`,R.forEach(he=>{J+=`- ${he.combination} (${he.purpose})
`}),J+=`
Known Authors:
`,ee.forEach(he=>{J+=`- ${he.name}: ${he.relevance}
`}),J+=`
Known Works:
`,te.forEach(he=>{J+=`- ${he.title}`,he.author&&(J+=` (${he.author}`),he.year&&(J+=`, ${he.year}`),he.author&&(J+=")"),J+=`
`}),J+=`
Database Suggestions:
`,J+=Z.join(", ")+`

`,J+=`Search Tips:
`,J+=h.search_tips||"",X(J)},le=async()=>{if(C.trim()){M(!0),I([]);try{const{data:{session:R}}=await be.auth.getSession();if(!(R!=null&&R.access_token))throw new Error("No authentication token found");const te=await(await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/topic_research_tools",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R.access_token}`},body:JSON.stringify({action:"search_literature",keywords:C.trim()})})).json();if(te.error)throw new Error(te.error);I(te.results||[]),(te.results||[]).length===0&&t({title:"No results found",description:"Try different keywords."})}catch(R){console.error("Error searching literature:",R),t({title:"Error",description:"Literature search failed.",variant:"destructive"})}finally{M(!1)}}},B=R=>{A(ee=>{const te=new Set(ee);return te.has(R)?te.delete(R):te.add(R),te})};return a.jsx(lr,{showSidebar:!0,pageTitle:"Literature Keywords",children:a.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Literature Keywords"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Generate search terms and find relevant literature for your topic"})]}),a.jsx(Me,{children:a.jsx($e,{className:"pt-6",children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(it,{value:G,onValueChange:Y,children:[a.jsx(rt,{className:"flex-1",children:a.jsx(at,{placeholder:H?"Loading...":"Select a topic..."})}),a.jsx(nt,{children:U.map(R=>a.jsx(Te,{value:R.id,children:R.title},R.id))})]}),a.jsx(ve,{onClick:F,disabled:!G,variant:"secondary",children:"Import Topic"})]})]})})}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(al,{className:"h-5 w-5 text-primary"}),"Find Literature Keywords"]}),a.jsx(fn,{children:"Generate search terms and find relevant literature for your topic"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Title / Topic *"}),a.jsx(Be,{placeholder:"e.g., AI in Education",value:n,onChange:R=>s(R.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Language"}),a.jsxs(R0,{type:"single",value:e,onValueChange:R=>R&&r(R),children:[a.jsx(hl,{value:"DE",children:"DE"}),a.jsx(hl,{value:"EN",children:"EN"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Research Questions (optional)"}),a.jsx(Wt,{placeholder:"One question per line...",value:i,onChange:R=>o(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Outline (optional)"}),a.jsx(Wt,{placeholder:"Chapter structure or topic overview...",value:l,onChange:R=>c(R.target.value),rows:4})]}),a.jsxs(SB,{open:j,onOpenChange:N,children:[a.jsx(NB,{asChild:!0,children:a.jsxs(ve,{variant:"ghost",className:"w-full justify-between p-3 h-auto border border-dashed border-border hover:bg-muted/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(jo,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-medium",children:e==="DE"?"Erweiterter Kontext (optional)":"Advanced Context (optional)"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e==="DE"?"Für bessere Ergebnisse":"For better results"}),a.jsx(ad,{className:`h-4 w-4 transition-transform ${j?"rotate-180":""}`})]})]})}),a.jsxs(AB,{className:"pt-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Einleitung":"Introduction"}),a.jsx(Wt,{placeholder:e==="DE"?"Kurze Einführung in das Thema...":"Brief introduction to the topic...",value:p,onChange:R=>g(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Problemstellung":"Problem Statement"}),a.jsx(Wt,{placeholder:e==="DE"?"Das Forschungsproblem...":"The research problem...",value:m,onChange:R=>v(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Ziele (ein Ziel pro Zeile)":"Objectives (one per line)"}),a.jsx(Wt,{placeholder:e==="DE"?`Ziel 1
Ziel 2
Ziel 3`:`Objective 1
Objective 2
Objective 3`,value:y,onChange:R=>x(R.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:e==="DE"?"Methodischer Ansatz":"Methodology"}),a.jsx(Wt,{placeholder:e==="DE"?"z.B. RCT, Qualitative Interviews, Systematic Review...":"e.g., RCT, Qualitative Interviews, Systematic Review...",value:b,onChange:R=>w(R.target.value),rows:2})]})]})]}),a.jsx(ve,{onClick:W,disabled:!n.trim()||u,className:"w-full",children:u?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating Keywords..."]}):"Generate Keywords"})]})]}),h&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Results"}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:oe,children:[a.jsx(yn,{className:"h-4 w-4 mr-2"}),"Copy All"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4"}),"Search Combinations"]})}),a.jsx($e,{children:a.jsx("div",{className:"space-y-2",children:(h.keyword_combinations||[]).map((R,ee)=>a.jsxs("div",{className:"flex items-start justify-between gap-2 p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.combination),children:[a.jsxs("div",{children:[a.jsx("code",{className:"text-sm font-medium",children:R.combination}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:R.purpose})]}),a.jsx(gt,{variant:"outline",className:"text-xs shrink-0",children:R.language})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(Ij,{className:"h-4 w-4"}),"Known Authors"]})}),a.jsx($e,{children:a.jsx("div",{className:"space-y-2",children:(h.known_authors||[]).map((R,ee)=>a.jsxs("div",{className:"p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.name),children:[a.jsx("span",{className:"font-medium text-sm",children:R.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:R.relevance})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsxs(Je,{className:"text-base flex items-center gap-2",children:[a.jsx(xi,{className:"h-4 w-4"}),"Known Works"]})}),a.jsx($e,{children:a.jsx("div",{className:"space-y-2",children:(h.known_works||[]).map((R,ee)=>a.jsxs("div",{className:"p-2 bg-muted/50 rounded-md cursor-pointer hover:bg-muted",onClick:()=>X(R.title),children:[a.jsx("span",{className:"font-medium text-sm",children:R.title}),(R.author||R.year)&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.author,R.year&&` (${R.year})`]}),R.relevance&&a.jsx("p",{className:"text-xs text-muted-foreground italic mt-1",children:R.relevance})]},ee))})})]}),a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"text-base",children:"Recommended Databases"})}),a.jsx($e,{children:a.jsx("div",{className:"flex flex-wrap gap-2",children:(h.database_suggestions||[]).map((R,ee)=>a.jsx(gt,{variant:"secondary",children:R},ee))})})]})]}),h.search_tips&&a.jsxs(Me,{children:[a.jsx(qe,{className:"pb-3",children:a.jsx(Je,{className:"text-base",children:"Search Tips"})}),a.jsx($e,{children:a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:h.search_tips})})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(xi,{className:"h-5 w-5 text-primary"}),"Search Real Literature"]}),a.jsx(fn,{children:"Search CrossRef and OpenAlex for real academic papers"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Be,{placeholder:"e.g., ITIL service transition challenges",value:C,onChange:R=>k(R.target.value),onKeyDown:R=>R.key==="Enter"&&le(),className:"flex-1"}),a.jsx(ve,{onClick:le,disabled:!C.trim()||E,children:E?a.jsx(Et,{className:"h-4 w-4 animate-spin"}):a.jsx(al,{className:"h-4 w-4"})})]}),z.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[z.length," results found"]}),z.map((R,ee)=>{var te;return a.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-2 hover:bg-muted/30 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("h4",{className:"font-medium text-sm leading-snug flex-1",children:R.title}),a.jsxs("div",{className:"flex gap-1 shrink-0 flex-wrap justify-end",children:[R.is_open_access&&a.jsx(gt,{className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Open Access"}),a.jsx(gt,{variant:"outline",className:"text-xs",children:R.source==="crossref"?"CrossRef":"OpenAlex"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[((te=R.authors)==null?void 0:te.length)>0&&a.jsxs("span",{children:[R.authors.slice(0,3).join(", "),R.authors.length>3?" et al.":""]}),R.year&&a.jsx("span",{children:R.year}),R.journal&&a.jsx("span",{className:"italic",children:R.journal})]}),R.abstract&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:q.has(ee)?R.abstract:R.abstract.substring(0,150)+"..."}),a.jsx("button",{onClick:()=>B(ee),className:"text-xs text-primary hover:underline mt-1",children:q.has(ee)?"Show less":"Show more"})]}),a.jsxs("div",{className:"flex gap-2 pt-1 flex-wrap",children:[R.doi&&a.jsxs(ve,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>X(R.doi),children:[a.jsx(yn,{className:"h-3 w-3 mr-1"}),"Copy DOI"]}),R.url&&a.jsx(ve,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>window.open(R.url,"_blank"),children:"View"})]})]},ee)})]})]})]})]})})}var sP="Switch",[cgt,$yt]=Ln(sP),[ugt,dgt]=cgt(sP),ime=S.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...h}=t,[f,p]=S.useState(null),g=jt(e,b=>p(b)),m=S.useRef(!1),v=f?d||!!f.closest("form"):!0,[y,x]=Ps({prop:s,defaultProp:i??!1,onChange:u,caller:sP});return a.jsxs(ugt,{scope:r,checked:y,disabled:l,children:[a.jsx(et.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":cme(y),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:g,onClick:ze(t.onClick,b=>{x(w=>!w),v&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})}),v&&a.jsx(lme,{control:f,bubbles:!m.current,name:n,value:c,checked:y,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});ime.displayName=sP;var ame="SwitchThumb",ome=S.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=dgt(ame,r);return a.jsx(et.span,{"data-state":cme(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});ome.displayName=ame;var hgt="SwitchBubbleInput",lme=S.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...s},i)=>{const o=S.useRef(null),l=jt(o,i),c=O8(r),u=qF(e);return S.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&p){const g=new Event("click",{bubbles:n});p.call(d,r),d.dispatchEvent(g)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});lme.displayName=hgt;function cme(t){return t?"checked":"unchecked"}var ume=ime,fgt=ome;const V1=S.forwardRef(({className:t,...e},r)=>a.jsx(ume,{className:Oe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:r,children:a.jsx(fgt,{className:Oe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));V1.displayName=ume.displayName;function pgt(t,e){if(!t.trim())return{pages:[],error:"Please enter page numbers"};const r=new Set,n=t.split(",").map(s=>s.trim()).filter(s=>s.length>0);try{for(const s of n)if(s.includes("-")){const[i,o]=s.split("-").map(l=>parseInt(l.trim()));if(isNaN(i)||isNaN(o)||i<1||o>e||i>o)return{pages:[],error:`Invalid range: ${s}`};for(let l=i;l<=o;l++)r.add(l)}else{const i=parseInt(s);if(isNaN(i)||i<1||i>e)return{pages:[],error:`Invalid page: ${s}`};r.add(i)}return{pages:Array.from(r).sort((s,i)=>s-i)}}catch{return{pages:[],error:"Invalid page format"}}}function mgt(){const{user:t,loading:e,checkStudentPoints:r,studentPoints:n}=Pt(),[s,i]=S.useState(!1),o=wr(),[l,c]=S.useState([]),[u,d]=S.useState(!0),[h,f]=S.useState(null),[p,g]=S.useState(""),[m,v]=S.useState([]),[y,x]=S.useState(""),[b,w]=S.useState(""),[j,N]=S.useState(!0),[C,k]=S.useState(!0),[E,M]=S.useState(!1),[z,I]=S.useState(null);S.useEffect(()=>{!t&&!e&&o("/login")},[t,e,o]),S.useEffect(()=>{t&&q()},[t]),S.useEffect(()=>{if(h){const Y=pgt(p,h.page_count||0);if(v(Y.pages||[]),x(Y.error||""),Y.pages&&Y.pages.length>0){const H=A(Y.pages);w(`${h.title} – Excerpt (${H})`)}}},[p,h]);const q=async()=>{if(t){d(!0);try{const{data:Y,error:H}=await be.from("documents").select("id, title, page_count, storage_path").eq("user_id",t.id).not("page_count","is",null).order("created_at",{ascending:!1});if(H){console.error("Error loading documents:",H),jb({title:"Error",description:"Documents could not be loaded",variant:"destructive"});return}c(Y||[])}catch(Y){console.error("Error in loadDocuments:",Y)}finally{d(!1)}}},A=Y=>{if(Y.length===0)return"";const H=[];let $=Y[0],L=Y[0];for(let F=1;F<Y.length;F++)Y[F]===L+1?L=Y[F]:($===L?H.push($.toString()):H.push(`${$}-${L}`),$=L=Y[F]);return $===L?H.push($.toString()):H.push(`${$}-${L}`),H.join(", ")},U=async()=>{if(!r()){i(!0);return}if(!(!h||m.length===0||y)){M(!0),jb({title:"Extract is being generated...",description:"Please wait a moment"});try{const{data:Y,error:H}=await be.functions.invoke("pdf_slicer",{body:{document_id:h.id,pages:m,new_title:b,keep_citation:j,copy_metadata:C}});if(H)throw H;if(Y.success)jb({title:"Successfully created",description:"Your PDF extract has been successfully created"}),I(Y.document),await q();else throw new Error(Y.error||"Uknown Error")}catch(Y){console.error("Error creating excerpt:",Y),jb({title:"Fehler",description:Y.message||"Excerpt could not be created",variant:"destructive"})}finally{M(!1)}}},K=()=>{f(null),g(""),v([]),x(""),w(""),N(!0),k(!0),I(null)},G=()=>{g(""),v([]),x(""),w(""),I(null)};return e||u?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})}):t?a.jsxs(lr,{showSidebar:!0,children:[a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(WJ,{className:"h-8 w-8 text-primary"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Page Selector"}),a.jsx("p",{className:"text-muted-foreground",children:"Create extracts from your PDF documents"})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Source"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"source-document",children:"Quelldokument"}),a.jsxs(it,{value:(h==null?void 0:h.id)||"",onValueChange:Y=>{const H=l.find($=>$.id===Y)||null;f(H),g(""),v([]),x("")},disabled:u||l.length===0,children:[a.jsx(rt,{id:"source-document",children:a.jsx(at,{placeholder:"Select document..."})}),a.jsx(nt,{children:l.map(Y=>a.jsxs(Te,{value:Y.id,children:[Y.title," (",Y.page_count||0," pages)"]},Y.id))})]})]}),h&&a.jsxs("div",{className:"text-sm text-muted-foreground",children:["pages: ",h.page_count||0," | Title: ",h.title]}),h&&a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"pages",children:"pages"}),a.jsx(Be,{id:"pages",value:p,onChange:Y=>g(Y.target.value),placeholder:"e.G. 1-3, 5, 9-11"}),a.jsxs("div",{className:"mt-2 text-sm text-muted-foreground",children:["Examples: 3-6, 8, 10-12 → ",m.length>0&&`${m.length} pages selected`]}),y&&a.jsx("div",{className:"mt-2 text-sm text-destructive",children:y})]})]})]}),h&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Goal & Optionsn"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"new-title",children:"New Title"}),a.jsx(Be,{id:"new-title",value:b,onChange:Y=>w(Y.target.value)})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"keep-citation",checked:j,onCheckedChange:N}),a.jsx(_e,{htmlFor:"keep-citation",children:"Retain APA citation"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"copy-metadata",checked:C,onCheckedChange:k}),a.jsx(_e,{htmlFor:"copy-metadata",children:"Copy DOI/ISBN"})]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ve,{onClick:U,disabled:!h||m.length===0||!!y||E,className:"flex-1",children:E?"Being created...":"Create extract"}),a.jsxs(ve,{variant:"outline",onClick:K,children:[a.jsx(n0e,{className:"h-4 w-4 mr-2"}),"Reset"]})]}),z&&a.jsxs(Me,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/50",children:[a.jsx(qe,{children:a.jsxs(Je,{className:"text-green-800 dark:text-green-200",children:[a.jsx(Ir,{className:"h-5 w-5 inline mr-2"}),"Auszug erfolgreich erstellt"]})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.title}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[z.page_count||0," pages"]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Saved at: ",z.storage_path]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs(ve,{onClick:()=>o("/documents"),children:[a.jsx(i0,{className:"h-4 w-4 mr-2"}),"Go to the library"]}),a.jsx(ve,{variant:"outline",onClick:G,children:"Create more"})]})]})]})]}),a.jsx(Tc,{open:s,onClose:()=>i(!1),remainingPoints:(n==null?void 0:n.remaining)??0})]}):null}function ggt(){const t=wr(),[e]=Dj(),{toast:r}=vn(),{user:n,loading:s}=Pt(),[i,o]=S.useState([]),[l,c]=S.useState(!1),[u,d]=S.useState(""),[h,f]=S.useState(!0),[p,g]=S.useState(!1),[m,v]=S.useState(!1),[y,x]=S.useState(null),[b,w]=S.useState(""),j=e.get("document");S.useEffect(()=>{if(!s&&!n){t("/login");return}n&&N()},[n,s,t]),S.useEffect(()=>{j&&i.length>0&&!u&&i.some(M=>M.id===j)&&d(j)},[j,i,u]);const N=async()=>{c(!0);try{const{data:E,error:M}=await be.from("documents").select("id, title, page_count, storage_path, created_at").order("created_at",{ascending:!1});if(M)throw M;o(E||[])}catch(E){console.error("Error loading documents:",E),r({title:"Error",description:"Failed to load documents.",variant:"destructive"})}finally{c(!1)}},C=async()=>{if(u){v(!0),w(""),x(null);try{const{data:{session:E}}=await be.auth.getSession();if(!E)throw new Error("AUTH");const M=await fetch("https://nqibmbtqcjucktqcreob.supabase.co/functions/v1/pdf_extract",{method:"POST",headers:{Authorization:`Bearer ${E.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({document_id:u,overwrite:h,also_block:p})}),z=await M.json();if(!M.ok||z.error)throw new Error(z.error||"UNKNOWN");console.log("Extract result:",z),x(z),r({title:"Sucessfully extracted",description:`${z.inserted_pages} Seiten extrahiert. page_count = ${z.page_count}.`}),await N()}catch(E){console.error("Extract error:",E);const M=E.message||"UNKNOWN";w(M);let z="Uknown Error.";switch(M){case"AUTH":z="Please Login.";break;case"DOC_NOT_FOUND":z="Document not found or permission denied.";break;case"STORAGE":z="Error accessing the file.";break;case"PDF_PARSE":z="PDF could not be processed.";break;case"DB_WRITE":z="Error saving to the database.";break}r({title:"Error",description:z,variant:"destructive"})}finally{v(!1)}}},k=i.find(E=>E.id===u);return s?a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(Et,{className:"h-8 w-8 animate-spin"})})}):a.jsx(lr,{showSidebar:!0,children:a.jsxs("div",{className:"container mx-auto py-8 space-y-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"PDF-Extract"}),a.jsx("p",{className:"text-muted-foreground",children:"Extract page-by-page text from previously uploaded documents"})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Choose Document"}),a.jsx(fn,{children:"Extract page-by-page text from previously uploaded documents"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs(it,{value:u,onValueChange:d,disabled:l||m,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Choose document..."})}),a.jsx(nt,{children:i.map(E=>a.jsxs(Te,{value:E.id,children:[E.title," (",E.page_count?`${E.page_count} Pages`:"unbekannt",")"]},E.id))})]}),k&&a.jsx("div",{className:"text-sm text-muted-foreground",children:k.page_count?"Extracted pages already exist.":"No page text has been extracted yet."}),l&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Et,{className:"h-4 w-4 animate-spin"}),"Loading Document..."]})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Optionen"}),a.jsx(fn,{children:"Configure the extraction settings"})]}),a.jsxs($e,{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"overwrite",checked:h,onCheckedChange:f,disabled:m}),a.jsx(_e,{htmlFor:"overwrite",children:"Overwrite existing page text"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(V1,{id:"alsoBlock",checked:p,onCheckedChange:g,disabled:m}),a.jsx(_e,{htmlFor:"alsoBlock",children:"Additionally, save the entire Markdown block"})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:p?"Additionally, a block containing all pages is stored as Markdown.":"Only pages are stored in the `pages` directory, and `page_count` is updated."})]})]}),a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsx(Je,{children:"Execution and result"}),a.jsx(fn,{children:"Start the text extraction and view the results."})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs(ve,{onClick:C,disabled:!u||m,className:"w-full",size:"lg",children:[m&&a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),m?"Extract...":"Extract"]}),y&&a.jsxs("div",{className:"p-4 bg-green-50 dark:bg-green-950 rounded-lg border border-green-200 dark:border-green-800",children:[a.jsx("h4",{className:"font-semibold text-green-800 dark:text-green-200 mb-2",children:"Extraction successful"}),a.jsxs("div",{className:"space-y-1 text-sm text-green-700 dark:text-green-300",children:[a.jsxs("div",{children:["New page_count: ",a.jsx("strong",{children:y.page_count})]}),a.jsxs("div",{children:["Overwritten: ",a.jsx("strong",{children:y.overwrote?"Yes":"No"})]}),y.block_id&&a.jsxs("div",{children:["Block-ID: ",a.jsx("strong",{children:y.block_id})]})]})]}),b&&a.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-950 rounded-lg border border-red-200 dark:border-red-800",children:[a.jsx("h4",{className:"font-semibold text-red-800 dark:text-red-200 mb-2",children:"Fehler aufgetreten"}),a.jsxs("div",{className:"text-sm text-red-700 dark:text-red-300",children:["Error Code: ",b]})]}),a.jsxs(ve,{variant:"outline",onClick:N,disabled:l||m,className:"w-full",children:[l&&a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx(HJ,{className:"mr-2 h-4 w-4"}),"Update document list"]})]})]})]})})}function ygt(t){var r,n;if(!t)return"GEN";const e=(t.type||((r=t.crossref_data)==null?void 0:r.type)||((n=t.crossref_payload)==null?void 0:n.type)||"").toLowerCase();return e.includes("journal")||e.includes("article")?"JOUR":e.includes("book")?"BOOK":e.includes("conference")||e.includes("proceeding")?"CONF":e.includes("thesis")||e.includes("dissertation")?"THES":"GEN"}function vgt(t){var r,n,s,i,o;const e=(t==null?void 0:t.authors)||((r=t==null?void 0:t.crossref_data)==null?void 0:r.authors)||((n=t==null?void 0:t.crossref_payload)==null?void 0:n.author)||((i=(s=t==null?void 0:t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.author)||((o=t==null?void 0:t.google_books_data)==null?void 0:o.authors)||[];return Array.isArray(e)?e.map(l=>typeof l=="string"?l:l!=null&&l.family?`${l.family}, ${l.given||""}`.trim():"").filter(Boolean):[]}function xgt(t){var n,s,i,o,l,c,u,d,h,f,p,g,m,v,y;if(!t)return null;const e=t.published_year||t.year||((n=t.crossref_data)==null?void 0:n.year)||((c=(l=(o=(i=(s=t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.issued)==null?void 0:o["date-parts"])==null?void 0:l[0])==null?void 0:c[0])||((f=(h=(d=(u=t.crossref_payload)==null?void 0:u.issued)==null?void 0:d["date-parts"])==null?void 0:h[0])==null?void 0:f[0])||((v=(m=(g=(p=t.crossref_payload)==null?void 0:p.published)==null?void 0:g["date-parts"])==null?void 0:m[0])==null?void 0:v[0]);if(e)return String(e);const r=(y=t.google_books_data)==null?void 0:y.publishedDate;return r?String(r).substring(0,4):null}function bgt(t){var r,n,s,i,o,l;const e=t.bib_meta;return(e==null?void 0:e.title)||((r=e==null?void 0:e.google_books_data)==null?void 0:r.title)||((s=(n=e==null?void 0:e.crossref_payload)==null?void 0:n.title)==null?void 0:s[0])||((l=(o=(i=e==null?void 0:e.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.title)==null?void 0:l[0])||t.title||"Untitled"}function wgt(t){var l,c,u,d,h,f;const e=t.bib_meta,r=e==null?void 0:e.crossref_payload,n=(l=e==null?void 0:e.crossref_data)==null?void 0:l.crossref_metadata,s=[],i=(p,g)=>{g&&s.push(`${p}  - ${g}`)};i("TY",ygt(e)),i("TI",bgt(t));for(const p of vgt(e))i("AU",p);i("PY",xgt(e)),i("DO",t.doi||(e==null?void 0:e.doi)||(r==null?void 0:r.DOI)||null),i("SN",t.isbn||(e==null?void 0:e.isbn)||((c=r==null?void 0:r.ISSN)==null?void 0:c[0])||((u=n==null?void 0:n.ISSN)==null?void 0:u[0])||null),i("PB",(e==null?void 0:e.publisher)||((d=e==null?void 0:e.google_books_data)==null?void 0:d.publisher)||(r==null?void 0:r.publisher)||(n==null?void 0:n.publisher)||null),i("JO",(e==null?void 0:e.journal)||((h=r==null?void 0:r["container-title"])==null?void 0:h[0])||((f=n==null?void 0:n["container-title"])==null?void 0:f[0])||null),i("VL",(e==null?void 0:e.volume)||(r==null?void 0:r.volume)||(n==null?void 0:n.volume)||null),i("IS",(e==null?void 0:e.issue)||(r==null?void 0:r.issue)||(n==null?void 0:n.issue)||null);const o=(e==null?void 0:e.pages)||(r==null?void 0:r.page)||(n==null?void 0:n.page);if(o&&typeof o=="string"){const p=o.split(/[-–]/);p[0]&&i("SP",p[0].trim()),p[1]&&i("EP",p[1].trim())}return i("AB",(e==null?void 0:e.abstract)||(r==null?void 0:r.abstract)||null),i("UR",(e==null?void 0:e.url)||(r==null?void 0:r.URL)||null),i("LA",(r==null?void 0:r.language)||null),s.push("ER  -"),s.join(`
`)}function D3(t,e="citations.ris"){const r=t.map(wgt).join(`

`),n=new Blob([r],{type:"application/x-research-info-systems"}),s=URL.createObjectURL(n),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}function _gt(t){var n,s,i,o,l;if(!t)return null;const e=t.authors||((n=t.crossref_data)==null?void 0:n.authors)||((s=t.crossref_payload)==null?void 0:s.author)||((o=(i=t.crossref_data)==null?void 0:i.crossref_metadata)==null?void 0:o.author)||((l=t.google_books_data)==null?void 0:l.authors);if(!Array.isArray(e)||e.length===0)return null;const r=c=>typeof c=="string"?c.split(/,\s*/)[0]||c.split(/\s+/).pop()||c:c!=null&&c.family?c.family:String(c);return e.length===1?r(e[0]):e.length===2?`${r(e[0])} & ${r(e[1])}`:`${r(e[0])} et al.`}function jgt(t){var n,s,i,o,l,c,u,d,h,f,p;if(!t)return null;const e=t.published_year||t.year||((n=t.crossref_data)==null?void 0:n.year)||((c=(l=(o=(i=(s=t.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.issued)==null?void 0:o["date-parts"])==null?void 0:l[0])==null?void 0:c[0])||((f=(h=(d=(u=t.crossref_payload)==null?void 0:u.issued)==null?void 0:d["date-parts"])==null?void 0:h[0])==null?void 0:f[0]);if(e)return String(e);const r=(p=t.google_books_data)==null?void 0:p.publishedDate;return r?String(r).substring(0,4):null}function dM(t){return t?!!(/\.\w{2,4}$/.test(t)||/^[\w-]+$/.test(t)&&t.length<40&&(/\d{3,}/.test(t)||/^[a-z]-\d/i.test(t))):!1}function Sgt(t){var n,s,i,o,l,c,u;const e=t.bib_meta,r=[e==null?void 0:e.title,(n=e==null?void 0:e.crossref_data)==null?void 0:n.title,(i=(s=e==null?void 0:e.crossref_data)==null?void 0:s.crossref_metadata)==null?void 0:i.title,(o=e==null?void 0:e.google_books_data)==null?void 0:o.title,(c=(l=e==null?void 0:e.crossref_payload)==null?void 0:l.title)==null?void 0:c[0]];for(const d of r){if(d&&typeof d=="string"&&d.trim()&&!dM(d.trim()))return d.trim();if(Array.isArray(d)&&((u=d[0])!=null&&u.trim()))return d[0].trim()}return t.title&&!dM(t.title)?t.title:t.original_filename&&!dM(t.original_filename)?t.original_filename:t.title||t.original_filename||"Untitled"}function Ngt(t){var e,r,n;return t&&(t.pages||((r=(e=t.crossref_data)==null?void 0:e.crossref_metadata)==null?void 0:r.page)||((n=t.crossref_payload)==null?void 0:n.page))||null}function Agt({doc:t,selected:e,onSelectionChange:r}){const[n,s]=S.useState(!1),i=wr(),o=t.bib_meta,l=Sgt(t),c=_gt(o),u=jgt(o),d=Ngt(o),h=t.doi||t.isbn||null,f=t.doi?"DOI":t.isbn?"ISBN":null,p=t.original_filename||null,g=p&&p!==l,m=async()=>{if(!t.citation_apa){Fe.error("No APA citation available");return}await navigator.clipboard.writeText(t.citation_apa),s(!0),Fe.success("APA citation copied"),setTimeout(()=>s(!1),2e3)},v=()=>{D3([t],`${l.replace(/[^a-zA-Z0-9]/g,"_").substring(0,40)}.ris`),Fe.success("RIS file downloaded")};return a.jsxs(Nn,{children:[a.jsx(vt,{className:"w-8",children:a.jsx(go,{checked:e,onCheckedChange:y=>r(t.id,!!y)})}),a.jsx(vt,{children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium text-sm line-clamp-2",children:l}),g&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1 mt-0.5",children:[a.jsx(Ir,{className:"w-3 h-3 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:p})]})]})}),a.jsx(vt,{className:"text-muted-foreground text-sm",children:c||"–"}),a.jsx(vt,{className:"text-muted-foreground text-sm",children:u||"–"}),a.jsx(vt,{className:"text-muted-foreground text-sm",children:d||"–"}),a.jsx(vt,{className:"text-muted-foreground text-sm max-w-[180px]",children:h?a.jsxs("span",{className:"truncate block",title:h,children:[f,": ",h]}):"–"}),a.jsx(vt,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:m,disabled:!t.citation_apa,children:n?a.jsx(Gs,{className:"w-4 h-4"}):a.jsx(yn,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Copy APA citation"})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:v,children:a.jsx(fo,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Export RIS"})]}),a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"sm",className:"w-8 h-8 p-0",onClick:()=>i("/reference-checker"),children:a.jsx(pl,{className:"w-4 h-4"})})}),a.jsx(Vt,{children:"Check with Citation Manager"})]})]})})]})}const JN={title:"",authors:"",publisher:"",published_year:"",isbn:"",doi:"",edition:"",pages:"",language:"",series:"",type:"book"},Egt=()=>{const{user:t,userProfile:e,loading:r}=Pt(),n=wr(),[s]=Dj(),i=s.get("document"),[o,l]=S.useState([]),[c,u]=S.useState(!0),[d,h]=S.useState(""),[f,p]=S.useState("all"),[g,m]=S.useState("newest"),[v,y]=S.useState(new Set),[x,b]=S.useState([]),[w,j]=S.useState(""),[N,C]=S.useState(""),[k,E]=S.useState(""),[M,z]=S.useState(!1),[I,q]=S.useState(null),[A,U]=S.useState(""),[K,G]=S.useState(!1),[Y,H]=S.useState(""),[$,L]=S.useState(!1),[F,W]=S.useState(""),[X,oe]=S.useState(JN),[le,B]=S.useState("manual_entry"),[R,ee]=S.useState(!1),[te,Z]=S.useState(JN),[J,he]=S.useState(!1);S.useEffect(()=>{!t&&!r&&n("/login")},[t,r,n]),S.useEffect(()=>{t&&P()},[t]),S.useEffect(()=>{e!=null&&e.id&&ie()},[e==null?void 0:e.id]),S.useEffect(()=>{if(i&&x.length>0){const fe=x.find(Ee=>Ee.id===i);fe&&(j(i),C(fe.doi||""),E(fe.isbn||""))}},[i,x]);const P=async()=>{if(t){u(!0);try{const{data:fe,error:Ee}=await be.from("v_documents_with_status").select("*").eq("user_id",t.id).or("bib_meta.not.is.null,citation_apa.not.is.null,doi.not.is.null,isbn.not.is.null").order("created_at",{ascending:!1});if(Ee){console.error("Error fetching citations:",Ee);return}l(fe||[])}finally{u(!1)}}},ie=async()=>{try{const{data:fe,error:Ee}=await be.from("documents").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(Ee)throw Ee;b(fe||[])}catch(fe){console.error("Error loading documents:",fe),Fe.error("Error loading documents")}},V=async()=>{var fe;if(!w){U("Please select a document");return}z(!0),U(""),q(null);try{const{data:Ee,error:Ce}=await be.functions.invoke("detect_bibliography",{body:{document_id:w,force:!0,manual_doi:N.trim()||null,manual_isbn:k.trim()||null}});if(Ce)throw Ce;if(Ee!=null&&Ee.error)throw new Error(Ee.error);const{data:Ge,error:dt}=await be.from("documents").select("*").eq("id",w).single();if(dt)throw dt;const Ne=Ge;q({citation_apa:Ne.citation_apa,doi:Ne.doi,isbn:Ne.isbn,bib_meta:Ne.bib_meta,source:((fe=Ne.bib_meta)==null?void 0:fe.method)||"unknown"}),Fe.success("Citation updated successfully"),b(Ze=>Ze.map(Ke=>Ke.id===w?Ne:Ke)),P()}catch(Ee){console.error("Reference check error:",Ee);const Ce=Ee.message||"Unknown error";Ce.includes("ISBN")||Ce.includes("isbn")?U("Invalid ISBN or no match found"):Ce.includes("DOI")||Ce.includes("doi")?U("Invalid DOI or no match found"):U(`Error: ${Ce}`)}finally{z(!1)}},O=async()=>{var fe,Ee;if(!Y.trim()){W("Please paste some text first");return}L(!0),W("");try{const{data:Ce,error:Ge}=await be.functions.invoke("parse_bibliography_text",{body:{rawText:Y.trim()}});if(Ge)throw Ge;if(Ce!=null&&Ce.error)throw new Error(Ce.error);const dt=Ce==null?void 0:Ce.data;dt&&(oe({title:dt.title||"",authors:((fe=dt.authors)==null?void 0:fe.join(", "))||"",publisher:dt.publisher||"",published_year:((Ee=dt.published_year)==null?void 0:Ee.toString())||"",isbn:dt.isbn||"",doi:dt.doi||"",edition:dt.edition||"",pages:dt.pages||"",language:dt.language||"",series:dt.series||"",type:dt.type||"book"}),B("parsed_paste"),Fe.success("Text successfully parsed!"))}catch(Ce){console.error("Parse error:",Ce),W(Ce.message||"Failed to parse text")}finally{L(!1)}},T=async()=>{if(!w){Fe.error("Please select a document first");return}if(!X.title.trim()){Fe.error("Title is required");return}ee(!0);try{const fe=X.authors.split(",").map(Xe=>Xe.trim()).filter(Boolean),Ee={title:X.title,authors:fe,publisher:X.publisher||null,published_year:parseInt(X.published_year)||null,edition:X.edition||null,pages:X.pages||null,language:X.language||null,series:X.series||null,type:X.type||"book",method:le},Ce=fe.length?fe.join(", "):"Unknown Author",Ge=X.published_year?`(${X.published_year})`:"(n.d.)",dt=X.publisher?`. ${X.publisher}`:"",Ne=`${Ce} ${Ge}. ${X.title}${dt}.`,{error:Ze}=await be.from("documents").update({bib_meta:Ee,citation_apa:Ne,isbn:X.isbn||null,doi:X.doi||null,title:X.title}).eq("id",w);if(Ze)throw Ze;const{data:Ke}=await be.from("documents").select("*").eq("id",w).single();Ke&&(b(Xe=>Xe.map(Ye=>Ye.id===w?Ke:Ye)),q({citation_apa:Ne,doi:X.doi,isbn:X.isbn,bib_meta:Ee,source:le})),Fe.success("Metadata applied successfully!"),oe(JN),H(""),P()}catch(fe){console.error("Apply error:",fe),Fe.error("Failed to apply metadata")}finally{ee(!1)}},D=(fe,Ee)=>{oe(Ce=>({...Ce,[fe]:Ee})),B("manual_entry")},ne=(fe,Ee)=>{Z(Ce=>({...Ce,[fe]:Ee}))},ue=async()=>{if(!te.title.trim()){Fe.error("Title is required");return}if(t){he(!0);try{const fe=te.authors.split(",").map(Ke=>Ke.trim()).filter(Boolean),Ee={title:te.title,authors:fe,publisher:te.publisher||null,published_year:parseInt(te.published_year)||null,edition:te.edition||null,pages:te.pages||null,language:te.language||null,series:te.series||null,type:te.type||"book",method:"manual_citation"},Ce=fe.length?fe.join(", "):"Unknown Author",Ge=te.published_year?`(${te.published_year})`:"(n.d.)",dt=te.publisher?`. ${te.publisher}`:"",Ne=`${Ce} ${Ge}. ${te.title}${dt}.`,{error:Ze}=await be.from("documents").insert({user_id:t.id,title:te.title,bib_meta:Ee,citation_apa:Ne,isbn:te.isbn||null,doi:te.doi||null,page_count:0});if(Ze)throw Ze;Fe.success("Citation source created successfully!"),Z(JN),await ie(),P()}catch(fe){console.error("Error creating citation-only entry:",fe),Fe.error("Failed to create citation source")}finally{he(!1)}}},re=async()=>{if(I!=null&&I.citation_apa)try{await navigator.clipboard.writeText(I.citation_apa),G(!0),Fe.success("Citation copied to clipboard"),setTimeout(()=>G(!1),2e3)}catch{Fe.error("Failed to copy")}},pe=x.find(fe=>fe.id===w),xe=fe=>{var Ce,Ge,dt,Ne,Ze;const Ee=(fe==null?void 0:fe.authors)||((Ce=fe==null?void 0:fe.crossref_data)==null?void 0:Ce.authors)||((Ge=fe==null?void 0:fe.crossref_payload)==null?void 0:Ge.author)||((Ne=(dt=fe==null?void 0:fe.crossref_data)==null?void 0:dt.crossref_metadata)==null?void 0:Ne.author)||((Ze=fe==null?void 0:fe.google_books_data)==null?void 0:Ze.authors)||[];return Array.isArray(Ee)?Ee.map(Ke=>typeof Ke=="string"?Ke:`${(Ke==null?void 0:Ke.family)||""} ${(Ke==null?void 0:Ke.given)||""}`.trim()).join(" "):""},ye=fe=>{var Ge,dt,Ne,Ze,Ke,Xe,Ye;const Ee=fe.bib_meta,Ce=[Ee==null?void 0:Ee.title,(Ge=Ee==null?void 0:Ee.crossref_data)==null?void 0:Ge.title,(Ne=(dt=Ee==null?void 0:Ee.crossref_data)==null?void 0:dt.crossref_metadata)==null?void 0:Ne.title,(Ze=Ee==null?void 0:Ee.google_books_data)==null?void 0:Ze.title,(Xe=(Ke=Ee==null?void 0:Ee.crossref_payload)==null?void 0:Ke.title)==null?void 0:Xe[0]];for(const At of Ce){if(At&&typeof At=="string"&&At.trim())return At.trim().toLowerCase();if(Array.isArray(At)&&((Ye=At[0])!=null&&Ye.trim()))return At[0].trim().toLowerCase()}return(fe.title||fe.original_filename||"").toLowerCase()},ae=fe=>{var Ge,dt,Ne,Ze,Ke,Xe,Ye,At,Ve,pt,Nt;if(!fe)return null;const Ee=fe.published_year||fe.year||((Ge=fe.crossref_data)==null?void 0:Ge.year)||((Xe=(Ke=(Ze=(Ne=(dt=fe.crossref_data)==null?void 0:dt.crossref_metadata)==null?void 0:Ne.issued)==null?void 0:Ze["date-parts"])==null?void 0:Ke[0])==null?void 0:Xe[0])||((pt=(Ve=(At=(Ye=fe.crossref_payload)==null?void 0:Ye.issued)==null?void 0:At["date-parts"])==null?void 0:Ve[0])==null?void 0:pt[0]);if(Ee)return Number(Ee);const Ce=(Nt=fe.google_books_data)==null?void 0:Nt.publishedDate;return Ce?parseInt(String(Ce).substring(0,4)):null},de=fe=>{var Ee,Ce;return((fe==null?void 0:fe.type)||((Ee=fe==null?void 0:fe.crossref_data)==null?void 0:Ee.type)||((Ce=fe==null?void 0:fe.crossref_payload)==null?void 0:Ce.type)||"").toLowerCase().replace(/-/g," ")},ge=S.useMemo(()=>{const fe=new Set;return o.forEach(Ee=>{const Ce=de(Ee.bib_meta);Ce&&fe.add(Ce)}),Array.from(fe).sort()},[o]),we=S.useMemo(()=>{let fe=o;if(d){const Ee=d.toLowerCase();fe=fe.filter(Ce=>{const Ge=ye(Ce),dt=xe(Ce.bib_meta).toLowerCase(),Ne=(Ce.doi||"").toLowerCase(),Ze=(Ce.isbn||"").toLowerCase();return Ge.includes(Ee)||dt.includes(Ee)||Ne.includes(Ee)||Ze.includes(Ee)})}return f!=="all"&&(fe=fe.filter(Ee=>de(Ee.bib_meta)===f)),fe=[...fe].sort((Ee,Ce)=>{if(g==="newest")return new Date(Ce.created_at).getTime()-new Date(Ee.created_at).getTime();if(g==="alphabetical")return ye(Ee).localeCompare(ye(Ce));const Ge=ae(Ee.bib_meta)||0;return(ae(Ce.bib_meta)||0)-Ge}),fe},[o,d,f,g]),je=(fe,Ee)=>{y(Ce=>{const Ge=new Set(Ce);return Ee?Ge.add(fe):Ge.delete(fe),Ge})},Se=()=>{we.length!==0&&(D3(we,"all-citations.ris"),Fe.success(`Exported ${we.length} citations`))},Ue=()=>{const fe=we.filter(Ee=>v.has(Ee.id));if(fe.length===0){Fe.error("No citations selected");return}D3(fe,"selected-citations.ris"),Fe.success(`Exported ${fe.length} citations`)};if(r||c)return a.jsx(lr,{showSidebar:!0,pageTitle:"My Citations",children:a.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})});if(!t)return null;const Ae=(fe,Ee)=>a.jsxs(it,{value:fe,onValueChange:Ee,children:[a.jsx(rt,{className:"mt-1",children:a.jsx(at,{placeholder:"Select language..."})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"German",children:"German"}),a.jsx(Te,{value:"English",children:"English"}),a.jsx(Te,{value:"French",children:"French"}),a.jsx(Te,{value:"Spanish",children:"Spanish"}),a.jsx(Te,{value:"Italian",children:"Italian"}),a.jsx(Te,{value:"Other",children:"Other"})]})]});return a.jsx(lr,{showSidebar:!0,pageTitle:"My Citations",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsxs(qe,{className:"pb-3",children:[a.jsx(Je,{children:"Citation Manager"}),a.jsx(fn,{children:"Verify, enter, or create citation entries for your documents"})]}),a.jsx($e,{children:a.jsxs(c5,{defaultValue:"check",className:"w-full",children:[a.jsxs(rk,{className:"grid w-full grid-cols-3",children:[a.jsxs(Od,{value:"check",className:"flex items-center gap-2",children:[a.jsx(xi,{className:"w-4 h-4"}),"Document Check"]}),a.jsxs(Od,{value:"manual",className:"flex items-center gap-2",children:[a.jsx($P,{className:"w-4 h-4"}),"Manual Entry"]}),a.jsxs(Od,{value:"physical",className:"flex items-center gap-2",children:[a.jsx(rz,{className:"w-4 h-4"}),"Add Source"]})]}),a.jsxs(Id,{value:"check",className:"space-y-6 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"document-select",children:"Document"}),a.jsxs(it,{value:w,onValueChange:j,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select a document..."})}),a.jsx(nt,{children:x.map(fe=>a.jsx(Te,{value:fe.id,children:a.jsx("span",{className:"font-medium",children:fe.title||fe.original_filename||"Untitled"})},fe.id))})]})]}),pe&&(()=>{var _S,jS,SS,NS,AS,ES,CS,kS,TS,PS,OS,IS;const fe=pe.bib_meta,Ee=fe==null?void 0:fe.google_books_data,Ce=(fe==null?void 0:fe.crossref_payload)||((_S=fe==null?void 0:fe.crossref_data)==null?void 0:_S.crossref_metadata),Ge=fe==null?void 0:fe.crossref_data,dt=(fe==null?void 0:fe.title)||(Ge==null?void 0:Ge.title)||pe.title||pe.original_filename||"No title",Ne=(fe==null?void 0:fe.type)||(Ce==null?void 0:Ce.type),Ze=((jS=fe==null?void 0:fe.authors)==null?void 0:jS.join(", "))||((SS=Ge==null?void 0:Ge.authors)==null?void 0:SS.join(", "))||((NS=Ee==null?void 0:Ee.authors)==null?void 0:NS.join(", "))||((AS=Ce==null?void 0:Ce.author)==null?void 0:AS.map(wl=>`${wl.family}, ${wl.given}`).join("; ")),Ke=(fe==null?void 0:fe.publisher)||(Ge==null?void 0:Ge.publisher)||(Ee==null?void 0:Ee.publisher)||(Ce==null?void 0:Ce.publisher),Xe=(fe==null?void 0:fe.published_year)||(Ge==null?void 0:Ge.year)||((ES=Ee==null?void 0:Ee.publishedDate)==null?void 0:ES.substring(0,4))||((TS=(kS=(CS=Ce==null?void 0:Ce.issued)==null?void 0:CS["date-parts"])==null?void 0:kS[0])==null?void 0:TS[0]),Ye=fe==null?void 0:fe.edition,At=(fe==null?void 0:fe.pages)||(Ge==null?void 0:Ge.pages)||(Ee==null?void 0:Ee.pageCount)||(Ce==null?void 0:Ce.page),Ve=(fe==null?void 0:fe.language)||(Ee==null?void 0:Ee.language),pt=fe==null?void 0:fe.series,Nt=pe.isbn||(fe==null?void 0:fe.isbn)||((OS=(PS=Ee==null?void 0:Ee.industryIdentifiers)==null?void 0:PS.find(wl=>wl.type==="ISBN_13"))==null?void 0:OS.identifier),Ms=pe.doi||(fe==null?void 0:fe.doi)||(Ge==null?void 0:Ge.doi),Zn=fe==null?void 0:fe.method,ta=Zn==="manual_entry"?"Manual Entry":Zn==="parsed_paste"?"Parsed Paste":Zn==="manual_input"?"Manual Input":Zn||null,La=(Ge==null?void 0:Ge.journal)||((IS=Ce==null?void 0:Ce["container-title"])==null?void 0:IS[0]),Ds=(Ge==null?void 0:Ge.volume)||(Ce==null?void 0:Ce.volume),ra=(Ge==null?void 0:Ge.issue)||(Ce==null?void 0:Ce.issue),iP=[{label:"Title",value:dt},Ne&&{label:"Type",value:Ne.charAt(0).toUpperCase()+Ne.slice(1)},Ze&&{label:"Author(s)",value:Ze},Ke&&{label:"Publisher",value:Ke},Xe&&{label:"Published",value:String(Xe)},Ye&&{label:"Edition",value:Ye},La&&{label:"Journal",value:La},Ds&&{label:"Volume",value:`${Ds}${ra?` (${ra})`:""}`},At&&{label:"Pages",value:String(At)},Ve&&{label:"Language",value:Ve.charAt(0).toUpperCase()+Ve.slice(1)},pt&&{label:"Series",value:pt},Nt&&{label:"ISBN",value:Nt},Ms&&{label:"DOI",value:Ms},ta&&{label:"Source",value:ta}].filter(Boolean);return a.jsxs("div",{className:"p-4 bg-muted/50 rounded-xl border border-border/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-sm font-semibold",children:"Current Status"}),a.jsx("div",{children:pe.citation_apa?a.jsxs(gt,{className:"bg-success/20 text-success hover:bg-success/30",children:[a.jsx(Gs,{className:"w-3 h-3 mr-1"}),"Citation Available"]}):a.jsxs(gt,{variant:"destructive",className:"bg-destructive/20 text-destructive hover:bg-destructive/30",children:[a.jsx(Rs,{className:"w-3 h-3 mr-1"}),"Citation Missing"]})})]}),a.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5",children:iP.map(wl=>a.jsxs("div",{className:"contents",children:[a.jsxs("span",{className:"text-xs text-muted-foreground py-0.5",children:[wl.label,":"]}),a.jsx("span",{className:"text-sm font-medium py-0.5 break-words",children:wl.value})]},wl.label))})]})})(),a.jsxs("div",{className:"pt-4 border-t border-border/50",children:[a.jsx(_e,{className:"text-sm font-medium mb-3 block",children:"Manual Override (Optional)"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"doi",className:"text-xs text-muted-foreground",children:"DOI"}),a.jsx(Be,{id:"doi",value:N,onChange:fe=>C(fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"isbn",className:"text-xs text-muted-foreground",children:"ISBN"}),a.jsx(Be,{id:"isbn",value:k,onChange:fe=>E(fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]})]})]}),a.jsx(ve,{onClick:V,disabled:M||!w,className:"w-full",size:"lg",children:M?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking document..."]}):a.jsxs(a.Fragment,{children:[a.jsx(al,{className:"w-4 h-4 mr-2"}),"Check Document"]})}),A&&a.jsxs("div",{className:"flex items-center gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg",children:[a.jsx(Ww,{className:"w-4 h-4 text-destructive shrink-0"}),a.jsx("span",{className:"text-sm text-destructive",children:A})]})]}),a.jsxs(Id,{value:"manual",className:"space-y-4 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"manual-document-select",children:"Target Document"}),a.jsxs(it,{value:w,onValueChange:j,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select a document to apply data..."})}),a.jsx(nt,{children:x.map(fe=>a.jsx(Te,{value:fe.id,children:a.jsx("span",{className:"font-medium",children:fe.title||fe.original_filename||"Untitled"})},fe.id))})]}),!w&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Select a document to apply bibliographic data"})]}),a.jsxs(c5,{defaultValue:"quick-paste",className:"w-full",children:[a.jsxs(rk,{className:"grid w-full grid-cols-2",children:[a.jsxs(Od,{value:"quick-paste",className:"flex items-center gap-2",children:[a.jsx($P,{className:"w-4 h-4"}),"Quick Paste"]}),a.jsxs(Od,{value:"manual-fields",className:"flex items-center gap-2",children:[a.jsx(r0e,{className:"w-4 h-4"}),"Manual Fields"]})]}),a.jsxs(Id,{value:"quick-paste",className:"space-y-4 mt-4",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Paste Raw Text"}),a.jsx(Wt,{value:Y,onChange:fe=>H(fe.target.value),placeholder:"Paste bibliographic data from Amazon, Google Books, library catalogs, etc...",className:"min-h-[120px] mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Example: ISBN978-3-411-87151-3VerlagDuden..."})]}),a.jsx(ve,{onClick:O,disabled:$||!Y.trim(),className:"w-full",children:$?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{className:"w-4 h-4 mr-2 animate-spin"}),"Parsing..."]}):a.jsxs(a.Fragment,{children:[a.jsx($P,{className:"w-4 h-4 mr-2"}),"Parse Text"]})}),F&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:[a.jsx(Ww,{className:"w-4 h-4 text-destructive shrink-0"}),a.jsx("span",{className:"text-sm text-destructive",children:F})]}),(X.title||X.authors||X.publisher)&&a.jsxs("div",{className:"p-4 bg-muted/50 rounded-xl border border-border/50 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Gs,{className:"w-4 h-4 text-success"}),a.jsx("span",{className:"text-sm font-medium",children:"Parsed Result (editable)"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Title *"}),a.jsx(Be,{value:X.title,onChange:fe=>D("title",fe.target.value),placeholder:"Enter title...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Authors (comma-separated)"}),a.jsx(Be,{value:X.authors,onChange:fe=>D("authors",fe.target.value),placeholder:"Author 1, Author 2...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Publisher"}),a.jsx(Be,{value:X.publisher,onChange:fe=>D("publisher",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Year"}),a.jsx(Be,{value:X.published_year,onChange:fe=>D("published_year",fe.target.value),placeholder:"2023",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"ISBN"}),a.jsx(Be,{value:X.isbn,onChange:fe=>D("isbn",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"DOI"}),a.jsx(Be,{value:X.doi,onChange:fe=>D("doi",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Edition"}),a.jsx(Be,{value:X.edition,onChange:fe=>D("edition",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Pages"}),a.jsx(Be,{value:X.pages,onChange:fe=>D("pages",fe.target.value),className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Language"}),Ae(X.language,fe=>D("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Series"}),a.jsx(Be,{value:X.series,onChange:fe=>D("series",fe.target.value),className:"mt-1"})]})]}),a.jsx(ve,{onClick:T,disabled:R||!w||!X.title.trim(),className:"w-full mt-4",children:R?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{className:"w-4 h-4 mr-2 animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Gs,{className:"w-4 h-4 mr-2"}),"Apply to Document"]})})]})]}),a.jsxs(Id,{value:"manual-fields",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Title *"}),a.jsx(Be,{value:X.title,onChange:fe=>D("title",fe.target.value),placeholder:"Book or article title...",className:"mt-1"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Authors (comma-separated)"}),a.jsx(Be,{value:X.authors,onChange:fe=>D("authors",fe.target.value),placeholder:"Last, First; Last, First...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Publisher"}),a.jsx(Be,{value:X.publisher,onChange:fe=>D("publisher",fe.target.value),placeholder:"Publisher name...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Year"}),a.jsx(Be,{value:X.published_year,onChange:fe=>D("published_year",fe.target.value),placeholder:"2023",type:"number",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"ISBN"}),a.jsx(Be,{value:X.isbn,onChange:fe=>D("isbn",fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"DOI"}),a.jsx(Be,{value:X.doi,onChange:fe=>D("doi",fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Edition"}),a.jsx(Be,{value:X.edition,onChange:fe=>D("edition",fe.target.value),placeholder:"4th edition",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Pages"}),a.jsx(Be,{value:X.pages,onChange:fe=>D("pages",fe.target.value),placeholder:"136",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Language"}),Ae(X.language,fe=>D("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Series"}),a.jsx(Be,{value:X.series,onChange:fe=>D("series",fe.target.value),placeholder:"Book series name...",className:"mt-1"})]})]}),a.jsx(ve,{onClick:T,disabled:R||!w||!X.title.trim(),className:"w-full",size:"lg",children:R?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{className:"w-4 h-4 mr-2 animate-spin"}),"Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Gs,{className:"w-4 h-4 mr-2"}),"Apply to Document"]})})]})]})]}),a.jsxs(Id,{value:"physical",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Title *"}),a.jsx(Be,{value:te.title,onChange:fe=>ne("title",fe.target.value),placeholder:"Book or article title...",className:"mt-1"})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx(_e,{children:"Authors (comma-separated)"}),a.jsx(Be,{value:te.authors,onChange:fe=>ne("authors",fe.target.value),placeholder:"Last, First; Last, First...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Publisher"}),a.jsx(Be,{value:te.publisher,onChange:fe=>ne("publisher",fe.target.value),placeholder:"Publisher name...",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Year"}),a.jsx(Be,{value:te.published_year,onChange:fe=>ne("published_year",fe.target.value),placeholder:"2023",type:"number",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"ISBN"}),a.jsx(Be,{value:te.isbn,onChange:fe=>ne("isbn",fe.target.value),placeholder:"978-3-16-148410-0",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"DOI"}),a.jsx(Be,{value:te.doi,onChange:fe=>ne("doi",fe.target.value),placeholder:"10.1000/example",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Edition"}),a.jsx(Be,{value:te.edition,onChange:fe=>ne("edition",fe.target.value),placeholder:"4th edition",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Pages"}),a.jsx(Be,{value:te.pages,onChange:fe=>ne("pages",fe.target.value),placeholder:"136",className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Language"}),Ae(te.language,fe=>ne("language",fe))]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Series"}),a.jsx(Be,{value:te.series,onChange:fe=>ne("series",fe.target.value),placeholder:"Book series name...",className:"mt-1"})]})]}),a.jsx(ve,{onClick:ue,disabled:J||!te.title.trim(),className:"w-full",size:"lg",children:J?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(rz,{className:"w-4 h-4 mr-2"}),"Create Source Entry"]})})]})]})})]}),I&&a.jsxs(Me,{children:[a.jsxs(qe,{children:[a.jsxs(Je,{className:"flex items-center gap-2",children:[a.jsx(Gs,{className:"w-5 h-5 text-success"}),"Result"]}),a.jsx(fn,{children:"Citation has been successfully updated"})]}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(_e,{className:"text-base font-semibold",children:"APA Citation"}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:re,disabled:!I.citation_apa,children:[a.jsx(yn,{className:"w-4 h-4 mr-2"}),K?"Copied!":"Copy"]})]}),a.jsx("div",{className:"p-4 bg-muted rounded-lg",children:a.jsx("p",{className:"text-sm leading-relaxed font-medium",children:I.citation_apa||"No citation available"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"Source"}),a.jsx("div",{className:"mt-1",children:a.jsx(gt,{variant:"secondary",children:I.source==="pdf_metadata_and_text_analysis"?"PDF Analysis":I.source==="google_books"?"Google Books":I.source==="open_library"?"Open Library":I.source==="crossref"?"CrossRef":I.source==="parsed_paste"?"Parsed Paste":I.source==="manual_entry"?"Manual Entry":I.source||"Unknown"})})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"DOI"}),a.jsx("p",{className:"text-sm mt-1",children:I.doi||"–"})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm",children:"ISBN"}),a.jsx("p",{className:"text-sm mt-1",children:I.isbn||"–"})]})]}),I.bib_meta&&a.jsxs(SB,{children:[a.jsx(NB,{asChild:!0,children:a.jsxs(ve,{variant:"ghost",size:"sm",className:"w-full justify-between",children:[a.jsx("span",{children:"Show Raw JSON Metadata"}),a.jsx(ad,{className:"w-4 h-4"})]})}),a.jsx(AB,{children:a.jsx("div",{className:"mt-2 p-4 bg-muted rounded-lg",children:a.jsx("pre",{className:"text-xs overflow-auto max-h-64",children:JSON.stringify(I.bib_meta,null,2)})})})]})]})]}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"My Citations"}),a.jsx("p",{className:"text-muted-foreground",children:"Manage bibliographic data from your library documents"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row flex-wrap gap-3",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(al,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),a.jsx(Be,{placeholder:"Search title, author, DOI, ISBN…",value:d,onChange:fe=>h(fe.target.value),className:"pl-9"})]}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{className:"w-[160px]",children:a.jsx(at,{placeholder:"All types"})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"all",children:"All types"}),ge.map(fe=>a.jsx(Te,{value:fe,className:"capitalize",children:fe},fe))]})]}),a.jsxs(it,{value:g,onValueChange:fe=>m(fe),children:[a.jsx(rt,{className:"w-[150px]",children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"newest",children:"Newest first"}),a.jsx(Te,{value:"alphabetical",children:"A → Z"}),a.jsx(Te,{value:"year",children:"Year (desc)"})]})]}),a.jsxs("div",{className:"flex gap-2 ml-auto",children:[a.jsxs(Yt,{children:[a.jsx(Xt,{asChild:!0,children:a.jsxs(ve,{variant:"outline",size:"sm",onClick:Se,disabled:we.length===0,children:[a.jsx(fo,{className:"w-4 h-4 mr-1"}),"Export all"]})}),a.jsxs(Vt,{className:"flex items-start gap-1.5 max-w-[220px]",children:[a.jsx(Hm,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:"In Zotero: File → Import → select the .ris file"})]})]}),a.jsxs(ve,{variant:"outline",size:"sm",onClick:Ue,disabled:v.size===0,children:[a.jsx(fo,{className:"w-4 h-4 mr-1"}),"Export selected (",v.size,")"]})]})]}),we.length===0?a.jsxs("div",{className:"min-h-[40vh] flex flex-col items-center justify-center text-center",children:[a.jsx(Ir,{className:"w-12 h-12 text-muted-foreground/40 mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:"No citations yet"}),a.jsx("p",{className:"text-muted-foreground text-sm max-w-md",children:"Upload documents to your library first. Bibliographic metadata will be extracted automatically."})]}):a.jsxs(yl,{children:[a.jsx(vl,{children:a.jsxs(Nn,{children:[a.jsx(yt,{className:"w-8"}),a.jsx(yt,{children:"Title"}),a.jsx(yt,{children:"Author(s)"}),a.jsx(yt,{children:"Year"}),a.jsx(yt,{children:"Pages"}),a.jsx(yt,{children:"DOI / ISBN"}),a.jsx(yt,{className:"text-right",children:"Actions"})]})}),a.jsx(xl,{children:we.map(fe=>a.jsx(Agt,{doc:fe,selected:v.has(fe.id),onSelectionChange:je},fe.id))})]})]})})};function eA({isLoading:t=!1,size:e=40}){return a.jsxs("div",{className:"relative flex-shrink-0",style:{width:e,height:e},children:[t&&a.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-transparent border-t-purple-500 animate-spin",style:{width:e,height:e}}),a.jsx("img",{src:"https://nqibmbtqcjucktqcreob.supabase.co/storage/v1/object/public/src/Logo_ST_small_supervisor.png",alt:"Thesis Supervisor",className:"rounded-full object-cover",style:{width:e,height:e}})]})}const Cgt=E6,kgt=C6,Tgt=k6,dme=S.forwardRef(({className:t,...e},r)=>a.jsx(Vj,{className:Oe("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));dme.displayName=Vj.displayName;const Pgt=id("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),hme=S.forwardRef(({side:t="right",className:e,children:r,...n},s)=>a.jsxs(Tgt,{children:[a.jsx(dme,{}),a.jsxs(qj,{ref:s,className:Oe(Pgt({side:t}),e),...n,children:[r,a.jsxs(kT,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(Rs,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hme.displayName=qj.displayName;const fme=S.forwardRef(({className:t,...e},r)=>a.jsx(Gj,{ref:r,className:Oe("text-lg font-semibold text-foreground",t),...e}));fme.displayName=Gj.displayName;const Ogt=S.forwardRef(({className:t,...e},r)=>a.jsx(Kj,{ref:r,className:Oe("text-sm text-muted-foreground",t),...e}));Ogt.displayName=Kj.displayName;const hM=768;function Igt(){const[t,e]=S.useState(void 0);return S.useEffect(()=>{const r=window.matchMedia(`(max-width: ${hM-1}px)`),n=()=>{e(window.innerWidth<hM)};return r.addEventListener("change",n),e(window.innerWidth<hM),()=>r.removeEventListener("change",n)},[]),!!t}const Rgt=["How well am I answering my research questions?","What is still missing in my thesis?","Can you review my discussion?"];function Mgt(){var q;const{user:t}=Pt(),e=Igt(),[r,n]=S.useState([]),[s,i]=S.useState(""),[o,l]=S.useState([]),[c,u]=S.useState(null),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState(!1),[v,y]=S.useState(!1),x=S.useRef(null),[b,w]=S.useState(null),j=S.useRef(null);S.useEffect(()=>{if(!t)return;(async()=>{const{data:U}=await be.from("theses").select("id, title").order("created_at",{ascending:!1});U&&U.length>0&&(n(U),i(U[0].id))})()},[t]),S.useEffect(()=>{if(!s)return;(async()=>{const{data:U}=await be.from("supervisor_chats").select("id, title, messages, created_at, updated_at").eq("thesis_id",s).order("updated_at",{ascending:!1});l(U||[]),u(null),h([])})()},[s]),S.useEffect(()=>{var A;(A=x.current)==null||A.scrollIntoView({behavior:"smooth"})},[d]);const N=A=>{u(A.id),h(A.messages||[]),y(!1)},C=()=>{u(null),h([]),p(""),y(!1)},k=S.useCallback(async A=>{if(!A.trim()||!s||!t||g)return;const U={role:"user",content:A.trim(),timestamp:new Date().toISOString()},K=[...d,U];h(K),p(""),m(!0);try{const{data:G,error:Y}=await be.functions.invoke("supervisor_chat",{body:{thesis_id:s,message:U.content,chat_history:d.map(L=>({role:L.role,content:L.content})),language:"en",attachment:b??null}});if(Y)throw Y;w(null);const H={role:"assistant",content:(G==null?void 0:G.message)||"Keine Antwort erhalten.",timestamp:new Date().toISOString()},$=[...K,H];if(h($),c)await be.from("supervisor_chats").update({messages:$,updated_at:new Date().toISOString()}).eq("id",c),l(L=>L.map(F=>F.id===c?{...F,messages:$,updated_at:new Date().toISOString()}:F));else{const L=U.content.substring(0,50),{data:F}=await be.from("supervisor_chats").insert({user_id:t.id,thesis_id:s,title:L,messages:$}).select("id").single();F&&(u(F.id),l(W=>[{id:F.id,title:L,messages:$,created_at:new Date().toISOString(),updated_at:new Date().toISOString()},...W]))}}catch(G){Fe.error("Fehler: "+(G.message||"Unbekannter Fehler"))}finally{m(!1)}},[d,s,t,g,c]),E=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),k(f))},M=async A=>{var G;const U=(G=A.target.files)==null?void 0:G[0];if(!U)return;if(U.size>10*1024*1024){Fe.error("Datei zu groß – maximum 10MB");return}const K=new FileReader;K.onload=()=>{const Y=K.result.split(",")[1];w({name:U.name,base64:Y,type:U.type}),Fe.success(`${U.name} attached`)},K.readAsDataURL(U)},z=a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground mb-1.5 block",children:"Thesis"}),a.jsxs(it,{value:s,onValueChange:i,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select thesis…"})}),a.jsx(nt,{children:r.map(A=>a.jsx(Te,{value:A.id,children:A.title},A.id))})]})]}),a.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[a.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Vergangene Chats"}),a.jsx(Yj,{className:"flex-1",children:a.jsxs("div",{className:"space-y-1",children:[o.map(A=>a.jsxs("button",{onClick:()=>N(A),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors flex items-center gap-2 ${c===A.id?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"}`,children:[a.jsx(Wm,{className:"w-3.5 h-3.5 flex-shrink-0 opacity-50"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-xs font-medium leading-tight",children:A.title||"Untitled"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:t1(new Date(A.updated_at),"dd.MM. HH:mm")})]})]},A.id)),o.length===0&&s&&a.jsx("p",{className:"text-sm text-muted-foreground px-3 py-4",children:"Noch keine Chats."})]})})]}),a.jsxs(ve,{variant:"outline",className:"w-full",onClick:C,children:[a.jsx(sc,{className:"w-4 h-4 mr-2"})," New Chat"]})]}),I=A=>{if(!(A.includes("✓")||A.includes("✗")||A.includes("→")))return a.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none
      [&>*:first-child]:mt-0 [&>*:last-child]:mb-0
      [&>p]:mb-3 [&>p]:leading-relaxed
      [&>p>strong]:block [&>p>strong]:mt-4 [&>p>strong]:mb-1 [&>p>strong]:text-sm
      [&>ul]:mt-1 [&>ul]:mb-3 [&>ul]:space-y-1.5
      [&>li]:leading-relaxed`,children:a.jsx(fc,{components:{p:({children:F,...W})=>{var le;const X=Array.isArray(F)?F:[F];return X.length===1&&typeof X[0]=="object"&&((le=X[0])==null?void 0:le.type)==="strong"?a.jsx("p",{className:"font-semibold text-sm mt-5 mb-1.5",...W,children:F}):a.jsx("p",{className:"mb-2.5 leading-relaxed",...W,children:F})},a:({href:F,children:W})=>a.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-80 transition-opacity",children:W}),hr:()=>null},children:A})});const K=[],G=A.split(`
`);let Y={type:"",lines:[]};const H=[];let $=!1;for(const F of G)F.startsWith("✓")||F.includes("Was gut ist")?(Y.lines.length&&K.push(Y),Y={type:"good",lines:[F.replace(/^✓\s*\*?\*?Was gut ist\*?\*?:?\s*/i,"").replace(/^✓\s*/,"")]},$=!0):F.startsWith("✗")||F.includes("Was verbessert")?(Y.lines.length&&K.push(Y),Y={type:"improve",lines:[F.replace(/^✗\s*\*?\*?Was verbessert werden muss\*?\*?:?\s*/i,"").replace(/^✗\s*/,"")]},$=!0):F.startsWith("→")||F.includes("Nächster")?(Y.lines.length&&K.push(Y),Y={type:"next",lines:[F.replace(/^→\s*\*?\*?Nächster konkreter Schritt\*?\*?:?\s*/i,"").replace(/^→\s*/,"")]},$=!0):$?Y.lines.push(F):H.push(F);Y.lines.length&&K.push(Y);const L={good:{label:"What is good",icon:"✓",bg:"bg-emerald-50 dark:bg-emerald-950/30",border:"border-emerald-200 dark:border-emerald-800",iconColor:"text-emerald-600 dark:text-emerald-400",labelColor:"text-emerald-700 dark:text-emerald-300"},improve:{label:"What needs to be improved",icon:"✗",bg:"bg-red-50 dark:bg-red-950/30",border:"border-red-200 dark:border-red-800",iconColor:"text-red-500 dark:text-red-400",labelColor:"text-red-700 dark:text-red-300"},next:{label:"Next concrete step",icon:"→",bg:"bg-blue-50 dark:bg-blue-950/30",border:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-500 dark:text-blue-400",labelColor:"text-blue-700 dark:text-blue-300"}};return a.jsxs("div",{className:"space-y-1",children:[H.join(`
`).trim()&&a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-3 [&>p]:mb-2 [&>p]:leading-relaxed",children:a.jsx(fc,{children:H.join(`
`)})}),K.map((F,W)=>{const X=L[F.type];return X?a.jsxs("div",{className:`rounded-xl border px-4 py-3 ${X.bg} ${X.border}`,children:[a.jsxs("div",{className:`flex items-center gap-1.5 font-semibold text-xs mb-2 ${X.labelColor}`,children:[a.jsx("span",{className:X.iconColor,children:X.icon}),X.label]}),a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>p]:mb-2 [&>p]:leading-relaxed [&>p]:text-foreground [&>ul]:space-y-1 [&>li]:leading-relaxed [&>li]:text-foreground",children:a.jsx(fc,{children:F.lines.join(`
`).trim()})})]},W):null})]})};return a.jsx(lr,{showSidebar:!0,pageTitle:"Supervisor",fullWidth:!0,hidePlatformAssistant:!0,children:a.jsxs("div",{className:"flex h-[calc(100vh-4rem)] -m-4 md:-m-6 xl:-m-8",children:[a.jsx("div",{className:"hidden md:flex w-[280px] flex-shrink-0 flex-col gap-4 border-r border-border px-4 pt-6 pb-4",children:z}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 px-4 md:px-6 pt-4 md:pt-6",children:[a.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b border-border mb-4",children:[e&&a.jsxs(Cgt,{open:v,onOpenChange:y,children:[a.jsx(kgt,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:a.jsx(LF,{className:"w-5 h-5"})})}),a.jsxs(hme,{side:"left",className:"w-[280px] p-4 flex flex-col gap-4",children:[a.jsx(fme,{className:"sr-only",children:"Chat History"}),z]})]}),a.jsx(eA,{isLoading:!1}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Thesis Supervisor"}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e&&s?((q=r.find(A=>A.id===s))==null?void 0:q.title)||"AI-powered feedback":"AI-powered feedback on your work"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 pb-4",children:[d.length===0&&!g&&a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-6",children:[a.jsx(eA,{size:64}),a.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Ask me questions about your thesis — I'll give you feedback like a supervisor.."}),a.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:Rgt.map(A=>a.jsx("button",{onClick:()=>k(A),className:"px-4 py-2 rounded-full border border-border text-sm text-foreground hover:bg-muted transition-colors",children:A},A))})]}),d.map((A,U)=>a.jsxs("div",{className:`flex gap-3 ${A.role==="user"?"justify-end":"justify-start"}`,children:[A.role==="assistant"&&a.jsx(eA,{size:32}),a.jsx("div",{className:`max-w-[85%] md:max-w-[75%] rounded-2xl px-4 text-sm ${A.role==="user"?"bg-purple-600 text-white rounded-br-md py-3":"bg-muted text-foreground rounded-bl-md shadow-sm py-4"}`,children:A.role==="assistant"?I(A.content):a.jsx("p",{className:"whitespace-pre-wrap",children:A.content})})]},U)),g&&a.jsxs("div",{className:"flex gap-3 justify-start",children:[a.jsx(eA,{size:32,isLoading:!0}),a.jsx("div",{className:"bg-muted rounded-2xl rounded-bl-md px-4 py-3",children:a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),a.jsx("span",{className:"w-2 h-2 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]})})]}),a.jsx("div",{ref:x})]}),a.jsxs("div",{className:"border-t border-border pt-4 pb-4 flex flex-col gap-2",children:[b&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted rounded-lg text-xs text-muted-foreground w-fit",children:[a.jsxs("span",{children:["📎 ",b.name]}),a.jsx("button",{onClick:()=>w(null),className:"hover:text-foreground",children:"✕"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("input",{ref:j,type:"file",accept:".pdf,.txt,.docx",className:"hidden",onChange:M}),a.jsx(ve,{variant:"outline",size:"icon",className:"h-[60px] w-[60px] flex-shrink-0",onClick:()=>{var A;return(A=j.current)==null?void 0:A.click()},disabled:g,children:a.jsx(e0e,{className:"w-5 h-5"})}),a.jsx(Wt,{value:f,onChange:A=>p(A.target.value),onKeyDown:E,placeholder:e?"Ask a question...":"Ask a question… (Enter to send, Shift+Enter for new line)",className:"min-h-[60px] max-h-[160px] resize-none",disabled:g||!s}),a.jsx(ve,{onClick:()=>k(f),disabled:g||!f.trim()||!s,size:"icon",className:"h-[60px] w-[60px] flex-shrink-0",children:a.jsx(VJ,{className:"w-5 h-5"})})]})]})]})]})})}function Dgt(){return a.jsx(lr,{showSidebar:!0,children:a.jsx("div",{className:"container mx-auto p-6 max-w-7xl",children:a.jsx(M_e,{})})})}function Lgt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=vn(),[o,l]=S.useState(""),[c,u]=S.useState(""),[d,h]=S.useState(""),[f,p]=S.useState("bachelor"),[g,m]=S.useState(""),[v,y]=S.useState("de"),[x,b]=S.useState(null),[w,j]=S.useState(!1),[N,C]=S.useState("both"),[k,E]=S.useState([]),[M,z]=S.useState("");S.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:K,error:G}=await be.from("summaries").select("id, summary_text").eq("user_id",t.id).eq("summary_mode","topic_explorer").order("created_at",{ascending:!1});if(G){console.error("Error loading topic explorer entries:",G);return}const Y=(K||[]).map(H=>{try{const $=JSON.parse(H.summary_text||"{}");return{id:H.id,title:$.title||"Unbenannt",data:$}}catch($){return console.error("Failed to parse topic explorer entry:",$),null}}).filter(Boolean);E(Y)})()},[t==null?void 0:t.id]);const I=()=>{var Y;const U=k.find(H=>H.id===M);if(!U)return;const{data:K}=U;l(K.title||""),u(K.objectives||"");const G=((Y=K.original_selection)==null?void 0:Y.researchQuestions)||[];h(G.join(`
`)),i({title:"Topic adopted",description:"Working title, objectives, and research questions have been completed"})},q=async()=>{if(!e()){s(!0);return}if(!o.trim()){i({title:"Enter Work Title",variant:"destructive"});return}j(!0);try{const U=d.split(`
`).filter(Y=>Y.trim()),{data:K,error:G}=await be.functions.invoke("research_setup_builder",{body:{title:o.trim(),aim:c.trim(),questions:U,degree:f,discipline:g.trim(),language:v}});if(G)throw G;b(K),i({title:"Research setup successfully generated",description:K.summary_id?"Saved to library":void 0})}catch(U){console.error("Research setup error:",U),i({title:"Error during transfer",variant:"destructive"})}j(!1)},A=async U=>{if(!x)return;const K=x.codebook,G=x.meta??{};if(!K||!K.categories||!K.categories.length){i({title:"No coding sheet generated",variant:"destructive"});return}let Y=K.categories;if(U!=="both"&&(Y=Y.filter(H=>H.source===U)),!Y.length){i({title:`No categories found for source "${U}"`,variant:"destructive"});return}try{const{data:H,error:$}=await be.from("codebooks").insert({title:G.title?`Coding sheet – ${G.title}`:"Coding sheet",description:G.aim??null,degree:G.degree??null,discipline:G.discipline??null,language:G.language??null,user_id:t==null?void 0:t.id}).select().single();if($)throw $;const L=Y.map((W,X)=>({codebook_id:H.id,name:W.name||"Category",definition:W.definition||"",coding_rule:W.coding_rule||"",anchor_example:W.anchor_example||"",order_index:Number.isFinite(W.order_index)?W.order_index:X})),{error:F}=await be.from("codebook_categories").insert(L);if(F)throw F;i({title:`Coding sheet (${U}) adopted`})}catch(H){console.error(H),i({title:"Error during transfer",variant:"destructive"})}};return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Research Design Setup"})}),a.jsxs($e,{className:"space-y-4",children:[k.length>0&&a.jsxs("div",{className:"p-4 border rounded-lg space-y-3 bg-inherit",children:[a.jsx(_e,{className:"text-sm font-semibold",children:"Take from Topic Explorer"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(it,{value:M,onValueChange:z,children:[a.jsx(rt,{className:"flex-1",children:a.jsx(at,{placeholder:"Select a topic..."})}),a.jsx(nt,{children:k.map(U=>a.jsx(Te,{value:U.id,children:U.title},U.id))})]}),a.jsx(ve,{onClick:I,disabled:!M,variant:"secondary",children:"Import topic"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"title",children:"Working title"}),a.jsx(Be,{id:"title",value:o,onChange:U=>l(U.target.value),placeholder:"Title of the research paper"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"discipline",children:"Discipline"}),a.jsx(Be,{id:"discipline",value:g,onChange:U=>m(U.target.value),placeholder:"e.g., Sociology, Psychology"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Degree"}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"bachelor",children:"Bachelor"}),a.jsx(Te,{value:"master",children:"Master"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:v,onValueChange:y,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"Deutsch"}),a.jsx(Te,{value:"en",children:"English"})]})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"aim",children:"Objectives"}),a.jsx(Wt,{id:"aim",value:c,onChange:U=>u(U.target.value),rows:3,placeholder:"Description of research objectives"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"questions",children:"Existing research questions (one per line)"}),a.jsx(Wt,{id:"questions",value:d,onChange:U=>h(U.target.value),rows:4,placeholder:"Research Question 1 Research Question 2 ... "})]}),a.jsx("div",{className:"flex gap-4",children:a.jsxs(ve,{onClick:q,disabled:w,children:[w&&a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Generate Research Setup"]})}),x&&a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Add as Codebook"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Source"}),a.jsxs(it,{value:N,onValueChange:U=>C(U),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"participant",children:"Participant Interviews"}),a.jsx(Te,{value:"expert",children:"Expert Interviews"}),a.jsx(Te,{value:"both",children:"Both (merged)"})]})]})]}),a.jsxs(ve,{onClick:()=>A(N),variant:"outline",children:["Add as Codebook (",N,")"]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Forschungskontext"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Titel"}),a.jsx("p",{className:"text-sm",children:x.meta.title})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Zielsetzung"}),a.jsx("p",{className:"text-sm",children:x.meta.aim})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Derived Research Questions"}),a.jsx("ul",{className:"list-disc list-inside text-sm space-y-1",children:x.meta.derived_research_questions.map((U,K)=>a.jsx("li",{children:U},K))})]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Teilnehmer-Interview"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Introduction"}),a.jsx("p",{className:"text-sm whitespace-pre-line",children:x.participant_interview.intro})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Fragen"}),a.jsx("div",{className:"space-y-3 mt-2",children:x.participant_interview.questions.map((U,K)=>a.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[a.jsx("p",{className:"font-medium text-sm",children:U.question}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["→ ",U.maps_to_rq]}),U.probes.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx(_e,{className:"text-xs",children:"Nachfragen:"}),a.jsx("ul",{className:"list-disc list-inside text-xs space-y-1 ml-2",children:U.probes.map((G,Y)=>a.jsx("li",{children:G},Y))})]})]},K))})]})]})]}),a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Experten-Interview"})}),a.jsxs($e,{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Introduction"}),a.jsx("p",{className:"text-sm whitespace-pre-line",children:x.expert_interview.intro})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"font-semibold",children:"Fragen"}),a.jsx("div",{className:"space-y-3 mt-2",children:x.expert_interview.questions.map((U,K)=>a.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[a.jsx("p",{className:"font-medium text-sm",children:U.question}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["→ ",U.maps_to_rq]}),U.probes.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx(_e,{className:"text-xs",children:"Nachfragen:"}),a.jsx("ul",{className:"list-disc list-inside text-xs space-y-1 ml-2",children:U.probes.map((G,Y)=>a.jsx("li",{children:G},Y))})]})]},K))})]})]})]})]})]})]}),a.jsx(Tc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}function Fgt(){const{user:t}=Pt(),{toast:e}=vn(),[r,n]=S.useState([]),[s,i]=S.useState(""),[o,l]=S.useState([]),[c,u]=S.useState(!1),[d,h]=S.useState("");S.useEffect(()=>{t&&f()},[t]),S.useEffect(()=>{s&&p()},[s]);const f=async()=>{const{data:C,error:k}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});k?e({title:"Error loading codebooks",variant:"destructive"}):n(C||[])},p=async()=>{if(!s)return;const{data:C,error:k}=await be.from("codebook_categories").select("*").eq("codebook_id",s).order("order_index",{ascending:!0});k?e({title:"Error loading categories",variant:"destructive"}):l(C||[])},g=async()=>{const C=d.trim();if(!C){e({title:"Please enter title",variant:"destructive"});return}if(!(t!=null&&t.id)){e({title:"Not signed in",variant:"destructive"});return}const k={title:C,user_id:t.id},{data:E,error:M}=await be.from("codebooks").insert(k).select().single();if(M){e({title:"Error creating",variant:"destructive"});return}h(""),await f(),i(E.id),e({title:"Codebook created"})},m=async()=>{if(!s){e({title:"No codebook selected",variant:"destructive"});return}try{const{error:C}=await be.from("codebooks").delete().eq("id",s);if(C)throw C;e({title:"Codebook deleted successfully"}),i(""),l([]),await f()}catch(C){console.error("Delete error:",C),e({title:"Error deleting",variant:"destructive"})}},v=()=>{l([...o,{id:`new-${Date.now()}`,codebook_id:s,name:"",definition:"",coding_rule:"",anchor_example:"",order_index:o.length}])},y=(C,k,E)=>{l(o.map(M=>M.id===C?{...M,[k]:E}:M))},x=async C=>{if(String(C).startsWith("new-")){l(o.filter(k=>k.id!==C));return}try{const{error:k}=await be.from("codebook_categories").delete().eq("id",C);if(k)throw k;l(o.filter(E=>E.id!==C)),e({title:"Category deleted successfully"})}catch{e({title:"Error deleting",variant:"destructive"})}},b=async()=>{if(s){u(!0);try{const C=o.filter(E=>!E.id.startsWith("new-")),k=o.filter(E=>E.id.startsWith("new-")).map(E=>({codebook_id:s,name:E.name,definition:E.definition,coding_rule:E.coding_rule,anchor_example:E.anchor_example,order_index:E.order_index}));if(C.length>0)for(const E of C){const{error:M}=await be.from("codebook_categories").update({name:E.name,definition:E.definition,coding_rule:E.coding_rule,anchor_example:E.anchor_example,order_index:E.order_index}).eq("id",E.id);if(M)throw M}if(k.length>0){const{error:E}=await be.from("codebook_categories").insert(k);if(E)throw E}e({title:"Categories saved successfully"}),p()}catch{e({title:"Error saving",variant:"destructive"})}u(!1)}},w=()=>{if(!s){e({title:"Select codebook",variant:"destructive"});return}const C=[["Category","Definition","Coding Rule","Anchor Example"]];for(const q of o)C.push([(q.name??"").replace(/\r?\n/g," ").trim(),(q.definition??"").replace(/\r?\n/g," ").trim(),(q.coding_rule??"").replace(/\r?\n/g," ").trim(),(q.anchor_example??"").replace(/\r?\n/g," ").trim()]);const k=W1.unparse(C,{delimiter:",",quotes:!0,newline:`\r
`}),E="\uFEFF",M=new Blob([E+k],{type:"text/csv;charset=utf-8"}),z=URL.createObjectURL(M),I=document.createElement("a");I.href=z,I.download=`codebook_${s}.csv`,I.click(),URL.revokeObjectURL(z)},j=async C=>{if(!s){e({title:"Select codebook",variant:"destructive"});return}try{const k=(z,I)=>new Promise((q,A)=>{const U=new FileReader;U.onload=()=>q(U.result),U.onerror=A,U.readAsText(z,I)});let E;try{E=await k(C,"UTF-8"),E.includes("�")&&(E=await k(C,"Windows-1252"))}catch{E=await k(C,"Windows-1252")}const M=E.charCodeAt(0)===65279?E.slice(1):E;if(!M.trim()){e({title:"Error",description:"CSV file is empty",variant:"destructive"});return}W1.parse(M,{header:!0,skipEmptyLines:!0,encoding:"UTF-8",delimiter:"",transformHeader:z=>(z||"").trim(),complete:async z=>{var I;try{if(!((I=z.data)!=null&&I.length)){e({title:"Error",description:"CSV contains no data",variant:"destructive"});return}const q=z.data[0];if(!(q&&q.hasOwnProperty("Category")&&q.hasOwnProperty("Definition")&&q.hasOwnProperty("Coding Rule")&&q.hasOwnProperty("Anchor Example"))){e({title:"Error",description:"CSV must contain headers 'Category', 'Definition', 'Coding Rule', 'Anchor Example'",variant:"destructive"});return}const U=z.data.map(Y=>({name:(Y.Category||"").trim(),definition:(Y.Definition||"").trim(),coding_rule:(Y["Coding Rule"]||"").trim(),anchor_example:(Y["Anchor Example"]||"").trim()})).filter(Y=>Y.name);if(U.length===0){e({title:"No valid rows found",description:"No rows with category names",variant:"destructive"});return}let K=0,G=0;for(const Y of U)try{const{data:H,error:$}=await be.from("codebook_categories").select("id").eq("codebook_id",s).eq("name",Y.name).maybeSingle();if($){console.error("Query error:",$);continue}if(H&&H.id){const{error:L}=await be.from("codebook_categories").update({definition:Y.definition,coding_rule:Y.coding_rule,anchor_example:Y.anchor_example}).eq("id",H.id);L||K++}else{const{error:L}=await be.from("codebook_categories").insert({...Y,codebook_id:s,order_index:U.indexOf(Y)});L||G++}}catch(H){console.error("Error processing category:",Y.name,H)}e({title:"Import complete",description:`${K} updated, ${G} newly added`}),await p()}catch(q){console.error("Import processing error:",q),e({title:"Error processing data",variant:"destructive"})}},error:z=>{console.error("CSV parsing error:",z),e({title:"Could not read CSV",description:"Please check file format",variant:"destructive"})}})}catch(k){console.error("File reading error:",k),e({title:"Could not read file",variant:"destructive"})}},N=async C=>{try{const{error:k}=await be.from("codebook_categories").update({name:C.name,definition:C.definition,coding_rule:C.coding_rule,anchor_example:C.anchor_example,order_index:C.order_index}).eq("id",C.id);if(k)throw k;e({title:"Category saved"})}catch(k){console.error(k),e({title:"Error saving",variant:"destructive"})}};return a.jsx("div",{className:"space-y-6",children:a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Edit Codebook"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsx("div",{className:"mb-4 p-3 border rounded-md",children:a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(_e,{children:"Create New Codebook"}),a.jsx(Be,{value:d,onChange:C=>h(C.target.value),placeholder:"e.g. Codebook – ITIL Challenges"})]}),a.jsxs(ve,{onClick:g,children:[a.jsx(sc,{className:"h-4 w-4 mr-2"}),"Create"]})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Select Codebook"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(it,{value:s,onValueChange:i,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:r.length?"Select codebook...":"No codebook available yet"})}),a.jsx(nt,{children:r.map(C=>a.jsx(Te,{value:C.id,children:C.title},C.id))})]}),s&&a.jsx(ve,{variant:"destructive",size:"icon",onClick:m,title:"Delete codebook",children:a.jsx(As,{className:"h-4 w-4"})})]})]}),!r.length&&a.jsx("p",{className:"text-sm text-muted-foreground",children:'Create a codebook above or go to "Research Setup" and adopt a generated one.'}),s&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ve,{variant:"outline",onClick:w,children:"Export CSV"}),a.jsxs("div",{children:[a.jsx("input",{id:"csv-import",type:"file",accept:".csv,text/csv",className:"hidden",onChange:C=>{var E;const k=(E=C.target.files)==null?void 0:E[0];k&&j(k),C.currentTarget.value=""}}),a.jsx(_e,{htmlFor:"csv-import",className:"cursor-pointer px-4 py-2 border rounded-md hover:bg-muted text-sm",children:"Import CSV"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ve,{onClick:v,size:"sm",children:[a.jsx(sc,{className:"h-4 w-4 mr-2"}),"Add Category"]}),a.jsxs(ve,{onClick:b,disabled:c,variant:"default",size:"sm",children:[c&&a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}),a.jsx(mD,{className:"h-4 w-4 mr-2"}),"Save All"]})]})]}),a.jsx("div",{className:"space-y-4",children:o.map((C,k)=>a.jsx(Me,{children:a.jsx($e,{className:"pt-4",children:a.jsxs("div",{className:"grid grid-cols-12 gap-4 items-start",children:[a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Name"}),a.jsx(Be,{value:C.name,onChange:E=>y(C.id,"name",E.target.value),placeholder:"Category name"})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Definition"}),a.jsx(Wt,{value:C.definition||"",onChange:E=>y(C.id,"definition",E.target.value),placeholder:"Category definition",rows:2})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{children:"Coding Rule"}),a.jsx(Wt,{value:C.coding_rule||"",onChange:E=>y(C.id,"coding_rule",E.target.value),placeholder:"Rules for coding",rows:2})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx(_e,{children:"Anchor Example"}),a.jsx(Wt,{value:C.anchor_example||"",onChange:E=>y(C.id,"anchor_example",E.target.value),placeholder:'e.g. "As an IT Service Manager I am..."',rows:2})]}),a.jsxs("div",{className:"col-span-1 flex flex-col gap-2 pt-6",children:[a.jsx(ve,{onClick:()=>N(C),size:"sm",variant:"outline",disabled:String(C.id).startsWith("new-"),title:String(C.id).startsWith("new-")?"Click 'Save All' above first":"Save this category",children:a.jsx(mD,{className:"h-4 w-4"})}),a.jsx(ve,{onClick:()=>x(C.id),size:"sm",variant:"destructive",children:a.jsx(As,{className:"h-4 w-4"})})]})]})})},C.id))})]})]})]})})}function $gt({open:t,onOpenChange:e,categoryId:r,categoryName:n,interviewId:s,interviewTitle:i,codebookId:o,onSuccess:l}){const[c,u]=S.useState([]),[d,h]=S.useState(!1),[f,p]=S.useState(!1),{toast:g}=vn();S.useEffect(()=>{t&&r&&s&&m()},[t,r,s]);const m=async()=>{h(!0);try{const{data:w,error:j}=await be.from("coded_segments").select("id, snippet").eq("category_id",r).eq("interview_id",s).order("created_at",{ascending:!0});if(j)throw j;w&&w.length>0?u(w.map(N=>({id:N.id,snippet:N.snippet}))):u([{id:crypto.randomUUID(),snippet:"",isNew:!0}])}catch(w){g({title:"Error loading snippets",description:w.message,variant:"destructive"}),u([{id:crypto.randomUUID(),snippet:"",isNew:!0}])}finally{h(!1)}},v=()=>{u([...c,{id:crypto.randomUUID(),snippet:"",isNew:!0}])},y=w=>{if(c.length===1){g({title:"Cannot delete",description:"At least one snippet must remain",variant:"destructive"});return}u(c.filter(j=>j.id!==w))},x=(w,j)=>{u(c.map(N=>N.id===w?{...N,snippet:j}:N))},b=async()=>{p(!0);try{const{data:{user:w}}=await be.auth.getUser();if(!w)throw new Error("Not authenticated");const j=c.filter(z=>!z.isNew),N=c.filter(z=>z.isNew),{data:C}=await be.from("coded_segments").select("id").eq("category_id",r).eq("interview_id",s),k=(C==null?void 0:C.map(z=>z.id))||[],E=j.map(z=>z.id),M=k.filter(z=>!E.includes(z));if(M.length>0){const{error:z}=await be.from("coded_segments").delete().in("id",M);if(z)throw z}for(const z of j){const{error:I}=await be.from("coded_segments").update({snippet:z.snippet}).eq("id",z.id);if(I)throw I}if(N.length>0){const{error:z}=await be.from("coded_segments").insert(N.map(I=>({user_id:w.id,interview_id:s,codebook_id:o,category_id:r,snippet:I.snippet,start_char:0,end_char:I.snippet.length})));if(z)throw z}g({title:"Success",description:"Snippets saved successfully"}),l(),e(!1)}catch(w){g({title:"Error saving snippets",description:w.message,variant:"destructive"})}finally{p(!1)}};return a.jsx(Vr,{open:t,onOpenChange:e,children:a.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Mr,{children:a.jsxs(Dr,{children:["Edit Snippets: ",n," - ",i]})}),d?a.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Loading..."}):a.jsxs("div",{className:"space-y-4",children:[c.map((w,j)=>a.jsxs("div",{className:"space-y-2 p-4 border border-border rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(_e,{htmlFor:`snippet-${w.id}`,children:["Snippet ",j+1]}),a.jsx(ve,{type:"button",variant:"ghost",size:"sm",onClick:()=>y(w.id),disabled:c.length===1,children:a.jsx(As,{className:"h-4 w-4"})})]}),a.jsx(Wt,{id:`snippet-${w.id}`,value:w.snippet,onChange:N=>x(w.id,N.target.value),placeholder:"Enter snippet text...",className:"min-h-[100px]"})]},w.id)),a.jsxs(ve,{type:"button",variant:"outline",onClick:v,className:"w-full",children:[a.jsx(sc,{className:"h-4 w-4 mr-2"}),"Add Snippet"]})]}),a.jsxs(yf,{children:[a.jsx(ve,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:f,children:"Cancel"}),a.jsx(ve,{type:"button",onClick:b,disabled:f||d,children:f?"Saving...":"Save Changes"})]})]})})}function Bgt(){const[t,e]=S.useState([]),[r,n]=S.useState(""),[s,i]=S.useState([]),[o,l]=S.useState([]),[c,u]=S.useState({}),[d,h]=S.useState(!1),[f,p]=S.useState(!0),[g,m]=S.useState(""),[v,y]=S.useState(null),[x,b]=S.useState(!1),[w,j]=S.useState(null),N=S.useRef(null),[C,k]=S.useState(!1),[E,M]=S.useState("error"),[z,I]=S.useState(""),[q,A]=S.useState(""),[U,K]=S.useState([]),[G,Y]=S.useState(null),[H,$]=S.useState(!1),{toast:L}=vn(),F=async()=>{p(!0);try{const{data:ie,error:V}=await be.from("codebooks").select("id, title").order("created_at",{ascending:!1});if(V)throw V;ie&&ie.length>0&&(e(ie),n(ie[0].id))}catch(ie){L({title:"Error loading codebooks",description:ie.message,variant:"destructive"})}finally{p(!1)}},W=async ie=>{if(!ie){i([]),l([]);return}h(!0);try{const{data:V,error:O}=await be.from("v_category_interview_matrix").select("*").eq("codebook_id",ie);if(O)throw O;const T={},D=new Set,ne={};V==null||V.forEach(re=>{var pe;T[re.category_id]||(T[re.category_id]={category_id:re.category_id,category_name:re.category_name,order_index:re.order_index||0,definition:re.definition,coding_rule:re.coding_rule,anchor_example:re.anchor_example},ne[re.category_id]={}),re.interview_title&&(D.add(re.interview_title),T[re.category_id][re.interview_title]=((pe=re.snippets)==null?void 0:pe.join(`
— `))||"",ne[re.category_id][re.interview_title]={interview_id:re.interview_id,snippets:re.snippets||[]})});const ue=Object.values(T).sort((re,pe)=>re.order_index-pe.order_index);i(ue),l(Array.from(D)),u(ne)}catch(V){L({title:"Error loading data",description:V.message,variant:"destructive"})}finally{h(!1)}};S.useEffect(()=>{F()},[]),S.useEffect(()=>{r&&W(r)},[r]);const X=async(ie,V,O)=>{try{const T={};V==="definition"&&(T.definition=O),V==="coding_rule"&&(T.coding_rule=O),V==="anchor_example"&&(T.anchor_example=O);const{error:D}=await be.from("codebook_categories").update(T).eq("id",ie);if(D)throw D;L({title:"Success",description:"Category updated successfully"}),r&&await W(r)}catch(T){L({title:"Error updating category",description:T.message,variant:"destructive"})}},oe=(ie,V,O)=>{var D;const T=(D=c[ie])==null?void 0:D[O];if(!T){L({title:"Error",description:"Interview data not found",variant:"destructive"});return}j({categoryId:ie,categoryName:V,interviewId:T.interview_id,interviewTitle:O}),b(!0)},le=()=>{r&&W(r)},B=()=>{const ie=[["Category","Definition","Coding Rule","Anchor Example",...o]];P.forEach(ue=>{ie.push([(ue.category_name??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.definition??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.coding_rule??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),(ue.anchor_example??"").toString().replace(/\r?\n/g," ").replace(/"/g,'""').trim(),...o.map(re=>{const pe=ue[re];return(typeof pe=="string"?pe:(pe??"").toString()).replace(/"/g,'""').replace(/\r?\n/g," ").trim()})])});const V=W1.unparse(ie,{delimiter:";",quotes:!0,escapeFormulae:!0,newline:`\r
`}),O="\uFEFF",T=new Blob([O+V],{type:"text/csv;charset=utf-8"}),D=URL.createObjectURL(T),ne=document.createElement("a");ne.href=D,ne.download="codebook_grid.csv",ne.click(),URL.revokeObjectURL(D)},R=()=>{var ie;(ie=N.current)==null||ie.click()},ee=async ie=>{var O;const V=(O=ie.target.files)==null?void 0:O[0];if(V){if(ie.target.value="",!r){L({title:"Error",description:"Please select a codebook first",variant:"destructive"});return}$(!0),W1.parse(V,{delimiter:";",header:!0,skipEmptyLines:!0,encoding:"UTF-8",complete:async T=>{try{await te(T.data)}catch(D){L({title:"Import-Error",description:D.message,variant:"destructive"})}finally{$(!1)}},error:T=>{$(!1),L({title:"Error reading CSV file",description:T.message,variant:"destructive"})}})}},te=async ie=>{var we;if(!ie||ie.length===0)throw new Error("CSV file is empty");const V=ie[0],O=["Category","Definition","Coding Rule","Anchor Example"],T=O.filter(je=>!(je in V));if(T.length>0)throw new Error(`Missing columns: ${T.join(", ")}`);const D=Object.keys(V).filter(je=>!O.includes(je)),{data:ne,error:ue}=await be.from("codebook_categories").select("id, name").eq("codebook_id",r);if(ue)throw ue;const re=new Map((ne==null?void 0:ne.map(je=>[je.name,je.id]))||[]),xe=ie.map(je=>je.Category).filter(Boolean).filter(je=>!re.has(je));if(xe.length>0){M("error"),I("Missing Categories"),A(`The following categories do not exist in the codebook. :

${xe.join(`
`)}

Please add these categories to the codebook first.`),k(!0);return}const{data:ye,error:ae}=await be.from("interviews").select("id, title").eq("user_id",(we=(await be.auth.getUser()).data.user)==null?void 0:we.id);if(ae)throw ae;const de=new Map((ye==null?void 0:ye.map(je=>[je.title,je.id]))||[]),ge=D.filter(je=>!de.has(je));if(ge.length>0){M("warning"),I("Missing Interviews"),A(`The following interviews do not exist:

${ge.join(`
`)}

How would you like to proceed??`),K(ge),Y({csvData:ie,categoryMap:re,interviewMap:de,csvInterviewColumns:D}),k(!0);return}Z(ie,re,de,D)},Z=(ie,V,O,T)=>{const D=new Set(ie.map(ue=>ue.Category)).size,ne=T.filter(ue=>O.has(ue)).length;M("confirm"),I("Confirm Import"),A(`You are about to overwrite the codebook:

• ${D} categories will be updated
• ${ne} interviews will be overwritten
• Existing codings will be replaced

Do you want to continue?`),Y({csvData:ie,categoryMap:V,interviewMap:O,csvInterviewColumns:T}),k(!0)},J=async(ie=!1)=>{var ue;if(!G)return;const{csvData:V,categoryMap:O,interviewMap:T,csvInterviewColumns:D}=G,ne=(ue=(await be.auth.getUser()).data.user)==null?void 0:ue.id;if(!ne){L({title:"Error",description:"User not authenticated",variant:"destructive"});return}$(!0),k(!1);try{let re=new Map(T);if(ie&&U.length>0)for(const xe of U){const{data:ye,error:ae}=await be.from("interviews").insert({user_id:ne,title:xe,raw_text:"[Placeholder - Please add interview text]",source:"CSV Import"}).select("id").single();if(ae)throw ae;re.set(xe,ye.id)}let pe=0;for(const xe of V){const ye=xe.Category,ae=O.get(ye);if(ae)for(const de of D){const ge=re.get(de);if(!ge)continue;const we=xe[de]||"",{error:je}=await be.from("coded_segments").delete().eq("category_id",ae).eq("interview_id",ge).eq("codebook_id",r);if(je)throw je;if(we.trim()){const Ue=we.split(/\s*\|\s*/).filter(Ae=>Ae.trim()).map(Ae=>({user_id:ne,interview_id:ge,codebook_id:r,category_id:ae,snippet:Ae.trim(),start_char:-1,end_char:-1}));if(Ue.length>0){const{error:Ae}=await be.from("coded_segments").insert(Ue);if(Ae)throw Ae;pe+=Ue.length}}}}L({title:"✅ Import successful",description:`${V.length} categories updated, ${pe} snippets imported`}),await W(r)}catch(re){L({title:"Import failed",description:re.message,variant:"destructive"})}finally{$(!1),Y(null),K([])}},he=ie=>{if(k(!1),ie==="cancel"){Y(null),K([]);return}if(ie==="skip"&&G){const{csvData:V,categoryMap:O,interviewMap:T}=G,D=Object.keys(V[0]).filter(ne=>!["Category","Definition","Coding Rule","Anchor Example"].includes(ne)&&T.has(ne));Z(V,O,T,D);return}if(ie==="placeholder"&&G){const{csvData:V,categoryMap:O,interviewMap:T,csvInterviewColumns:D}=G;Z(V,O,T,D);return}ie==="confirm"&&J(U.length>0)},P=s.filter(ie=>ie.category_name.toLowerCase().includes(g.toLowerCase()));return f?a.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:a.jsx(Et,{className:"h-8 w-8 animate-spin text-primary"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Codingbook (Grid)"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"Excel-like view of your entire codebook with all interviews"})]}),a.jsxs(Me,{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"codebook-select",className:"text-sm font-medium mb-2 block",children:"Select Coding Book"}),a.jsxs(it,{value:r,onValueChange:n,children:[a.jsx(rt,{id:"codebook-select",className:"w-full max-w-md",children:a.jsx(at,{placeholder:"Please select a codebook"})}),a.jsx(nt,{children:t.map(ie=>a.jsx(Te,{value:ie.id,children:ie.title},ie.id))})]})]}),r&&a.jsxs("div",{className:"flex gap-4 items-center justify-between",children:[a.jsxs("div",{className:"relative flex-1 max-w-sm",children:[a.jsx(al,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Be,{placeholder:"Search categories...",value:g,onChange:ie=>m(ie.target.value),className:"pl-9"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:N,type:"file",accept:".csv",onChange:ee,className:"hidden"}),a.jsxs(ve,{onClick:R,variant:"outline",disabled:H,children:[H?a.jsx(Et,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(Qh,{className:"h-4 w-4 mr-2"}),"Import CSV"]}),a.jsxs(ve,{onClick:B,variant:"outline",children:[a.jsx(fo,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})]})]}),r?d?a.jsx(Me,{className:"p-12",children:a.jsx("div",{className:"flex items-center justify-center",children:a.jsx(Et,{className:"h-8 w-8 animate-spin text-primary"})})}):a.jsxs(Me,{className:"overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{className:"sticky top-0 bg-muted z-10",children:a.jsxs("tr",{children:[a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[150px]",children:"Category"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Definition"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Coding Rule"}),a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[200px]",children:"Anchor Example"}),o.map(ie=>a.jsx("th",{className:"border border-border p-3 text-left font-semibold text-sm min-w-[250px]",children:ie},ie))]})}),a.jsx("tbody",{children:P.map(ie=>a.jsxs("tr",{className:"hover:bg-muted/50 transition-colors",children:[a.jsx("td",{className:"border border-border p-3 text-sm font-medium",children:ie.category_name}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"definition"}),children:(v==null?void 0:v.rowId)===ie.category_id&&(v==null?void 0:v.field)==="definition"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.definition||"",onBlur:V=>{X(ie.category_id,"definition",V.target.value),y(null)},onKeyDown:V=>{V.key==="Escape"&&y(null),V.key==="Enter"&&V.ctrlKey&&(X(ie.category_id,"definition",V.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.definition||"—"})}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"coding_rule"}),children:(v==null?void 0:v.rowId)===ie.category_id&&(v==null?void 0:v.field)==="coding_rule"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.coding_rule||"",onBlur:V=>{X(ie.category_id,"coding_rule",V.target.value),y(null)},onKeyDown:V=>{V.key==="Escape"&&y(null),V.key==="Enter"&&V.ctrlKey&&(X(ie.category_id,"coding_rule",V.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.coding_rule||"—"})}),a.jsx("td",{className:"border border-border p-3 text-sm cursor-pointer hover:bg-accent/10",onClick:()=>y({rowId:ie.category_id,field:"anchor_example"}),children:(v==null?void 0:v.rowId)===ie.category_id&&(v==null?void 0:v.field)==="anchor_example"?a.jsx("textarea",{autoFocus:!0,defaultValue:ie.anchor_example||"",onBlur:V=>{X(ie.category_id,"anchor_example",V.target.value),y(null)},onKeyDown:V=>{V.key==="Escape"&&y(null),V.key==="Enter"&&V.ctrlKey&&(X(ie.category_id,"anchor_example",V.currentTarget.value),y(null))},className:"w-full p-2 border-2 border-primary rounded bg-yellow-50 dark:bg-yellow-950/20 text-sm resize-none min-h-[80px] focus:outline-none focus:ring-2 focus:ring-primary"}):a.jsx("div",{className:"whitespace-pre-wrap",children:ie.anchor_example||"—"})}),o.map(V=>a.jsx("td",{className:"border border-border p-3 text-sm align-top cursor-pointer hover:bg-accent/10",onClick:()=>oe(ie.category_id,ie.category_name,V),children:a.jsx("div",{className:"whitespace-pre-wrap text-muted-foreground",children:ie[V]||"—"})},V))]},ie.category_id))})]})}),P.length===0&&a.jsx("div",{className:"text-center py-12 text-muted-foreground",children:a.jsx("p",{children:"No categories found"})})]}):a.jsx(Me,{className:"p-12",children:a.jsx("div",{className:"text-center text-muted-foreground",children:a.jsx("p",{className:"text-lg",children:"Please select a codebook to view the data."})})}),x&&w&&r&&a.jsx($gt,{open:x,onOpenChange:b,categoryId:w.categoryId,categoryName:w.categoryName,interviewId:w.interviewId,interviewTitle:w.interviewTitle,codebookId:r,onSuccess:le}),a.jsx(wi,{open:C,onOpenChange:k,children:a.jsxs(Qs,{children:[a.jsxs(Zs,{children:[a.jsxs(ei,{className:"flex items-center gap-2",children:[E==="error"&&a.jsx(Ww,{className:"h-5 w-5 text-destructive"}),z]}),a.jsx(ti,{className:"whitespace-pre-line",children:q})]}),a.jsxs(Js,{children:[E==="error"&&a.jsx(Cs,{onClick:()=>he("cancel"),children:"OK"}),E==="warning"&&a.jsxs(a.Fragment,{children:[a.jsx(Is,{onClick:()=>he("cancel"),children:"Abbrechen"}),a.jsx(ve,{onClick:()=>he("skip"),variant:"outline",children:"Nur existierende importieren"}),a.jsx(Cs,{onClick:()=>he("placeholder"),children:"Mit Platzhaltern fortfahren"})]}),E==="confirm"&&a.jsxs(a.Fragment,{children:[a.jsx(Is,{onClick:()=>he("cancel"),children:"Abbrechen"}),a.jsx(Cs,{onClick:()=>he("confirm"),children:"Import durchführen"})]})]})]})})]})}function Ugt(){const{user:t}=Pt(),{toast:e}=vn(),[r,n]=S.useState([]),[s,i]=S.useState({title:"",source:"",raw_text:""}),[o,l]=S.useState(null),[c,u]=S.useState(null),[d,h]=S.useState({title:"",source:"",raw_text:""}),[f,p]=S.useState(!1);S.useEffect(()=>{t&&g()},[t]);const g=async()=>{const{data:x,error:b}=await be.from("interviews").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});b?e({title:"Error loading interviews",variant:"destructive"}):n(x||[])},m=async()=>{if(!s.title.trim()||!s.raw_text.trim()){e({title:"Title and text are required",variant:"destructive"});return}try{const{error:x}=await be.from("interviews").insert({title:s.title.trim(),source:s.source.trim(),raw_text:s.raw_text.trim(),user_id:t==null?void 0:t.id});if(x)throw x;e({title:"Interview added successfully"}),i({title:"",source:"",raw_text:""}),g()}catch{e({title:"Error adding",variant:"destructive"})}},v=x=>{u(x),h({title:x.title,source:x.source||"",raw_text:x.raw_text})},y=async()=>{if(!c||!d.title.trim()||!d.raw_text.trim()){e({title:"Title and text are required",variant:"destructive"});return}p(!0);try{const{error:x}=await be.from("interviews").update({title:d.title.trim(),source:d.source.trim(),raw_text:d.raw_text.trim()}).eq("id",c.id);if(x)throw x;e({title:"Interview updated successfully"}),u(null),g()}catch{e({title:"Error updating interview",variant:"destructive"})}finally{p(!1)}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Manage Interviews"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Title"}),a.jsx(Be,{value:s.title,onChange:x=>i({...s,title:x.target.value}),placeholder:"Interview Title"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Source (optional)"}),a.jsx(Be,{value:s.source,onChange:x=>i({...s,source:x.target.value}),placeholder:"e.g. Person A, Document XYZ"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interview Text"}),a.jsx(Wt,{value:s.raw_text,onChange:x=>i({...s,raw_text:x.target.value}),placeholder:"Complete interview text...",rows:8})]}),a.jsxs(ve,{onClick:m,children:[a.jsx(sc,{className:"h-4 w-4 mr-2"}),"Add Interview"]}),a.jsx(Es,{}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h3",{className:"font-medium",children:["Existing Interviews (",r.length,")"]}),r.map(x=>a.jsx(Me,{children:a.jsxs($e,{className:"pt-4",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:x.title}),x.source&&a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Source: ",x.source]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(x.created_at).toLocaleDateString()})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ve,{onClick:()=>l(o===x.id?null:x.id),size:"sm",variant:"outline",children:[a.jsx(Yi,{className:"h-4 w-4 mr-2"}),o===x.id?"Close":"View Text"]}),a.jsxs(ve,{onClick:()=>v(x),size:"sm",variant:"outline",children:[a.jsx(zJ,{className:"h-4 w-4 mr-2"}),"Edit Interview"]})]})]}),o===x.id&&a.jsx("div",{className:"mt-4 p-4 bg-muted rounded max-h-60 overflow-y-auto",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm",children:x.raw_text})})]})},x.id))]})]})]}),a.jsx(Vr,{open:!!c,onOpenChange:x=>!x&&u(null),children:a.jsxs(Rr,{className:"max-w-2xl",children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Edit Interview"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Title"}),a.jsx(Be,{value:d.title,onChange:x=>h({...d,title:x.target.value}),placeholder:"Interview Title"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Source (optional)"}),a.jsx(Be,{value:d.source,onChange:x=>h({...d,source:x.target.value}),placeholder:"e.g. Person A, Document XYZ"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interview Text"}),a.jsx(Wt,{value:d.raw_text,onChange:x=>h({...d,raw_text:x.target.value}),placeholder:"Complete interview text...",rows:12})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),a.jsx(ve,{onClick:y,disabled:f,children:f?"Saving...":"Save Changes"})]})]})})]})}function zgt({selectedCodebook:t,selectedInterviews:e,categories:r,interviews:n,userId:s,onCodingComplete:i}){const{toast:o}=vn(),[l,c]=S.useState([]),[u,d]=S.useState(!1),[h,f]=S.useState(!1),[p,g]=S.useState(new Set),[m,v]=S.useState(new Set);S.useEffect(()=>{t&&e.length>0?y():c([])},[t,e]);const y=async()=>{d(!0);try{const{data:k,error:E}=await be.from("coded_segments").select("*").eq("user_id",s).eq("codebook_id",t).in("interview_id",e).order("created_at",{ascending:!1});if(E)throw E;c(k||[])}catch(k){console.error("Error loading segments:",k),o({title:"Error loading segments",variant:"destructive"})}finally{d(!1)}},x=async(k,E)=>{f(!0);try{const M={codebook_id:t,interview_id:k};E&&(M.overwrite_existing=!0);const{data:z,error:I}=await be.functions.invoke("codebooks_apply",{body:M});if(I)throw I;o({title:`${z.created_segments} Segmente erstellt`,description:E?"Existing ones overwritten":"New added"}),await y(),i==null||i()}catch(M){console.error("Recode error:",M),o({title:"Encoding errors",variant:"destructive"})}finally{f(!1)}},b=()=>{const k={};return l.forEach(E=>{k[E.interview_id]||(k[E.interview_id]={}),k[E.interview_id][E.category_id]||(k[E.interview_id][E.category_id]=[]),k[E.interview_id][E.category_id].push(E)}),k},w=k=>{const E=new Set(p);E.has(k)?E.delete(k):E.add(k),g(E)},j=k=>{const E=new Set(m);E.has(k)?E.delete(k):E.add(k),v(E)},N=(k,E=220)=>k.length<=E?{truncated:k,isTruncated:!1}:{truncated:k.substring(0,E)+"...",isTruncated:!0};if(!t||e.length===0)return null;const C=b();return u?a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Latest encodings"})}),a.jsx($e,{className:"flex justify-center items-center py-8",children:a.jsx(Et,{className:"h-8 w-8 animate-spin"})})]}):l.length===0?a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Latest encodings"})}),a.jsx($e,{children:a.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[a.jsx("p",{children:"No codes are available yet."}),a.jsx("p",{className:"text-sm mt-2",children:"First, perform an automatic encoding."})]})})]}):a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{children:["Latest encodings (",l.length," Segmente)"]})}),a.jsx($e,{className:"space-y-6",children:e.map(k=>{const E=n.find(I=>I.id===k),M=C[k];if(!E||!M)return null;const z=Object.values(M).reduce((I,q)=>I+q.length,0);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:E.title}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[z," Segmente"]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ve,{onClick:()=>x(k,!0),disabled:h,variant:"outline",size:"sm",children:[h&&a.jsx(Et,{className:"mr-2 h-3 w-3 animate-spin"}),"Overwrite"]}),a.jsxs(ve,{onClick:()=>x(k,!1),disabled:h,variant:"outline",size:"sm",children:[h&&a.jsx(Et,{className:"mr-2 h-3 w-3 animate-spin"}),"Attach"]})]})]}),a.jsx("div",{className:"space-y-3",children:Object.entries(M).map(([I,q])=>{const A=r.find(H=>H.id===I),U=`${k}-${I}`,K=p.has(U),G=K?q:q.slice(0,3),Y=q.length>3;return a.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:(A==null?void 0:A.name)||"Unknown category"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[q.length," ",q.length===1?"Segment":"Segmente"]})]}),Y&&a.jsx(ve,{onClick:()=>w(U),variant:"ghost",size:"sm",children:K?a.jsxs(a.Fragment,{children:[a.jsx(RJ,{className:"h-4 w-4 mr-1"}),"Fewer"]}):a.jsxs(a.Fragment,{children:[a.jsx(ad,{className:"h-4 w-4 mr-1"}),"Show all"]})})]}),a.jsx("div",{className:"space-y-2",children:G.map(H=>{var X;const{truncated:$,isTruncated:L}=N(H.snippet),F=m.has(H.id),W=F?H.snippet:$;return a.jsxs("div",{className:"bg-muted/50 rounded p-3 space-y-2",children:[a.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W}),L&&a.jsx(ve,{onClick:()=>j(H.id),variant:"ghost",size:"sm",className:"h-6 text-xs",children:F?"Show less":"Show full text"}),a.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2 border-t",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Confidence:"})," ",((X=H.confidence)==null?void 0:X.toFixed(2))||"N/A"]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Position:"})," ",H.start_char,"–",H.end_char]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Created:"})," ",new Date(H.created_at).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]},H.id)})})]},U)})})]},k)})})]})}function Hgt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=vn(),[o,l]=S.useState([]),[c,u]=S.useState(""),[d,h]=S.useState([]),[f,p]=S.useState([]),[g,m]=S.useState([]),[v,y]=S.useState([]),[x,b]=S.useState(!1),[w,j]=S.useState("all");S.useEffect(()=>{t&&(N(),k())},[t]),S.useEffect(()=>{c&&C()},[c]),S.useEffect(()=>{c&&g.length>0&&M()},[c,g]);const N=async()=>{const{data:I,error:q}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});q?i({title:"Error loading codebooks",variant:"destructive"}):l(I||[])},C=async()=>{if(!c)return;const{data:I,error:q}=await be.from("codebook_categories").select("*").eq("codebook_id",c).order("order_index",{ascending:!0});q?i({title:"Error loading categories",variant:"destructive"}):h(I||[])},k=async()=>{const{data:I,error:q}=await be.from("interviews").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});q?i({title:"Error loading interviews",variant:"destructive"}):p(I||[])},E=async()=>{if(!e()){s(!0);return}if(!c||g.length===0){i({title:"Select codebook and interviews",variant:"destructive"});return}b(!0);try{for(const I of g){const{data:q,error:A}=await be.functions.invoke("codebooks_apply",{body:{codebook_id:c,interview_id:I}});if(A)throw A;i({title:`${q.created_segments} Segments created for interview`})}M()}catch{i({title:"Error during automatic coding",variant:"destructive"})}b(!1)},M=async()=>{if(!c||g.length===0)return;const{data:I,error:q}=await be.from("coded_segments").select("*").eq("user_id",t==null?void 0:t.id).eq("codebook_id",c).in("interview_id",g).order("created_at",{ascending:!1});q?i({title:"Error loading coded segments",variant:"destructive"}):y(I||[])},z=w==="all"?v:v.filter(I=>I.category_id===w);return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Automatic coding"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Coding sheet"}),a.jsxs(it,{value:c,onValueChange:u,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select codebook..."})}),a.jsx(nt,{children:o.map(I=>a.jsx(Te,{value:I.id,children:I.title},I.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Interviews"}),a.jsxs(it,{value:g.join(","),onValueChange:I=>m(I?[I]:[]),children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select interview..."})}),a.jsx(nt,{children:f.map(I=>a.jsx(Te,{value:I.id,children:I.title},I.id))})]})]})]}),a.jsxs(ve,{onClick:E,disabled:x,children:[x&&a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Automatic encoding"]}),c&&g.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("h3",{className:"font-medium",children:["Coded segments (",z.length,")"]}),a.jsxs(it,{value:w,onValueChange:j,children:[a.jsx(rt,{className:"w-48",children:a.jsx(at,{placeholder:"Filter by category..."})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"all",children:"All categories"}),d.map(I=>a.jsx(Te,{value:I.id,children:I.name},I.id))]})]})]}),a.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:z.map(I=>{var A;const q=d.find(U=>U.id===I.category_id);return a.jsx(Me,{children:a.jsx($e,{className:"pt-4",children:a.jsxs("div",{className:"grid grid-cols-12 gap-4 items-start",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx(_e,{className:"text-xs",children:"category"}),a.jsx("p",{className:"text-sm font-medium",children:(q==null?void 0:q.name)||"Unknown"})]}),a.jsxs("div",{className:"col-span-5",children:[a.jsx(_e,{className:"text-xs",children:"Snippet"}),a.jsx("p",{className:"text-sm",children:I.snippet})]}),a.jsxs("div",{className:"col-span-3",children:[a.jsx(_e,{className:"text-xs",children:"Memo"}),a.jsx(Wt,{value:I.memo||"",placeholder:"Add memo...",rows:2,className:"text-xs"})]}),a.jsxs("div",{className:"col-span-1",children:[a.jsx(_e,{className:"text-xs",children:"Confidence"}),a.jsx("p",{className:"text-sm",children:((A=I.confidence)==null?void 0:A.toFixed(2))||"N/A"})]}),a.jsxs("div",{className:"col-span-1",children:[a.jsx(_e,{className:"text-xs",children:"Position"}),a.jsxs("p",{className:"text-xs",children:[I.start_char,"-",I.end_char]})]})]})})},I.id)})})]})]})]}),a.jsx(zgt,{selectedCodebook:c,selectedInterviews:g,categories:d,interviews:f,userId:t==null?void 0:t.id,onCodingComplete:M}),a.jsx(Tc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}const AX={small:{wordMin:150,wordMax:300,overheadTokens:600},medium:{wordMin:300,wordMax:600,overheadTokens:700},big:{wordMin:500,wordMax:900,overheadTokens:800}},Wgt=t=>Math.round(t*1.4),Vgt=t=>Math.round(t/4);function qgt(){const{user:t,checkStudentPoints:e,studentPoints:r}=Pt(),[n,s]=S.useState(!1),{toast:i}=vn(),[o,l]=S.useState([]),[c,u]=S.useState(""),[d,h]=S.useState([]),[f,p]=S.useState(""),[g,m]=S.useState("medium"),[v,y]=S.useState("de"),[x,b]=S.useState(null),[w,j]=S.useState(!1),[N,C]=S.useState([]),[k,E]=S.useState(""),[M,z]=S.useState([]),[I,q]=S.useState(""),[A,U]=S.useState({prompt:0,completion:0,total:0}),[K,G]=S.useState(null),[Y,H]=S.useState([]),[$,L]=S.useState(!1),[F,W]=S.useState(""),[X,oe]=S.useState(""),[le,B]=S.useState(!1);S.useEffect(()=>{t&&(te(),J())},[t]),S.useEffect(()=>{c&&Z()},[c]),S.useEffect(()=>{k?(he(),R()):(z([]),q(""),H([]),W(""))},[k]);const R=async()=>{const{data:T}=await be.from("chapters").select("id, title, order_index").eq("thesis_id",k).order("order_index");H(T||[])},ee=async()=>{if(!(!F||!x)){B(!0);try{const{data:T}=await be.from("sections").select("order_index").eq("chapter_id",F).order("order_index",{ascending:!1}).limit(1),D=T!=null&&T.length?T[0].order_index+1:0,ne=x.category_conclusion?`

Fazit Kategorie: ${x.title}
${x.category_conclusion}`:"",ue=x.summary_text+ne;await be.from("sections").insert({chapter_id:F,content:ue,title:X.trim()||null,type:"other",order_index:D,status:"open"}),i({title:"Successfully imported",description:"Saved as section in chapter."}),L(!1),oe(""),W("")}catch{i({title:"Fehler beim Import",variant:"destructive"})}finally{B(!1)}}};S.useEffect(()=>{ie()},[f,I,c,d,M,g]);const te=async()=>{const{data:T,error:D}=await be.from("codebooks").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});D?i({title:"Error loading codebooks",variant:"destructive"}):l(T||[])},Z=async()=>{if(!c)return;const{data:T,error:D}=await be.from("codebook_categories").select("*").eq("codebook_id",c).order("order_index",{ascending:!0});D?i({title:"Error loading categories",variant:"destructive"}):h(T||[])},J=async()=>{const{data:T,error:D}=await be.from("theses").select("id, title, description").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});D?i({title:"Error loading the theses",variant:"destructive"}):C(T||[])},he=async()=>{const{data:T,error:D}=await be.from("sections").select(`
        id,
        title,
        content,
        order_index,
        chapters!inner(title, thesis_id, order_index)
      `).eq("chapters.thesis_id",k);if(D)console.error("Section load error:",D),i({title:"Error loading the Section",description:D.message,variant:"destructive"});else{const ne=(T||[]).sort((ue,re)=>{var pe,xe;return(((pe=ue.chapters)==null?void 0:pe.order_index)||0)-(((xe=re.chapters)==null?void 0:xe.order_index)||0)});z(ne)}},P=T=>T?T.trim().split(/\s+/).slice(0,8).join(" ")+(T.split(/\s+/).length>8?"...":""):"",ie=async()=>{var ae,de,ge,we;if(!c||!f){U({prompt:0,completion:0,total:0});return}const T=AX[g]??AX.medium,D=Wgt((T.wordMin+T.wordMax)/2);let ne=0;const ue=d.find(je=>je.id===f);ue&&(ne+=((ae=ue.name)==null?void 0:ae.length)||0,ne+=((de=ue.definition)==null?void 0:de.length)||0,ne+=((ge=ue.anchor_example)==null?void 0:ge.length)||0,ne+=((we=ue.coding_rule)==null?void 0:we.length)||0);const re=M.find(je=>je.id===I);if(re!=null&&re.content&&(ne+=re.content.length),f&&c)try{const{data:je}=await be.from("coded_segments").select("snippet, interviews!inner(title)").eq("category_id",f).eq("codebook_id",c);if(je&&je.length>0){je.forEach(Ue=>{var Ae,fe,Ee;ne+=((Ae=Ue.snippet)==null?void 0:Ae.length)||0,ne+=((Ee=(fe=Ue.interviews)==null?void 0:fe.title)==null?void 0:Ee.length)||0});const Se=[...new Set(je.map(Ue=>{var Ae;return((Ae=Ue.interviews)==null?void 0:Ae.title)||""}))];ne+=Se.join(", ").length}}catch(je){console.error("Error loading snippets for estimation:",je)}const xe=T.overheadTokens+200+Vgt(ne),ye=xe+D;U({prompt:xe,completion:D,total:ye})},V=async()=>{var T,D,ne;if(!e()){s(!0);return}if(!c||!f){i({title:"Select coding sheet and category",variant:"destructive"});return}j(!0),G(null);try{const{data:ue}=await be.from("codebook_categories").select("name, definition, anchor_example, coding_rule").eq("id",f).single(),{data:re}=await be.from("coded_segments").select(`
          snippet,
          interviews!inner(title)
        `).eq("category_id",f).eq("codebook_id",c),pe=[...new Set((re==null?void 0:re.map(ge=>ge.interviews.title))||[])],xe=(re==null?void 0:re.map(ge=>({snippet:ge.snippet,interview_title:ge.interviews.title})))||[];let ye="";if(I){const{data:ge}=await be.from("sections").select("content").eq("id",I).single();ye=(ge==null?void 0:ge.content)||""}const{data:ae,error:de}=await be.functions.invoke("analysis_results",{body:{codebook_id:c,category_id:f,mode:g,language:v,thesis_id:k||null,section_id:I||null,category_metadata:{category_title:(ue==null?void 0:ue.name)||"",definition:(ue==null?void 0:ue.definition)||"",coding_rule:(ue==null?void 0:ue.coding_rule)||"",anchor_example:(ue==null?void 0:ue.anchor_example)||"",interviewer_names:pe,snippet_count:xe.length,all_snippets:xe},section_content:ye}});if(de)throw de;b(ae),G({prompt:(T=ae==null?void 0:ae.usage)==null?void 0:T.prompt_tokens,completion:(D=ae==null?void 0:ae.usage)==null?void 0:D.completion_tokens,total:(ne=ae==null?void 0:ae.usage)==null?void 0:ne.total_tokens}),i({title:"Analysis generated successfully!"})}catch(ue){console.error("Error:",ue),i({title:"Error during generation",description:ue.message,variant:"destructive"})}finally{j(!1)}},O=async()=>{if(!(!x||!c))try{const{error:T}=await be.from("qualitative_summaries").insert({codebook_id:c,category_id:f||null,title:x.title,summary_text:x.summary_text,proof_json:x.proof_json});if(T)throw T;i({title:"Summary saved to library"})}catch{i({title:"Error saving",variant:"destructive"})}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{children:"Analysis configuration"})}),a.jsxs($e,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Coding sheet *"}),a.jsxs(it,{value:c,onValueChange:u,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select coding sheet..."})}),a.jsx(nt,{children:o.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Kategorie *"}),a.jsxs(it,{value:f,onValueChange:p,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select category..."})}),a.jsx(nt,{children:d.map(T=>a.jsx(Te,{value:T.id,children:T.name},T.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mode"}),a.jsxs(it,{value:g,onValueChange:m,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"small",children:"Short"}),a.jsx(Te,{value:"medium",children:"Middle"}),a.jsx(Te,{value:"big",children:"Large"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Language"}),a.jsxs(it,{value:v,onValueChange:y,children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(nt,{children:[a.jsx(Te,{value:"de",children:"German"}),a.jsx(Te,{value:"en",children:"English"})]})]})]})]}),a.jsxs("div",{className:"border-t pt-4 mt-4",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Thesis-Kontext"}),N.length===0&&a.jsxs(td,{className:"mb-4",children:[a.jsx(Ww,{className:"h-4 w-4"}),a.jsx(z8,{children:"No thesis available"}),a.jsxs(rd,{children:["Please write a thesis first in"," ",a.jsx(mt,{to:"/thesis-builder",className:"underline font-medium",children:"Thesis Builder"}),", before you can perform an analysis."]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Thesis *"}),a.jsxs(it,{value:k,onValueChange:T=>{E(T),q("")},children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Choose Thesis"})}),a.jsx(nt,{children:N.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Theory-Section"}),a.jsxs(it,{value:I,onValueChange:q,disabled:!k,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:k?"Select section (optional)":"Select thesis first"})}),a.jsx(nt,{children:M.map(T=>a.jsx(Te,{value:T.id,children:T.title?`${T.title} (${T.chapters.title})`:`${T.chapters.title} – ${P(T.content)}`},T.id))})]})]})]})]}),a.jsxs(ve,{onClick:V,disabled:w||!c||!f||!k,className:"w-full",children:[w&&a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Start analysis"]})]})]}),x&&a.jsxs(a.Fragment,{children:[a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsxs(Je,{className:"flex justify-between items-center flex-wrap gap-2",children:[x.title,a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ve,{onClick:()=>L(!0),variant:"outline",size:"sm",disabled:!x||!k,children:[a.jsx(Oj,{className:"mr-2 h-4 w-4"}),"Import to Chapter"]}),a.jsx(ve,{onClick:O,variant:"outline",size:"sm",children:"Save to library"})]})]})}),a.jsxs($e,{className:"space-y-0",children:[a.jsx("div",{className:"prose max-w-none whitespace-pre-wrap",children:x.summary_text}),x.category_conclusion&&a.jsxs(a.Fragment,{children:[a.jsx("hr",{className:"my-6 border-border"}),a.jsxs("div",{className:"prose max-w-none",children:[a.jsxs("p",{className:"font-bold underline mb-2",children:["Conclusion Category: ",x.title]}),a.jsx("p",{className:"whitespace-pre-wrap",children:x.category_conclusion})]})]})]})]}),x.proof_json&&x.proof_json.length>0&&a.jsxs(Me,{children:[a.jsx(qe,{children:a.jsx(Je,{className:"text-base",children:"Supporting material"})}),a.jsx($e,{className:"space-y-3",children:x.proof_json.map((T,D)=>a.jsxs("div",{className:"p-4 bg-muted rounded-md",children:[a.jsxs("blockquote",{className:"italic text-sm mb-2",children:['"',T.quote,'"']}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["(",T.interview_title,", Cell XY)"]})]},D))})]})]}),a.jsx(Vr,{open:$,onOpenChange:L,children:a.jsxs(Rr,{children:[a.jsx(Mr,{children:a.jsx(Dr,{children:"Import as Section"})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Target Chapter"}),a.jsxs(it,{value:F,onValueChange:W,children:[a.jsx(rt,{children:a.jsx(at,{placeholder:"Select chapter..."})}),a.jsx(nt,{children:Y.map(T=>a.jsx(Te,{value:T.id,children:T.title},T.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Section-Title (optional)"}),a.jsx(Be,{value:X,onChange:T=>oe(T.target.value),placeholder:"e.g. Interview Analysis"})]})]}),a.jsxs(yf,{children:[a.jsx(ve,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),a.jsx(ve,{onClick:ee,disabled:!F||le,children:le?a.jsxs(a.Fragment,{children:[a.jsx(Et,{className:"mr-2 h-4 w-4 animate-spin"}),"Import..."]}):a.jsxs(a.Fragment,{children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"Import"]})})]})]})}),a.jsx(Tc,{open:n,onClose:()=>s(!1),remainingPoints:(r==null?void 0:r.remaining)??0})]})}const Ggt=()=>{const t=mf();return S.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),a.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:[a.jsx(ea,{title:"Page Not Found | Academly.ai",description:"Private page on Academly.ai.",canonical:"https://academly.ai/404",noIndex:!0}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-blue-500 hover:text-blue-700 underline",children:"Return to Home"})]})]})},Kgt=new C1e;function Ygt(){return a.jsx(I1e,{client:Kgt,children:a.jsxs(Si,{children:[a.jsx(Y0e,{}),a.jsx(Ebe,{}),a.jsx(V_e,{children:a.jsxs(L_e,{children:[a.jsx(Ct,{path:"/",element:a.jsx(Sit,{})}),a.jsx(Ct,{path:"/pricing",element:a.jsx(Tit,{})}),a.jsx(Ct,{path:"/subscription/success",element:a.jsx(Oit,{})}),a.jsx(Ct,{path:"/subscription/cancel",element:a.jsx(Iit,{})}),a.jsx(Ct,{path:"/how-it-works",element:a.jsx(Lit,{})}),a.jsx(Ct,{path:"/topic-ideas",element:a.jsx(Vit,{})}),a.jsx(Ct,{path:"/literature-search",element:a.jsx(Git,{})}),a.jsx(Ct,{path:"/team",element:a.jsx(Xit,{})}),a.jsx(Ct,{path:"/waitlist",element:a.jsx(cot,{})}),a.jsx(Ct,{path:"/legal",element:a.jsx(fot,{})}),a.jsx(Ct,{path:"/login",element:a.jsx(yot,{})}),a.jsx(Ct,{path:"/reset-password",element:a.jsx(vot,{})}),a.jsx(Ct,{path:"/vs/chatgpt",element:a.jsx(bot,{})}),a.jsx(Ct,{path:"/vs/jenni-ai",element:a.jsx(_ot,{})}),a.jsx(Ct,{path:"/blog",element:a.jsx(Sot,{})}),a.jsx(Ct,{path:"/dashboard",element:a.jsx(Qst,{})}),a.jsx(Ct,{path:"/documents",element:a.jsx(Zct,{})}),a.jsx(Ct,{path:"/summary",element:a.jsx(tut,{})}),a.jsx(Ct,{path:"/pdf-extract",element:a.jsx(ggt,{})}),a.jsx(Ct,{path:"/pdf-slicer",element:a.jsx(mgt,{})}),a.jsx(Ct,{path:"/topic-explorer",element:a.jsx(igt,{})}),a.jsx(Ct,{path:"/topic-explorer/ideas",element:a.jsx(agt,{})}),a.jsx(Ct,{path:"/topic-explorer/outline",element:a.jsx(ogt,{})}),a.jsx(Ct,{path:"/topic-explorer/keywords",element:a.jsx(lgt,{})}),a.jsx(Ct,{path:"/thesis-builder",element:a.jsx(Nut,{})}),a.jsx(Ct,{path:"/methods-approach",element:a.jsx(Aut,{})}),a.jsx(Ct,{path:"/discussion",element:a.jsx(Cut,{})}),a.jsx(Ct,{path:"/conclusion",element:a.jsx(Tut,{})}),a.jsx(Ct,{path:"/thesis-manager",element:a.jsx(sgt,{})}),a.jsxs(Ct,{path:"/qualitative",element:a.jsx(Dgt,{}),children:[a.jsx(Ct,{index:!0,element:a.jsx(FD,{to:"/qualitative/research-setup",replace:!0})}),a.jsx(Ct,{path:"research-setup",element:a.jsx(Lgt,{})}),a.jsx(Ct,{path:"kodierbogen",element:a.jsx(Fgt,{})}),a.jsx(Ct,{path:"kodierbogen-grid",element:a.jsx(Bgt,{})}),a.jsx(Ct,{path:"interviews",element:a.jsx(Ugt,{})}),a.jsx(Ct,{path:"kodieren",element:a.jsx(Hgt,{})}),a.jsx(Ct,{path:"auswertung",element:a.jsx(qgt,{})})]}),a.jsx(Ct,{path:"/reference-checker",element:a.jsx(Egt,{})}),a.jsx(Ct,{path:"/supervisor",element:a.jsx(Mgt,{})}),a.jsx(Ct,{path:"/citations",element:a.jsx(FD,{to:"/reference-checker",replace:!0})}),a.jsx(Ct,{path:"/history",element:a.jsx(rut,{})}),a.jsx(Ct,{path:"/account",element:a.jsx(Sut,{})}),a.jsx(Ct,{path:"*",element:a.jsx(Ggt,{})})]})})]})})}ZZ(document.getElementById("root")).render(a.jsx(iJ,{children:a.jsx(VEe,{children:a.jsx(hNe,{children:a.jsx(Ygt,{})})})}));