PageSourceSearch

https://heroesofthefaith.ai/assets/index-DPYLf8_8.js

js heroesofthefaith.ai collected 2026-10-05 14:32:13 UTC 2,647,416 bytes, 1,035 lines download raw bytes

vendor: 4,161 bytes, lines 1-9
1var Rce=Object.defineProperty;var pz=n=>{throw TypeError(n)};var Pce=(n,e,t)=>e in n?Rce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Nt=(n,e,t)=>Pce(n,typeof e!="symbol"?e+"":e,t),Kj=(n,e,t)=>e.has(n)||pz("Cannot "+t);var w=(n,e,t)=>(Kj(n,e,"read from private field"),t?t.call(n):e.get(n)),G=(n,e,t)=>e.has(n)?pz("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),F=(n,e,t,r)=>(Kj(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),W=(n,e,t)=>(Kj(n,e,"access private method"),t);var Ss=(n,e,t,r)=>({set _(s){F(n,e,s,t)},get _(){return w(n,e,r)}});function Dce(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in n)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(n,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"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(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 r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();var bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ro(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Iq={exports:{}},FN={},Lq={exports:{}},on={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var yS=Symbol.for("react.element"),Oce=Symbol.for("react.portal"),Mce=Symbol.for("react.fragment"),Ice=Symbol.for("react.strict_mode"),Lce=Symbol.for("react.profiler"),Fce=Symbol.for("react.provider"),Bce=Symbol.for("react.context"),zce=Symbol.for("react.forward_ref"),$ce=Symbol.for("react.suspense"),Uce=Symbol.for("react.memo"),Vce=Symbol.for("react.lazy"),mz=Symbol.iterator;function Hce(n){return n===null||typeof n!="object"?null:(n=mz&&n[mz]||n["@@iterator"],typeof n=="function"?n:null)}var Fq={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bq=Object.assign,zq={};function h0(n,e,t){this.props=n,this.context=e,this.refs=zq,this.updater=t||Fq}h0.prototype.isReactComponent={};h0.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=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,n,e,"setState")};h0.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function $q(){}$q.prototype=h0.prototype;function g4(n,e,t){this.props=n,this.context=e,this.refs=zq,this.updater=t||Fq}var v4=g4.prototype=new $q;v4.constructor=g4;Bq(v4,h0.prototype);v4.isPureReactComponent=!0;var gz=Array.isArray,Uq=Object.prototype.hasOwnProperty,y4={current:null},Vq={key:!0,ref:!0,__self:!0,__source:!0};function Hq(n,e,t){var r,s={},i=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(i=""+e.key),e)Uq.call(e,r)&&!Vq.hasOwnProperty(r)&&(s[r]=e[r]);var o=arguments.length-2;if(o===1)s.children=t;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];s.children=l}if(n&&n.defaultProps)for(r in o=n.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return{$$typeof:yS,type:n,key:i,ref:a,props:s,_owner:y4.current}}function Wce(n,e){return{$$typeof:yS,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}
vendor: 5,084 bytes, lines 9-17
9function x4(n){return typeof n=="object"&&n!==null&&n.$$typeof===yS}function qce(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var vz=/\/+/g;function Yj(n,e){return typeof n=="object"&&n!==null&&n.key!=null?qce(""+n.key):e.toString(36)}function Pk(n,e,t,r,s){var i=typeof n;(i==="undefined"||i==="boolean")&&(n=null);var a=!1;if(n===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(n.$$typeof){case yS:case Oce:a=!0}}if(a)return a=n,s=s(a),n=r===""?"."+Yj(a,0):r,gz(s)?(t="",n!=null&&(t=n.replace(vz,"$&/")+"/"),Pk(s,e,t,"",function(u){return u})):s!=null&&(x4(s)&&(s=Wce(s,t+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(vz,"$&/")+"/")+n)),e.push(s)),1;if(a=0,r=r===""?".":r+":",gz(n))for(var o=0;o<n.length;o++){i=n[o];var l=r+Yj(i,o);a+=Pk(i,e,t,l,s)}else if(l=Hce(n),typeof l=="function")for(n=l.call(n),o=0;!(i=n.next()).done;)i=i.value,l=r+Yj(i,o++),a+=Pk(i,e,t,l,s);else if(i==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function AE(n,e,t){if(n==null)return n;var r=[],s=0;return Pk(n,r,"","",function(i){return e.call(t,i,s++)}),r}function Gce(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var ta={current:null},Dk={transition:null},Kce={ReactCurrentDispatcher:ta,ReactCurrentBatchConfig:Dk,ReactCurrentOwner:y4};function Wq(){throw Error("act(...) is not supported in production builds of React.")}on.Children={map:AE,forEach:function(n,e,t){AE(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return AE(n,function(){e++}),e},toArray:function(n){return AE(n,function(e){return e})||[]},only:function(n){if(!x4(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};on.Component=h0;on.Fragment=Mce;on.Profiler=Lce;on.PureComponent=g4;on.StrictMode=Ice;on.Suspense=$ce;on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kce;on.act=Wq;on.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var r=Bq({},n.props),s=n.key,i=n.ref,a=n._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=y4.current),e.key!==void 0&&(s=""+e.key),n.type&&n.type.defaultProps)var o=n.type.defaultProps;for(l in e)Uq.call(e,l)&&!Vq.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=t;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];r.children=o}return{$$typeof:yS,type:n.type,key:s,ref:i,props:r,_owner:a}};on.createContext=function(n){return n={$$typeof:Bce,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Fce,_context:n},n.Consumer=n};on.createElement=Hq;on.createFactory=function(n){var e=Hq.bind(null,n);return e.type=n,e};on.createRef=function(){return{current:null}};on.forwardRef=function(n){return{$$typeof:zce,render:n}};on.isValidElement=x4;on.lazy=function(n){return{$$typeof:Vce,_payload:{_status:-1,_result:n},_init:Gce}};on.memo=function(n,e){return{$$typeof:Uce,type:n,compare:e===void 0?null:e}};on.startTransition=function(n){var e=Dk.transition;Dk.transition={};try{n()}finally{Dk.transition=e}};on.unstable_act=Wq;on.useCallback=function(n,e){return ta.current.useCallback(n,e)};on.useContext=function(n){return ta.current.useContext(n)};on.useDebugValue=function(){};on.useDeferredValue=function(n){return ta.current.useDeferredValue(n)};on.useEffect=function(n,e){return ta.current.useEffect(n,e)};on.useId=function(){return ta.current.useId()};on.useImperativeHandle=function(n,e,t){return ta.current.useImperativeHandle(n,e,t)};on.useInsertionEffect=function(n,e){return ta.current.useInsertionEffect(n,e)};on.useLayoutEffect=function(n,e){return ta.current.useLayoutEffect(n,e)};on.useMemo=function(n,e){return ta.current.useMemo(n,e)};on.useReducer=function(n,e,t){return ta.current.useReducer(n,e,t)};on.useRef=function(n){return ta.current.useRef(n)};on.useState=function(n){return ta.current.useState(n)};on.useSyncExternalStore=function(n,e,t){return ta.current.useSyncExternalStore(n,e,t)};on.useTransition=function(){return ta.current.useTransition()};on.version="18.3.1";Lq.exports=on;var _=Lq.exports;const Oe=ro(_),BN=Dce({__proto__:null,default:Oe},[_]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Yce=_,Xce=Symbol.for("react.element"),Zce=Symbol.for("react.fragment"),Jce=Object.prototype.hasOwnProperty,Qce=Yce.__SECRET_INT
vendor: 11,498 bytes, lines 17-34
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,eue={key:!0,ref:!0,__self:!0,__source:!0};function qq(n,e,t){var r,s={},i=null,a=null;t!==void 0&&(i=""+t),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)Jce.call(e,r)&&!eue.hasOwnProperty(r)&&(s[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:Xce,type:n,key:i,ref:a,props:s,_owner:Qce.current}}FN.Fragment=Zce;FN.jsx=qq;FN.jsxs=qq;Iq.exports=FN;var c=Iq.exports,Gq={exports:{}},so={},Kq={exports:{}},Yq={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(n){function e(B,$){var ie=B.length;B.push($);e:for(;0<ie;){var ne=ie-1>>>1,L=B[ne];if(0<s(L,$))B[ne]=$,B[ie]=L,ie=ne;else break e}}function t(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var $=B[0],ie=B.pop();if(ie!==$){B[0]=ie;e:for(var ne=0,L=B.length,te=L>>>1;ne<te;){var ae=2*(ne+1)-1,de=B[ae],ue=ae+1,le=B[ue];if(0>s(de,ie))ue<L&&0>s(le,de)?(B[ne]=le,B[ue]=ie,ne=ue):(B[ne]=de,B[ae]=ie,ne=ae);else if(ue<L&&0>s(le,ie))B[ne]=le,B[ue]=ie,ne=ue;else break e}}return $}function s(B,$){var ie=B.sortIndex-$.sortIndex;return ie!==0?ie:B.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;n.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();n.unstable_now=function(){return a.now()-o}}var l=[],u=[],d=1,h=null,f=3,p=!1,m=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,v=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(B){for(var $=t(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=B)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(u)}}function E(B){if(g=!1,b(B),!m)if(t(l)!==null)m=!0,q(S);else{var $=t(u);$!==null&&I(E,$.startTime-B)}}function S(B,$){m=!1,g&&(g=!1,v(A),A=-1),p=!0;var ie=f;try{for(b($),h=t(l);h!==null&&(!(h.expirationTime>$)||B&&!D());){var ne=h.callback;if(typeof ne=="function"){h.callback=null,f=h.priorityLevel;var L=ne(h.expirationTime<=$);$=n.unstable_now(),typeof L=="function"?h.callback=L:h===t(l)&&r(l),b($)}else r(l);h=t(l)}if(h!==null)var te=!0;else{var ae=t(u);ae!==null&&I(E,ae.startTime-$),te=!1}return te}finally{h=null,f=ie,p=!1}}var k=!1,C=null,A=-1,T=5,j=-1;function D(){return!(n.unstable_now()-j<T)}function R(){if(C!==null){var B=n.unstable_now();j=B;var $=!0;try{$=C(!0,B)}finally{$?M():(k=!1,C=null)}}else k=!1}var M;if(typeof x=="function")M=function(){x(R)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,U=N.port2;N.port1.onmessage=R,M=function(){U.postMessage(null)}}else M=function(){y(R,0)};function q(B){C=B,k||(k=!0,M())}function I(B,$){A=y(function(){B(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(B){B.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,q(S))},n.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<B?Math.floor(1e3/B):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(B){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var ie=f;f=$;try{return B()}finally{f=ie}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(B,$){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ie=f;f=B;try{return $()}finally{f=ie}},n.unstable_scheduleCallback=function(B,$,ie){var ne=n.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?ne+ie:ne):ie=ne,B){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=ie+L,B={id:d++,callback:$,priorityLevel:B,startTime:ie,expirationTime:L,sortIndex:-1},ie>ne?(B.sortIndex=ie,e(u,B),t(l)===null&&B===t(u)&&(g?(v(A),A=-1):g=!0,I(E,ie-ne))):(B.sortIndex=L,e(l,B),m||p||(m=!0,q(S))),B},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(B){var $=f;return function(){var ie=f;f=$;try{return B.apply(this,arguments)}finally{f=ie}}}})(Yq);Kq.exports=Yq;var tue=Kq.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var nue=_,to=tue;function We(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Xq=new Set,Vw={};function xg(n,e){jx(n,e),jx(n+"Capture",e)}function jx(n,e){for(Vw[n]=e,n=0;n<e.length;n++)Xq.add(e[n])}var id=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),AD=Object.prototype.hasOwnProperty,rue=/^[: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]*$/,yz={},xz={};function sue(n){return AD.call(xz,n)?!0:AD.call(yz,n)?!1:rue.test(n)?xz[n]=!0:(yz[n]=!0,!1)}function iue(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function aue(n,e,t,r){if(e===null||typeof e>"u"||iue(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function na(n,e,t,r,s,i,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=i,this.removeEmptyString=a}var ii={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){ii[n]=new na(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];ii[e]=new na(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){ii[n]=new na(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){ii[n]=new na(n,2,!1,n,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(n){ii[n]=new na(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){ii[n]=new na(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){ii[n]=new na(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){ii[n]=new na(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){ii[n]=new na(n,5,!1,n.toLowerCase(),null,!1,!1)});var b4=/[\-:]([a-z])/g;function w4(n){return n[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(n){var e=n.replace(b4,w4);ii[e]=new na(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(b4,w4);ii[e]=new na(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(b4,w4);ii[e]=new na(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){ii[n]=new na(n,1,!1,n.toLowerCase(),null,!1,!1)});ii.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){ii[n]=new na(n,1,!1,n.toLowerCase(),null,!0,!0)});function _4(n,e,t,r){var s=ii.hasOwnProperty(e)?ii[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(aue(e,t,s,r)&&(t=null),r||s===null?sue(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):s.mustUseProperty?n[s.propertyName]=t===null?s.type===3?!1:"":t:(e=s.attributeName,r=s.attributeNamespace,t===null?n.removeAttribute(e):(s=s.type,t=s===3||s===4&&t===!0?"":""+t,r?n.setAttributeNS(r,e,t):n.setAttribute(e,t))))}var _d=nue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,NE=Symbol.for("react.element"),Av=Symbol.for("react.portal"),Nv=Symbol.for("react.fragment"),S4=Symbol.for("react.strict_mode"),ND=Symbol.for("react.profiler"),Zq=Symbol.for("react.provider"),Jq=Symbol.for("react.context"),E4=Symbol.for("react.forward_ref"),TD=Symbol.for("react.suspense"),jD=Symbol.for("react.suspense_list"),k4=Symbol.for("react.memo"),$d=Symbol.for("react.lazy"),Qq=Symbol.for("react.offscreen"),bz=Symbol.iterator;function H0(n){return n===null||typeof n!="object"?null:(n=bz&&n[bz]||n["@@iterator"],typeof n=="function"?n:null)}var gr=Object.assign,Xj;function bb(n){if(Xj===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);Xj=e&&e[1]||""}return`
34`+Xj+n}var Zj=!1;function Jj(n,e){if(!n||Zj)return"";Zj=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(n,[],e)}else{try{e.call()}catch(u){r=u}n.call(e.prototype)}else{try{throw Error()}catch(u){r=u}n()}}
vendor: 16,788 bytes, lines 34-37
34catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35`),i=r.stack.split(`
36`),a=s.length-1,o=i.length-1;1<=a&&0<=o&&s[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(s[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||s[a]!==i[o]){var l=`
37`+s[a].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=a&&0<=o);break}}}finally{Zj=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?bb(n):""}function oue(n){switch(n.tag){case 5:return bb(n.type);case 16:return bb("Lazy");case 13:return bb("Suspense");case 19:return bb("SuspenseList");case 0:case 2:case 15:return n=Jj(n.type,!1),n;case 11:return n=Jj(n.type.render,!1),n;case 1:return n=Jj(n.type,!0),n;default:return""}}function RD(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Nv:return"Fragment";case Av:return"Portal";case ND:return"Profiler";case S4:return"StrictMode";case TD:return"Suspense";case jD:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case Jq:return(n.displayName||"Context")+".Consumer";case Zq:return(n._context.displayName||"Context")+".Provider";case E4:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case k4:return e=n.displayName||null,e!==null?e:RD(n.type)||"Memo";case $d:e=n._payload,n=n._init;try{return RD(n(e))}catch{}}return null}function lue(n){var e=n.type;switch(n.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 n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return RD(e);case 8:return e===S4?"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 cf(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function e9(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function cue(n){var e=e9(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var s=t.get,i=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function TE(n){n._valueTracker||(n._valueTracker=cue(n))}function t9(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=e9(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function JC(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function PD(n,e){var t=e.checked;return gr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function wz(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=cf(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function n9(n,e){e=e.checked,e!=null&&_4(n,"checked",e,!1)}function DD(n,e){n9(n,e);var t=cf(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?OD(n,e.type,t):e.hasOwnProperty("defaultValue")&&OD(n,e.type,cf(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function _z(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function OD(n,e,t){(e!=="number"||JC(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var wb=Array.isArray;function Zv(n,e,t,r){if(n=n.options,e){e={};for(var s=0;s<t.length;s++)e["$"+t[s]]=!0;for(t=0;t<n.length;t++)s=e.hasOwnProperty("$"+n[t].value),n[t].selected!==s&&(n[t].selected=s),s&&r&&(n[t].defaultSelected=!0)}else{for(t=""+cf(t),e=null,s=0;s<n.length;s++){if(n[s].value===t){n[s].selected=!0,r&&(n[s].defaultSelected=!0);return}e!==null||n[s].disabled||(e=n[s])}e!==null&&(e.selected=!0)}}function MD(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(We(91));return gr({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Sz(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(We(92));if(wb(t)){if(1<t.length)throw Error(We(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:cf(t)}}function r9(n,e){var t=cf(e.value),r=cf(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),r!=null&&(n.defaultValue=""+r)}function Ez(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function s9(n){switch(n){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 ID(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?s9(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var jE,i9=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,r,s){MSApp.execUnsafeLocalFunction(function(){return n(e,t,r,s)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(jE=jE||document.createElement("div"),jE.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=jE.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Hw(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var sw={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},uue=["Webkit","ms","Moz","O"];Object.keys(sw).forEach(function(n){uue.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),sw[e]=sw[n]})});function a9(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||sw.hasOwnProperty(n)&&sw[n]?(""+e).trim():e+"px"}function o9(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,s=a9(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,s):n[t]=s}}var due=gr({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 LD(n,e){if(e){if(due[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(We(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(We(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(We(61))}if(e.style!=null&&typeof e.style!="object")throw Error(We(62))}}function FD(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){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 BD=null;function C4(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var zD=null,Jv=null,Qv=null;function kz(n){if(n=wS(n)){if(typeof zD!="function")throw Error(We(280));var e=n.stateNode;e&&(e=HN(e),zD(n.stateNode,n.type,e))}}function l9(n){Jv?Qv?Qv.push(n):Qv=[n]:Jv=n}function c9(){if(Jv){var n=Jv,e=Qv;if(Qv=Jv=null,kz(n),e)for(n=0;n<e.length;n++)kz(e[n])}}function u9(n,e){return n(e)}function d9(){}var Qj=!1;function h9(n,e,t){if(Qj)return n(e,t);Qj=!0;try{return u9(n,e,t)}finally{Qj=!1,(Jv!==null||Qv!==null)&&(d9(),c9())}}function Ww(n,e){var t=n.stateNode;if(t===null)return null;var r=HN(t);if(r===null)return null;t=r[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":(r=!r.disabled)||(n=n.type,r=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!r;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(We(231,e,typeof t));return t}var $D=!1;if(id)try{var W0={};Object.defineProperty(W0,"passive",{get:function(){$D=!0}}),window.addEventListener("test",W0,W0),window.removeEventListener("test",W0,W0)}catch{$D=!1}function hue(n,e,t,r,s,i,a,o,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(t,u)}catch(d){this.onError(d)}}var iw=!1,QC=null,e2=!1,UD=null,fue={onError:function(n){iw=!0,QC=n}};function pue(n,e,t,r,s,i,a,o,l){iw=!1,QC=null,hue.apply(fue,arguments)}function mue(n,e,t,r,s,i,a,o,l){if(pue.apply(this,arguments),iw){if(iw){var u=QC;iw=!1,QC=null}else throw Error(We(198));e2||(e2=!0,UD=u)}}function bg(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function f9(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function Cz(n){if(bg(n)!==n)throw Error(We(188))}function gue(n){var e=n.alternate;if(!e){if(e=bg(n),e===null)throw Error(We(188));return e!==n?null:n}for(var t=n,r=e;;){var s=t.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){t=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===t)return Cz(s),n;if(i===r)return Cz(s),e;i=i.sibling}throw Error(We(188))}if(t.return!==r.return)t=s,r=i;else{for(var a=!1,o=s.child;o;){if(o===t){a=!0,t=s,r=i;break}if(o===r){a=!0,r=s,t=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===t){a=!0,t=i,r=s;break}if(o===r){a=!0,r=i,t=s;break}o=o.sibling}if(!a)throw Error(We(189))}}if(t.alternate!==r)throw Error(We(190))}if(t.tag!==3)throw Error(We(188));return t.stateNode.current===t?n:e}function p9(n){return n=gue(n),n!==null?m9(n):null}function m9(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=m9(n);if(e!==null)return e;n=n.sibling}return null}var g9=to.unstable_scheduleCallback,Az=to.unstable_cancelCallback,vue=to.unstable_shouldYield,yue=to.unstable_requestPaint,Br=to.unstable_now,xue=to.unstable_getCurrentPriorityLevel,A4=to.unstable_ImmediatePriority,v9=to.unstable_UserBlockingPriority,t2=to.unstable_NormalPriority,bue=to.unstable_LowPriority,y9=to.unstable_IdlePriority,zN=null,Lc=null;function wue(n){if(Lc&&typeof Lc.onCommitFiberRoot=="function")try{Lc.onCommitFiberRoot(zN,n,void 0,(n.current.flags&128)===128)}catch{}}var Ul=Math.clz32?Math.clz32:Eue,_ue=Math.log,Sue=Math.LN2;function Eue(n){return n>>>=0,n===0?32:31-(_ue(n)/Sue|0)|0}var RE=64,PE=4194304;function _b(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function n2(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,s=n.suspendedLanes,i=n.pingedLanes,a=t&268435455;if(a!==0){var o=a&~s;o!==0?r=_b(o):(i&=a,i!==0&&(r=_b(i)))}else a=t&~s,a!==0?r=_b(a):i!==0&&(r=_b(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0<e;)t=31-Ul(e),s=1<<t,r|=n[t],e&=~s;return r}function kue(n,e){switch(n){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 Cue(n,e){for(var t=n.suspendedLanes,r=n.pingedLanes,s=n.expirationTimes,i=n.pendingLanes;0<i;){var a=31-Ul(i),o=1<<a,l=s[a];l===-1?(!(o&t)||o&r)&&(s[a]=kue(o,e)):l<=e&&(n.expiredLanes|=o),i&=~o}}function VD(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function x9(){var n=RE;return RE<<=1,!(RE&4194240)&&(RE=64),n}function eR(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function xS(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Ul(e),n[e]=t}function Aue(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0<t;){var s=31-Ul(t),i=1<<s;e[s]=0,r[s]=-1,n[s]=-1,t&=~i}}function N4(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var r=31-Ul(t),s=1<<r;s&e|n[r]&e&&(n[r]|=e),t&=~s}}var In=0;function b9(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var w9,T4,_9,S9,E9,HD=!1,DE=[],Wh=null,qh=null,Gh=null,qw=new Map,Gw=new Map,Kd=[],Nue="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 Nz(n,e){switch(n){case"focusin":case"focusout":Wh=null;break;case"dragenter":case"dragleave":qh=null;break;case"mouseover":case"mouseout":Gh=null;break;case"pointerover":case"pointerout":qw.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gw.delete(e.pointerId)}}function q0(n,e,t,r,s,i){return n===null||n.nativeEvent!==i?(n={blockedOn:e,domEventName:t,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=wS(e),e!==null&&T4(e)),n):(n.eventSystemFlags|=r,e=n.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),n)}function Tue(n,e,t,r,s){switch(e){case"focusin":return Wh=q0(Wh,n,e,t,r,s),!0;case"dragenter":return qh=q0(qh,n,e,t,r,s),!0;case"mouseover":return Gh=q0(Gh,n,e,t,r,s),!0;case"pointerover":var i=s.pointerId;return qw.set(i,q0(qw.get(i)||null,n,e,t,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Gw.set(i,q0(Gw.get(i)||null,n,e,t,r,s)),!0}return!1}function k9(n){var e=pp(n.target);if(e!==null){var t=bg(e);if(t!==null){if(e=t.tag,e===13){if(e=f9(t),e!==null){n.blockedOn=e,E9(n.priority,function(){_9(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Ok(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=WD(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var r=new t.constructor(t.type,t);BD=r,t.target.dispatchEvent(r),BD=null}else return e=wS(t),e!==null&&T4(e),n.blockedOn=t,!1;e.shift()}return!0}function Tz(n,e,t){Ok(n)&&t.delete(e)}function jue(){HD=!1,Wh!==null&&Ok(Wh)&&(Wh=null),qh!==null&&Ok(qh)&&(qh=null),Gh!==null&&Ok(Gh)&&(Gh=null),qw.forEac
vendor: 11,902 bytes, line 37
37h(Tz),Gw.forEach(Tz)}function G0(n,e){n.blockedOn===e&&(n.blockedOn=null,HD||(HD=!0,to.unstable_scheduleCallback(to.unstable_NormalPriority,jue)))}function Kw(n){function e(s){return G0(s,n)}if(0<DE.length){G0(DE[0],n);for(var t=1;t<DE.length;t++){var r=DE[t];r.blockedOn===n&&(r.blockedOn=null)}}for(Wh!==null&&G0(Wh,n),qh!==null&&G0(qh,n),Gh!==null&&G0(Gh,n),qw.forEach(e),Gw.forEach(e),t=0;t<Kd.length;t++)r=Kd[t],r.blockedOn===n&&(r.blockedOn=null);for(;0<Kd.length&&(t=Kd[0],t.blockedOn===null);)k9(t),t.blockedOn===null&&Kd.shift()}var ey=_d.ReactCurrentBatchConfig,r2=!0;function Rue(n,e,t,r){var s=In,i=ey.transition;ey.transition=null;try{In=1,j4(n,e,t,r)}finally{In=s,ey.transition=i}}function Pue(n,e,t,r){var s=In,i=ey.transition;ey.transition=null;try{In=4,j4(n,e,t,r)}finally{In=s,ey.transition=i}}function j4(n,e,t,r){if(r2){var s=WD(n,e,t,r);if(s===null)uR(n,e,r,s2,t),Nz(n,r);else if(Tue(s,n,e,t,r))r.stopPropagation();else if(Nz(n,r),e&4&&-1<Nue.indexOf(n)){for(;s!==null;){var i=wS(s);if(i!==null&&w9(i),i=WD(n,e,t,r),i===null&&uR(n,e,r,s2,t),i===s)break;s=i}s!==null&&r.stopPropagation()}else uR(n,e,r,null,t)}}var s2=null;function WD(n,e,t,r){if(s2=null,n=C4(r),n=pp(n),n!==null)if(e=bg(n),e===null)n=null;else if(t=e.tag,t===13){if(n=f9(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return s2=n,null}function C9(n){switch(n){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(xue()){case A4:return 1;case v9:return 4;case t2:case bue:return 16;case y9:return 536870912;default:return 16}default:return 16}}var Fh=null,R4=null,Mk=null;function A9(){if(Mk)return Mk;var n,e=R4,t=e.length,r,s="value"in Fh?Fh.value:Fh.textContent,i=s.length;for(n=0;n<t&&e[n]===s[n];n++);var a=t-n;for(r=1;r<=a&&e[t-r]===s[i-r];r++);return Mk=s.slice(n,1<r?1-r:void 0)}function Ik(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function OE(){return!0}function jz(){return!1}function io(n){function e(t,r,s,i,a){this._reactName=t,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in n)n.hasOwnProperty(o)&&(t=n[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?OE:jz,this.isPropagationStopped=jz,this}return gr(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=OE)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=OE)},persist:function(){},isPersistent:OE}),e}var f0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},P4=io(f0),bS=gr({},f0,{view:0,detail:0}),Due=io(bS),tR,nR,K0,$N=gr({},bS,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:D4,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==K0&&(K0&&n.type==="mousemove"?(tR=n.screenX-K0.screenX,nR=n.screenY-K0.screenY):nR=tR=0,K0=n),tR)},movementY:function(n){return"movementY"in n?n.movementY:nR}}),Rz=io($N),Oue=gr({},$N,{dataTransfer:0}),Mue=io(Oue),Iue=gr({},bS,{relatedTarget:0}),rR=io(Iue),Lue=gr({},f0,{animationName:0,elapsedTime:0,pseudoElement:0}),Fue=io(Lue),Bue=gr({},f0,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),zue=io(Bue),$ue=gr({},f0,{data:0}),Pz=io($ue),Uue={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vue={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"},Hue={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wue(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=Hue[n])?!!e[n]:!1}function D4(){return Wue}var que=gr({},bS,{key:function(n){if(n.key){var e=Uue[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Ik(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Vue[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:D4,charCode:function(n){return n.type==="keypress"?Ik(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ik(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Gue=io(que),Kue=gr({},$N,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dz=io(Kue),Yue=gr({},bS,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:D4}),Xue=io(Yue),Zue=gr({},f0,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jue=io(Zue),Que=gr({},$N,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),ede=io(Que),tde=[9,13,27,32],O4=id&&"CompositionEvent"in window,aw=null;id&&"documentMode"in document&&(aw=document.documentMode);var nde=id&&"TextEvent"in window&&!aw,N9=id&&(!O4||aw&&8<aw&&11>=aw),Oz=" ",Mz=!1;function T9(n,e){switch(n){case"keyup":return tde.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function j9(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Tv=!1;function rde(n,e){switch(n){case"compositionend":return j9(e);case"keypress":return e.which!==32?null:(Mz=!0,Oz);case"textInput":return n=e.data,n===Oz&&Mz?null:n;default:return null}}function sde(n,e){if(Tv)return n==="compositionend"||!O4&&T9(n,e)?(n=A9(),Mk=R4=Fh=null,Tv=!1,n):null;switch(n){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 N9&&e.locale!=="ko"?null:e.data;default:return null}}var ide={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 Iz(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!ide[n.type]:e==="textarea"}function R9(n,e,t,r){l9(r),e=i2(e,"onChange"),0<e.length&&(t=new P4("onChange","change",null,t,r),n.push({event:t,listeners:e}))}var ow=null,Yw=null;function ade(n){U9(n,0)}function UN(n){var e=Pv(n);if(t9(e))return n}function ode(n,e){if(n==="change")return e}var P9=!1;if(id){var sR;if(id){var iR="oninput"in document;if(!iR){var Lz=document.createElement("div");Lz.setAttribute("oninput","return;"),iR=typeof Lz.oninput=="function"}sR=iR}else sR=!1;P9=sR&&(!document.documentMode||9<document.documentMode)}function Fz(){ow&&(ow.detachEvent("onpropertychange",D9),Yw=ow=null)}function D9(n){if(n.propertyName==="value"&&UN(Yw)){var e=[];R9(e,Yw,n,C4(n)),h9(ade,e)}}function lde(n,e,t){n==="focusin"?(Fz(),ow=e,Yw=t,ow.attachEvent("onpropertychange",D9)):n==="focusout"&&Fz()}function cde(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return UN(Yw)}function ude(n,e){if(n==="click")return UN(e)}function dde(n,e){if(n==="input"||n==="change")return UN(e)}function hde(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Gl=typeof Object.is=="function"?Object.is:hde;function Xw(n,e){if(Gl(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(r=0;r<t.length;r++){var s=t[r];if(!AD.call(e,s)||!Gl(n[s],e[s]))return!1}return!0}function Bz(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function zz(n,e){var t=Bz(n);n=0;for(var r;t;){if(t.nodeType===3){if(r=n+t.textContent.length,n<=e&&r>=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Bz(t)}}function O9(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?O9(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function M9(){for(var n=window,e=JC();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=JC(n.document)}return e}function M4(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function fde(n){var e=M9(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&O9(t.ownerDocument.documentElement,t)){if(r!==null&&M4(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var s=t.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!n.extend&&i>r&&(s=r,r=i,i=s),s=zz(t,i);var a=zz(t,r);s&&a&&(n.rangeCount!==1||n.anchorNode!==s.node||n.anchorOffset!==s.offset||n.focusNode!==a.node||n.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),n.removeAllRanges(),i>r?(n.addRange(e),n.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var pde=id&&"documentMode"in document&&11>=document.documentMode,jv=null,qD=null,lw=null,GD=!1;function $z(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;GD||jv==null||jv!==JC(r)||(r=jv,"selectionStart"in r&&M4(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,510 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),lw&&Xw(lw,r)||(lw=r,r=i2(qD,"onSelect"),0<r.length&&(e=new P4("onSelect","select",null,e,t),n.push({event:e,listeners:r}),e.target=jv)))}function ME(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Rv={animationend:ME("Animation","AnimationEnd"),animationiteration:ME("Animation","AnimationIteration"),animationstart:ME("Animation","AnimationStart"),transitionend:ME("Transition","TransitionEnd")},aR={},I9={};id&&(I9=document.createElement("div").style,"AnimationEvent"in window||(delete Rv.animationend.animation,delete Rv.animationiteration.animation,delete Rv.animationstart.animation),"TransitionEvent"in window||delete Rv.transitionend.transition);function VN(n){if(aR[n])return aR[n];if(!Rv[n])return n;var e=Rv[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in I9)return aR[n]=e[t];return n}var L9=VN("animationend"),F9=VN("animationiteration"),B9=VN("animationstart"),z9=VN("transitionend"),$9=new Map,Uz="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 kf(n,e){$9.set(n,e),xg(e,[n])}for(var oR=0;oR<Uz.length;oR++){var lR=Uz[oR],mde=lR.toLowerCase(),gde=lR[0].toUpperCase()+lR.slice(1);kf(mde,"on"+gde)}kf(L9,"onAnimationEnd");kf(F9,"onAnimationIteration");kf(B9,"onAnimationStart");kf("dblclick","onDoubleClick");kf("focusin","onFocus");kf("focusout","onBlur");kf(z9,"onTransitionEnd");jx("onMouseEnter",["mouseout","mouseover"]);jx("onMouseLeave",["mouseout","mouseover"]);jx("onPointerEnter",["pointerout","pointerover"]);jx("onPointerLeave",["pointerout","pointerover"]);xg("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));xg("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));xg("onBeforeInput",["compositionend","keypress","textInput","paste"]);xg("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));xg("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));xg("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sb="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(" "),vde=new Set("cancel close invalid load scroll toggle".split(" ").concat(Sb));function Vz(n,e,t){var r=n.type||"unknown-event";n.currentTarget=t,mue(r,e,void 0,n),n.currentTarget=null}function U9(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var r=n[t],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,u=o.currentTarget;if(o=o.listener,l!==i&&s.isPropagationStopped())break e;Vz(s,o,u),i=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,u=o.currentTarget,o=o.listener,l!==i&&s.isPropagationStopped())break e;Vz(s,o,u),i=l}}}if(e2)throw n=UD,e2=!1,UD=null,n}function Zn(n,e){var t=e[JD];t===void 0&&(t=e[JD]=new Set);var r=n+"__bubble";t.has(r)||(V9(e,n,2,!1),t.add(r))}function cR(n,e,t){var r=0;e&&(r|=4),V9(t,n,r,e)}var IE="_reactListening"+Math.random().toString(36).slice(2);function Zw(n){if(!n[IE]){n[IE]=!0,Xq.forEach(function(t){t!=="selectionchange"&&(vde.has(t)||cR(t,!1,n),cR(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[IE]||(e[IE]=!0,cR("selectionchange",!1,e))}}function V9(n,e,t,r){switch(C9(e)){case 1:var s=Rue;break;case 4:s=Pue;break;default:s=j4}t=s.bind(null,e,t,n),s=void 0,!$D||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?n.addEventListener(e,t,{capture:!0,passive:s}):n.addEventListener(e,t,!0):s!==void 0?n.addEventListener(e,t,{passive:s}):n.addEventListener(e,t,!1)}function uR(n,e,t,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;
vendor: 2,535 bytes, line 37
37if(o===s||o.nodeType===8&&o.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;a=a.return}for(;o!==null;){if(a=pp(o),a===null)return;if(l=a.tag,l===5||l===6){r=i=a;continue e}o=o.parentNode}}r=r.return}h9(function(){var u=i,d=C4(t),h=[];e:{var f=$9.get(n);if(f!==void 0){var p=P4,m=n;switch(n){case"keypress":if(Ik(t)===0)break e;case"keydown":case"keyup":p=Gue;break;case"focusin":m="focus",p=rR;break;case"focusout":m="blur",p=rR;break;case"beforeblur":case"afterblur":p=rR;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Rz;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Mue;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Xue;break;case L9:case F9:case B9:p=Fue;break;case z9:p=Jue;break;case"scroll":p=Due;break;case"wheel":p=ede;break;case"copy":case"cut":case"paste":p=zue;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Dz}var g=(e&4)!==0,y=!g&&n==="scroll",v=g?f!==null?f+"Capture":null:f;g=[];for(var x=u,b;x!==null;){b=x;var E=b.stateNode;if(b.tag===5&&E!==null&&(b=E,v!==null&&(E=Ww(x,v),E!=null&&g.push(Jw(x,E,b)))),y)break;x=x.return}0<g.length&&(f=new p(f,m,null,t,d),h.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=n==="mouseover"||n==="pointerover",p=n==="mouseout"||n==="pointerout",f&&t!==BD&&(m=t.relatedTarget||t.fromElement)&&(pp(m)||m[ad]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=u,m=m?pp(m):null,m!==null&&(y=bg(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(g=Rz,E="onMouseLeave",v="onMouseEnter",x="mouse",(n==="pointerout"||n==="pointerover")&&(g=Dz,E="onPointerLeave",v="onPointerEnter",x="pointer"),y=p==null?f:Pv(p),b=m==null?f:Pv(m),f=new g(E,x+"leave",p,t,d),f.target=y,f.relatedTarget=b,E=null,pp(d)===u&&(g=new g(v,x+"enter",m,t,d),g.target=b,g.relatedTarget=y,E=g),y=E,p&&m)t:{for(g=p,v=m,x=0,b=g;b;b=zg(b))x++;for(b=0,E=v;E;E=zg(E))b++;for(;0<x-b;)g=zg(g),x--;for(;0<b-x;)v=zg(v),b--;for(;x--;){if(g===v||v!==null&&g===v.alternate)break t;g=zg(g),v=zg(v)}g=null}else g=null;p!==null&&Hz(h,f,p,g,!1),m!==null&&y!==null&&Hz(h,y,m,g,!0)}}
vendor: 4,886 bytes, lines 37-38
37e:{if(f=u?Pv(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var S=ode;else if(Iz(f))if(P9)S=dde;else{S=cde;var k=lde}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=ude);if(S&&(S=S(n,u))){R9(h,S,t,d);break e}k&&k(n,f,u),n==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&OD(f,"number",f.value)}switch(k=u?Pv(u):window,n){case"focusin":(Iz(k)||k.contentEditable==="true")&&(jv=k,qD=u,lw=null);break;case"focusout":lw=qD=jv=null;break;case"mousedown":GD=!0;break;case"contextmenu":case"mouseup":case"dragend":GD=!1,$z(h,t,d);break;case"selectionchange":if(pde)break;case"keydown":case"keyup":$z(h,t,d)}var C;if(O4)e:{switch(n){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Tv?T9(n,t)&&(A="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(A="onCompositionStart");A&&(N9&&t.locale!=="ko"&&(Tv||A!=="onCompositionStart"?A==="onCompositionEnd"&&Tv&&(C=A9()):(Fh=d,R4="value"in Fh?Fh.value:Fh.textContent,Tv=!0)),k=i2(u,A),0<k.length&&(A=new Pz(A,n,null,t,d),h.push({event:A,listeners:k}),C?A.data=C:(C=j9(t),C!==null&&(A.data=C)))),(C=nde?rde(n,t):sde(n,t))&&(u=i2(u,"onBeforeInput"),0<u.length&&(d=new Pz("onBeforeInput","beforeinput",null,t,d),h.push({event:d,listeners:u}),d.data=C))}U9(h,e)})}function Jw(n,e,t){return{instance:n,listener:e,currentTarget:t}}function i2(n,e){for(var t=e+"Capture",r=[];n!==null;){var s=n,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ww(n,t),i!=null&&r.unshift(Jw(n,i,s)),i=Ww(n,e),i!=null&&r.push(Jw(n,i,s))),n=n.return}return r}function zg(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Hz(n,e,t,r,s){for(var i=e._reactName,a=[];t!==null&&t!==r;){var o=t,l=o.alternate,u=o.stateNode;if(l!==null&&l===r)break;o.tag===5&&u!==null&&(o=u,s?(l=Ww(t,i),l!=null&&a.unshift(Jw(t,l,o))):s||(l=Ww(t,i),l!=null&&a.push(Jw(t,l,o)))),t=t.return}a.length!==0&&n.push({event:e,listeners:a})}var yde=/\r\n?/g,xde=/\u0000|\uFFFD/g;function Wz(n){return(typeof n=="string"?n:""+n).replace(yde,`
38`).replace(xde,"")}function LE(n,e,t){if(e=Wz(e),Wz(n)!==e&&t)throw Error(We(425))}function a2(){}var KD=null,YD=null;function XD(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ZD=typeof setTimeout=="function"?setTimeout:void 0,bde=typeof clearTimeout=="function"?clearTimeout:void 0,qz=typeof Promise=="function"?Promise:void 0,wde=typeof queueMicrotask=="function"?queueMicrotask:typeof qz<"u"?function(n){return qz.resolve(null).then(n).catch(_de)}:ZD;function _de(n){setTimeout(function(){throw n})}function dR(n,e){var t=e,r=0;do{var s=t.nextSibling;if(n.removeChild(t),s&&s.nodeType===8)if(t=s.data,t==="/$"){if(r===0){n.removeChild(s),Kw(e);return}r--}else t!=="$"&&t!=="$?"&&t!=="$!"||r++;t=s}while(t);Kw(e)}function Kh(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function Gz(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var p0=Math.random().toString(36).slice(2),Rc="__reactFiber$"+p0,Qw="__reactProps$"+p0,ad="__reactContainer$"+p0,JD="__reactEvents$"+p0,Sde="__reactListeners$"+p0,Ede="__reactHandles$"+p0;function pp(n){var e=n[Rc];if(e)return e;for(var t=n.parentNode;t;){if(e=t[ad]||t[Rc]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=Gz(n);n!==null;){if(t=n[Rc])return t;n=Gz(n)}return e}n=t,t=n.parentNode}return null}function wS(n){return n=n[Rc]||n[ad],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Pv(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(We(33))}function HN(n){return n[Qw]||null}var QD=[],Dv=-1;function Cf(n){return{current:n}}function er(n){0>Dv||(n.current=QD[Dv],QD[Dv]=null,Dv--)}function Kn(n,e){Dv++,QD[Dv]=n.current,n.current=e}var uf={},Ai=Cf(uf),wa=Cf(!1),Um=uf;function Rx(n,e){var t=n.type.contextTypes;if(!t)return uf;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in t)s[i]=e[i];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=s),s}function _a(n){return n=n.childContextTypes,n!=null}function o2(){er(wa),er(Ai)}function Kz(n,e,t){if(Ai.current!==uf)throw Error(We(168));Kn(Ai,e),Kn(wa,t)}function H9(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();
vendor: 14,458 bytes, line 38
38for(var s in r)if(!(s in e))throw Error(We(108,lue(n)||"Unknown",s));return gr({},t,r)}function l2(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||uf,Um=Ai.current,Kn(Ai,n),Kn(wa,wa.current),!0}function Yz(n,e,t){var r=n.stateNode;if(!r)throw Error(We(169));t?(n=H9(n,e,Um),r.__reactInternalMemoizedMergedChildContext=n,er(wa),er(Ai),Kn(Ai,n)):er(wa),Kn(wa,t)}var mu=null,WN=!1,hR=!1;function W9(n){mu===null?mu=[n]:mu.push(n)}function kde(n){WN=!0,W9(n)}function Af(){if(!hR&&mu!==null){hR=!0;var n=0,e=In;try{var t=mu;for(In=1;n<t.length;n++){var r=t[n];do r=r(!0);while(r!==null)}mu=null,WN=!1}catch(s){throw mu!==null&&(mu=mu.slice(n+1)),g9(A4,Af),s}finally{In=e,hR=!1}}return null}var Ov=[],Mv=0,c2=null,u2=0,ko=[],Co=0,Vm=null,qu=1,Gu="";function Jf(n,e){Ov[Mv++]=u2,Ov[Mv++]=c2,c2=n,u2=e}function q9(n,e,t){ko[Co++]=qu,ko[Co++]=Gu,ko[Co++]=Vm,Vm=n;var r=qu;n=Gu;var s=32-Ul(r)-1;r&=~(1<<s),t+=1;var i=32-Ul(e)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,qu=1<<32-Ul(e)+s|t<<s|r,Gu=i+n}else qu=1<<i|t<<s|r,Gu=n}function I4(n){n.return!==null&&(Jf(n,1),q9(n,1,0))}function L4(n){for(;n===c2;)c2=Ov[--Mv],Ov[Mv]=null,u2=Ov[--Mv],Ov[Mv]=null;for(;n===Vm;)Vm=ko[--Co],ko[Co]=null,Gu=ko[--Co],ko[Co]=null,qu=ko[--Co],ko[Co]=null}var Za=null,Xa=null,rr=!1,Ol=null;function G9(n,e){var t=Ro(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function Xz(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Za=n,Xa=Kh(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Za=n,Xa=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Vm!==null?{id:qu,overflow:Gu}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Ro(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Za=n,Xa=null,!0):!1;default:return!1}}function eO(n){return(n.mode&1)!==0&&(n.flags&128)===0}function tO(n){if(rr){var e=Xa;if(e){var t=e;if(!Xz(n,e)){if(eO(n))throw Error(We(418));e=Kh(t.nextSibling);var r=Za;e&&Xz(n,e)?G9(r,t):(n.flags=n.flags&-4097|2,rr=!1,Za=n)}}else{if(eO(n))throw Error(We(418));n.flags=n.flags&-4097|2,rr=!1,Za=n}}}function Zz(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Za=n}function FE(n){if(n!==Za)return!1;if(!rr)return Zz(n),rr=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!XD(n.type,n.memoizedProps)),e&&(e=Xa)){if(eO(n))throw K9(),Error(We(418));for(;e;)G9(n,e),e=Kh(e.nextSibling)}if(Zz(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(We(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Xa=Kh(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Xa=null}}else Xa=Za?Kh(n.stateNode.nextSibling):null;return!0}function K9(){for(var n=Xa;n;)n=Kh(n.nextSibling)}function Px(){Xa=Za=null,rr=!1}function F4(n){Ol===null?Ol=[n]:Ol.push(n)}var Cde=_d.ReactCurrentBatchConfig;function Y0(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(We(309));var r=t.stateNode}if(!r)throw Error(We(147,n));var s=r,i=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(a){var o=s.refs;a===null?delete o[i]:o[i]=a},e._stringRef=i,e)}if(typeof n!="string")throw Error(We(284));if(!t._owner)throw Error(We(290,n))}return n}function BE(n,e){throw n=Object.prototype.toString.call(e),Error(We(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function Jz(n){var e=n._init;return e(n._payload)}function Y9(n){function e(v,x){if(n){var b=v.deletions;b===null?(v.deletions=[x],v.flags|=16):b.push(x)}}function t(v,x){if(!n)return null;for(;x!==null;)e(v,x),x=x.sibling;return null}function r(v,x){for(v=new Map;x!==null;)x.key!==null?v.set(x.key,x):v.set(x.index,x),x=x.sibling;return v}function s(v,x){return v=Jh(v,x),v.index=0,v.sibling=null,v}function i(v,x,b){return v.index=b,n?(b=v.alternate,b!==null?(b=b.index,b<x?(v.flags|=2,x):b):(v.flags|=2,x)):(v.flags|=1048576,x)}function a(v){return n&&v.alternate===null&&(v.flags|=2),v}function o(v,x,b,E){return x===null||x.tag!==6?(x=xR(b,v.mode,E),x.return=v,x):(x=s(x,b),x.return=v,x)}function l(v,x,b,E){var S=b.type;return S===Nv?d(v,x,b.props.children,E,b.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$d&&Jz(S)===x.type)?(E=s(x,b.props),E.ref=Y0(v,x,b),E.return=v,E):(E=Vk(b.type,b.key,b.props,null,v.mode,E),E.ref=Y0(v,x,b),E.return=v,E)}function u(v,x,b,E){return x===null||x.tag!==4||x.stateNode.containerInfo!==b.containerInfo||x.stateNode.implementation!==b.implementation?(x=bR(b,v.mode,E),x.return=v,x):(x=s(x,b.children||[]),x.return=v,x)}function d(v,x,b,E,S){return x===null||x.tag!==7?(x=Dm(b,v.mode,E,S),x.return=v,x):(x=s(x,b),x.return=v,x)}function h(v,x,b){if(typeof x=="string"&&x!==""||typeof x=="number")return x=xR(""+x,v.mode,b),x.return=v,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case NE:return b=Vk(x.type,x.key,x.props,null,v.mode,b),b.ref=Y0(v,null,x),b.return=v,b;case Av:return x=bR(x,v.mode,b),x.return=v,x;case $d:var E=x._init;return h(v,E(x._payload),b)}if(wb(x)||H0(x))return x=Dm(x,v.mode,b,null),x.return=v,x;BE(v,x)}return null}function f(v,x,b,E){var S=x!==null?x.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return S!==null?null:o(v,x,""+b,E);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case NE:return b.key===S?l(v,x,b,E):null;case Av:return b.key===S?u(v,x,b,E):null;case $d:return S=b._init,f(v,x,S(b._payload),E)}if(wb(b)||H0(b))return S!==null?null:d(v,x,b,E,null);BE(v,b)}return null}function p(v,x,b,E,S){if(typeof E=="string"&&E!==""||typeof E=="number")return v=v.get(b)||null,o(x,v,""+E,S);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case NE:return v=v.get(E.key===null?b:E.key)||null,l(x,v,E,S);case Av:return v=v.get(E.key===null?b:E.key)||null,u(x,v,E,S);case $d:var k=E._init;return p(v,x,b,k(E._payload),S)}if(wb(E)||H0(E))return v=v.get(b)||null,d(x,v,E,S,null);BE(x,E)}return null}function m(v,x,b,E){for(var S=null,k=null,C=x,A=x=0,T=null;C!==null&&A<b.length;A++){C.index>A?(T=C,C=null):T=C.sibling;var j=f(v,C,b[A],E);if(j===null){C===null&&(C=T);break}n&&C&&j.alternate===null&&e(v,C),x=i(j,x,A),k===null?S=j:k.sibling=j,k=j,C=T}if(A===b.length)return t(v,C),rr&&Jf(v,A),S;if(C===null){for(;A<b.length;A++)C=h(v,b[A],E),C!==null&&(x=i(C,x,A),k===null?S=C:k.sibling=C,k=C);return rr&&Jf(v,A),S}for(C=r(v,C);A<b.length;A++)T=p(C,v,A,b[A],E),T!==null&&(n&&T.alternate!==null&&C.delete(T.key===null?A:T.key),x=i(T,x,A),k===null?S=T:k.sibling=T,k=T);return n&&C.forEach(function(D){return e(v,D)}),rr&&Jf(v,A),S}function g(v,x,b,E){var S=H0(b);if(typeof S!="function")throw Error(We(150));if(b=S.call(b),b==null)throw Error(We(151));for(var k=S=null,C=x,A=x=0,T=null,j=b.next();C!==null&&!j.done;A++,j=b.next()){C.index>A?(T=C,C=null):T=C.sibling;var D=f(v,C,j.value,E);if(D===null){C===null&&(C=T);break}n&&C&&D.alternate===null&&e(v,C),x=i(D,x,A),k===null?S=D:k.sibling=D,k=D,C=T}if(j.done)return t(v,C),rr&&Jf(v,A),S;if(C===null){for(;!j.done;A++,j=b.next())j=h(v,j.value,E),j!==null&&(x=i(j,x,A),k===null?S=j:k.sibling=j,k=j);return rr&&Jf(v,A),S}for(C=r(v,C);!j.done;A++,j=b.next())j=p(C,v,A,j.value,E),j!==null&&(n&&j.alternate!==null&&C.delete(j.key===null?A:j.key),x=i(j,x,A),k===null?S=j:k.sibling=j,k=j);return n&&C.forEach(function(R){return e(v,R)}),rr&&Jf(v,A),S}function y(v,x,b,E){if(typeof b=="object"&&b!==null&&b.type===Nv&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case NE:e:{for(var S=b.key,k=x;k!==null;){if(k.key===S){if(S=b.type,S===Nv){if(k.tag===7){t(v,k.sibling),x=s(k,b.props.children),x.return=v,v=x;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$d&&Jz(S)===k.type){t(v,k.sibling),x=s(k,b.props),x.ref=Y0(v,k,b),x.return=v,v=x;break e}t(v,k);break}else e(v,k);k=k.sibling}b.type===Nv?(x=Dm(b.props.children,v.mode,E,b.key),x.return=v,v=x):(E=Vk(b.type,b.key,b.props,null,v.mode,E),E.ref=Y0(v,x,b),E.return=v,v=E)}return a(v);case Av:e:{for(k=b.key;x!==null;){if(x.key===k)if(x.tag===4&&x.stateNode.containerInfo===b.containerInfo&&x.stateNode.implementation===b.implementation){t(v,x.sibling),x=s(x,b.children||[]),x.return=v,v=x;break e}else{t(v,x);break}else e(v,x);x=x.sibling}x=bR(b,v.mode,E),x.return=v,v=x}return a(v);case $d:return k=b._init,y(v,x,k(b._payload),E)}if(wb(b))return m(v,x,b,E);if(H0(b))return g(v,x,b,E);BE(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,x!==null&&x.tag===6?(t(v,x.sibling),x=s(x,b),x.return=v,v=x):(t(v,x),x=xR(b,v.mode,E),x.return=v,v=x),a(v)):t(v,x)}return y}var Dx=Y9(!0),X9=Y9(!1),d2=Cf(null),h2=null,Iv=null,B4=null;function z4(){B4=Iv=h2=null}function $4(n){var e=d2.current;er(d2),n._currentValue=e}function nO(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function ty(n,e){h2=n,B4=Iv=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(ya=!0),n.firstContext=null)}function Uo(n){var e=n._currentValue;if(B4!==n)if(n={context:n,memoizedValue:e,next:null},Iv===null){if(h2===null)throw Error(We(308));Iv=n,h2.dependencies={lanes:0,firstContext:n}}else Iv=Iv.next=n;return e}var mp=null;function U4(n){mp===null?mp=[n]:mp.push(n)}function Z9(n,e,t,r){var s=e.interleaved;return s===null?(t.next=t,U4(e)):(t.next=s.next,s.next=t),e.interleaved=t,od(n,r)}function od(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Ud=!1;function V4(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function J9(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Ju(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Yh(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,vn&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,od(n,t)}return s=r.interleaved,s===null?(e.next=e,U4(r)):(e.next=s.next,s.next=e),r.interleaved=e,od(n,t)}function Lk(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,N4(n,t)}}function Qz(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var s=null,i=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};i===null?s=i=a:i=i.next=a,t=t.next}while(t!==null);i===null?s=i=e:i=i.next=e}else s=i=e;t={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function f2(n,e,t,r){var s=n.updateQueue;Ud=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?i=u:a.next=u,a=l;var d=n.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;a=0,d=u=l=null,o=i;do{var f=o.lane,p=o.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=n,g=o;switch(f=e,p=t,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=gr({},h,f);break e;case 2:Ud=!0}}o.callback!==null&&o.lane!==0&&(n.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else p={eventTime:p,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,l=h):d=d.next=p,a|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do a|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Wm|=a,n.lanes=a,n.memoizedState=h}}function e$(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var r=n[e],s=r.callback;if(s!==null){if(r.callback=null,r=t,typeof s!="function")throw Error(We(191,s));s.call(r)}}}var _S={},Fc=Cf(_S),e1=Cf(_S),t1=Cf(_S);function gp(n){if(n===_S)throw Error(We(174));return n}function H4(n,e){switch(Kn(t1,e),Kn(e1,n),Kn(Fc,_S),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ID(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=ID(e,n)}er(Fc),Kn(Fc,e)}function Ox(){er(Fc),er(e1),er(t1)}function Q9(n){gp(t1.current);var e=gp(Fc.current),t=ID(e,n.type);e!==t&&(Kn(e1,n),Kn(Fc,t))}function W4(n){e1.current===n&&(er(Fc),er(e1))}var ur=Cf(0);function p2(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var fR=[];function q4(){for(var n=0;n<fR.length;n++)fR[n]._workInProgressVersionPrimary=null;fR.length=0}var Fk=_d.ReactCurrentDispatcher,pR=_d.ReactCurrentBatchConfig,Hm=0,mr=null,gs=null,js=null,m2=!1,cw=!1,n1=0,Ade=0;function li(){throw Error(We(321))}function G4(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!Gl(n[t],e[t]))return!1;return!0}function K4(n,e,t,r,s,i){if(Hm=i,mr=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Fk.current=n===null||n.memoizedState===null?Rde:Pde,n=t(r,s),cw){i=0;do{if(cw=!1,n1=0,25<=i)throw Error(We(301));i+=1,js=gs=null,e.updateQueue=null,Fk.current=Dde,n=t(r,s)}while(cw)}
vendor: 4,779 bytes, line 38
38if(Fk.current=g2,e=gs!==null&&gs.next!==null,Hm=0,js=gs=mr=null,m2=!1,e)throw Error(We(300));return n}function Y4(){var n=n1!==0;return n1=0,n}function ac(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return js===null?mr.memoizedState=js=n:js=js.next=n,js}function Vo(){if(gs===null){var n=mr.alternate;n=n!==null?n.memoizedState:null}else n=gs.next;var e=js===null?mr.memoizedState:js.next;if(e!==null)js=e,gs=n;else{if(n===null)throw Error(We(310));gs=n,n={memoizedState:gs.memoizedState,baseState:gs.baseState,baseQueue:gs.baseQueue,queue:gs.queue,next:null},js===null?mr.memoizedState=js=n:js=js.next=n}return js}function r1(n,e){return typeof e=="function"?e(n):e}function mR(n){var e=Vo(),t=e.queue;if(t===null)throw Error(We(311));t.lastRenderedReducer=n;var r=gs,s=r.baseQueue,i=t.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,t.pending=null}if(s!==null){i=s.next,r=r.baseState;var o=a=null,l=null,u=i;do{var d=u.lane;if((Hm&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:n(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(o=l=h,a=r):l=l.next=h,mr.lanes|=d,Wm|=d}u=u.next}while(u!==null&&u!==i);l===null?a=r:l.next=o,Gl(r,e.memoizedState)||(ya=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=l,t.lastRenderedState=r}if(n=t.interleaved,n!==null){s=n;do i=s.lane,mr.lanes|=i,Wm|=i,s=s.next;while(s!==n)}else s===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function gR(n){var e=Vo(),t=e.queue;if(t===null)throw Error(We(311));t.lastRenderedReducer=n;var r=t.dispatch,s=t.pending,i=e.memoizedState;if(s!==null){t.pending=null;var a=s=s.next;do i=n(i,a.action),a=a.next;while(a!==s);Gl(i,e.memoizedState)||(ya=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),t.lastRenderedState=i}return[i,r]}function e7(){}function t7(n,e){var t=mr,r=Vo(),s=e(),i=!Gl(r.memoizedState,s);if(i&&(r.memoizedState=s,ya=!0),r=r.queue,X4(s7.bind(null,t,r,n),[n]),r.getSnapshot!==e||i||js!==null&&js.memoizedState.tag&1){if(t.flags|=2048,s1(9,r7.bind(null,t,r,s,e),void 0,null),Ds===null)throw Error(We(349));Hm&30||n7(t,e,s)}return s}function n7(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=mr.updateQueue,e===null?(e={lastEffect:null,stores:null},mr.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function r7(n,e,t,r){e.value=t,e.getSnapshot=r,i7(e)&&a7(n)}function s7(n,e,t){return t(function(){i7(e)&&a7(n)})}function i7(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Gl(n,t)}catch{return!0}}function a7(n){var e=od(n,1);e!==null&&Vl(e,n,1,-1)}function t$(n){var e=ac();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r1,lastRenderedState:n},e.queue=n,n=n.dispatch=jde.bind(null,mr,n),[e.memoizedState,n]}function s1(n,e,t,r){return n={tag:n,create:e,destroy:t,deps:r,next:null},e=mr.updateQueue,e===null?(e={lastEffect:null,stores:null},mr.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(r=t.next,t.next=n,n.next=r,e.lastEffect=n)),n}function o7(){return Vo().memoizedState}function Bk(n,e,t,r){var s=ac();mr.flags|=n,s.memoizedState=s1(1|e,t,void 0,r===void 0?null:r)}function qN(n,e,t,r){var s=Vo();r=r===void 0?null:r;var i=void 0;if(gs!==null){var a=gs.memoizedState;if(i=a.destroy,r!==null&&G4(r,a.deps)){s.memoizedState=s1(e,t,i,r);return}}mr.flags|=n,s.memoizedState=s1(1|e,t,i,r)}function n$(n,e){return Bk(8390656,8,n,e)}function X4(n,e){return qN(2048,8,n,e)}function l7(n,e){return qN(4,2,n,e)}function c7(n,e){return qN(4,4,n,e)}function u7(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function d7(n,e,t){return t=t!=null?t.concat([n]):null,qN(4,4,u7.bind(null,e,n),t)}function Z4(){}function h7(n,e){var t=Vo();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&G4(e,r[1])?r[0]:(t.memoizedState=[n,e],n)}function f7(n,e){var t=Vo();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&G4(e,r[1])?r[0]:(n=n(),t.memoizedState=[n,e],n)}function p7(n,e,t){return Hm&21?(Gl(t,e)||(t=x9(),mr.lanes|=t,Wm|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,ya=!0),n.memoizedState=t)}function Nde(n,e){var t=In;In=t!==0&&4>t?t:4,n(!0);var r=pR.transition;pR.transition={};try{n(!1),e()}finally{In=t,pR.transition=r}}function m7(){return Vo().memoizedState}function Tde(n,e,t){var r=Zh(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},g7(n))v7(e,t);else if(t=Z9(n,e,t,r),t!==null){var s=qi();Vl(t,n,r,s),y7(t,e,r)}}
vendor: 6,306 bytes, lines 38-40
38function jde(n,e,t){var r=Zh(n),s={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(g7(n))v7(e,s);else{var i=n.alternate;if(n.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,o=i(a,t);if(s.hasEagerState=!0,s.eagerState=o,Gl(o,a)){var l=e.interleaved;l===null?(s.next=s,U4(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}t=Z9(n,e,s,r),t!==null&&(s=qi(),Vl(t,n,r,s),y7(t,e,r))}}function g7(n){var e=n.alternate;return n===mr||e!==null&&e===mr}function v7(n,e){cw=m2=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function y7(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,N4(n,t)}}var g2={readContext:Uo,useCallback:li,useContext:li,useEffect:li,useImperativeHandle:li,useInsertionEffect:li,useLayoutEffect:li,useMemo:li,useReducer:li,useRef:li,useState:li,useDebugValue:li,useDeferredValue:li,useTransition:li,useMutableSource:li,useSyncExternalStore:li,useId:li,unstable_isNewReconciler:!1},Rde={readContext:Uo,useCallback:function(n,e){return ac().memoizedState=[n,e===void 0?null:e],n},useContext:Uo,useEffect:n$,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Bk(4194308,4,u7.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Bk(4194308,4,n,e)},useInsertionEffect:function(n,e){return Bk(4,2,n,e)},useMemo:function(n,e){var t=ac();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=ac();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=Tde.bind(null,mr,n),[r.memoizedState,n]},useRef:function(n){var e=ac();return n={current:n},e.memoizedState=n},useState:t$,useDebugValue:Z4,useDeferredValue:function(n){return ac().memoizedState=n},useTransition:function(){var n=t$(!1),e=n[0];return n=Nde.bind(null,n[1]),ac().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=mr,s=ac();if(rr){if(t===void 0)throw Error(We(407));t=t()}else{if(t=e(),Ds===null)throw Error(We(349));Hm&30||n7(r,e,t)}s.memoizedState=t;var i={value:t,getSnapshot:e};return s.queue=i,n$(s7.bind(null,r,i,n),[n]),r.flags|=2048,s1(9,r7.bind(null,r,i,t,e),void 0,null),t},useId:function(){var n=ac(),e=Ds.identifierPrefix;if(rr){var t=Gu,r=qu;t=(r&~(1<<32-Ul(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=n1++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=Ade++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},Pde={readContext:Uo,useCallback:h7,useContext:Uo,useEffect:X4,useImperativeHandle:d7,useInsertionEffect:l7,useLayoutEffect:c7,useMemo:f7,useReducer:mR,useRef:o7,useState:function(){return mR(r1)},useDebugValue:Z4,useDeferredValue:function(n){var e=Vo();return p7(e,gs.memoizedState,n)},useTransition:function(){var n=mR(r1)[0],e=Vo().memoizedState;return[n,e]},useMutableSource:e7,useSyncExternalStore:t7,useId:m7,unstable_isNewReconciler:!1},Dde={readContext:Uo,useCallback:h7,useContext:Uo,useEffect:X4,useImperativeHandle:d7,useInsertionEffect:l7,useLayoutEffect:c7,useMemo:f7,useReducer:gR,useRef:o7,useState:function(){return gR(r1)},useDebugValue:Z4,useDeferredValue:function(n){var e=Vo();return gs===null?e.memoizedState=n:p7(e,gs.memoizedState,n)},useTransition:function(){var n=gR(r1)[0],e=Vo().memoizedState;return[n,e]},useMutableSource:e7,useSyncExternalStore:t7,useId:m7,unstable_isNewReconciler:!1};function hl(n,e){if(n&&n.defaultProps){e=gr({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function rO(n,e,t,r){e=n.memoizedState,t=t(r,e),t=t==null?e:gr({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var GN={isMounted:function(n){return(n=n._reactInternals)?bg(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var r=qi(),s=Zh(n),i=Ju(r,s);i.payload=e,t!=null&&(i.callback=t),e=Yh(n,i,s),e!==null&&(Vl(e,n,s,r),Lk(e,n,s))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var r=qi(),s=Zh(n),i=Ju(r,s);i.tag=1,i.payload=e,t!=null&&(i.callback=t),e=Yh(n,i,s),e!==null&&(Vl(e,n,s,r),Lk(e,n,s))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=qi(),r=Zh(n),s=Ju(t,r);s.tag=2,e!=null&&(s.callback=e),e=Yh(n,s,r),e!==null&&(Vl(e,n,r,t),Lk(e,n,r))}};function r$(n,e,t,r,s,i,a){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(r,i,a):e.prototype&&e.prototype.isPureReactComponent?!Xw(t,r)||!Xw(s,i):!0}function x7(n,e,t){var r=!1,s=uf,i=e.contextType;return typeof i=="object"&&i!==null?i=Uo(i):(s=_a(e)?Um:Ai.current,r=e.contextTypes,i=(r=r!=null)?Rx(n,s):uf),e=new e(t,i),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=GN,n.stateNode=e,e._reactInternals=n,r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=i),e}function s$(n,e,t,r){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,r),e.state!==n&&GN.enqueueReplaceState(e,e.state,null)}function sO(n,e,t,r){var s=n.stateNode;s.props=t,s.state=n.memoizedState,s.refs={},V4(n);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Uo(i):(i=_a(e)?Um:Ai.current,s.context=Rx(n,i)),s.state=n.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(rO(n,e,i,t),s.state=n.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&&GN.enqueueReplaceState(s,s.state,null),f2(n,t,s,r),s.state=n.memoizedState),typeof s.componentDidMount=="function"&&(n.flags|=4194308)}function Mx(n,e){try{var t="",r=e;do t+=oue(r),r=r.return;while(r);var s=t}catch(i){s=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:n,source:e,stack:s,digest:null}}function vR(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function iO(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}
vendor: 10,877 bytes, line 40
40var Ode=typeof WeakMap=="function"?WeakMap:Map;function b7(n,e,t){t=Ju(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){y2||(y2=!0,mO=r),iO(n,e)},t}function w7(n,e,t){t=Ju(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;t.payload=function(){return r(s)},t.callback=function(){iO(n,e)}}var i=n.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(t.callback=function(){iO(n,e),typeof r!="function"&&(Xh===null?Xh=new Set([this]):Xh.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),t}function i$(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new Ode;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(t)||(s.add(t),n=Kde.bind(null,n,e,t),e.then(n,n))}function a$(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function o$(n,e,t,r,s){return n.mode&1?(n.flags|=65536,n.lanes=s,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Ju(-1,1),e.tag=2,Yh(t,e,1))),t.lanes|=1),n)}var Mde=_d.ReactCurrentOwner,ya=!1;function Mi(n,e,t,r){e.child=n===null?X9(e,null,t,r):Dx(e,n.child,t,r)}function l$(n,e,t,r,s){t=t.render;var i=e.ref;return ty(e,s),r=K4(n,e,t,r,i,s),t=Y4(),n!==null&&!ya?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,ld(n,e,s)):(rr&&t&&I4(e),e.flags|=1,Mi(n,e,r,s),e.child)}function c$(n,e,t,r,s){if(n===null){var i=t.type;return typeof i=="function"&&!iF(i)&&i.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=i,_7(n,e,i,r,s)):(n=Vk(t.type,null,r,e,e.mode,s),n.ref=e.ref,n.return=e,e.child=n)}if(i=n.child,!(n.lanes&s)){var a=i.memoizedProps;if(t=t.compare,t=t!==null?t:Xw,t(a,r)&&n.ref===e.ref)return ld(n,e,s)}return e.flags|=1,n=Jh(i,r),n.ref=e.ref,n.return=e,e.child=n}function _7(n,e,t,r,s){if(n!==null){var i=n.memoizedProps;if(Xw(i,r)&&n.ref===e.ref)if(ya=!1,e.pendingProps=r=i,(n.lanes&s)!==0)n.flags&131072&&(ya=!0);else return e.lanes=n.lanes,ld(n,e,s)}return aO(n,e,t,r,s)}function S7(n,e,t){var r=e.pendingProps,s=r.children,i=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Kn(Fv,Ua),Ua|=t;else{if(!(t&1073741824))return n=i!==null?i.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Kn(Fv,Ua),Ua|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:t,Kn(Fv,Ua),Ua|=r}else i!==null?(r=i.baseLanes|t,e.memoizedState=null):r=t,Kn(Fv,Ua),Ua|=r;return Mi(n,e,s,t),e.child}function E7(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function aO(n,e,t,r,s){var i=_a(t)?Um:Ai.current;return i=Rx(e,i),ty(e,s),t=K4(n,e,t,r,i,s),r=Y4(),n!==null&&!ya?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,ld(n,e,s)):(rr&&r&&I4(e),e.flags|=1,Mi(n,e,t,s),e.child)}function u$(n,e,t,r,s){if(_a(t)){var i=!0;l2(e)}else i=!1;if(ty(e,s),e.stateNode===null)zk(n,e),x7(e,t,r),sO(e,t,r,s),r=!0;else if(n===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,u=t.contextType;typeof u=="object"&&u!==null?u=Uo(u):(u=_a(t)?Um:Ai.current,u=Rx(e,u));var d=t.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||l!==u)&&s$(e,a,r,u),Ud=!1;var f=e.memoizedState;a.state=f,f2(e,r,a,s),l=e.memoizedState,o!==r||f!==l||wa.current||Ud?(typeof d=="function"&&(rO(e,t,d,r),l=e.memoizedState),(o=Ud||r$(e,t,o,r,f,l,u))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),a.props=r,a.state=l,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,J9(n,e),o=e.memoizedProps,u=e.type===e.elementType?o:hl(e.type,o),a.props=u,h=e.pendingProps,f=a.context,l=t.contextType,typeof l=="object"&&l!==null?l=Uo(l):(l=_a(t)?Um:Ai.current,l=Rx(e,l));var p=t.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||f!==l)&&s$(e,a,r,l),Ud=!1,f=e.memoizedState,a.state=f,f2(e,r,a,s);var m=e.memoizedState;o!==h||f!==m||wa.current||Ud?(typeof p=="function"&&(rO(e,t,p,r),m=e.memoizedState),(u=Ud||r$(e,t,u,r,f,m,l)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,m,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,m,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),a.props=r,a.state=m,a.context=l,r=u):(typeof a.componentDidUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),r=!1)}return oO(n,e,t,r,i,s)}function oO(n,e,t,r,s,i){E7(n,e);var a=(e.flags&128)!==0;if(!r&&!a)return s&&Yz(e,t,!1),ld(n,e,i);r=e.stateNode,Mde.current=e;var o=a&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&a?(e.child=Dx(e,n.child,null,i),e.child=Dx(e,null,o,i)):Mi(n,e,o,i),e.memoizedState=r.state,s&&Yz(e,t,!0),e.child}function k7(n){var e=n.stateNode;e.pendingContext?Kz(n,e.pendingContext,e.pendingContext!==e.context):e.context&&Kz(n,e.context,!1),H4(n,e.containerInfo)}function d$(n,e,t,r,s){return Px(),F4(s),e.flags|=256,Mi(n,e,t,r),e.child}var lO={dehydrated:null,treeContext:null,retryLane:0};function cO(n){return{baseLanes:n,cachePool:null,transitions:null}}function C7(n,e,t){var r=e.pendingProps,s=ur.current,i=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=n!==null&&n.memoizedState===null?!1:(s&2)!==0),o?(i=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(s|=1),Kn(ur,s&1),n===null)return tO(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=r.children,n=r.fallback,i?(r=e.mode,i=e.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=XN(a,r,0,null),n=Dm(n,r,t,null),i.return=e,n.return=e,i.sibling=n,e.child=i,e.child.memoizedState=cO(t),e.memoizedState=lO,n):J4(e,a));if(s=n.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return Ide(n,e,a,r,o,s,t);if(i){i=r.fallback,a=e.mode,s=n.child,o=s.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Jh(s,l),r.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=Jh(o,i):(i=Dm(i,a,t,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,a=n.child.memoizedState,a=a===null?cO(t):{baseLanes:a.baseLanes|t,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=n.childLanes&~t,e.memoizedState=lO,r}return i=n.child,n=i.sibling,r=Jh(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function J4(n,e){return e=XN({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function zE(n,e,t,r){return r!==null&&F4(r),Dx(e,n.child,null,t),n=J4(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Ide(n,e,t,r,s,i,a){if(t)return e.flags&256?(e.flags&=-257,r=vR(Error(We(422))),zE(n,e,a,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=XN({mode:"visible",children:r.children},s,0,null),i=Dm(i,s,a,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Dx(e,n.child,null,a),e.child.memoizedState=cO(a),e.memoizedState=lO,i);if(!(e.mode&1))return zE(n,e,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(We(419)),r=vR(i,r,void 0),zE(n,e,a,r)}if(o=(a&n.childLanes)!==0,ya||o){if(r=Ds,r!==null){switch(a&-a){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&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,od(n,s),Vl(r,n,s,-1))}return sF(),r=vR(Error(We(421))),zE(n,e,a,r)}return s.data==="$?"?(e.flags|=128,e.child=n.child,e=Yde.bind(null,n),s._reactRetry=e,null):(n=i.treeContext,Xa=Kh(s.nextSibling),Za=e,rr=!0,Ol=null,n!==null&&(ko[Co++]=qu,ko[Co++]=Gu,ko[Co++]=Vm,qu=n.id,Gu=n.overflow,Vm=e),e=J4(e,r.children),e.flags|=4096,e)}function h$(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),nO(n.return,e,t)}function yR(n,e,t,r,s){var i=n.memoizedState;i===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=t,i.tailMode=s)}function A7(n,e,t){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(Mi(n,e,r.children,t),r=ur.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&h$(n,t,e);else if(n.tag===19)h$(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(Kn(ur,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(t=e.child,s=null;t!==null;)n=t.alternate,n!==null&&p2(n)===null&&(s=t),t=t.sibling;t=s,t===null?(s=e.child,e.child=null):(s=t.sibling,t.sibling=null),yR(e,!1,s,t,i);break;case"backwards":for(t=null,s=e.child,e.child=null;s!==null;){if(n=s.alternate,n!==null&&p2(n)===null){e.child=s;break}n=s.sibling,s.sibling=t,t=s,s=n}yR(e,!0,t,null,i);break;case"together":yR(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function zk(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}
vendor: 4,907 bytes, line 40
40function ld(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Wm|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(We(153));if(e.child!==null){for(n=e.child,t=Jh(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Jh(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function Lde(n,e,t){switch(e.tag){case 3:k7(e),Px();break;case 5:Q9(e);break;case 1:_a(e.type)&&l2(e);break;case 4:H4(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;Kn(d2,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Kn(ur,ur.current&1),e.flags|=128,null):t&e.child.childLanes?C7(n,e,t):(Kn(ur,ur.current&1),n=ld(n,e,t),n!==null?n.sibling:null);Kn(ur,ur.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return A7(n,e,t);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Kn(ur,ur.current),r)break;return null;case 22:case 23:return e.lanes=0,S7(n,e,t)}return ld(n,e,t)}var N7,uO,T7,j7;N7=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};uO=function(){};T7=function(n,e,t,r){var s=n.memoizedProps;if(s!==r){n=e.stateNode,gp(Fc.current);var i=null;switch(t){case"input":s=PD(n,s),r=PD(n,r),i=[];break;case"select":s=gr({},s,{value:void 0}),r=gr({},r,{value:void 0}),i=[];break;case"textarea":s=MD(n,s),r=MD(n,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=a2)}LD(t,r);var a;t=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var o=s[u];for(a in o)o.hasOwnProperty(a)&&(t||(t={}),t[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Vw.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(o=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&l!==o&&(l!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(t||(t={}),t[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(t||(t={}),t[a]=l[a])}else t||(i||(i=[]),i.push(u,t)),t=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Vw.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Zn("scroll",n),i||o===l||(i=[])):(i=i||[]).push(u,l))}t&&(i=i||[]).push("style",t);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};j7=function(n,e,t,r){t!==r&&(e.flags|=4)};function X0(n,e){if(!rr)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function ci(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var s=n.child;s!==null;)t|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=n,s=s.sibling;else for(s=n.child;s!==null;)t|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=n,s=s.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function Fde(n,e,t){var r=e.pendingProps;switch(L4(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ci(e),null;case 1:return _a(e.type)&&o2(),ci(e),null;case 3:return r=e.stateNode,Ox(),er(wa),er(Ai),q4(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(FE(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ol!==null&&(yO(Ol),Ol=null))),uO(n,e),ci(e),null;case 5:W4(e);var s=gp(t1.current);if(t=e.type,n!==null&&e.stateNode!=null)T7(n,e,t,r,s),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(We(166));return ci(e),null}if(n=gp(Fc.current),FE(e)){r=e.stateNode,t=e.type;var i=e.memoizedProps;switch(r[Rc]=e,r[Qw]=i,n=(e.mode&1)!==0,t){case"dialog":Zn("cancel",r),Zn("close",r);break;case"iframe":case"object":case"embed":Zn("load",r);break;case"video":case"audio":for(s=0;s<Sb.length;s++)Zn(Sb[s],r);break;case"source":Zn("error",r);break;case"img":case"image":case"link":Zn("error",r),Zn("load",r);break;case"details":Zn("toggle",r);break;case"input":wz(r,i),Zn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Zn("invalid",r);break;case"textarea":Sz(r,i),Zn("invalid",r)}LD(t,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];
vendor: 29,368 bytes, line 40
40a==="children"?typeof o=="string"?r.textContent!==o&&(i.suppressHydrationWarning!==!0&&LE(r.textContent,o,n),s=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&LE(r.textContent,o,n),s=["children",""+o]):Vw.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&Zn("scroll",r)}switch(t){case"input":TE(r),_z(r,i,!0);break;case"textarea":TE(r),Ez(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=a2)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=s9(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=a.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=a.createElement(t,{is:r.is}):(n=a.createElement(t),t==="select"&&(a=n,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):n=a.createElementNS(n,t),n[Rc]=e,n[Qw]=r,N7(n,e,!1,!1),e.stateNode=n;e:{switch(a=FD(t,r),t){case"dialog":Zn("cancel",n),Zn("close",n),s=r;break;case"iframe":case"object":case"embed":Zn("load",n),s=r;break;case"video":case"audio":for(s=0;s<Sb.length;s++)Zn(Sb[s],n);s=r;break;case"source":Zn("error",n),s=r;break;case"img":case"image":case"link":Zn("error",n),Zn("load",n),s=r;break;case"details":Zn("toggle",n),s=r;break;case"input":wz(n,r),s=PD(n,r),Zn("invalid",n);break;case"option":s=r;break;case"select":n._wrapperState={wasMultiple:!!r.multiple},s=gr({},r,{value:void 0}),Zn("invalid",n);break;case"textarea":Sz(n,r),s=MD(n,r),Zn("invalid",n);break;default:s=r}LD(t,s),o=s;for(i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="style"?o9(n,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&i9(n,l)):i==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&Hw(n,l):typeof l=="number"&&Hw(n,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Vw.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Zn("scroll",n):l!=null&&_4(n,i,l,a))}switch(t){case"input":TE(n),_z(n,r,!1);break;case"textarea":TE(n),Ez(n);break;case"option":r.value!=null&&n.setAttribute("value",""+cf(r.value));break;case"select":n.multiple=!!r.multiple,i=r.value,i!=null?Zv(n,!!r.multiple,i,!1):r.defaultValue!=null&&Zv(n,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(n.onclick=a2)}switch(t){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return ci(e),null;case 6:if(n&&e.stateNode!=null)j7(n,e,n.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(We(166));if(t=gp(t1.current),gp(Fc.current),FE(e)){if(r=e.stateNode,t=e.memoizedProps,r[Rc]=e,(i=r.nodeValue!==t)&&(n=Za,n!==null))switch(n.tag){case 3:LE(r.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&LE(r.nodeValue,t,(n.mode&1)!==0)}i&&(e.flags|=4)}else r=(t.nodeType===9?t:t.ownerDocument).createTextNode(r),r[Rc]=e,e.stateNode=r}return ci(e),null;case 13:if(er(ur),r=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(rr&&Xa!==null&&e.mode&1&&!(e.flags&128))K9(),Px(),e.flags|=98560,i=!1;else if(i=FE(e),r!==null&&r.dehydrated!==null){if(n===null){if(!i)throw Error(We(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(We(317));i[Rc]=e}else Px(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ci(e),i=!1}else Ol!==null&&(yO(Ol),Ol=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(r=r!==null,r!==(n!==null&&n.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(n===null||ur.current&1?xs===0&&(xs=3):sF())),e.updateQueue!==null&&(e.flags|=4),ci(e),null);case 4:return Ox(),uO(n,e),n===null&&Zw(e.stateNode.containerInfo),ci(e),null;case 10:return $4(e.type._context),ci(e),null;case 17:return _a(e.type)&&o2(),ci(e),null;case 19:if(er(ur),i=e.memoizedState,i===null)return ci(e),null;if(r=(e.flags&128)!==0,a=i.rendering,a===null)if(r)X0(i,!1);else{if(xs!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(a=p2(n),a!==null){for(e.flags|=128,X0(i,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=t,t=e.child;t!==null;)i=t,n=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=n,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,n=a.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return Kn(ur,ur.current&1|2),e.child}n=n.sibling}i.tail!==null&&Br()>Ix&&(e.flags|=128,r=!0,X0(i,!1),e.lanes=4194304)}else{if(!r)if(n=p2(a),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),X0(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!rr)return ci(e),null}else 2*Br()-i.renderingStartTime>Ix&&t!==1073741824&&(e.flags|=128,r=!0,X0(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(t=i.last,t!==null?t.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Br(),e.sibling=null,t=ur.current,Kn(ur,r?t&1|2:t&1),e):(ci(e),null);case 22:case 23:return rF(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ua&1073741824&&(ci(e),e.subtreeFlags&6&&(e.flags|=8192)):ci(e),null;case 24:return null;case 25:return null}throw Error(We(156,e.tag))}function Bde(n,e){switch(L4(e),e.tag){case 1:return _a(e.type)&&o2(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Ox(),er(wa),er(Ai),q4(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return W4(e),null;case 13:if(er(ur),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(We(340));Px()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return er(ur),null;case 4:return Ox(),null;case 10:return $4(e.type._context),null;case 22:case 23:return rF(),null;case 24:return null;default:return null}}var $E=!1,yi=!1,zde=typeof WeakSet=="function"?WeakSet:Set,ft=null;function Lv(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Ar(n,e,r)}else t.current=null}function dO(n,e,t){try{t()}catch(r){Ar(n,e,r)}}var f$=!1;function $de(n,e){if(KD=r2,n=M9(),M4(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{t.nodeType,i.nodeType}catch{t=null;break e}var a=0,o=-1,l=-1,u=0,d=0,h=n,f=null;t:for(;;){for(var p;h!==t||s!==0&&h.nodeType!==3||(o=a+s),h!==i||r!==0&&h.nodeType!==3||(l=a+r),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===n)break t;if(f===t&&++u===s&&(o=a),f===i&&++d===r&&(l=a),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}t=o===-1||l===-1?null:{start:o,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(YD={focusedElem:n,selectionRange:t},r2=!1,ft=e;ft!==null;)if(e=ft,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ft=n;else for(;ft!==null;){e=ft;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,y=m.memoizedState,v=e.stateNode,x=v.getSnapshotBeforeUpdate(e.elementType===e.type?g:hl(e.type,g),y);v.__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(We(163))}}catch(E){Ar(e,e.return,E)}if(n=e.sibling,n!==null){n.return=e.return,ft=n;break}ft=e.return}return m=f$,f$=!1,m}function uw(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&n)===n){var i=s.destroy;s.destroy=void 0,i!==void 0&&dO(e,t,i)}s=s.next}while(s!==r)}}function KN(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function hO(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function R7(n){var e=n.alternate;e!==null&&(n.alternate=null,R7(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Rc],delete e[Qw],delete e[JD],delete e[Sde],delete e[Ede])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function P7(n){return n.tag===5||n.tag===3||n.tag===4}function p$(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||P7(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function fO(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=a2));else if(r!==4&&(n=n.child,n!==null))for(fO(n,e,t),n=n.sibling;n!==null;)fO(n,e,t),n=n.sibling}function pO(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(pO(n,e,t),n=n.sibling;n!==null;)pO(n,e,t),n=n.sibling}var Gs=null,Rl=!1;function Nd(n,e,t){for(t=t.child;t!==null;)D7(n,e,t),t=t.sibling}function D7(n,e,t){if(Lc&&typeof Lc.onCommitFiberUnmount=="function")try{Lc.onCommitFiberUnmount(zN,t)}catch{}switch(t.tag){case 5:yi||Lv(t,e);case 6:var r=Gs,s=Rl;Gs=null,Nd(n,e,t),Gs=r,Rl=s,Gs!==null&&(Rl?(n=Gs,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Gs.removeChild(t.stateNode));break;case 18:Gs!==null&&(Rl?(n=Gs,t=t.stateNode,n.nodeType===8?dR(n.parentNode,t):n.nodeType===1&&dR(n,t),Kw(n)):dR(Gs,t.stateNode));break;case 4:r=Gs,s=Rl,Gs=t.stateNode.containerInfo,Rl=!0,Nd(n,e,t),Gs=r,Rl=s;break;case 0:case 11:case 14:case 15:if(!yi&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&dO(t,e,a),s=s.next}while(s!==r)}Nd(n,e,t);break;case 1:if(!yi&&(Lv(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(o){Ar(t,e,o)}Nd(n,e,t);break;case 21:Nd(n,e,t);break;case 22:t.mode&1?(yi=(r=yi)||t.memoizedState!==null,Nd(n,e,t),yi=r):Nd(n,e,t);break;default:Nd(n,e,t)}}function m$(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new zde),e.forEach(function(r){var s=Xde.bind(null,n,r);t.has(r)||(t.add(r),r.then(s,s))})}}function Jo(n,e){var t=e.deletions;if(t!==null)for(var r=0;r<t.length;r++){var s=t[r];try{var i=n,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:Gs=o.stateNode,Rl=!1;break e;case 3:Gs=o.stateNode.containerInfo,Rl=!0;break e;case 4:Gs=o.stateNode.containerInfo,Rl=!0;break e}o=o.return}if(Gs===null)throw Error(We(160));D7(i,a,s),Gs=null,Rl=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){Ar(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)O7(e,n),e=e.sibling}function O7(n,e){var t=n.alternate,r=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Jo(e,n),tc(n),r&4){try{uw(3,n,n.return),KN(3,n)}catch(g){Ar(n,n.return,g)}try{uw(5,n,n.return)}catch(g){Ar(n,n.return,g)}}break;case 1:Jo(e,n),tc(n),r&512&&t!==null&&Lv(t,t.return);break;case 5:if(Jo(e,n),tc(n),r&512&&t!==null&&Lv(t,t.return),n.flags&32){var s=n.stateNode;try{Hw(s,"")}catch(g){Ar(n,n.return,g)}}if(r&4&&(s=n.stateNode,s!=null)){var i=n.memoizedProps,a=t!==null?t.memoizedProps:i,o=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&n9(s,i),FD(o,a);var u=FD(o,i);for(a=0;a<l.length;a+=2){var d=l[a],h=l[a+1];d==="style"?o9(s,h):d==="dangerouslySetInnerHTML"?i9(s,h):d==="children"?Hw(s,h):_4(s,d,h,u)}switch(o){case"input":DD(s,i);break;case"textarea":r9(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Zv(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Zv(s,!!i.multiple,i.defaultValue,!0):Zv(s,!!i.multiple,i.multiple?[]:"",!1))}s[Qw]=i}catch(g){Ar(n,n.return,g)}}break;case 6:if(Jo(e,n),tc(n),r&4){if(n.stateNode===null)throw Error(We(162));s=n.stateNode,i=n.memoizedProps;try{s.nodeValue=i}catch(g){Ar(n,n.return,g)}}break;case 3:if(Jo(e,n),tc(n),r&4&&t!==null&&t.memoizedState.isDehydrated)try{Kw(e.containerInfo)}catch(g){Ar(n,n.return,g)}break;case 4:Jo(e,n),tc(n);break;case 13:Jo(e,n),tc(n),s=n.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(tF=Br())),r&4&&m$(n);break;case 22:if(d=t!==null&&t.memoizedState!==null,n.mode&1?(yi=(u=yi)||d,Jo(e,n),yi=u):Jo(e,n),tc(n),r&8192){if(u=n.memoizedState!==null,(n.stateNode.isHidden=u)&&!d&&n.mode&1)for(ft=n,d=n.child;d!==null;){for(h=ft=d;ft!==null;){switch(f=ft,p=f.child,f.tag){case 0:case 11:case 14:case 15:uw(4,f,f.return);break;case 1:Lv(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,t=f.return;try{e=r,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(g){Ar(r,t,g)}}break;case 5:Lv(f,f.return);break;case 22:if(f.memoizedState!==null){v$(h);continue}}p!==null?(p.return=f,ft=p):v$(h)}d=d.sibling}e:for(d=null,h=n;;){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"):(o=h.stateNode,l=h.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=a9("display",a))}catch(g){Ar(n,n.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){Ar(n,n.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Jo(e,n),tc(n),r&4&&m$(n);break;case 21:break;default:Jo(e,n),tc(n)}}function tc(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(P7(t)){var r=t;break e}t=t.return}throw Error(We(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Hw(s,""),r.flags&=-33);var i=p$(n);pO(n,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,o=p$(n);fO(n,o,a);break;default:throw Error(We(161))}}catch(l){Ar(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Ude(n,e,t){ft=n,M7(n)}function M7(n,e,t){for(var r=(n.mode&1)!==0;ft!==null;){var s=ft,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||$E;if(!a){var o=s.alternate,l=o!==null&&o.memoizedState!==null||yi;o=$E;var u=yi;if($E=a,(yi=l)&&!u)for(ft=s;ft!==null;)a=ft,l=a.child,a.tag===22&&a.memoizedState!==null?y$(s):l!==null?(l.return=a,ft=l):y$(s);for(;i!==null;)ft=i,M7(i),i=i.sibling;ft=s,$E=o,yi=u}g$(n)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ft=i):g$(n)}}function g$(n){for(;ft!==null;){var e=ft;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:yi||KN(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!yi)if(t===null)r.componentDidMount();else{var s=e.elementType===e.type?t.memoizedProps:hl(e.type,t.memoizedProps);r.componentDidUpdate(s,t.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&e$(e,i,r);break;case 3:var a=e.updateQueue;if(a!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}e$(e,a,t)}break;case 5:var o=e.stateNode;if(t===null&&e.flags&4){t=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.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&&Kw(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(We(163))}yi||e.flags&512&&hO(e)}catch(f){Ar(e,e.return,f)}}if(e===n){ft=null;break}if(t=e.sibling,t!==null){t.return=e.return,ft=t;break}ft=e.return}}function v$(n){for(;ft!==null;){var e=ft;if(e===n){ft=null;break}var t=e.sibling;if(t!==null){t.return=e.return,ft=t;break}ft=e.return}}function y$(n){for(;ft!==null;){var e=ft;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{KN(4,e)}catch(l){Ar(e,t,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(l){Ar(e,s,l)}}var i=e.return;try{hO(e)}catch(l){Ar(e,i,l)}break;case 5:var a=e.return;try{hO(e)}catch(l){Ar(e,a,l)}}}catch(l){Ar(e,e.return,l)}if(e===n){ft=null;break}var o=e.sibling;if(o!==null){o.return=e.return,ft=o;break}ft=e.return}}var Vde=Math.ceil,v2=_d.ReactCurrentDispatcher,Q4=_d.ReactCurrentOwner,Mo=_d.ReactCurrentBatchConfig,vn=0,Ds=null,Jr=null,ei=0,Ua=0,Fv=Cf(0),xs=0,i1=null,Wm=0,YN=0,eF=0,dw=null,ma=null,tF=0,Ix=1/0,uu=null,y2=!1,mO=null,Xh=null,UE=!1,Bh=null,x2=0,hw=0,gO=null,$k=-1,Uk=0;function qi(){return vn&6?Br():$k!==-1?$k:$k=Br()}function Zh(n){return n.mode&1?vn&2&&ei!==0?ei&-ei:Cde.transition!==null?(Uk===0&&(Uk=x9()),Uk):(n=In,n!==0||(n=window.event,n=n===void 0?16:C9(n.type)),n):1}function Vl(n,e,t,r){if(50<hw)throw hw=0,gO=null,Error(We(185));xS(n,t,r),(!(vn&2)||n!==Ds)&&(n===Ds&&(!(vn&2)&&(YN|=t),xs===4&&Yd(n,ei)),Sa(n,r),t===1&&vn===0&&!(e.mode&1)&&(Ix=Br()+500,WN&&Af()))}function Sa(n,e){var t=n.callbackNode;Cue(n,e);var r=n2(n,n===Ds?ei:0);if(r===0)t!==null&&Az(t),n.callbackNode=null,n.callbackPriority=0;else if(e=r&-r,n.callbackPriority!==e){if(t!=null&&Az(t),e===1)n.tag===0?kde(x$.bind(null,n)):W9(x$.bind(null,n)),wde(function(){!(vn&6)&&Af()}),t=null;else{switch(b9(r)){case 1:t=A4;break;case 4:t=v9;break;case 16:t=t2;break;case 536870912:t=y9;break;default:t=t2}t=V7(t,I7.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function I7(n,e){if($k=-1,Uk=0,vn&6)throw Error(We(327));var t=n.callbackNode;if(ny()&&n.callbackNode!==t)return null;var r=n2(n,n===Ds?ei:0);if(r===0)return null;if(r&30||r&n.expiredLanes||e)e=b2(n,r);else{e=r;var s=vn;vn|=2;var i=F7();(Ds!==n||ei!==e)&&(uu=null,Ix=Br()+500,Pm(n,e));do try{qde();break}catch(o){L7(n,o)}while(!0);z4(),v2.current=i,vn=s,Jr!==null?e=0:(Ds=null,ei=0,e=xs)}if(e!==0){if(e===2&&(s=VD(n),s!==0&&(r=s,e=vO(n,s))),e===1)throw t=i1,Pm(n,0),Yd(n,r),Sa(n,Br()),t;if(e===6)Yd(n,r);else{if(s=n.current.alternate,!(r&30)&&!Hde(s)&&(e=b2(n,r),e===2&&(i=VD(n),i!==0&&(r=i,e=vO(n,i))),e===1))throw t=i1,Pm(n,0),Yd(n,r),Sa(n,Br()),t;switch(n.finishedWork=s,n.finishedLanes=r,e){case 0:case 1:throw Error(We(345));case 2:Qf(n,ma,uu);break;case 3:if(Yd(n,r),(r&130023424)===r&&(e=tF+500-Br(),10<e)){if(n2(n,0)!==0)break;if(s=n.suspendedLanes,(s&r)!==r){qi(),n.pingedLanes|=n.suspendedLanes&s;break}n.timeoutHandle=ZD(Qf.bind(null,n,ma,uu),e);break}Qf(n,ma,uu);break;case 4:if(Yd(n,r),(r&4194240)===r)break;for(e=n.eventTimes,s=-1;0<r;){var a=31-Ul(r);i=1<<a,a=e[a],a>s&&(s=a),r&=~i}if(r=s,r=Br()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Vde(r/1960))-r,10<r){n.timeoutHandle=ZD(Qf.bind(null,n,ma,uu),r);break}Qf(n,ma,uu);break;case 5:Qf(n,ma,uu);break;default:throw Error(We(329))}}}return Sa(n,Br()),n.callbackNode===t?I7.bind(null,n):null}function vO(n,e){var t=dw;return n.current.memoizedState.isDehydrated&&(Pm(n,e).flags|=256),n=b2(n,e),n!==2&&(e=ma,ma=t,e!==null&&yO(e)),n}function yO(n){ma===null?ma=n:ma.push.apply(ma,n)}function Hde(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var r=0;r<t.length;r++){var s=t[r],i=s.getSnapshot;s=s.value;try{if(!Gl(i(),s))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Yd(n,e){for(e&=~eF,e&=~YN,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-Ul(e),r=1<<t;n[t]=-1,e&=~r}}function x$(n){if(vn&6)throw Error(We(327));ny();var e=n2(n,0);if(!(e&1))return Sa(n,Br()),null;var t=b2(n,e);if(n.tag!==0&&t===2){var r=VD(n);r!==0&&(e=r,t=vO(n,r))}if(t===1)throw t=i1,Pm(n,0),Yd(n,e),Sa(n,Br()),t;if(t===6)throw Error(We(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,Qf(n,ma,uu),Sa(n,Br()),null}function nF(n,e){var t=vn;vn|=1;try{return n(e)}finally{vn=t,vn===0&&(Ix=Br()+500,WN&&Af())}}function qm(n){Bh!==null&&Bh.tag===0&&!(vn&6)&&ny();var e=vn;vn|=1;var t=Mo.transition,r=In;try{if(Mo.transition=null,In=1,n)return n()}finally{In=r,Mo.transition=t,vn=e,!(vn&6)&&Af()}}function rF(){Ua=Fv.current,er(Fv)}function Pm(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,bde(t)),Jr!==null)for(t=Jr.return;t!==null;){var r=t;switch(L4(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&o2();break;case 3:Ox(),er(wa),er(Ai),q4();break;case 5:W4(r);break;case 4:Ox();break;case 13:er(ur);break;case 19:er(ur);break;case 10:$4(r.type._context);break;case 22:case 23:rF()}t=t.return}if(Ds=n,Jr=n=Jh(n.current,null),ei=Ua=e,xs=0,i1=null,eF=YN=Wm=0,ma=dw=null,mp!==null){for(e=0;e<mp.length;e++)if(t=mp[e],r=t.interleaved,r!==null){t.interleaved=null;var s=r.next,i=t.pending;if(i!==null){var a=i.next;i.next=s,r.next=a}t.pending=r}mp=null}return n}function L7(n,e){do{var t=Jr;try{if(z4(),Fk.current=g2,m2){for(var r=mr.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}m2=!1}if(Hm=0,js=gs=mr=null,cw=!1,n1=0,Q4.current=null,t===null||t.return===null){xs=1,i1=e,Jr=null;break}e:{var i=n,a=t.return,o=t,l=e;if(e=ei,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=o,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=a$(a);if(p!==null){p.flags&=-257,o$(p,a,o,i,e),p.mode&1&&i$(i,u,e),e=p,l=u;var m=e.updateQueue;if(m===null){var g=new Set;g.add(l),e.updateQueue=g}else m.add(l);break e}else{if(!(e&1)){i$(i,u,e),sF();break e}l=Error(We(426))}}else if(rr&&o.mode&1){var y=a$(a);if(y!==null){!(y.flags&65536)&&(y.flags|=256),o$(y,a,o,i,e),F4(Mx(l,o));break e}}i=l=Mx(l,o),xs!==4&&(xs=2),dw===null?dw=[i]:dw.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var v=b7(i,l,e);Qz(i,v);break e;case 1:o=l;var x=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Xh===null||!Xh.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var E=w7(i,o,e);Qz(i,E);break e}}i=i.return}while(i!==null)}z7(t)}catch(S){e=S,Jr===t&&t!==null&&(Jr=t=t.return);continue}break}while(!0)}function F7(){var n=v2.current;return v2.current=g2,n===null?g2:n}function sF(){(xs===0||xs===3||xs===2)&&(xs=4),Ds===null||!(Wm&268435455)&&!(YN&268435455)||Yd(Ds,ei)}function b2(n,e){var t=vn;vn|=2;var r=F7();(Ds!==n||ei!==e)&&(uu=null,Pm(n,e));do try{Wde();break}catch(s){L7(n,s)}while(!0);if(z4(),vn=t,v2.current=r,Jr!==null)throw Error(We(261));return Ds=null,ei=0,xs}function Wde(){for(;Jr!==null;)B7(Jr)}function qde(){for(;Jr!==null&&!vue();)B7(Jr)}function B7(n){var e=U7(n.alternate,n,Ua);n.memoizedProps=n.pendingProps,e===null?z7(n):Jr=e,Q4.current=null}function z7(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Bde(t,e),t!==null){t.flags&=32767,Jr=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{xs=6,Jr=null;return}}else if(t=Fde(t,e,Ua),t!==null){Jr=t;return}if(e=e.sibling,e!==null){Jr=e;return}Jr=e=n}while(e!==null);xs===0&&(xs=5)}function Qf(n,e,t){var r=In,s=Mo.transition;try{Mo.transition=null,In=1,Gde(n,e,t,r)}finally{Mo.transition=s,In=r}return null}function Gde(n,e,t,r){do ny();while(Bh!==null);if(vn&6)throw Error(We(327));t=n.finishedWork;var s=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(We(177));n.callbackNode=null,n.callbackPriority=0;var i=t.lanes|t.childLanes;if(Aue(n,i),n===Ds&&(Jr=Ds=null,ei=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||UE||(UE=!0,V7(t2,function(){return ny(),null})),i=(t.flags&15990)!==0,t.subtreeFlags&15990||i){i=Mo.transition,Mo.transition=null;var a=In;In=1;var o=vn;vn|=4,Q4.current=null,$de(n,t),O7(t,n),fde(YD),r2=!!KD,YD=KD=null,n.current=t,Ude(t),yue(),vn=o,In=a,Mo.transition=i}else n.current=t;if(UE&&(UE=!1,Bh=n,x2=s),i=n.pendingLanes,i===0&&(Xh=null),wue(t.stateNode),Sa(n,Br()),e!==null)for(r=n.onRecoverableError,t=0;t<e.length;t++)s=e[t],r(s.value,{componentStack:s.stack,digest:s.digest});if(y2)throw y2=!1,n=mO,mO=null,n;return x2&1&&n.tag!==0&&ny(),i=n.pendingLanes,i&1?n===gO?hw++:(hw=0,gO=n):hw=0,Af(),null}function ny(){if(Bh!==null){var n=b9(x2),e=Mo.transition,t=In;try{if(Mo.transition=null,In=16>n?16:n,Bh===null)var r=!1;else{if(n=Bh,Bh=null,x2=0,vn&6)throw Error(We(331));var s=vn;for(vn|=4,ft=n.current;ft!==null;){var i=ft,a=i.child;if(ft.flags&16){var o=i.deletions;if(o!==null){for(var l=0;l<o.length;l++){var u=o[l];for(ft=u;ft!==null;){var d=ft;switch(d.tag){case 0:case 11:case 15:uw(8,d,i)}var h=d.child;if(h!==null)h.return=d,ft=h;else for(;ft!==null;){d=ft;var f=d.sibling,p=d.return;if(R7(d),d===u){ft=null;break}if(f!==null){f.return=p,ft=f;break}ft=p}}}var m=i.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var y=g.sibling;g.sibling=null,g=y}while(g!==null)}}ft=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,ft=a;else e:for(;ft!==null;){if(i=ft,i.flags&2048)switch(i.tag){case 0:case 11:case 15:uw(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,ft=v;break e}ft=i.return}}var x=n.current;for(ft=x;ft!==null;){a=ft;var b=a.child;if(a.subtreeFlags&2064&&b!==null)b.return=a,ft=b;else e:for(a=x;ft!==null;){if(o=ft,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:KN(9,o)}}catch(S){Ar(o,o.return,S)}if(o===a){ft=null;break e}var E=o.sibling;if(E!==null){E.return=o.return,ft=E;break e}ft=o.return}}if(vn=s,Af(),Lc&&typeof Lc.onPostCommitFiberRoot=="function")try{Lc.onPostCommitFiberRoot(zN,n)}catch{}r=!0}return r}finally{In=t,Mo.transition=e}}return!1}function b$(n,e,t){e=Mx(t,e),e=b7(n,e,1),n=Yh(n,e,1),e=qi(),n!==null&&(xS(n,1,e),Sa(n,e))}function Ar(n,e,t){if(n.tag===3)b$(n,n,t);else for(;e!==null;){if(e.tag===3){b$(e,n,t);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Xh===null||!Xh.has(r))){n=Mx(t,n),n=w7(e,n,1),e=Yh(e,n,1),n=qi(),e!==null&&(xS(e,1,n),Sa(e,n));break}}e=e.return}}function Kde(n,e,t){var r=n.pingCache;r!==null&&r.delete(e),e=qi(),n.pingedLanes|=n.suspendedLanes&t,Ds===n&&(ei&t)===t&&(xs===4||xs===3&&(ei&130023424)===ei&&500>Br()-tF?Pm(n,0):eF|=t),Sa(n,e)}function $7(n,e){e===0&&(n.mode&1?(e=PE,PE<<=1,!(PE&130023424)&&(PE=4194304)):e=1);var t=qi();n=od(n,e),n!==null&&(xS(n,e,t),Sa(n,t))}function Yde(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),$7(n,t)}function Xde(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,s=n.memoizedState;s!==null&&(t=s.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(We(314))}r!==null&&r.delete(e),$7(n,t)}var U7;U7=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||wa.current)ya=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return ya=!1,Lde(n,e,t);ya=!!(n.flags&131072)}else ya=!1,rr&&e.flags&1048576&&q9(e,u2,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;zk(n,e),n=e.pendingProps;var s=Rx(e,Ai.current);ty(e,t),s=K4(null,e,r,n,s,t);var i=Y4();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,_a(r)?(i=!0,l2(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,V4(e),s.updater=GN,e.stateNode=s,s._reactInternals=e,sO(e,r,n,t),e=oO(null,e,r,!0,i,t)):(e.tag=0,rr&&i&&I4(e),Mi(null,e,s,t),e=e.child),e;case 16:r=e.elementType;e:{switch(zk(n,e),n=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=Jde(r),n=hl(r,n),s){case 0:e=aO(null,e,r,n,t);break e;case 1:e=u$(null,e,r,n,t);break e;case 11:e=l$(null,e,r,n,t);break e;case 14:e=c$(null,e,r,hl(r.type,n),t);break e}throw Error(We(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:hl(r,s),aO(n,e,r,s,t);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:hl(r,s),u$(n,e,r,s,t);case 3:e:{if(k7(e),n===null)throw Error(We(387));r=e.pendingProps,i=e.memoizedState,s=i.element,J9(n,e),f2(e,r,null,t);var a=e.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Mx(Error(We(423)),e),e=d$(n,e,r,t,s
vendor: 6,564 bytes, line 40
40);break e}else if(r!==s){s=Mx(Error(We(424)),e),e=d$(n,e,r,t,s);break e}else for(Xa=Kh(e.stateNode.containerInfo.firstChild),Za=e,rr=!0,Ol=null,t=X9(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Px(),r===s){e=ld(n,e,t);break e}Mi(n,e,r,t)}e=e.child}return e;case 5:return Q9(e),n===null&&tO(e),r=e.type,s=e.pendingProps,i=n!==null?n.memoizedProps:null,a=s.children,XD(r,s)?a=null:i!==null&&XD(r,i)&&(e.flags|=32),E7(n,e),Mi(n,e,a,t),e.child;case 6:return n===null&&tO(e),null;case 13:return C7(n,e,t);case 4:return H4(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Dx(e,null,r,t):Mi(n,e,r,t),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:hl(r,s),l$(n,e,r,s,t);case 7:return Mi(n,e,e.pendingProps,t),e.child;case 8:return Mi(n,e,e.pendingProps.children,t),e.child;case 12:return Mi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,a=s.value,Kn(d2,r._currentValue),r._currentValue=a,i!==null)if(Gl(i.value,a)){if(i.children===s.children&&!wa.current){e=ld(n,e,t);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Ju(-1,t&-t),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=t,l=i.alternate,l!==null&&(l.lanes|=t),nO(i.return,t,e),o.lanes|=t;break}l=l.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(We(341));a.lanes|=t,o=a.alternate,o!==null&&(o.lanes|=t),nO(a,t,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Mi(n,e,s.children,t),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,ty(e,t),s=Uo(s),r=r(s),e.flags|=1,Mi(n,e,r,t),e.child;case 14:return r=e.type,s=hl(r,e.pendingProps),s=hl(r.type,s),c$(n,e,r,s,t);case 15:return _7(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:hl(r,s),zk(n,e),e.tag=1,_a(r)?(n=!0,l2(e)):n=!1,ty(e,t),x7(e,r,s),sO(e,r,s,t),oO(null,e,r,!0,n,t);case 19:return A7(n,e,t);case 22:return S7(n,e,t)}throw Error(We(156,e.tag))};function V7(n,e){return g9(n,e)}function Zde(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ro(n,e,t,r){return new Zde(n,e,t,r)}function iF(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Jde(n){if(typeof n=="function")return iF(n)?1:0;if(n!=null){if(n=n.$$typeof,n===E4)return 11;if(n===k4)return 14}return 2}function Jh(n,e){var t=n.alternate;return t===null?(t=Ro(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Vk(n,e,t,r,s,i){var a=2;if(r=n,typeof n=="function")iF(n)&&(a=1);else if(typeof n=="string")a=5;else e:switch(n){case Nv:return Dm(t.children,s,i,e);case S4:a=8,s|=8;break;case ND:return n=Ro(12,t,e,s|2),n.elementType=ND,n.lanes=i,n;case TD:return n=Ro(13,t,e,s),n.elementType=TD,n.lanes=i,n;case jD:return n=Ro(19,t,e,s),n.elementType=jD,n.lanes=i,n;case Qq:return XN(t,s,i,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Zq:a=10;break e;case Jq:a=9;break e;case E4:a=11;break e;case k4:a=14;break e;case $d:a=16,r=null;break e}throw Error(We(130,n==null?n:typeof n,""))}return e=Ro(a,t,e,s),e.elementType=n,e.type=r,e.lanes=i,e}function Dm(n,e,t,r){return n=Ro(7,n,r,e),n.lanes=t,n}function XN(n,e,t,r){return n=Ro(22,n,r,e),n.elementType=Qq,n.lanes=t,n.stateNode={isHidden:!1},n}function xR(n,e,t){return n=Ro(6,n,null,e),n.lanes=t,n}function bR(n,e,t){return e=Ro(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function Qde(n,e,t,r,s){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=eR(0),this.expirationTimes=eR(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eR(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function aF(n,e,t,r,s,i,a,o,l){return n=new Qde(n,e,t,o,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Ro(3,null,null,e),n.current=i,i.stateNode=n,i.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},V4(i),n}function ehe(n,e,t){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Av,key:r==null?null:""+r,children:n,containerInfo:e,implementation:t}}function H7(n){if(!n)return uf;n=n._reactInternals;e:{if(bg(n)!==n||n.tag!==1)throw Error(We(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(_a(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(We(171))}if(n.tag===1){var t=n.type;if(_a(t))return H9(n,t,e)}return e}function W7(n,e,t,r,s,i,a,o,l){return n=aF(t,r,!0,n,s,i,a,o,l),n.context=H7(null),t=n.current,r=qi(),s=Zh(t),i=Ju(r,s),i.callback=e??null,Yh(t,i,s),n.current.lanes=s,xS(n,s,r),Sa(n,r),n}function ZN(n,e,t,r){var s=e.current,i=qi(),a=Zh(s);return t=H7(t),e.context===null?e.context=t:e.pendingContext=t,e=Ju(i,a),e.payload={element:n},r=r===void 0?null:r,r!==null&&(e.callback=r),n=Yh(s,e,a),n!==null&&(Vl(n,s,a,i),Lk(n,s,a)),a}function w2(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function w$(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}
vendor: 6,076 bytes, line 40
40function oF(n,e){w$(n,e),(n=n.alternate)&&w$(n,e)}function the(){return null}var q7=typeof reportError=="function"?reportError:function(n){console.error(n)};function lF(n){this._internalRoot=n}JN.prototype.render=lF.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(We(409));ZN(n,e,null,null)};JN.prototype.unmount=lF.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;qm(function(){ZN(null,n,null,null)}),e[ad]=null}};function JN(n){this._internalRoot=n}JN.prototype.unstable_scheduleHydration=function(n){if(n){var e=S9();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Kd.length&&e!==0&&e<Kd[t].priority;t++);Kd.splice(t,0,n),t===0&&k9(n)}};function cF(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function QN(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function _$(){}function nhe(n,e,t,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=w2(a);i.call(u)}}var a=W7(e,r,n,0,null,!1,!1,"",_$);return n._reactRootContainer=a,n[ad]=a.current,Zw(n.nodeType===8?n.parentNode:n),qm(),a}for(;s=n.lastChild;)n.removeChild(s);if(typeof r=="function"){var o=r;r=function(){var u=w2(l);o.call(u)}}var l=aF(n,0,!1,null,null,!1,!1,"",_$);return n._reactRootContainer=l,n[ad]=l.current,Zw(n.nodeType===8?n.parentNode:n),qm(function(){ZN(e,l,t,r)}),l}function eT(n,e,t,r,s){var i=t._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var o=s;s=function(){var l=w2(a);o.call(l)}}ZN(e,a,n,s)}else a=nhe(t,e,n,s,r);return w2(a)}w9=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=_b(e.pendingLanes);t!==0&&(N4(e,t|1),Sa(e,Br()),!(vn&6)&&(Ix=Br()+500,Af()))}break;case 13:qm(function(){var r=od(n,1);if(r!==null){var s=qi();Vl(r,n,1,s)}}),oF(n,1)}};T4=function(n){if(n.tag===13){var e=od(n,134217728);if(e!==null){var t=qi();Vl(e,n,134217728,t)}oF(n,134217728)}};_9=function(n){if(n.tag===13){var e=Zh(n),t=od(n,e);if(t!==null){var r=qi();Vl(t,n,e,r)}oF(n,e)}};S9=function(){return In};E9=function(n,e){var t=In;try{return In=n,e()}finally{In=t}};zD=function(n,e,t){switch(e){case"input":if(DD(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var r=t[e];if(r!==n&&r.form===n.form){var s=HN(r);if(!s)throw Error(We(90));t9(r),DD(r,s)}}}break;case"textarea":r9(n,t);break;case"select":e=t.value,e!=null&&Zv(n,!!t.multiple,e,!1)}};u9=nF;d9=qm;var rhe={usingClientEntryPoint:!1,Events:[wS,Pv,HN,l9,c9,nF]},Z0={findFiberByHostInstance:pp,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},she={bundleType:Z0.bundleType,version:Z0.version,rendererPackageName:Z0.rendererPackageName,rendererConfig:Z0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_d.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=p9(n),n===null?null:n.stateNode},findFiberByHostInstance:Z0.findFiberByHostInstance||the,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 VE=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!VE.isDisabled&&VE.supportsFiber)try{zN=VE.inject(she),Lc=VE}catch{}}so.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rhe;so.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cF(e))throw Error(We(200));return ehe(n,e,null,t)};so.createRoot=function(n,e){if(!cF(n))throw Error(We(299));var t=!1,r="",s=q7;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=aF(n,1,!1,null,null,t,!1,r,s),n[ad]=e.current,Zw(n.nodeType===8?n.parentNode:n),new lF(e)};so.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(We(188)):(n=Object.keys(n).join(","),Error(We(268,n)));return n=p9(e),n=n===null?null:n.stateNode,n};so.flushSync=function(n){return qm(n)};so.hydrate=function(n,e,t){if(!QN(e))throw Error(We(200));return eT(null,n,e,!0,t)};so.hydrateRoot=function(n,e,t){if(!cF(n))throw Error(We(405));var r=t!=null&&t.hydratedSources||null,s=!1,i="",a=q7;if(t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),e=W7(e,null,n,1,t??null,s,!1,i,a),n[ad]=e.current,Zw(n),r)for(n=0;n<r.length;n++)t=r[n],s=t._getVersion,s=s(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,s]:e.mutableSourceEagerHydrationData.push(t,s);return new JN(e)};so.render=function(n,e,t){if(!QN(e))throw Error(We(200));return eT(null,n,e,!1,t)};so.unmountComponentAtNode=function(n){if(!QN(n))throw Error(We(40));return n._reactRootContainer?(qm(function(){eT(null,null,n,!1,function(){n._reactRootContainer=null,n[ad]=null})}),!0):!1};so.unstable_batchedUpdates=nF;so.unstable_renderSubtreeIntoContainer=function(n,e,t,r){if(!QN(t))throw Error(We(200));if(n==null||n._reactInternals===void 0)throw Error(We(38));return eT(n,e,t,!1,r)};so.version="18.3.1-next-f1338f8080-20240426";function G7(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(G7)}catch(n){console.error(n)}}G7(),Gq.exports=so;var wg=Gq.exports;const uF=ro(wg);var K7,S$=wg;K7=S$.createRoot,S$.hydrateRoot;var ihe=typeof Element<"u",ahe=typeof Map=="function",ohe=typeof Set=="function",lhe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Hk(n,e){if(n===e)return!0;
40if(n&&e&&typeof n=="object"&&typeof e=="object"){if(n.constructor!==e.constructor)return!1;var t,r,s;if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!Hk(n[r],e[r]))return!1;return!0}var i;if(ahe&&n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(i=n.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;for(i=n.entries();!(r=i.next()).done;)if(!Hk(r.value[1],e.get(r.value[0])))return!1;return!0}if(ohe&&n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(i=n.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(lhe&&ArrayBuffer.isView(n)&&ArrayBuffer.isView(e)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(n[r]!==e[r])return!1;return!0}if(n.constructor===RegExp)return n.source===e.source&&n.flags===e.flags;if(n.valueOf!==Object.prototype.valueOf&&typeof n.valueOf=="function"&&typeof e.valueOf=="function")return n.valueOf()===e.valueOf();if(n.toString!==Object.prototype.toString&&typeof n.toString=="function"&&typeof e.toString=="function")return n.toString()===e.toString();if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;if(ihe&&n instanceof Element)return!1;for(r=t;r--!==0;)if(!((s[r]==="_owner"||s[r]==="__v"||s[r]==="__o")&&n.$$typeof)&&!Hk(n[s[r]],e[s[r]]))return!1;return!0}return n!==n&&e!==e}var che=function(e,t){try{return Hk(e,t)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const uhe=ro(che);var dhe=function(n,e,t,r,s,i,a,o){if(!n){var l;if(e===void 0)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[t,r,s,i,a,o],d=0;l=new Error(e.replace(/%s/g,function(){return u[d++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}},hhe=dhe;const E$=ro(hhe);var fhe=function(e,t,r,s){var i=r?r.call(s,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),u=0;u<a.length;u++){var d=a[u];if(!l(d))return!1;var h=e[d],f=t[d];if(i=r?r.call(s,h,f,d):void 0,i===!1||i===void 0&&h!==f)return!1}return!0};const phe=ro(fhe);var Y7=(n=>(n.BASE="base",n.BODY="body",n.HEAD="head",n.HTML="html",n.LINK="link",n.META="meta",n.NOSCRIPT="noscript",n.SCRIPT="script",n.STYLE="style",n.TITLE="title",n.FRAGMENT="Symbol(react.fragment)",n))(Y7||{}),wR={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"]}},k$=Object.values(Y7),dF={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},mhe=Object.entries(dF).reduce((n,[e,t])=>(n[t]=e,n),{}),Bl="data-rh",ry={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},sy=(n,e)=>{for(let t=n.length-1;t>=0;t-=1){const r=n[t];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},ghe=n=>{let e=sy(n,"title");const t=sy(n,ry.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),t&&e)return t.replace(/%s/g,()=>e);const r=sy(n,ry.DEFAULT_TITLE);return e||r||void 0},vhe=n=>sy(n,ry.ON_CHANGE_CLIENT_STATE)||(()=>{}),_R=(n,e)=>e.filter(t=>typeof t[n]<"u").map(t=>t[n]).reduce((t,r)=>({...t,...r}),{}),yhe=(n,e)=>e.filter(t=>typeof t.base<"u").map(t=>t.base).reverse().reduce((t,r)=>{if(!t.length){const s=Object.keys(r);for(let i=0;i<s.length;i+=1){const o=s[i].toLowerCase();if(n.indexOf(o)!==-1&&r[o])return t.concat(r)}}return t},[]),xhe=n=>console&&typeof console.warn=="function"&&console.warn(n),J0=(n,e,t)=>{const r={};return t.filter(s=>Array.isArray(s[n])?!0:(typeof s[n]<"u"&&xhe(`Helmet: ${n} should be of type "Array". Instead found type "${typeof s[n]}"`),!1)).map(s=>s[n]).reverse().reduce((s,i)=>{const a={};i.filter(l=>{let u;const d=Object.keys(l);for(let f=0;f<d.length;f+=1){const p=d[f],m=p.toLowerCase();e.indexOf(m)!==-1&&!(u==="rel"&&l[u].toLowerCase()==="canonical")&&!(m==="rel"&&l[m].toLowerCase()==="stylesheet")&&(u=m),e.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(u=p)}if(!u||!l[u])return!1;const h=l[u].toLowerCase();return r[u]||(r[u]={}),a[u]||(a[u]={}),r[u][h]?!1:(a[u][h]=!0,!0)}
40).reverse().forEach(l=>s.push(l));const o=Object.keys(a);for(let l=0;l<o.length;l+=1){const u=o[l],d={...r[u],...a[u]};r[u]=d}return s},[]).reverse()},bhe=(n,e)=>{if(Array.isArray(n)&&n.length){for(let t=0;t<n.length;t+=1)if(n[t][e])return!0}return!1},whe=n=>({baseTag:yhe(["href"],n),bodyAttributes:_R("bodyAttributes",n),defer:sy(n,ry.DEFER),encode:sy(n,ry.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:_R("htmlAttributes",n),linkTags:J0("link",["rel","href"],n),metaTags:J0("meta",["name","charset","http-equiv","property","itemprop"],n),noscriptTags:J0("noscript",["innerHTML"],n),onChangeClientState:vhe(n),scriptTags:J0("script",["src","innerHTML"],n),styleTags:J0("style",["cssText"],n),title:ghe(n),titleAttributes:_R("titleAttributes",n),prioritizeSeoTags:bhe(n,ry.PRIORITIZE_SEO_TAGS)}),X7=n=>Array.isArray(n)?n.join(""):n,_he=(n,e)=>{const t=Object.keys(n);for(let r=0;r<t.length;r+=1)if(e[t[r]]&&e[t[r]].includes(n[t[r]]))return!0;return!1},SR=(n,e)=>Array.isArray(n)?n.reduce((t,r)=>(_he(r,e)?t.priority.push(r):t.default.push(r),t),{priority:[],default:[]}):{default:n,priority:[]},C$=(n,e)=>({...n,[e]:void 0}),She=["noscript","script","style"],xO=(n,e=!0)=>e===!1?String(n):String(n).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),Z7=n=>Object.keys(n).reduce((e,t)=>{const r=typeof n[t]<"u"?`${t}="${n[t]}"`:`${t}`;return e?`${e} ${r}`:r},""),Ehe=(n,e,t,r)=>{const s=Z7(t),i=X7(e);return s?`<${n} ${Bl}="true" ${s}>${xO(i,r)}</${n}>`:`<${n} ${Bl}="true">${xO(i,r)}</${n}>`},khe=(n,e,t=!0)=>e.reduce((r,s)=>{const i=s,a=Object.keys(i).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const h=typeof i[d]>"u"?d:`${d}="${xO(i[d],t)}"`;return u?`${u} ${h}`:h},""),o=i.innerHTML||i.cssText||"",l=She.indexOf(n)===-1;return`${r}<${n} ${Bl}="true" ${a}${l?"/>":`>${o}</${n}>`}`},""),J7=(n,e={})=>Object.keys(n).reduce((t,r)=>{const s=dF[r];return t[s||r]=n[r],t},e),Che=(n,e,t)=>{const r={key:e,[Bl]:!0},s=J7(t,r);return[Oe.createElement("title",s,e)]},Wk=(n,e)=>e.map((t,r)=>{const s={key:r,[Bl]:!0};return Object.keys(t).forEach(i=>{const o=dF[i]||i;if(o==="innerHTML"||o==="cssText"){const l=t.innerHTML||t.cssText;s.dangerouslySetInnerHTML={__html:l}}else s[o]=t[i]}),Oe.createElement(n,s)}),go=(n,e,t=!0)=>{switch(n){case"title":return{toComponent:()=>Che(n,e.title,e.titleAttributes),toString:()=>Ehe(n,e.title,e.titleAttributes,t)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>J7(e),toString:()=>Z7(e)};default:return{toComponent:()=>Wk(n,e),toString:()=>khe(n,e,t)}}},Ahe=({metaTags:n,linkTags:e,scriptTags:t,encode:r})=>{const s=SR(n,wR.meta),i=SR(e,wR.link),a=SR(t,wR.script);return{priorityMethods:{toComponent:()=>[...Wk("meta",s.priority),...Wk("link",i.priority),...Wk("script",a.priority)],toString:()=>`${go("meta",s.priority,r)} ${go("link",i.priority,r)} ${go("script",a.priority,r)}`},metaTags:s.default,linkTags:i.default,scriptTags:a.default}},Nhe=n=>{const{baseTag:e,bodyAttributes:t,encode:r=!0,htmlAttributes:s,noscriptTags:i,styleTags:a,title:o="",titleAttributes:l,prioritizeSeoTags:u}=n;let{linkTags:d,metaTags:h,scriptTags:f}=n,p={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:p,linkTags:d,metaTags:h,scriptTags:f}=Ahe(n)),{priority:p,base:go("base",e,r),bodyAttributes:go("bodyAttributes",t,r),htmlAttributes:go("htmlAttributes",s,r),link:go("link",d,r),meta:go("meta",h,r),noscript:go("noscript",i,r),script:go("script",f,r),style:go("style",a,r),title:go("title",{title:o,titleAttributes:l},r)}},bO=Nhe,HE=[],Q7=!!(typeof window<"u"&&window.document&&window.document.createElement),wO=class{constructor(n,e){Nt(this,"instances",[]);Nt(this,"canUseDOM",Q7);Nt(this,"context");Nt(this,"value",{setHelmet:n=>{this.context.helmet=n},helmetInstances:{get:()=>this.canUseDOM?HE:this.instances,add:n=>{(this.canUseDOM?HE:this.instances).push(n)},remove:n=>{const e=(this.canUseDOM?HE:this.instances).indexOf(n);(this.canUseDOM?HE:this.instances).splice(e,1)}}});this.context=n,this.canUseDOM=e||!1,e||(n.helmet=bO({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},The={},eG=Oe.createContext(The),Cp,tG=(Cp=class extends _.Component{constructor(t){super(t);Nt(this,"helmetData");this.helmetData=new wO(this.props.context||{},Cp.canUseDOM)}render(){return Oe.createElement(eG.Provider,{value:this.helmetData.value},this.props.children)}},Nt(Cp,"canUseDOM",Q7),Cp),$g=(n,e)=>{const t=document.head||document.querySelector("head"),r=t.querySelectorAll(`${n}[${Bl}]`),s=[].slice.call(r),i=[];let a;return e&&e.length&&e.forEach(o=>{const l=document.createElement(n);for(const u in o)if(Object.prototype.hasOwnProperty.call(o,u))if(u==="innerHTML")l.innerHTML=o.innerHTML;else if(u==="cssText")l.styleSheet?l.styleSheet.cssText=o.cssText:l.appendChild(document.createTextNode(o.cssText));else{const d=u,h=typeof o[d]>"u"?"":o[d];l.setAttribute(u,h)}l.setAttribute(Bl,"true"),s.some((u,d)=>(a=d,l.isEqualNode(u)))?s.splice(a,1):i.push(l)}
40),s.forEach(o=>{var l;return(l=o.parentNode)==null?void 0:l.removeChild(o)}),i.forEach(o=>t.appendChild(o)),{oldTags:s,newTags:i}},_O=(n,e)=>{const t=document.getElementsByTagName(n)[0];if(!t)return;const r=t.getAttribute(Bl),s=r?r.split(","):[],i=[...s],a=Object.keys(e);for(const o of a){const l=e[o]||"";t.getAttribute(o)!==l&&t.setAttribute(o,l),s.indexOf(o)===-1&&s.push(o);const u=i.indexOf(o);u!==-1&&i.splice(u,1)}for(let o=i.length-1;o>=0;o-=1)t.removeAttribute(i[o]);s.length===i.length?t.removeAttribute(Bl):t.getAttribute(Bl)!==a.join(",")&&t.setAttribute(Bl,a.join(","))},jhe=(n,e)=>{typeof n<"u"&&document.title!==n&&(document.title=X7(n)),_O("title",e)},A$=(n,e)=>{const{baseTag:t,bodyAttributes:r,htmlAttributes:s,linkTags:i,metaTags:a,noscriptTags:o,onChangeClientState:l,scriptTags:u,styleTags:d,title:h,titleAttributes:f}=n;_O("body",r),_O("html",s),jhe(h,f);const p={baseTag:$g("base",t),linkTags:$g("link",i),metaTags:$g("meta",a),noscriptTags:$g("noscript",o),scriptTags:$g("script",u),styleTags:$g("style",d)},m={},g={};Object.keys(p).forEach(y=>{const{newTags:v,oldTags:x}=p[y];v.length&&(m[y]=v),x.length&&(g[y]=p[y].oldTags)}),e&&e(),l(n,m,g)},Q0=null,Rhe=n=>{Q0&&cancelAnimationFrame(Q0),n.defer?Q0=requestAnimationFrame(()=>{A$(n,()=>{Q0=null})}):(A$(n),Q0=null)},Phe=Rhe,N$=class extends _.Component{constructor(){super(...arguments);Nt(this,"rendered",!1)}shouldComponentUpdate(e){return!phe(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:t}=this.props.context;let r=null;const s=whe(e.get().map(i=>{const a={...i.props};return delete a.context,a}));tG.canUseDOM?Phe(s):bO&&(r=bO(s)),t(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},CD,Dhe=(CD=class extends _.Component{shouldComponentUpdate(n){return!uhe(C$(this.props,"helmetData"),C$(n,"helmetData"))}mapNestedChildrenToProps(n,e){if(!e)return null;switch(n.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${n.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(n,e,t,r){return{...e,[n.type]:[...e[n.type]||[],{...t,...this.mapNestedChildrenToProps(n,r)}]}}mapObjectTypeChildren(n,e,t,r){switch(n.type){case"title":return{...e,[n.type]:r,titleAttributes:{...t}};case"body":return{...e,bodyAttributes:{...t}};case"html":return{...e,htmlAttributes:{...t}};default:return{...e,[n.type]:{...t}}}}mapArrayTypeChildrenToProps(n,e){let t={...e};return Object.keys(n).forEach(r=>{t={...t,[r]:n[r]}}),t}warnOnInvalidChildren(n,e){return E$(k$.some(t=>n.type===t),typeof n.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 ${k$.join(", ")} are allowed. Helmet does not support rendering <${n.type}> elements. Refer to our API for more information.`),E$(!e||typeof e=="string"||Array.isArray(e)&&!e.some(t=>typeof t!="string"),`Helmet expects a string as a child of <${n.type}>. Did you forget to wrap your children in braces? ( <${n.type}>{\`\`}</${n.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(n,e){let t={};return Oe.Children.forEach(n,r=>{if(!r||!r.props)return;const{children:s,...i}=r.props,a=Object.keys(i).reduce((l,u)=>(l[mhe[u]||u]=i[u],l),{});let{type:o}=r;
40switch(typeof o=="symbol"?o=o.toString():this.warnOnInvalidChildren(r,s),o){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":t=this.flattenArrayTypeChildren(r,t,a,s);break;default:e=this.mapObjectTypeChildren(r,e,a,s);break}}),this.mapArrayTypeChildrenToProps(t,e)}render(){const{children:n,...e}=this.props;let t={...e},{helmetData:r}=e;if(n&&(t=this.mapChildrenToProps(n,t)),r&&!(r instanceof wO)){const s=r;r=new wO(s.context,!0),delete t.helmetData}return r?Oe.createElement(N$,{...t,context:r.value}):Oe.createElement(eG.Consumer,null,s=>Oe.createElement(N$,{...t,context:s}))}},Nt(CD,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),CD);const Ohe=1,Mhe=1e6;let ER=0;function Ihe(){return ER=(ER+1)%Number.MAX_SAFE_INTEGER,ER.toString()}const kR=new Map,T$=n=>{if(kR.has(n))return;const e=setTimeout(()=>{kR.delete(n),fw({type:"REMOVE_TOAST",toastId:n})},Mhe);kR.set(n,e)},Lhe=(n,e)=>{switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,Ohe)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?T$(t):n.toasts.forEach(r=>{T$(r.id)}),{...n,toasts:n.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}},qk=[];let Gk={toasts:[]};function fw(n){Gk=Lhe(Gk,n),qk.forEach(e=>{e(Gk)})}function Qr({...n}){const e=Ihe(),t=s=>fw({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>fw({type:"DISMISS_TOAST",toastId:e});return fw({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:t}}function Jl(){const[n,e]=_.useState(Gk);return _.useEffect(()=>(qk.push(e),()=>{const t=qk.indexOf(e);t>-1&&qk.splice(t,1)}),[n]),{...n,toast:Qr,dismiss:t=>fw({type:"DISMISS_TOAST",toastId:t})}}function $e(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n==null||n(s),t===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function j$(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function tT(...n){return e=>{let t=!1;const r=n.map(s=>{const i=j$(s,e);return!t&&typeof i=="function"&&(t=!0),i});if(t)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():j$(n[s],null)}}}}function Ct(...n){return _.useCallback(tT(...n),n)}function Fhe(n,e){const t=_.createContext(e),r=i=>{const{children:a,...o}=i,l=_.useMemo(()=>o,Object.values(o));return c.jsx(t.Provider,{value:l,children:a})};r.displayName=n+"Provider";function s(i){const a=_.useContext(t);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${n}\``)}return[r,s]}function Hr(n,e=[]){let t=[];function r(i,a){const o=_.createContext(a),l=t.length;t=[...t,a];const u=h=>{var v;const{scope:f,children:p,...m}=h,g=((v=f==null?void 0:f[n])==null?void 0:v[l])||o,y=_.useMemo(()=>m,Object.values(m));return c.jsx(g.Provider,{value:y,children:p})};u.displayName=i+"Provider";function d(h,f){var g;const p=((g=f==null?void 0:f[n])==null?void 0:g[l])||o,m=_.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=t.map(a=>_.createContext(a));return function(o){const l=(o==null?void 0:o[n])||i;return _.useMemo(()=>({[`__scope${n}`]:{...o,[n]:l}}),[o,l])}};return s.scopeName=n,[r,Bhe(s,...e)]}function Bhe(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((o,{useScope:l,scopeName:u})=>{const h=l(i)[`__scope${u}`];return{...o,...h}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return t.scopeName=e.scopeName,t}function df(n){const e=zhe(n),t=_.forwardRef((r,s)=>{const{children:i,...a}=r,o=_.Children.toArray(i),l=o.find($he);if(l){const u=l.props.children,d=o.map(h=>h===l?_.Children.count(u)>1?_.Children.only(null):_.isValidElement(u)?u.props.children:null:h);return c.jsx(e,{...a,ref:s,children:_.isValidElement(u)?_.cloneElement(u,void 0,d):null})}return c.jsx(e,{...a,ref:s,children:i})});return t.displayName=`${n}.Slot`,t}var Nf=df("Slot");function zhe(n){const e=_.forwardRef((t,r)=>{const{children:s,...i}=t;if(_.isValidElement(s)){const a=Vhe(s),o=Uhe(i,s.props);return s.type!==_.Fragment&&(o.ref=r?tT(r,a):a),_.cloneElement(s,o)}return _.Children.count(s)>1?_.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var nG=Symbol("radix.slottable");function rG(n){const e=({children:t})=>c.jsx(c.Fragment,{children:t});return e.displayName=`${n}.Slottable`,e.__radixId=nG,e}function $he(n){return _.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===nG}function Uhe(n,e){const t={...e};for(const r in e){const s=n[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?t[r]=(...o)=>{const l=i(...o);return s(...o),l}:s&&(t[r]=s):r==="style"?t[r]={...s,...i}
vendor: 10,589 bytes, line 40
40:r==="className"&&(t[r]=[s,i].filter(Boolean).join(" "))}return{...n,...t}}function Vhe(n){var r,s;let e=(r=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(s=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:s.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function SS(n){const e=n+"CollectionProvider",[t,r]=Hr(e),[s,i]=t(e,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:y,children:v}=g,x=Oe.useRef(null),b=Oe.useRef(new Map).current;return c.jsx(s,{scope:y,itemMap:b,collectionRef:x,children:v})};a.displayName=e;const o=n+"CollectionSlot",l=df(o),u=Oe.forwardRef((g,y)=>{const{scope:v,children:x}=g,b=i(o,v),E=Ct(y,b.collectionRef);return c.jsx(l,{ref:E,children:x})});u.displayName=o;const d=n+"CollectionItemSlot",h="data-radix-collection-item",f=df(d),p=Oe.forwardRef((g,y)=>{const{scope:v,children:x,...b}=g,E=Oe.useRef(null),S=Ct(y,E),k=i(d,v);return Oe.useEffect(()=>(k.itemMap.set(E,{ref:E,...b}),()=>void k.itemMap.delete(E))),c.jsx(f,{[h]:"",ref:S,children:x})});p.displayName=d;function m(g){const y=i(n+"CollectionConsumer",g);return Oe.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((k,C)=>b.indexOf(k.ref.current)-b.indexOf(C.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:u,ItemSlot:p},m,r]}var Hhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],st=Hhe.reduce((n,e)=>{const t=df(`Primitive.${e}`),r=_.forwardRef((s,i)=>{const{asChild:a,...o}=s,l=a?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function hF(n,e){n&&wg.flushSync(()=>n.dispatchEvent(e))}function Pr(n){const e=_.useRef(n);return _.useEffect(()=>{e.current=n}),_.useMemo(()=>(...t)=>{var r;return(r=e.current)==null?void 0:r.call(e,...t)},[])}function Whe(n,e=globalThis==null?void 0:globalThis.document){const t=Pr(n);_.useEffect(()=>{const r=s=>{s.key==="Escape"&&t(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[t,e])}var qhe="DismissableLayer",SO="dismissableLayer.update",Ghe="dismissableLayer.pointerDownOutside",Khe="dismissableLayer.focusOutside",R$,sG=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_g=_.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,onDismiss:o,...l}=n,u=_.useContext(sG),[d,h]=_.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=_.useState({}),m=Ct(e,C=>h(C)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),x=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,E=x>=v,S=Xhe(C=>{const A=C.target,T=[...u.branches].some(j=>j.contains(A));!E||T||(s==null||s(C),a==null||a(C),C.defaultPrevented||o==null||o())},f),k=Zhe(C=>{const A=C.target;[...u.branches].some(j=>j.contains(A))||(i==null||i(C),a==null||a(C),C.defaultPrevented||o==null||o())},f);return Whe(C=>{x===u.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&o&&(C.preventDefault(),o()))},f),_.useEffect(()=>{if(d)return t&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(R$=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),P$(),()=>{t&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=R$)}},[d,f,t,u]),_.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),P$())},[d,u]),_.useEffect(()=>{const C=()=>p({});return document.addEventListener(SO,C),()=>document.removeEventListener(SO,C)},[]),c.jsx(st.div,{...l,ref:m,style:{pointerEvents:b?E?"auto":"none":void 0,...n.style},onFocusCapture:$e(n.onFocusCapture,k.onFocusCapture),onBlurCapture:$e(n.onBlurCapture,k.onBlurCapture),onPointerDownCapture:$e(n.onPointerDownCapture,S.onPointerDownCapture)})});_g.displayName=qhe;var Yhe="DismissableLayerBranch",iG=_.forwardRef((n,e)=>{const t=_.useContext(sG),r=_.useRef(null),s=Ct(e,r);return _.useEffect(()=>{const i=r.current;if(i)return t.branches.add(i),()=>{t.branches.delete(i)}},[t.branches]),c.jsx(st.div,{...n,ref:s})});iG.displayName=Yhe;function Xhe(n,e=globalThis==null?void 0:globalThis.document){const t=Pr(n),r=_.useRef(!1),s=_.useRef(()=>{});return _.useEffect(()=>{const i=o=>{if(o.target&&!r.current){let l=function(){aG(Ghe,t,u,{discrete:!0})};const u={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=l,e.addEventListener("click",s.current,{once:!0})):l()}else e.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function Zhe(n,e=globalThis==null?void 0:globalThis.document){const t=Pr(n),r=_.useRef(!1);return _.useEffect(()=>{const s=i=>{i.target&&!r.current&&aG(Khe,t,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function P$(){const n=new CustomEvent(SO);document.dispatchEvent(n)}function aG(n,e,t,{discrete:r}){const s=t.originalEvent.target,i=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&s.addEventListener(n,e,{once:!0}),r?hF(s,i):s.dispatchEvent(i)}var Jhe=_g,Qhe=iG,Dr=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},efe="Portal",m0=_.forwardRef((n,e)=>{var o;const{container:t,...r}=n,[s,i]=_.useState(!1);Dr(()=>i(!0),[]);const a=t||s&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?uF.createPortal(c.jsx(st.div,{...r,ref:e}),a):null});m0.displayName=efe;function tfe(n,e){return _.useReducer((t,r)=>e[t][r]??t,n)}var ss=n=>{const{present:e,children:t}=n,r=nfe(e),s=typeof t=="function"?t({present:r.isPresent}):_.Children.only(t),i=Ct(r.ref,rfe(s));return typeof t=="function"||r.isPresent?_.cloneElement(s,{ref:i}):null};ss.displayName="Presence";function nfe(n){const[e,t]=_.useState(),r=_.useRef(null),s=_.useRef(n),i=_.useRef("none"),a=n?"mounted":"unmounted",[o,l]=tfe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const u=WE(r.current);i.current=o==="mounted"?u:"none"},[o]),Dr(()=>{const u=r.current,d=s.current;if(d!==n){const f=i.current,p=WE(u);n?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,l]),Dr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,h=p=>{const g=WE(r.current).includes(p.animationName);if(p.target===e&&g&&(l("ANIMATION_END"),!s.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=WE(r.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 l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:_.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function WE(n){return(n==null?void 0:n.animationName)||"none"}function rfe(n){var r,s;let e=(r=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(s=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:s.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var sfe=BN[" useInsertionEffect ".trim().toString()]||Dr;function Zi({prop:n,defaultProp:e,onChange:t=()=>{},caller:r}){const[s,i,a]=ife({defaultProp:e,onChange:t}),o=n!==void 0,l=o?n:s;{const d=_.useRef(n!==void 0);_.useEffect(()=>{const h=d.current;h!==o&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${o?"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=o},[o,r])}const u=_.useCallback(d=>{var h;if(o){const f=afe(d)?d(n):d;f!==n&&((h=a.current)==null||h.call(a,f))}else i(d)},[o,n,i,a]);return[l,u]}function ife({defaultProp:n,onChange:e}){const[t,r]=_.useState(n),s=_.useRef(t),i=_.useRef(e);return sfe(()=>{i.current=e},[e]),_.useEffect(()=>{var a;s.current!==t&&((a=i.current)==null||a.call(i,t),s.current=t)},[t,s]),[t,r,i]}function afe(n){return typeof n=="function"}var oG=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"}),ofe="VisuallyHidden",nT=_.forwardRef((n,e)=>c.jsx(st.span,{...n,ref:e,style:{...oG,...n.style}}));nT.displayName=ofe;var lfe=nT,fF="ToastProvider",[pF,cfe,ufe]=SS("Toast"),[lG,Bqe]=Hr("Toast",[ufe]),[dfe,rT]=lG(fF),cG=n=>{const{__scopeToast:e,label:t="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=n,[o,l]=_.useState(null),[u,d]=_.useState(0),h=_.useRef(!1),f=_.useRef(!1);return t.trim()||console.error(`Invalid prop \`label\` supplied to \`${fF}\`. Expected non-empty \`string\`.`),c.jsx(pF.Provider,{scope:e,children:c.jsx(dfe,{scope:e,label:t,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:o,onViewportChange:l,onToastAdd:_.useCallback(()=>d(p=>p+1),[]),onToastRemove:_.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:a})})};cG.displayName=fF;var uG="ToastViewport",hfe=["F8"],EO="toast.viewportPause",kO="toast.viewportResume",dG=_.forwardRef((n,e)=>{const{__scopeToast:t,hotkey:r=hfe,label:s="Notifications ({hotkey})",...i}=n,a=rT(uG,t),o=cfe(t),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),h=_.useRef(null),f=Ct(e,h,a.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=a.toastCount>0;_.useEffect(()=>{const y=v=>{var b;r.length!==0&&r.every(E=>
40v[E]||v.code===E)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),_.useEffect(()=>{const y=l.current,v=h.current;if(m&&y&&v){const x=()=>{if(!a.isClosePausedRef.current){const k=new CustomEvent(EO);v.dispatchEvent(k),a.isClosePausedRef.current=!0}},b=()=>{if(a.isClosePausedRef.current){const k=new CustomEvent(kO);v.dispatchEvent(k),a.isClosePausedRef.current=!1}},E=k=>{!y.contains(k.relatedTarget)&&b()},S=()=>{y.contains(document.activeElement)||b()};return y.addEventListener("focusin",x),y.addEventListener("focusout",E),y.addEventListener("pointermove",x),y.addEventListener("pointerleave",S),window.addEventListener("blur",x),window.addEventListener("focus",b),()=>{y.removeEventListener("focusin",x),y.removeEventListener("focusout",E),y.removeEventListener("pointermove",x),y.removeEventListener("pointerleave",S),window.removeEventListener("blur",x),window.removeEventListener("focus",b)}}},[m,a.isClosePausedRef]);const g=_.useCallback(({tabbingDirection:y})=>{const x=o().map(b=>{const E=b.ref.current,S=[E,...kfe(E)];return y==="forwards"?S:S.reverse()});return(y==="forwards"?x.reverse():x).flat()},[o]);return _.useEffect(()=>{const y=h.current;if(y){const v=x=>{var S,k,C;const b=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!b){const A=document.activeElement,T=x.shiftKey;if(x.target===y&&T){(S=u.current)==null||S.focus();return}const R=g({tabbingDirection:T?"backwards":"forwards"}),M=R.findIndex(N=>N===A);CR(R.slice(M+1))?x.preventDefault():T?(k=u.current)==null||k.focus():(C=d.current)==null||C.focus()}};return y.addEventListener("keydown",v),()=>y.removeEventListener("keydown",v)}},[o,g]),c.jsxs(Qhe,{ref:l,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&c.jsx(CO,{ref:u,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"forwards"});CR(y)}}),c.jsx(pF.Slot,{scope:t,children:c.jsx(st.ol,{tabIndex:-1,...i,ref:f})}),m&&c.jsx(CO,{ref:d,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"backwards"});CR(y)}})]})});dG.displayName=uG;var hG="ToastFocusProxy",CO=_.forwardRef((n,e)=>{const{__scopeToast:t,onFocusFromOutsideViewport:r,...s}=n,i=rT(hG,t);return c.jsx(nT,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{var u;const o=a.relatedTarget;!((u=i.viewport)!=null&&u.contains(o))&&r()}})});CO.displayName=hG;var ES="Toast",ffe="toast.swipeStart",pfe="toast.swipeMove",mfe="toast.swipeCancel",gfe="toast.swipeEnd",fG=_.forwardRef((n,e)=>{const{forceMount:t,open:r,defaultOpen:s,onOpenChange:i,...a}=n,[o,l]=Zi({prop:r,defaultProp:s??!0,onChange:i,caller:ES});return c.jsx(ss,{present:t||o,children:c.jsx(xfe,{open:o,...a,ref:e,onClose:()=>l(!1),onPause:Pr(n.onPause),onResume:Pr(n.onResume),onSwipeStart:$e(n.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(n.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:$e(n.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:$e(n.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`),l(!1)})})})});fG.displayName=ES;var[vfe,yfe]=lG(ES,{onClose(){}}),xfe=_.forwardRef((n,e)=>{const{__scopeToast:t,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:o,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...m}=n,g=rT(ES,t),[y,v]=_.useState(null),x=Ct(e,N=>v(N)),b=_.useRef(null),E=_.useRef(null),S=s||g.duration,k=_.useRef(0),C=_.useRef(S),A=_.useRef(0),{onToastAdd:T,onToastRemove:j}=g,D=Pr(()=>{var U;(y==null?void 0:y.contains(document.activeElement))&&((U=g.viewport)==null||U.focus()),a()}),R=_.useCallback(N=>
40{!N||N===1/0||(window.clearTimeout(A.current),k.current=new Date().getTime(),A.current=window.setTimeout(D,N))},[D]);_.useEffect(()=>{const N=g.viewport;if(N){const U=()=>{R(C.current),u==null||u()},q=()=>{const I=new Date().getTime()-k.current;C.current=C.current-I,window.clearTimeout(A.current),l==null||l()};return N.addEventListener(EO,q),N.addEventListener(kO,U),()=>{N.removeEventListener(EO,q),N.removeEventListener(kO,U)}}},[g.viewport,S,l,u,R]),_.useEffect(()=>{i&&!g.isClosePausedRef.current&&R(S)},[i,S,g.isClosePausedRef,R]),_.useEffect(()=>(T(),()=>j()),[T,j]);const M=_.useMemo(()=>y?bG(y):null,[y]);return g.viewport?c.jsxs(c.Fragment,{children:[M&&c.jsx(bfe,{__scopeToast:t,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:M}),c.jsx(vfe,{scope:t,onClose:D,children:wg.createPortal(c.jsx(pF.ItemSlot,{scope:t,children:c.jsx(Jhe,{asChild:!0,onEscapeKeyDown:$e(o,()=>{g.isFocusedToastEscapeKeyDownRef.current||D(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(st.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection,...m,ref:x,style:{userSelect:"none",touchAction:"none",...n.style},onKeyDown:$e(n.onKeyDown,N=>{N.key==="Escape"&&(o==null||o(N.nativeEvent),N.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:$e(n.onPointerDown,N=>{N.button===0&&(b.current={x:N.clientX,y:N.clientY})}),onPointerMove:$e(n.onPointerMove,N=>{if(!b.current)return;const U=N.clientX-b.current.x,q=N.clientY-b.current.y,I=!!E.current,B=["left","right"].includes(g.swipeDirection),$=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,ie=B?$(0,U):0,ne=B?0:$(0,q),L=N.pointerType==="touch"?10:2,te={x:ie,y:ne},ae={originalEvent:N,delta:te};I?(E.current=te,qE(pfe,h,ae,{discrete:!1})):D$(te,g.swipeDirection,L)?(E.current=te,qE(ffe,d,ae,{discrete:!1}),N.target.setPointerCapture(N.pointerId)):(Math.abs(U)>L||Math.abs(q)>L)&&(b.current=null)}),onPointerUp:$e(n.onPointerUp,N=>{const U=E.current,q=N.target;if(q.hasPointerCapture(N.pointerId)&&q.releasePointerCapture(N.pointerId),E.current=null,b.current=null,U){const I=N.currentTarget,B={originalEvent:N,delta:U};D$(U,g.swipeDirection,g.swipeThreshold)?qE(gfe,p,B,{discrete:!0}):qE(mfe,f,B,{discrete:!0}),I.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),bfe=n=>{const{__scopeToast:e,children:t,...r}=n,s=rT(ES,e),[i,a]=_.useState(!1),[o,l]=_.useState(!1);return Sfe(()=>a(!0)),_.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),o?null:c.jsx(m0,{asChild:!0,children:c.jsx(nT,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",t]})})})},wfe="ToastTitle",pG=_.forwardRef((n,e)=>{const{__scopeToast:t,...r}=n;return c.jsx(st.div,{...r,ref:e})});pG.displayName=wfe;var _fe="ToastDescription",mG=_.forwardRef((n,e)=>{const{__scopeToast:t,...r}=n;return c.jsx(st.div,{...r,ref:e})});mG.displayName=_fe;var gG="ToastAction",vG=_.forwardRef((n,e)=>{const{altText:t,...r}=n;return t.trim()?c.jsx(xG,{altText:t,asChild:!0,children:c.jsx(mF,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${gG}\`. Expected non-empty \`string\`.`),null)});vG.displayName=gG;var yG="ToastClose",mF=_.forwardRef((n,e)=>{const{__scopeToast:t,...r}=n,s=yfe(yG,t);return c.jsx(xG,{asChild:!0,children:c.jsx(st.button,{type:"button",...r,ref:e,onClick:$e(n.onClick,s.onClose)})})});mF.displayName=yG;var xG=_.forwardRef((n,e)=>{const{__scopeToast:t,altText:r,...s}=n;return c.jsx(st.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function bG(n){const e=[];return Array.from(n.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),Efe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...bG(r))}}),e}function qE(n,e,t,{discrete:r}){const s=t.originalEvent.currentTarget,i=new CustomEvent(n,{bubbles:!0,cancelable:!0,detail:t});e&&s.addEventListener(n,e,{once:!0}),r?hF(s,i):s.dispatchEvent(i)}var D$=(n,e,t=0)=>{const r=Math.abs(n.x),s=Math.abs(n.y),i=r>s;return e==="left"||e==="right"?i&&r>t:!i&&s>t};function Sfe(n=()=>{}){const e=Pr(n);Dr(()=>{let t=0,r=0;return t=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(r)}},[e])}function Efe(n){return n.nodeType===n.ELEMENT_NODE}function kfe(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function CR(n){const e=document.activeElement;return n.some(t=>t===e?!0:(t.focus(),document.activeElement!==e))}var Cfe=cG,wG=dG,_G=fG,SG=pG,EG=mG,kG=vG,CG=mF;function AG(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=AG(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function g0(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=AG(n))&&(r&&(r+=" "),r+=e);return r}const O$=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,M$=g0,Sg=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return M$(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(u=>{const d=t==null?void 0:t[u],h=i==null?void 0:i[u];if(d===null)return null;const f=O$(d)||O$(h);return s[u][f]}),o=t&&Object.entries(t).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...i,...o}[g]):{...i,...o}[g]===y})?[...u,h,f]:u},[]);return M$(n,a,l,t==null?void 0:t.class,t==null?void 0:t.className)};/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const Afe=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NG=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var Nfe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const Tfe=_.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},l)=>_.createElement("svg",{ref:l,...Nfe,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:NG("lucide",s),...o},[...a.map(([u,d])=>_.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const ze=(n,e)=>{const t=_.forwardRef(({className:r,...s},i)=>_.createElement(Tfe,{ref:i,iconNode:e,className:NG(`lucide-${Afe(n)}`,r),...s}));return t.displayName=`${n}`,t};/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const AR=ze("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const AO=ze("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const Ji=ze("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const a1=ze("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const jfe=ze("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const NO=ze("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["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"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const En=ze("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"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const Kk=ze("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"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const pw=ze("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"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const kS=ze("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"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const Go=ze("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const _2=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const CS=ze("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const cd=ze("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const Rfe=ze("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const o1=ze("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"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const gF=ze("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const TG=ze("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const Pfe=ze("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const sT=ze("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"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const jG=ze("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const RG=ze("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const PG=ze("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const Dfe=ze("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
181 * @license lucide-react v0.462.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const vF=ze("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"}]]);/**
186 * @license lucide-react v0.462.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const TO=ze("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
191 * @license lucide-react v0.462.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const yF=ze("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"}]]);/**
196 * @license lucide-react v0.462.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const Ofe=ze("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
201 * @license lucide-react v0.462.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const Mfe=ze("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
206 * @license lucide-react v0.462.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const iT=ze("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"}]]);/**
211 * @license lucide-react v0.462.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const Ife=ze("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"}]]);/**
216 * @license lucide-react v0.462.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const aT=ze("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"}]]);/**
221 * @license lucide-react v0.462.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const Lfe=ze("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/**
226 * @license lucide-react v0.462.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const S2=ze("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/**
231 * @license lucide-react v0.462.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const wi=ze("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"}]]);/**
236 * @license lucide-react v0.462.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const I$=ze("FileUp",[["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 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
241 * @license lucide-react v0.462.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const Ffe=ze("FileWarning",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
246 * @license lucide-react v0.462.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const Bfe=ze("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
251 * @license lucide-react v0.462.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const zfe=ze("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
256 * @license lucide-react v0.462.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const DG=ze("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
261 * @license lucide-react v0.462.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const $fe=ze("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
266 * @license lucide-react v0.462.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const Ufe=ze("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
271 * @license lucide-react v0.462.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const Vfe=ze("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}
275]]);/**
276 * @license lucide-react v0.462.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const E2=ze("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/**
281 * @license lucide-react v0.462.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const oT=ze("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
286 * @license lucide-react v0.462.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const OG=ze("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
291 * @license lucide-react v0.462.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const Hfe=ze("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
296 * @license lucide-react v0.462.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const xF=ze("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
301 * @license lucide-react v0.462.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const MG=ze("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
306 * @license lucide-react v0.462.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const Wfe=ze("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
311 * @license lucide-react v0.462.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const qfe=ze("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
316 * @license lucide-react v0.462.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const bF=ze("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
321 * @license lucide-react v0.462.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const et=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
326 * @license lucide-react v0.462.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const wF=ze("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"}]]);/**
331 * @license lucide-react v0.462.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const Gfe=ze("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",ke
335y:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
336 * @license lucide-react v0.462.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const IG=ze("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"}]]);/**
341 * @license lucide-react v0.462.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const Kfe=ze("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"}]]);/**
346 * @license lucide-react v0.462.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const Yfe=ze("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"}]]);/**
351 * @license lucide-react v0.462.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const LG=ze("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"}]]);/**
356 * @license lucide-react v0.462.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const l1=ze("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
361 * @license lucide-react v0.462.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const Tf=ze("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"}]]);/**
366 * @license lucide-react v0.462.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const Xfe=ze("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
371 * @license lucide-react v0.462.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const FG=ze("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
376 * @license lucide-react v0.462.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const Zfe=ze("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/**
381 * @license lucide-react v0.462.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const _F=ze("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
386 * @license lucide-react v0.462.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const mw=ze("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
391 * @license lucide-react v0.462.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const Jfe=ze("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"}]]);/**
396 * @license lucide-react v0.462.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const BG=ze("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
401 * @license lucide-react v0.462.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const zG=ze("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"}]]);/**
406 * @license lucide-react v0.462.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const Qfe=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
411 * @license lucide-react v0.462.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const ka=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
416 * @license lucide-react v0.462.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const ud=ze("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"}]]);/**
421 * @license lucide-react v0.462.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const epe=ze("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
426 * @license lucide-react v0.462.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const AS=ze("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"}]]);/**
431 * @license lucide-react v0.462.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const tpe=ze("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"}]]);/**
436 * @license lucide-react v0.462.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const NS=ze("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"}]]);/**
441 * @license lucide-react v0.462.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const Eg=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
446 * @license lucide-react v0.462.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const TS=ze("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"}]]);/**
451 * @license lucide-react v0.462.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const $G=ze("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
456 * @license lucide-react v0.462.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const k2=ze("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
461 * @license lucide-react v0.462.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const npe=ze("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",ke
465y:"oel41y"}]]);/**
466 * @license lucide-react v0.462.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const jS=ze("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"}]]);/**
471 * @license lucide-react v0.462.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const UG=ze("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"}]]);/**
476 * @license lucide-react v0.462.0 - ISC
477 *
478 * This source code is licensed under the ISC license.
479 * See the LICENSE file in the root directory of this source tree.
480 */const rpe=ze("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
481 * @license lucide-react v0.462.0 - ISC
482 *
483 * This source code is licensed under the ISC license.
484 * See the LICENSE file in the root directory of this source tree.
485 */const spe=ze("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
486 * @license lucide-react v0.462.0 - ISC
487 *
488 * This source code is licensed under the ISC license.
489 * See the LICENSE file in the root directory of this source tree.
490 */const Eb=ze("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
491 * @license lucide-react v0.462.0 - ISC
492 *
493 * This source code is licensed under the ISC license.
494 * See the LICENSE file in the root directory of this source tree.
495 */const Gm=ze("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"}]]);/**
496 * @license lucide-react v0.462.0 - ISC
497 *
498 * This source code is licensed under the ISC license.
499 * See the LICENSE file in the root directory of this source tree.
500 */const jO=ze("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"}]]);/**
501 * @license lucide-react v0.462.0 - ISC
502 *
503 * This source code is licensed under the ISC license.
504 * See the LICENSE file in the root directory of this source tree.
505 */const zi=ze("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/**
506 * @license lucide-react v0.462.0 - ISC
507 *
508 * This source code is licensed under the ISC license.
509 * See the LICENSE file in the root directory of this source tree.
510 */const VG=ze("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
511 * @license lucide-react v0.462.0 - ISC
512 *
513 * This source code is licensed under the ISC license.
514 * See the LICENSE file in the root directory of this source tree.
515 */const HG=ze("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
516 * @license lucide-react v0.462.0 - ISC
517 *
518 * This source code is licensed under the ISC license.
519 * See the LICENSE file in the root directory of this source tree.
520 */const ao=ze("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
520],["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"}]]);/**
521 * @license lucide-react v0.462.0 - ISC
522 *
523 * This source code is licensed under the ISC license.
524 * See the LICENSE file in the root directory of this source tree.
525 */const ipe=ze("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"}]]);/**
526 * @license lucide-react v0.462.0 - ISC
527 *
528 * This source code is licensed under the ISC license.
529 * See the LICENSE file in the root directory of this source tree.
530 */const L$=ze("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
531 * @license lucide-react v0.462.0 - ISC
532 *
533 * This source code is licensed under the ISC license.
534 * See the LICENSE file in the root directory of this source tree.
535 */const ape=ze("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
536 * @license lucide-react v0.462.0 - ISC
537 *
538 * This source code is licensed under the ISC license.
539 * See the LICENSE file in the root directory of this source tree.
540 */const ope=ze("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
541 * @license lucide-react v0.462.0 - ISC
542 *
543 * This source code is licensed under the ISC license.
544 * See the LICENSE file in the root directory of this source tree.
545 */const F$=ze("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"}]]);/**
546 * @license lucide-react v0.462.0 - ISC
547 *
548 * This source code is licensed under the ISC license.
549 * See the LICENSE file in the root directory of this source tree.
550 */const Js=ze("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"}]]);/**
551 * @license lucide-react v0.462.0 - ISC
552 *
553 * This source code is licensed under the ISC license.
554 * See the LICENSE file in the root directory of this source tree.
555 */const Ku=ze("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"}]]);/**
556 * @license lucide-react v0.462.0 - ISC
557 *
558 * This source code is licensed under the ISC license.
559 * See the LICENSE file in the root directory of this source tree.
560 */const lpe=ze("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
561 * @license lucide-react v0.462.0 - ISC
562 *
563 * This source code is licensed under the ISC license.
564 * See the LICENSE file in the root directory of this source tree.
565 */const cpe=ze("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
566 * @license lucide-react v0.462.0 - ISC
567 *
568 * This source code is licensed under the ISC license.
569 * See the LICENSE file in the root directory of this source tree.
570 */const Ho=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
vendor: 9,241 bytes, lines 570-585
570],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
571 * @license lucide-react v0.462.0 - ISC
572 *
573 * This source code is licensed under the ISC license.
574 * See the LICENSE file in the root directory of this source tree.
575 */const upe=ze("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
576 * @license lucide-react v0.462.0 - ISC
577 *
578 * This source code is licensed under the ISC license.
579 * See the LICENSE file in the root directory of this source tree.
580 */const dpe=ze("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"}]]);/**
581 * @license lucide-react v0.462.0 - ISC
582 *
583 * This source code is licensed under the ISC license.
584 * See the LICENSE file in the root directory of this source tree.
585 */const hpe=ze("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"}]]),SF="-",fpe=n=>{const e=mpe(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:a=>{const o=a.split(SF);return o[0]===""&&o.length!==1&&o.shift(),WG(o,e)||ppe(a)},getConflictingClassGroupIds:(a,o)=>{const l=t[a]||[];return o&&r[a]?[...l,...r[a]]:l}}},WG=(n,e)=>{var a;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),s=r?WG(n.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=n.join(SF);return(a=e.validators.find(({validator:o})=>o(i)))==null?void 0:a.classGroupId},B$=/^\[(.+)\]$/,ppe=n=>{if(B$.test(n)){const e=B$.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},mpe=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return vpe(Object.entries(n.classGroups),t).forEach(([i,a])=>{RO(a,r,i,e)}),r},RO=(n,e,t,r)=>{n.forEach(s=>{if(typeof s=="string"){const i=s===""?e:z$(e,s);i.classGroupId=t;return}if(typeof s=="function"){if(gpe(s)){RO(s(r),e,t,r);return}e.validators.push({validator:s,classGroupId:t});return}Object.entries(s).forEach(([i,a])=>{RO(a,z$(e,i),t,r)})})},z$=(n,e)=>{let t=n;return e.split(SF).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},gpe=n=>n.isThemeGetter,vpe=(n,e)=>e?n.map(([t,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,o])=>[e+a,o])):i);return[t,s]}):n,ype=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const s=(i,a)=>{t.set(i,a),e++,e>n&&(e=0,r=t,t=new Map)};return{get(i){let a=t.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return s(i,a),a},set(i,a){t.has(i)?t.set(i,a):s(i,a)}}},qG="!",xpe=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,s=e[0],i=e.length,a=o=>{const l=[];let u=0,d=0,h;for(let y=0;y<o.length;y++){let v=o[y];if(u===0){if(v===s&&(r||o.slice(y,y+i)===e)){l.push(o.slice(d,y)),d=y+i;continue}if(v==="/"){h=y;continue}}v==="["?u++:v==="]"&&u--}const f=l.length===0?o:o.substring(d),p=f.startsWith(qG),m=p?f.substring(1):f,g=h&&h>d?h-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}};return t?o=>t({className:o,parseClassName:a}):a},bpe=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},wpe=n=>({cache:ype(n.cacheSize),parseClassName:xpe(n),...fpe(n)}),_pe=/\s+/,Spe=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],a=n.trim().split(_pe);let o="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=t(u);let m=!!p,g=r(m?f.substring(0,p):f);if(!g){if(!m){o=u+(o.length>0?" "+o:o);continue}if(g=r(f),!g){o=u+(o.length>0?" "+o:o);continue}m=!1}const y=bpe(d).join(":"),v=h?y+qG:y,x=v+g;if(i.includes(x))continue;i.push(x);const b=s(g,m);for(let E=0;E<b.length;++E){const S=b[E];i.push(v+S)}o=u+(o.length>0?" "+o:o)}return o};function Epe(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=GG(e))&&(r&&(r+=" "),r+=t);return r}const GG=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=GG(n[r]))&&(t&&(t+=" "),t+=e);return t};function kpe(n,...e){let t,r,s,i=a;function a(l){const u=e.reduce((d,h)=>h(d),n());return t=wpe(u),r=t.cache.get,s=t.cache.set,i=o,o(l)}function o(l){const u=r(l);if(u)return u;const d=Spe(l,t);return s(l,d),d}return function(){return i(Epe.apply(null,arguments))}}const Xn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},KG=/^\[(?:([a-z-]+):)?(.+)\]$/i,Cpe=/^\d+\/\d+$/,Ape=new Set(["px","full","screen"]),Npe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tpe=/\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$/,jpe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Rpe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ppe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qc=n=>iy(n)||Ape.has(n)||Cpe.test(n),Td=n=>v0(n,"length",zpe),iy=n=>!!n&&!Number.isNaN(Number(n)),NR=n=>v0(n,"number",iy),eb=n=>!!n&&Number.isInteger(Number(n)),Dpe=n=>n.endsWith("%")&&iy(n.slice(0,-1)),Kt=n=>KG.test(n),jd=n=>Npe.test(n),Ope=new Set(["length","size","percentage"]),Mpe=n=>v0(n,Ope,YG),Ipe=n=>v0(n,"position",YG),Lpe=new Set(["image","url"]),Fpe=n=>v0(n,Lpe,Upe),Bpe=n=>v0(n,"",$pe),tb=()=>!0,v0=(n,e,t)=>{const r=KG.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},zpe=n=>Tpe.test(n)&&!jpe.test(n),YG=()=>!1,$pe=n=>Rpe.test(n),Upe=n=>Ppe.test(n),Vpe=()=>{const n=Xn("colors"),e=Xn("spacing"),t=Xn("blur"),r=Xn("brightness"),s=Xn("borderColor"),i=Xn("borderRadius"),a=Xn("borderSpacing"),o=Xn("borderWidth"),l=Xn("contrast"),u=Xn("grayscale"),d=Xn("hueRotate"),h=Xn("invert"),f=Xn("gap"),p=Xn("gradientColorStops"),m=Xn("gradientColorStopPositions"),g=Xn("inset"),y=Xn("margin"),v=Xn("opacity"),x=Xn("padding"),b=Xn("saturate"),E=Xn("scale"),S=Xn("sepia"),k=Xn("skew"),C=Xn("space"),A=Xn("translate"),T=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Kt,e],R=()=>[Kt,e],M=()=>["",Qc,Td],N=()=>["auto",iy,Kt],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],I=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",Kt],ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ne=()=>[iy,Kt];return{cacheSize:500,separator:":",theme:{colors:[tb],spacing:[Qc,Td],blur:["none","",jd,Kt],brightness:ne(),borderColor:[n],borderRadius:["none","","full",jd,Kt],borderSpacing:R(),borderWidth:M(),contrast:ne(),grayscale:$(),hueRotate:ne(),invert:$(),gap:R(),gradientColorStops:[n],gradientColorStopPositions:[Dpe,Td],inset:D(),margin:D(),opacity:ne(),padding:R(),saturate:ne(),scale:ne(),sepia:$(),skew:ne(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",Kt]}],container:["container"],columns:[{columns:[jd]}],"break-after":[{"break-after":ie()}],"break-before":[{"break-before":ie()}],"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(),Kt]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",eb,Kt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Kt]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",eb,Kt]}],"grid-cols":[{"grid-cols":[tb]}],"col-start-end":[{col:["auto",{span:["full",eb,Kt]},Kt]}],"col-start":[{"col-start":N()}
vendor: 9,426 bytes, line 585
585],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[tb]}],"row-start-end":[{row:["auto",{span:[eb,Kt]},Kt]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Kt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"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:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"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",Kt,e]}],"min-w":[{"min-w":[Kt,e,"min","max","fit"]}],"max-w":[{"max-w":[Kt,e,"none","full","min","max","fit","prose",{screen:[jd]},jd]}],h:[{h:[Kt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Kt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Kt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Kt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",jd,Td]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",NR]}],"font-family":[{font:[tb]}],"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",Kt]}],"line-clamp":[{"line-clamp":["none",iy,NR]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qc,Kt]}],"list-image":[{"list-image":["none",Kt]}],"list-style-type":[{list:["none","disc","decimal",Kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qc,Td]}],"underline-offset":[{"underline-offset":["auto",Qc,Kt]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Kt]}],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",Kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),Ipe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Mpe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Fpe]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"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:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[Qc,Kt]}],"outline-w":[{outline:[Qc,Td]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Qc,Td]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",jd,Bpe]}],"shadow-color":[{shadow:[tb]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...I(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",jd,Kt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Kt]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",Kt]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",Kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[eb,Kt]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Kt]}],accent:[{accent:["auto",n]}],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",Kt]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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"]}
vendor: 4,657 bytes, line 585
585],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",Kt]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Qc,Td,NR]}],stroke:[{stroke:[n,"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"]}}},Hpe=kpe(Vpe);function ke(...n){return Hpe(g0(n))}const Wpe=Cfe,XG=_.forwardRef(({className:n,...e},t)=>c.jsx(wG,{ref:t,className:ke("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]",n),...e}));XG.displayName=wG.displayName;const qpe=Sg("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"}}),ZG=_.forwardRef(({className:n,variant:e,...t},r)=>c.jsx(_G,{ref:r,className:ke(qpe({variant:e}),n),...t}));ZG.displayName=_G.displayName;const Gpe=_.forwardRef(({className:n,...e},t)=>c.jsx(kG,{ref:t,className:ke("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 group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",n),...e}));Gpe.displayName=kG.displayName;const JG=_.forwardRef(({className:n,...e},t)=>c.jsx(CG,{ref:t,className:ke("absolute right-2 top-2 rounded-md p-1 text-foreground
585/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",n),"toast-close":"",...e,children:c.jsx(Ho,{className:"h-4 w-4"})}));JG.displayName=CG.displayName;const QG=_.forwardRef(({className:n,...e},t)=>c.jsx(SG,{ref:t,className:ke("text-sm font-semibold",n),...e}));QG.displayName=SG.displayName;const eK=_.forwardRef(({className:n,...e},t)=>c.jsx(EG,{ref:t,className:ke("text-sm opacity-90",n),...e}));eK.displayName=EG.displayName;function Kpe(){const{toasts:n}=Jl();return c.jsxs(Wpe,{children:[n.map(function({id:e,title:t,description:r,action:s,...i}){return c.jsxs(ZG,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[t&&c.jsx(QG,{children:t}),r&&c.jsx(eK,{children:r})]}),s,c.jsx(JG,{})]},e)}),c.jsx(XG,{})]})}var C2=["light","dark"],EF="(prefers-color-scheme: dark)",Ype=typeof window>"u",kF=_.createContext(void 0),Xpe={setTheme:n=>{},themes:[]},tK=()=>{var n;return(n=_.useContext(kF))!=null?n:Xpe},Zpe=n=>_.useContext(kF)?n.children:_.createElement(Qpe,{...n}),Jpe=["light","dark"],Qpe=({forcedTheme:n,disableTransitionOnChange:e=!1,enableSystem:t=!0,enableColorScheme:r=!0,storageKey:s="theme",themes:i=Jpe,defaultTheme:a=t?"system":"light",attribute:o="data-theme",value:l,children:u,nonce:d})=>{let[h,f]=_.useState(()=>$$(s,a)),[p,m]=_.useState(()=>$$(s)),g=l?Object.values(l):i,y=_.useCallback(E=>{let S=E;if(!S)return;E==="system"&&t&&(S=U$());let k=l?l[S]:S,C=e?tme():null,A=document.documentElement;if(o==="class"?(A.classList.remove(...g),k&&A.classList.add(k)):k?A.setAttribute(o,k):A.removeAttribute(o),r){let T=C2.includes(a)?a:null,j=C2.includes(S)?S:T;A.style.colorScheme=j}C==null||C()},[]),v=_.useCallback(E=>{let S=typeof E=="function"?E(E):E;f(S);try{localStorage.setItem(s,S)}catch{}},[n]),x=_.useCallback(E=>{let S=U$(E);m(S),h==="system"&&t&&!n&&y("system")},[h,n]);_.useEffect(()=>{let E=window.matchMedia(EF);return E.addListener(x),x(E),()=>E.removeListener(x)},[x]),_.useEffect(()=>{let E=S=>{if(S.key!==s)return;let k=S.newValue||a;v(k)};return window.addEventListener("storage",E),()=>window.removeEventListener("storage",E)},[v]),_.useEffect(()=>{y(n??h)},[n,h]);let b=_.useMemo(()=>({theme:h,setTheme:v,forcedTheme:n,resolvedTheme:h==="system"?p:h,themes:t?[...i,"system"]:i,systemTheme:t?p:void 0}),[h,v,n,p,t,i]);return _.createElement(kF.Provider,{value:b},_.createElement(eme,{forcedTheme:n,disableTransitionOnChange:e,enableSystem:t,enableColorScheme:r,storageKey:s,themes:i,defaultTheme:a,attribute:o,value:l,children:u,attrs:g,nonce:d}),u)},eme=_.memo(({forcedTheme:n,storageKey:e,attribute:t,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:a,attrs:o,nonce:l})=>{let u=i==="system",d=t==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${o.map(m=>`'${m}'`).join(",")})`};`:`var d=document.documentElement,n='${t}',s='setAttribute';`,h=s?C2.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(m,g=!1,y=!0)=>{let v=a?a[m]:m,x=g?m+"|| ''":`'${v}'`,b="";return s&&y&&!g&&C2.includes(m)&&(b+=`d.style.colorScheme = '${m}';`),t==="class"?g||v?b+=`c.add(${x})`:b+="null":v&&(b+=`d[s](n,${x})`),b},p=n?`!function(){${d}${f(n)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${EF}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}${u?"":"else{"+f(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${h}}catch(t){}}();`;return _.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})}),$$=(n,e)=>{if(Ype)return;let t;try{t=localStorage.getItem(n)||void 0}catch{}return t||e},tme=()=>{let n=document.createElement("style");return n.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(n)},1)}},U$=n=>
585(n||(n=window.matchMedia(EF)),n.matches?"dark":"light"),nme=n=>{switch(n){case"success":return ime;case"info":return ome;case"warning":return ame;case"error":return lme;default:return null}},rme=Array(12).fill(0),sme=({visible:n,className:e})=>Oe.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":n},Oe.createElement("div",{className:"sonner-spinner"},rme.map((t,r)=>Oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),ime=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.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"})),ame=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Oe.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"})),ome=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.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"})),lme=Oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Oe.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"})),cme=Oe.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"},Oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ume=()=>{let[n,e]=Oe.useState(document.hidden);return Oe.useEffect(()=>{let t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),n},PO=1,dme=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let e=this.subscribers.indexOf(n);this.subscribers.splice(e,1)}),this.publish=n=>{this.subscribers.forEach(e=>e(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var e;let{message:t,...r}=n,s=typeof(n==null?void 0:n.id)=="number"||((e=n.id)==null?void 0:e.length)>0?n.id:PO++,i=this.toasts.find(o=>o.id===s),a=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(o=>o.id===s?(this.publish({...o,...n,id:s,title:t}),{...o,...n,id:s,dismissible:a,title:t}):o):this.addToast({title:t,...r,dismissible:a,id:s}),s},this.dismiss=n=>(this.dismissedToasts.add(n),n||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:n,dismiss:!0})),n),this.message=(n,e)=>this.create({...e,message:n}),this.error=(n,e)=>this.create({...e,message:n,type:"error"}),this.success=(n,e)=>this.create({...e,type:"success",message:n}),this.info=(n,e)=>this.create({...e,type:"info",message:n}),this.warning=(n,e)=>this.create({...e,type:"warning",message:n}),this.loading=(n,e)=>this.create({...e,type:"loading",message:n}),this.promise=(n,e)=>{if(!e)return;let t;e.loading!==void 0&&(t=this.create({...e,promise:n,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=n instanceof Promise?n:n(),s=t!==void 0,i,a=r.then(async l=>{if(i=["resolve",l],Oe.isValidElement(l))s=!1,this.create({id:t,type:"default",message:l});else if(fme(l)&&!l.ok){s=!1;let u=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,d=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:t,type:"error",message:u,description:d})}else if(e.success!==void 0){s=!1;let u=typeof e.success=="function"?await e.success(l):e.success,d=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"success",message:u,description:d})}}).catch(async l=>{if(i=["reject",l],e.error!==void 0){s=!1;let u=typeof e.error=="function"?await e.error(l):e.error,d=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"error",message:u,description:d})}}).finally(()=>{var l;s&&(this.dismiss(t),t=void 0),(l=e.finally)==null||l.call(e)}),o=()=>new Promise((l,u)=>a.then(()=>i[0]==="reject"?u(i[1]):l(i[1])).catch(u));return typeof t!="string"&&typeof t!="number"?{unwrap:o}:Object.assign(t,{unwrap:o})},this.custom=(n,e)=>{let t=(e==null?void 0:e.id)||PO++;return this.create({jsx:n(t),id:t,...e}),t},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},fa=new dme,hme=(n,e)=>{let t=(e==null?void 0:e.id)||PO++;return fa.addToast({title:n,...e,id:t}),t},fme=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",pme=hme,mme=()=>fa.toasts,gme=()=>fa.getActiveToasts(),Ye=Object.assign(pme,{success:fa.success,info:fa.info,warning:fa.warning,error:fa.error,custom:fa.custom,message:fa.message,promise:fa.promise,dismiss:fa.dismiss,loading:fa.loading},{getHistory:mme,getToasts:gme});function vme(n,{insertAt:e}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n))}vme(`: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;
585left: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}
585: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%);
585--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%)}
586`);function GE(n){return n.label!==void 0}var yme=3,xme="32px",bme="16px",V$=4e3,wme=356,_me=14,Sme=20,Eme=200;function Qo(...n){return n.filter(Boolean).join(" ")}function kme(n){let[e,t]=n.split("-"),r=[];return e&&r.push(e),t&&r.push(t),r}var Cme=n=>{var e,t,r,s,i,a,o,l,u,d,h;let{invert:f,toast:p,unstyled:m,interacting:g,setHeights:y,visibleToasts:v,heights:x,index:b,toasts:E,expanded:S,removeToast:k,defaultRichColors:C,closeButton:A,style:T,cancelButtonStyle:j,actionButtonStyle:D,className:R="",descriptionClassName:M="",duration:N,position:U,gap:q,loadingIcon:I,expandByDefault:B,classNames:$,icons:ie,closeButtonAriaLabel:ne="Close toast",pauseWhenPageIsHidden:L}=n,[te,ae]=Oe.useState(null),[de,ue]=Oe.useState(null),[le,ve]=Oe.useState(!1),[_e,Ne]=Oe.useState(!1),[Pe,Se]=Oe.useState(!1),[Ce,O]=Oe.useState(!1),[X,ee]=Oe.useState(!1),[V,H]=Oe.useState(0),[se,z]=Oe.useState(0),Q=Oe.useRef(p.duration||N||V$),Y=Oe.useRef(null),ce=Oe.useRef(null),he=b===0,ge=b+1<=v,Ee=p.type,Le=p.dismissible!==!1,qe=p.className||"",lt=p.descriptionClassName||"",rt=Oe.useMemo(()=>x.findIndex(P=>P.toastId===p.id)||0,[x,p.id]),Pt=Oe.useMemo(()=>{var P;return(P=p.closeButton)!=null?P:A},[p.closeButton,A]),en=Oe.useMemo(()=>
586p.duration||N||V$,[p.duration,N]),gt=Oe.useRef(0),Wt=Oe.useRef(0),wn=Oe.useRef(0),J=Oe.useRef(null),[Me,Be]=U.split("-"),Qe=Oe.useMemo(()=>x.reduce((P,Ae,je)=>je>=rt?P:P+Ae.height,0),[x,rt]),ye=ume(),De=p.invert||f,K=Ee==="loading";Wt.current=Oe.useMemo(()=>rt*q+Qe,[rt,Qe]),Oe.useEffect(()=>{Q.current=en},[en]),Oe.useEffect(()=>{ve(!0)},[]),Oe.useEffect(()=>{let P=ce.current;if(P){let Ae=P.getBoundingClientRect().height;return z(Ae),y(je=>[{toastId:p.id,height:Ae,position:p.position},...je]),()=>y(je=>je.filter(Z=>Z.toastId!==p.id))}},[y,p.id]),Oe.useLayoutEffect(()=>{if(!le)return;let P=ce.current,Ae=P.style.height;P.style.height="auto";let je=P.getBoundingClientRect().height;P.style.height=Ae,z(je),y(Z=>Z.find(fe=>fe.toastId===p.id)?Z.map(fe=>fe.toastId===p.id?{...fe,height:je}:fe):[{toastId:p.id,height:je,position:p.position},...Z])},[le,p.title,p.description,y,p.id]);let Ie=Oe.useCallback(()=>{Ne(!0),H(Wt.current),y(P=>P.filter(Ae=>Ae.toastId!==p.id)),setTimeout(()=>{k(p)},Eme)},[p,k,y,Wt]);Oe.useEffect(()=>{if(p.promise&&Ee==="loading"||p.duration===1/0||p.type==="loading")return;let P;return S||g||L&&ye?(()=>{if(wn.current<gt.current){let Ae=new Date().getTime()-gt.current;Q.current=Q.current-Ae}wn.current=new Date().getTime()})():Q.current!==1/0&&(gt.current=new Date().getTime(),P=setTimeout(()=>{var Ae;(Ae=p.onAutoClose)==null||Ae.call(p,p),Ie()},Q.current)),()=>clearTimeout(P)},[S,g,p,Ee,L,ye,Ie]),Oe.useEffect(()=>{p.delete&&Ie()},[Ie,p.delete]);function St(){var P,Ae,je;return ie!=null&&ie.loading?Oe.createElement("div",{className:Qo($==null?void 0:$.loader,(P=p==null?void 0:p.classNames)==null?void 0:P.loader,"sonner-loader"),"data-visible":Ee==="loading"},ie.loading):I?Oe.createElement("div",{className:Qo($==null?void 0:$.loader,(Ae=p==null?void 0:p.classNames)==null?void 0:Ae.loader,"sonner-loader"),"data-visible":Ee==="loading"},I):Oe.createElement(sme,{className:Qo($==null?void 0:$.loader,(je=p==null?void 0:p.classNames)==null?void 0:je.loader),visible:Ee==="loading"})}return Oe.createElement("li",{tabIndex:0,ref:ce,className:Qo(R,qe,$==null?void 0:$.toast,(e=p==null?void 0:p.classNames)==null?void 0:e.toast,$==null?void 0:$.default,$==null?void 0:$[Ee],(t=p==null?void 0:p.classNames)==null?void 0:t[Ee]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:C,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":le,"data-promise":!!p.promise,"data-swiped":X,"data-removed":_e,"data-visible":ge,"data-y-position":Me,"data-x-position":Be,"data-index":b,"data-front":he,"data-swiping":Pe,"data-dismissible":Le,"data-type":Ee,"data-invert":De,"data-swipe-out":Ce,"data-swipe-direction":de,"data-expanded":!!(S||B&&le),style:{"--index":b,"--toasts-before":b,"--z-index":E.length-b,"--offset":`${_e?V:Wt.current}px`,"--initial-height":B?"auto":`${se}px`,...T,...p.style},onDragEnd:()=>{Se(!1),ae(null),J.current=null},onPointerDown:P=>{K||!Le||(Y.current=new Date,H(Wt.current),P.target.setPointerCapture(P.pointerId),P.target.tagName!=="BUTTON"&&(Se(!0),J.current={x:P.clientX,y:P.clientY}))},onPointerUp:()=>{var P,Ae,je,Z;if(Ce||!Le)return;J.current=null;let fe=Number(((P=ce.current)==null?void 0:P.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Re=Number(((Ae=ce.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ht=new Date().getTime()-((je=Y.current)==null?void 0:je.getTime()),Ze=te==="x"?fe:Re,nt=Math.abs(Ze)/ht;if(Math.abs(Ze)>=Sme||nt>.11){H(Wt.current),(Z=p.onDismiss)==null||Z.call(p,p),ue(te==="x"?fe>0?"right":"left":Re>0?"down":"up"),Ie(),O(!0),ee(!1);return}Se(!1),ae(null)},onPointerMove:P=>{var Ae,je,Z,fe;if(!J.current||!Le||((Ae=window.getSelection())==null?void 0:Ae.toString().length)>0)return;let Re=P.clientY-J.current.y,ht=P.clientX-J.current.x,Ze=(je=n.swipeDirections)!=null?je:kme(U);!te&&(Math.abs(ht)>1||Math.abs(Re)>1)&&ae(Math.abs(ht)>Math.abs(Re)?"x":"y");let nt={x:0,y:0};te==="y"?(Ze.includes("top")||Ze.includes("bottom"))&&(Ze.includes("top")&&Re<0||Ze.includes("bottom")&&Re>0)&&(nt.y=Re):te==="x"&&(Ze.includes("left")||Ze.includes("right"))&&(Ze.includes("left")&&ht<0||Ze.includes("right")&&ht>0)&&(nt.x=ht),(Math.abs(nt.x)>0||Math.abs(nt.y)>0)&&ee(!0),(Z=ce.current)==null||Z.style.setProperty("--swipe-amount-x",`${nt.x}px`),(fe=ce.current)==null||fe.style.setProperty("--swipe-amount-y",`${nt.y}px`)}},Pt&&!p.jsx?Oe.createElement("button",{"aria-label":ne,"data-disabled":K,"data-close-button":!0,onClick:K||!Le?()=>{}:()=>{var P;Ie(),(P=p.onDismiss)==null||P.call(p,p)},className:Qo($==null?void 0:$.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=ie==null?void 0:ie.close)!=null?i:cme):null,p.jsx||_.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:Oe.createElement(Oe.Fragment,null,Ee||p.icon||p.promise?Oe.createElement("div",{"data-icon":"",className:Qo($==null?void 0:$.icon,(a=p==null?void 0:p.classNames)==null?void 0:a.icon)}
vendor: 6,816 bytes, line 586
586,p.promise||p.type==="loading"&&!p.icon?p.icon||St():null,p.type!=="loading"?p.icon||(ie==null?void 0:ie[Ee])||nme(Ee):null):null,Oe.createElement("div",{"data-content":"",className:Qo($==null?void 0:$.content,(o=p==null?void 0:p.classNames)==null?void 0:o.content)},Oe.createElement("div",{"data-title":"",className:Qo($==null?void 0:$.title,(l=p==null?void 0:p.classNames)==null?void 0:l.title)},typeof p.title=="function"?p.title():p.title),p.description?Oe.createElement("div",{"data-description":"",className:Qo(M,lt,$==null?void 0:$.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),_.isValidElement(p.cancel)?p.cancel:p.cancel&&GE(p.cancel)?Oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||j,onClick:P=>{var Ae,je;GE(p.cancel)&&Le&&((je=(Ae=p.cancel).onClick)==null||je.call(Ae,P),Ie())},className:Qo($==null?void 0:$.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,_.isValidElement(p.action)?p.action:p.action&&GE(p.action)?Oe.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||D,onClick:P=>{var Ae,je;GE(p.action)&&((je=(Ae=p.action).onClick)==null||je.call(Ae,P),!P.defaultPrevented&&Ie())},className:Qo($==null?void 0:$.actionButton,(h=p==null?void 0:p.classNames)==null?void 0:h.actionButton)},p.action.label):null))};function H$(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function Ame(n,e){let t={};return[n,e].forEach((r,s)=>{let i=s===1,a=i?"--mobile-offset":"--offset",o=i?bme:xme;function l(u){["top","right","bottom","left"].forEach(d=>{t[`${a}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?t[`${a}-${u}`]=o:t[`${a}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(o)}),t}var Nme=_.forwardRef(function(n,e){let{invert:t,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:a,className:o,offset:l,mobileOffset:u,theme:d="light",richColors:h,duration:f,style:p,visibleToasts:m=yme,toastOptions:g,dir:y=H$(),gap:v=_me,loadingIcon:x,icons:b,containerAriaLabel:E="Notifications",pauseWhenPageIsHidden:S}=n,[k,C]=Oe.useState([]),A=Oe.useMemo(()=>Array.from(new Set([r].concat(k.filter(L=>L.position).map(L=>L.position)))),[k,r]),[T,j]=Oe.useState([]),[D,R]=Oe.useState(!1),[M,N]=Oe.useState(!1),[U,q]=Oe.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=Oe.useRef(null),B=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=Oe.useRef(null),ie=Oe.useRef(!1),ne=Oe.useCallback(L=>{C(te=>{var ae;return(ae=te.find(de=>de.id===L.id))!=null&&ae.delete||fa.dismiss(L.id),te.filter(({id:de})=>de!==L.id)})},[]);return Oe.useEffect(()=>fa.subscribe(L=>{if(L.dismiss){C(te=>te.map(ae=>ae.id===L.id?{...ae,delete:!0}:ae));return}setTimeout(()=>{uF.flushSync(()=>{C(te=>{let ae=te.findIndex(de=>de.id===L.id);return ae!==-1?[...te.slice(0,ae),{...te[ae],...L},...te.slice(ae+1)]:[L,...te]})})})}),[]),Oe.useEffect(()=>{if(d!=="system"){q(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:te})=>{q(te?"dark":"light")})}catch{L.addListener(({matches:ae})=>{try{q(ae?"dark":"light")}catch(de){console.error(de)}})}},[d]),Oe.useEffect(()=>{k.length<=1&&R(!1)},[k]),Oe.useEffect(()=>{let L=te=>{var ae,de;s.every(ue=>te[ue]||te.code===ue)&&(R(!0),(ae=I.current)==null||ae.focus()),te.code==="Escape"&&(document.activeElement===I.current||(de=I.current)!=null&&de.contains(document.activeElement))&&R(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[s]),Oe.useEffect(()=>{if(I.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,ie.current=!1)}},[I.current]),Oe.createElement("section",{ref:e,"aria-label":`${E} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((L,te)=>{var ae;let[de,ue]=L.split("-");return k.length?Oe.createElement("ol",{key:L,dir:y==="auto"?H$():y,tabIndex:-1,ref:I,className:o,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":de,"data-lifted":D&&k.length>1&&!i,"data-x-position":ue,style:{"--front-toast-height":`${((ae=T[0])==null?void 0:ae.height)||0}px`,"--width":`${wme}px`,"--gap":`${v}px`,...p,...Ame(l,u)},onBlur:le=>{ie.current&&!le.currentTarget.contains(le.relatedTarget)&&(ie.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||ie.current||(ie.current=!0,$.current=le.relatedTarget)},onMouseEnter:()=>R(!0),onMouseMove:()=>R(!0),onMouseLeave:()=>{M||R(!1)},onDragEnd:()=>R(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||N(!0)},onPointerUp:()=>N(!1)},k.filter(le=>!le.position&&te===0||le.position===L).map((le,ve)=>{var _e,Ne;return Oe.createElement(Cme,{key:le.id,icons:b,index:ve,toast:le,defaultRichColors:h,duration:(_e=g==null?void 0:g.duration)!=null?_e:f,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:t,visibleToasts:m,closeButton:(Ne=g==null?void 0:g.closeButton)!=null?Ne:a,interacting:M,position:L,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:ne,toasts:k.filter(Pe=>Pe.position==le.position),heights:T.filter(Pe=>Pe.position==le.position),setHeights:j,expandByDefault:i,gap:v,loadingIcon:x,expanded:D,pauseWhenPageIsHidden:S,swipeDirections:n.swipeDirections})})):null}))});const Tme=({...n})=>{const{theme:e="system"}=tK();return c.jsx(Nme,{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"}},...n})};var jme=BN[" useId ".trim().toString()]||(()=>{}),Rme=0;function Ja(n){const[e,t]=_.useState(jme());return Dr(()=>{n||t(r=>r??String(Rme++))},[n]),n||(e?`radix-${e}
586`:"")}const Pme=["top","right","bottom","left"],hf=Math.min,Wa=Math.max,A2=Math.round,KE=Math.floor,Bc=n=>({x:n,y:n}),Dme={left:"right",right:"left",bottom:"top",top:"bottom"},Ome={start:"end",end:"start"};function DO(n,e,t){return Wa(n,hf(e,t))}function dd(n,e){return typeof n=="function"?n(e):n}function hd(n){return n.split("-")[0]}function y0(n){return n.split("-")[1]}function CF(n){return n==="x"?"y":"x"}function AF(n){return n==="y"?"height":"width"}const Mme=new Set(["top","bottom"]);function Dc(n){return Mme.has(hd(n))?"y":"x"}function NF(n){return CF(Dc(n))}function Ime(n,e,t){t===void 0&&(t=!1);const r=y0(n),s=NF(n),i=AF(s);let a=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=N2(a)),[a,N2(a)]}function Lme(n){const e=N2(n);return[OO(n),e,OO(e)]}function OO(n){return n.replace(/start|end/g,e=>Ome[e])}const W$=["left","right"],q$=["right","left"],Fme=["top","bottom"],Bme=["bottom","top"];function zme(n,e,t){switch(n){case"top":case"bottom":return t?e?q$:W$:e?W$:q$;case"left":case"right":return e?Fme:Bme;default:return[]}}function $me(n,e,t,r){const s=y0(n);let i=zme(hd(n),t==="start",r);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(OO)))),i}function N2(n){return n.replace(/left|right|bottom|top/g,e=>Dme[e])}function Ume(n){return{top:0,right:0,bottom:0,left:0,...n}}function nK(n){return typeof n!="number"?Ume(n):{top:n,right:n,bottom:n,left:n}}function T2(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function G$(n,e,t){let{reference:r,floating:s}=n;const i=Dc(e),a=NF(e),o=AF(a),l=hd(e),u=i==="y",d=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,f=r[o]/2-s[o]/2;let p;switch(l){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-s.width,y:h};break;default:p={x:r.x,y:r.y}}switch(y0(e)){case"start":p[a]-=f*(t&&u?-1:1);break;case"end":p[a]+=f*(t&&u?-1:1);break}return p}const Vme=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=t,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:n,floating:e,strategy:s}),{x:d,y:h}=G$(u,r,l),f=r,p={},m=0;for(let g=0;g<o.length;g++){const{name:y,fn:v}=o[g],{x,y:b,data:E,reset:S}=await v({x:d,y:h,initialPlacement:r,placement:f,strategy:s,middlewareData:p,rects:u,platform:a,elements:{reference:n,floating:e}});d=x??d,h=b??h,p={...p,[y]:{...p[y],...E}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(u=S.rects===!0?await a.getElementRects({reference:n,floating:e,strategy:s}):S.rects),{x:d,y:h}=G$(u,f,l)),g=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function c1(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:a,elements:o,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=dd(e,n),m=nK(p),y=o[f?h==="floating"?"reference":"floating":h],v=T2(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),x=h==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),E=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},S=T2(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:x,offsetParent:b,strategy:l}):x);return{top:(v.top-S.top+m.top)/E.y,bottom:(S.bottom-v.bottom+m.bottom)/E.y,left:(v.left-S.left+m.left)/E.x,right:(S.right-v.right+m.right)/E.x}}const Hme=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:i,platform:a,elements:o,middlewareData:l}=e,{element:u,padding:d=0}=dd(n,e)||{};if(u==null)return{};const h=nK(d),f={x:t,y:r},p=NF(s),m=AF(p),g=await a.getDimensions(u),y=p==="y",v=y?"top":"left",x=y?"bottom":"right",b=y?"clientHeight":"clientWidth",E=i.reference[m]+i.reference[p]-f[p]-i.floating[m],S=f[p]-i.reference[p],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let C=k?k[b]:0;(!C||!await(a.isElement==null?void 0:a.isElement(k)))&&(C=o.floating[b]||i.floating[m]);const A=E/2-S/2,T=C/2-g[m]/2-1,j=hf(h[v],T),D=hf(h[x],T),R=j,M=C-g[m]-D,N=C/2-g[m]/2+A,U=DO(R,N,M),q=!l.arrow&&y0(s)!=null&&N!==U&&i.reference[m]/2-(N<R?j:D)-g[m]/2<0,I=q?N<R?N-R:N-M:0;return{[p]:f[p]+I,data:{[p]:U,centerOffset:N-U-I,...q&&{alignmentOffset:I}},reset:q}}}),Wme=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=dd(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const v=hd(s),x=Dc(o),b=hd(o)===o,E=await(l.isRTL==null?void 0:l.isRTL(u.floating)),S=f||(b||!g?[N2(o)]:Lme(o)),k=m!=="none";!f&&k&&S.push(...$me(o,g,m,E));const C=[o,...S],A=await c1(e,y),T=[];let j=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&T.push(A[v]),h){const N=Ime(s,a,E);T.push(A[N[0]],A[N[1]])}if(j=[...j,{placement:s,overflows:T}],!T.every(N=>N<=0)){var D,R;const N=(((D=i.flip)==null?void 0:D.index)||0)+1,U=C[N];if(U&&(!(h==="alignment"?x!==Dc(U):!1)||j.every(B=>B.overflows[0]>0&&Dc(B.placement)===x)))return{data:{index:N,overflows:j},reset:{placement:U}};let q=(R=j.filter(I=>I.overflows[0]<=0).sort((I,B)=>I.overflows[1]-B.overflows[1])[0])==null?void 0:R.placement;if(!q)switch(p){case"bestFit":{var M;
vendor: 13,714 bytes, line 586
586const I=(M=j.filter(B=>{if(k){const $=Dc(B.placement);return $===x||$==="y"}return!0}).map(B=>[B.placement,B.overflows.filter($=>$>0).reduce(($,ie)=>$+ie,0)]).sort((B,$)=>B[1]-$[1])[0])==null?void 0:M[0];I&&(q=I);break}case"initialPlacement":q=o;break}if(s!==q)return{reset:{placement:q}}}return{}}}};function K$(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Y$(n){return Pme.some(e=>n[e]>=0)}const qme=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...s}=dd(n,e);switch(r){case"referenceHidden":{const i=await c1(e,{...s,elementContext:"reference"}),a=K$(i,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Y$(a)}}}case"escaped":{const i=await c1(e,{...s,altBoundary:!0}),a=K$(i,t.floating);return{data:{escapedOffsets:a,escaped:Y$(a)}}}default:return{}}}}},rK=new Set(["left","top"]);async function Gme(n,e){const{placement:t,platform:r,elements:s}=n,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=hd(t),o=y0(t),l=Dc(t)==="y",u=rK.has(a)?-1:1,d=i&&l?-1:1,h=dd(e,n);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof m=="number"&&(p=o==="end"?m*-1:m),l?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const Kme=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:i,placement:a,middlewareData:o}=e,l=await Gme(e,n);return a===((t=o.offset)==null?void 0:t.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:a}}}}},Yme=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:o={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...l}=dd(n,e),u={x:t,y:r},d=await c1(e,l),h=Dc(hd(s)),f=CF(h);let p=u[f],m=u[h];if(i){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=p+d[y],b=p-d[v];p=DO(x,p,b)}if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=m+d[y],b=m-d[v];m=DO(x,m,b)}const g=o.fn({...e,[f]:p,[h]:m});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:i,[h]:a}}}}}},Xme=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:s,rects:i,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=dd(n,e),d={x:t,y:r},h=Dc(s),f=CF(h);let p=d[f],m=d[h];const g=dd(o,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const b=f==="y"?"height":"width",E=i.reference[f]-i.floating[b]+y.mainAxis,S=i.reference[f]+i.reference[b]-y.mainAxis;p<E?p=E:p>S&&(p=S)}if(u){var v,x;const b=f==="y"?"width":"height",E=rK.has(hd(s)),S=i.reference[h]-i.floating[b]+(E&&((v=a.offset)==null?void 0:v[h])||0)+(E?0:y.crossAxis),k=i.reference[h]+i.reference[b]+(E?0:((x=a.offset)==null?void 0:x[h])||0)-(E?y.crossAxis:0);m<S?m=S:m>k&&(m=k)}return{[f]:p,[h]:m}}}},Zme=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:s,rects:i,platform:a,elements:o}=e,{apply:l=()=>{},...u}=dd(n,e),d=await c1(e,u),h=hd(s),f=y0(s),p=Dc(s)==="y",{width:m,height:g}=i.floating;let y,v;h==="top"||h==="bottom"?(y=h,v=f===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(v=h,y=f==="end"?"top":"bottom");const x=g-d.top-d.bottom,b=m-d.left-d.right,E=hf(g-d[y],x),S=hf(m-d[v],b),k=!e.middlewareData.shift;let C=E,A=S;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(A=b),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=x),k&&!f){const j=Wa(d.left,0),D=Wa(d.right,0),R=Wa(d.top,0),M=Wa(d.bottom,0);p?A=m-2*(j!==0||D!==0?j+D:Wa(d.left,d.right)):C=g-2*(R!==0||M!==0?R+M:Wa(d.top,d.bottom))}await l({...e,availableWidth:A,availableHeight:C});const T=await a.getDimensions(o.floating);return m!==T.width||g!==T.height?{reset:{rects:!0}}:{}}}};function lT(){return typeof window<"u"}function x0(n){return sK(n)?(n.nodeName||"").toLowerCase():"#document"}function Qa(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Yc(n){var e;return(e=(sK(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function sK(n){return lT()?n instanceof Node||n instanceof Qa(n).Node:!1}function Kl(n){return lT()?n instanceof Element||n instanceof Qa(n).Element:!1}function qc(n){return lT()?n instanceof HTMLElement||n instanceof Qa(n).HTMLElement:!1}function X$(n){return!lT()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Qa(n).ShadowRoot}const Jme=new Set(["inline","contents"]);function RS(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=Yl(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!Jme.has(s)}const Qme=new Set(["table","td","th"]);function ege(n){return Qme.has(x0(n))}const tge=[":popover-open",":modal"];function cT(n){return tge.some(e=>{try{return n.matches(e)}catch{return!1}})}const nge=["transform","translate","scale","rotate","perspective"],rge=["transform","translate","scale","rotate","perspective","filter"],sge=["paint","layout","strict","content"];function TF(n){const e=jF(),t=Kl(n)?Yl(n):n;return nge.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||rge.some(r=>(t.willChange||"").includes(r))||sge.some(r=>(t.contain||"").includes(r))}function ige(n){let e=ff(n);for(;qc(e)&&!Lx(e);){if(TF(e))return e;if(cT(e))return null;e=ff(e)}return null}function jF(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const age=new Set(["html","body","#document"]);function Lx(n){return age.has(x0(n))}function Yl(n){return Qa(n).getComputedStyle(n)}function uT(n){return Kl(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ff(n){if(x0(n)==="html")return n;const e=n.assignedSlot||n.parentNode||X$(n)&&n.host||Yc(n);return X$(e)?e.host:e}function iK(n){const e=ff(n);return Lx(e)?n.ownerDocument?n.ownerDocument.body:n.body:qc(e)&&RS(e)?e:iK(e)}function u1(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=iK(n),i=s===((r=n.ownerDocument)==null?void 0:r.body),a=Qa(s);if(i){const o=MO(a);return e.concat(a,a.visualViewport||[],RS(s)?s:[],o&&t?u1(o):[])}return e.concat(s,u1(s,[],t))}function MO(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function aK(n){const e=Yl(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=qc(n),i=s?n.offsetWidth:t,a=s?n.offsetHeight:r,o=A2(t)!==i||A2(r)!==a;return o&&(t=i,r=a),{width:t,height:r,$:o}}function RF(n){return Kl(n)?n:n.contextElement}function ay(n){const e=RF(n);if(!qc(e))return Bc(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:i}=aK(e);let a=(i?A2(t.width):t.width)/r,o=(i?A2(t.height):t.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const oge=Bc(0);function oK(n){const e=Qa(n);return!jF()||!e.visualViewport?oge:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lge(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Qa(n)?!1:e}function Km(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),i=RF(n);let a=Bc(1);e&&(r?Kl(r)&&(a=ay(r)):a=ay(n));const o=lge(i,t,r)?oK(i):Bc(0);let l=(s.left+o.x)/a.x,u=(s.top+o.y)/a.y,d=s.width/a.x,h=s.height/a.y;if(i){const f=Qa(i),p=r&&Kl(r)?Qa(r):r;let m=f,g=MO(m);for(;g&&r&&p!==m;){const y=ay(g),v=g.getBoundingClientRect(),x=Yl(g),b=v.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,E=v.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,h*=y.y,l+=b,u+=E,m=Qa(g),g=MO(m)}}return T2({width:d,height:h,x:l,y:u})}function PF(n,e){const t=uT(n).scrollLeft;return e?e.left+t:Km(Yc(n)).left+t}function lK(n,e,t){t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=r.left+e.scrollLeft-(t?0:PF(n,r)),i=r.top+e.scrollTop;return{x:s,y:i}}function cge(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const i=s==="fixed",a=Yc(r),o=e?cT(e.floating):!1;if(r===a||o&&i)return t;let l={scrollLeft:0,scrollTop:0},u=Bc(1);const d=Bc(0),h=qc(r);if((h||!h&&!i)&&((x0(r)!=="body"||RS(a))&&(l=uT(r)),qc(r))){const p=Km(r);u=ay(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const f=a&&!h&&!i?lK(a,l,!0):Bc(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+d.x+f.x,y:t.y*u.y-l.scrollTop*u.y+d.y+f.y}}function uge(n){return Array.from(n.getClientRects())}function dge(n){const e=Yc(n),t=uT(n),r=n.ownerDocument.body,s=Wa(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Wa(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-t.scrollLeft+PF(n);const o=-t.scrollTop;return Yl(r).direction==="rtl"&&(a+=Wa(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:o}}function hge(n,e){const t=Qa(n),r=Yc(n),s=t.visualViewport;let i=r.clientWidth,a=r.clientHeight,o=0,l=0;if(s){i=s.width,a=s.height;const u=jF();(!u||u&&e==="fixed")&&(o=s.offsetLeft,l=s.offsetTop)}return{width:i,height:a,x:o,y:l}}const fge=new Set(["absolute","fixed"]);function pge(n,e){const t=Km(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,i=qc(n)?ay(n):Bc(1),a=n.clientWidth*i.x,o=n.clientHeight*i.y,l=s*i.x,u=r*i.y;return{width:a,height:o,x:l,y:u}}function Z$(n,e,t){let r;if(e==="viewport")r=hge(n,t);else if(e==="document")r=dge(Yc(n));else if(Kl(e))r=pge(e,t);else{const s=oK(n);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return T2(r)}function cK(n,e){const t=ff(n);return t===e||!Kl(t)||Lx(t)?!1:Yl(t).position==="fixed"||cK(t,e)}function mge(n,e){const t=e.get(n);if(t)return t;let r=u1(n,[],!1).filter(o=>Kl(o)&&x0(o)!=="body"),s=null;const i=Yl(n).position==="fixed";let a=i?ff(n):n;for(;Kl(a)&&!Lx(a);){const o=Yl(a),l=TF(a);!l&&o.position==="fixed"&&(s=null),(i?!l&&!s:!l&&o.position==="static"&&!!s&&fge.has(s.position)||RS(a)&&!l&&cK(n,a))?r=r.filter(d=>d!==a):s=o,a=ff(a)}return e.set(n,r),r}function gge(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const a=[...t==="clippingAncestors"?cT(e)?[]:mge(e,this._c):[].concat(t),r],o=a[0],l=a.reduce((u,d)=>{const h=Z$(e,d,s);return u.top=Wa(h.top,u.top),u.right=hf(h.right,u.right),u.bottom=hf(h.bottom,u.bottom),u.left=Wa(h.left,u.left),u},Z$(e,o,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function vge(n){const{width:e,height:t}=aK(n);return{width:e,height:t}}function yge(n,e,t){const r=qc(e),s=Yc(e),i=t==="fixed",a=Km(n,!0,i,e);let o={scrollLeft:0,scrollTop:0};const l=Bc(0);function u(){l.x=PF(s)}if(r||!r&&!i)if((x0(e)!=="body"||RS(s))&&(o=uT(e)),r){const p=Km(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&u();i&&!r&&s&&u();const d=s&&!r&&!i?lK(s,o):Bc(0),h=a.left+o.scrollLeft-l.x-d.x,f=a.top+o.scrollTop-l.y-d.y;return{x:h,y:f,width:a.width,height:a.height}}function TR(n){return Yl(n).position==="static"}function J$(n,e){if(!qc(n)||Yl(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Yc(n)===t&&(t=t.ownerDocument.body),t}function uK(n,e){const t=Qa(n);if(cT(n))return t;if(!qc(n)){let s=ff(n);for(;s&&!Lx(s);){if(Kl(s)&&!TR(s))return s;s=ff(s)}return t}let r=J$(n,e);for(;r&&ege(r)&&TR(r);)r=J$(r,e);return r&&Lx(r)&&TR(r)&&!TF(r)?t:r||ige(n)||t}const xge=async function(n){const e=this.getOffsetParent||uK,t=this.getDimensions,r=await t(n.floating);return{reference:yge(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bge(n){return Yl(n).direction==="rtl"}const wge={convertOffsetParentRelativeRectToViewportRelativeRect:cge,getDocumentElement:Yc,getClippingRect:gge,getOffsetParent:uK,getElementRects:xge,getClientRects:uge,getDimensions:vge,getScale:ay,isElement:Kl,isRTL:bge};function dK(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function _ge(n,e){let t=null,r;const s=Yc(n);function i(){var o;clearTimeout(r),(o=t)==null||o.disconnect(),t=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const u=n.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(o||e(),!f||!p)return;const m=KE(h),g=KE(s.clientWidth-(d+f)),y=KE(s.clientHeight-(h+p)),v=KE(d),b={rootMargin:-m+"px "+-g+"px "+-y+"px "+-v+"px",threshold:Wa(0,hf(1,l))||1};let E=!0;function S(k){const C=k[0].intersectionRatio;if(C!==l){if(!E)return a();C?a(!1,C):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C===1&&!dK(u,n.getBoundingClientRect())&&a(),E=!1}try{t=new IntersectionObserver(S,{...b,root:s.ownerDocument})}catch{t=new IntersectionObserver(S,b)}t.observe(n)}return a(!0),i}function Sge(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=RF(n),d=s||i?[...u?u1(u):[],...u1(e)]:[];d.forEach(v=>{s&&v.addEventListener("scroll",t,{passive:!0}),i&&v.addEventListener("resize",t)});const h=u&&o?_ge(u,t):null;let f=-1,p=null;a&&(p=new ResizeObserver(v=>{let[x]=v;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(e)})),t()}),u&&!l&&p.observe(u),p.observe(e));let m,g=l?Km(n):null;l&&y();function y(){const v=Km(n);g&&!dK(g,v)&&t(),g=v,m=requestAnimationFrame(y)}return t(),()=>{var v;d.forEach(x=>{s&&x.removeEventListener("scroll",t),i&&x.removeEventListener("resize",t)}),h==null||h(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const Ege=Kme,kge=Yme,Cge=Wme,Age=Zme,Nge=qme,Q$=Hme,Tge=Xme,jge=(n,e,t)=>{const r=new Map,s={platform:wge,...t},i={...s.platform,_c:r};return Vme(n,e,{...s,platform:i})};var Rge=typeof document<"u",Pge=function(){},Yk=Rge?_.useLayoutEffect:Pge;function j2(n,e){if(n===e)return!0;
vendor: 4,317 bytes, line 586
586if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!j2(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&n.$$typeof)&&!j2(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function hK(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function e6(n,e){const t=hK(n);return Math.round(e*t)/t}function jR(n){const e=_.useRef(n);return Yk(()=>{e.current=n}),e}function Dge(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:o=!0,whileElementsMounted:l,open:u}=n,[d,h]=_.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);j2(f,r)||p(r);const[m,g]=_.useState(null),[y,v]=_.useState(null),x=_.useCallback(B=>{B!==k.current&&(k.current=B,g(B))},[]),b=_.useCallback(B=>{B!==C.current&&(C.current=B,v(B))},[]),E=i||m,S=a||y,k=_.useRef(null),C=_.useRef(null),A=_.useRef(d),T=l!=null,j=jR(l),D=jR(s),R=jR(u),M=_.useCallback(()=>{if(!k.current||!C.current)return;const B={placement:e,strategy:t,middleware:f};D.current&&(B.platform=D.current),jge(k.current,C.current,B).then($=>{const ie={...$,isPositioned:R.current!==!1};N.current&&!j2(A.current,ie)&&(A.current=ie,wg.flushSync(()=>{h(ie)}))})},[f,e,t,D,R]);Yk(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[u]);const N=_.useRef(!1);Yk(()=>(N.current=!0,()=>{N.current=!1}),[]),Yk(()=>{if(E&&(k.current=E),S&&(C.current=S),E&&S){if(j.current)return j.current(E,S,M);M()}},[E,S,M,j,T]);const U=_.useMemo(()=>({reference:k,floating:C,setReference:x,setFloating:b}),[x,b]),q=_.useMemo(()=>({reference:E,floating:S}),[E,S]),I=_.useMemo(()=>{const B={position:t,left:0,top:0};if(!q.floating)return B;const $=e6(q.floating,d.x),ie=e6(q.floating,d.y);return o?{...B,transform:"translate("+$+"px, "+ie+"px)",...hK(q.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:$,top:ie}},[t,o,q.floating,d.x,d.y]);return _.useMemo(()=>({...d,update:M,refs:U,elements:q,floatingStyles:I}),[d,M,U,q,I])}const Oge=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?Q$({element:r.current,padding:s}).fn(t):{}:r?Q$({element:r,padding:s}).fn(t):{}}}},Mge=(n,e)=>({...Ege(n),options:[n,e]}),Ige=(n,e)=>({...kge(n),options:[n,e]}),Lge=(n,e)=>({...Tge(n),options:[n,e]}),Fge=(n,e)=>({...Cge(n),options:[n,e]}),Bge=(n,e)=>({...Age(n),options:[n,e]}),zge=(n,e)=>({...Nge(n),options:[n,e]}),$ge=(n,e)=>({...Oge(n),options:[n,e]});var Uge="Arrow",fK=_.forwardRef((n,e)=>{const{children:t,width:r=10,height:s=5,...i}=n;return c.jsx(st.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});fK.displayName=Uge;var Vge=fK;function PS(n){const[e,t]=_.useState(void 0);return Dr(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,o;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,o=u.blockSize}else a=n.offsetWidth,o=n.offsetHeight;t({width:a,height:o})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var DF="Popper",[pK,jf]=Hr(DF),[Hge,mK]=pK(DF),gK=n=>{const{__scopePopper:e,children:t}=n,[r,s]=_.useState(null);return c.jsx(Hge,{scope:e,anchor:r,onAnchorChange:s,children:t})};gK.displayName=DF;var vK="PopperAnchor",yK=_.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...s}=n,i=mK(vK,t),a=_.useRef(null),o=Ct(e,a);return _.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:c.jsx(st.div,{...s,ref:o})});yK.displayName=vK;var OF="PopperContent",[Wge,qge]=pK(OF),xK=_.forwardRef((n,e)=>{var le,ve,_e,Ne,Pe,Se;const{__scopePopper:t,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l
vendor: 4,693 bytes, line 586
586=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...g}=n,y=mK(OF,t),[v,x]=_.useState(null),b=Ct(e,Ce=>x(Ce)),[E,S]=_.useState(null),k=PS(E),C=(k==null?void 0:k.width)??0,A=(k==null?void 0:k.height)??0,T=r+(i!=="center"?"-"+i:""),j=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},D=Array.isArray(u)?u:[u],R=D.length>0,M={padding:j,boundary:D.filter(Kge),altBoundary:R},{refs:N,floatingStyles:U,placement:q,isPositioned:I,middlewareData:B}=Dge({strategy:"fixed",placement:T,whileElementsMounted:(...Ce)=>Sge(...Ce,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[Mge({mainAxis:s+A,alignmentAxis:a}),l&&Ige({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Lge():void 0,...M}),l&&Fge({...M}),Bge({...M,apply:({elements:Ce,rects:O,availableWidth:X,availableHeight:ee})=>{const{width:V,height:H}=O.reference,se=Ce.floating.style;se.setProperty("--radix-popper-available-width",`${X}px`),se.setProperty("--radix-popper-available-height",`${ee}px`),se.setProperty("--radix-popper-anchor-width",`${V}px`),se.setProperty("--radix-popper-anchor-height",`${H}px`)}}),E&&$ge({element:E,padding:o}),Yge({arrowWidth:C,arrowHeight:A}),f&&zge({strategy:"referenceHidden",...M})]}),[$,ie]=_K(q),ne=Pr(m);Dr(()=>{I&&(ne==null||ne())},[I,ne]);const L=(le=B.arrow)==null?void 0:le.x,te=(ve=B.arrow)==null?void 0:ve.y,ae=((_e=B.arrow)==null?void 0:_e.centerOffset)!==0,[de,ue]=_.useState();return Dr(()=>{v&&ue(window.getComputedStyle(v).zIndex)},[v]),c.jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:I?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(Ne=B.transformOrigin)==null?void 0:Ne.x,(Pe=B.transformOrigin)==null?void 0:Pe.y].join(" "),...((Se=B.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:c.jsx(Wge,{scope:t,placedSide:$,onArrowChange:S,arrowX:L,arrowY:te,shouldHideArrow:ae,children:c.jsx(st.div,{"data-side":$,"data-align":ie,...g,ref:b,style:{...g.style,animation:I?void 0:"none"}})})})});xK.displayName=OF;var bK="PopperArrow",Gge={top:"bottom",right:"left",bottom:"top",left:"right"},wK=_.forwardRef(function(e,t){const{__scopePopper:r,...s}=e,i=qge(bK,r),a=Gge[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]: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:c.jsx(Vge,{...s,ref:t,style:{...s.style,display:"block"}})})});wK.displayName=bK;function Kge(n){return n!==null}var Yge=n=>({name:"transformOrigin",options:n,fn(e){var y,v,x;const{placement:t,rects:r,middlewareData:s}=e,a=((y=s.arrow)==null?void 0:y.centerOffset)!==0,o=a?0:n.arrowWidth,l=a?0:n.arrowHeight,[u,d]=_K(t),h={start:"0%",center:"50%",end:"100%"}[d],f=(((v=s.arrow)==null?void 0:v.x)??0)+o/2,p=(((x=s.arrow)==null?void 0:x.y)??0)+l/2;let m="",g="";return u==="bottom"?(m=a?h:`${f}px`,g=`${-l}px`):u==="top"?(m=a?h:`${f}px`,g=`${r.floating.height+l}px`):u==="right"?(m=`${-l}px`,g=a?h:`${p}px`):u==="left"&&(m=`${r.floating.width+l}px`,g=a?h:`${p}px`),{data:{x:m,y:g}}}});function _K(n){const[e,t="center"]=n.split("-");return[e,t]}var dT=gK,DS=yK,hT=xK,fT=wK,[pT,zqe]=Hr("Tooltip",[jf]),mT=jf(),SK="TooltipProvider",Xge=700,IO="tooltip.open",[Zge,MF]=pT(SK),EK=n=>{const{__scopeTooltip:e,delayDuration:t=Xge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=n,a=_.useRef(!0),o=_.useRef(!1),l=_.useRef(0);return _.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(Zge,{scope:e,isOpenDelayedRef:a,delayDuration:t,onOpen:_.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:_.useCallback(u=>{o.current=u},[]),disableHoverableContent:s,children:i})};EK.displayName=SK;var d1="Tooltip",[Jge,gT]=pT(d1),kK=n=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=n,l=MF(d1,n.__scopeTooltip),u=mT(e),[d,h]=_.useState(null),f=Ja(),p=_.useRef(0),m=a??l.disableHoverableContent,g=o??l.delayDuration,y=_.useRef(!1),[v,x]=Zi({prop:r,defaultProp:s??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(IO))):l.onClose(),i==null||i(C)}
vendor: 6,548 bytes, line 586
586,caller:d1}),b=_.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),E=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,x(!0)},[x]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),k=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,x(!0),p.current=0},g)},[g,x]);return _.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(dT,{...u,children:c.jsx(Jge,{scope:e,contentId:f,open:v,stateAttribute:b,trigger:d,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{l.isOpenDelayedRef.current?k():E()},[l.isOpenDelayedRef,k,E]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:E,onClose:S,disableHoverableContent:m,children:t})})};kK.displayName=d1;var LO="TooltipTrigger",CK=_.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,s=gT(LO,t),i=MF(LO,t),a=mT(t),o=_.useRef(null),l=Ct(e,o,s.onTriggerChange),u=_.useRef(!1),d=_.useRef(!1),h=_.useCallback(()=>u.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),c.jsx(DS,{asChild:!0,...a,children:c.jsx(st.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:$e(n.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:$e(n.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:$e(n.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:$e(n.onFocus,()=>{u.current||s.onOpen()}),onBlur:$e(n.onBlur,s.onClose),onClick:$e(n.onClick,s.onClose)})})});CK.displayName=LO;var Qge="TooltipPortal",[$qe,eve]=pT(Qge,{forceMount:void 0}),Fx="TooltipContent",AK=_.forwardRef((n,e)=>{const t=eve(Fx,n.__scopeTooltip),{forceMount:r=t.forceMount,side:s="top",...i}=n,a=gT(Fx,n.__scopeTooltip);return c.jsx(ss,{present:r||a.open,children:a.disableHoverableContent?c.jsx(NK,{side:s,...i,ref:e}):c.jsx(tve,{side:s,...i,ref:e})})}),tve=_.forwardRef((n,e)=>{const t=gT(Fx,n.__scopeTooltip),r=MF(Fx,n.__scopeTooltip),s=_.useRef(null),i=Ct(e,s),[a,o]=_.useState(null),{trigger:l,onClose:u}=t,d=s.current,{onPointerInTransitChange:h}=r,f=_.useCallback(()=>{o(null),h(!1)},[h]),p=_.useCallback((m,g)=>{const y=m.currentTarget,v={x:m.clientX,y:m.clientY},x=ave(v,y.getBoundingClientRect()),b=ove(v,x),E=lve(g.getBoundingClientRect()),S=uve([...b,...E]);o(S),h(!0)},[h]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(l&&d){const m=y=>p(y,d),g=y=>p(y,l);return l.addEventListener("pointerleave",m),d.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",g)}}},[l,d,p,f]),_.useEffect(()=>{if(a){const m=g=>{const y=g.target,v={x:g.clientX,y:g.clientY},x=(l==null?void 0:l.contains(y))||(d==null?void 0:d.contains(y)),b=!cve(v,a);x?f():b&&(f(),u())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,d,a,u,f]),c.jsx(NK,{...n,ref:i})}),[nve,rve]=pT(d1,{isInside:!1}),sve=rG("TooltipContent"),NK=_.forwardRef((n,e)=>{const{__scopeTooltip:t,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...o}=n,l=gT(Fx,t),u=mT(t),{onClose:d}=l;return _.useEffect(()=>(document.addEventListener(IO,d),()=>document.removeEventListener(IO,d)),[d]),_.useEffect(()=>{if(l.trigger){const h=f=>{const p=f.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),c.jsx(_g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:c.jsxs(hT,{"data-state":l.stateAttribute,...u,...o,ref:e,style:{...o.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:[c.jsx(sve,{children:r}),c.jsx(nve,{scope:t,isInside:!0,children:c.jsx(lfe,{id:l.contentId,role:"tooltip",children:s||r})})]})})});AK.displayName=Fx;var TK="TooltipArrow",ive=_.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,s=mT(t);return rve(TK,t).isInside?null:c.jsx(fT,{...s,...r,ref:e})});ive.displayName=TK;function ave(n,e){const t=Math.abs(e.top-n.y),r=Math.abs(e.bottom-n.y),s=Math.abs(e.right-n.x),i=Math.abs(e.left-n.x);switch(Math.min(t,r,s,i)){case i:return"left";case s:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ove(n,e,t=5){const r=[];switch(e){case"top":r.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":r.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":r.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":r.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return r}function lve(n){const{top:e,right:t,bottom:r,left:s}=n;return[{x:s,y:e},{x:t,y:e},{x:t,y:r},{x:s,y:r}]}function cve(n,e){const{x:t,y:r}=n;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const o=e[i],l=e[a],u=o.x,d=o.y,h=l.x,f=l.y;d>r!=f>r&&t<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function uve(n){const e=n.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),dve(e)}function dve(n){if(n.length<=1)return n.slice();const e=[];for(let r=0;r<n.length;r++){const s=n[r];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const t=[];for(let r=n.length-1;r>=0;r--){const s=n[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var hve=EK,fve=kK,pve=CK,jK=AK;const RK=hve,mve=fve,gve=pve,PK=_.forwardRef(({className:n,sideOffset:e=4,...t},r)=>c.jsx(jK,{ref:r,sideOffset:e,className:ke("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]:sli
586de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...t}));PK.displayName=jK.displayName;var b0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ym=typeof window>"u"||"Deno"in globalThis;function Ii(){}function vve(n,e){return typeof n=="function"?n(e):n}function FO(n){return typeof n=="number"&&n>=0&&n!==1/0}function DK(n,e){return Math.max(n+(e||0)-Date.now(),0)}function Qh(n,e){return typeof n=="function"?n(e):n}function So(n,e){return typeof n=="function"?n(e):n}function t6(n,e){const{type:t="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=n;if(a){if(r){if(e.queryHash!==IF(a,e.options))return!1}else if(!h1(e.queryKey,a))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||s&&s!==e.state.fetchStatus||i&&!i(e))}function n6(n,e){const{exact:t,status:r,predicate:s,mutationKey:i}=n;if(i){if(!e.options.mutationKey)return!1;if(t){if(Xm(e.options.mutationKey)!==Xm(i))return!1}else if(!h1(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function IF(n,e){return((e==null?void 0:e.queryKeyHashFn)||Xm)(n)}function Xm(n){return JSON.stringify(n,(e,t)=>BO(t)?Object.keys(t).sort().reduce((r,s)=>(r[s]=t[s],r),{}):t)}function h1(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?Object.keys(e).every(t=>h1(n[t],e[t])):!1}function OK(n,e){if(n===e)return n;const t=r6(n)&&r6(e);if(t||BO(n)&&BO(e)){const r=t?n:Object.keys(n),s=r.length,i=t?e:Object.keys(e),a=i.length,o=t?[]:{},l=new Set(r);let u=0;for(let d=0;d<a;d++){const h=t?d:i[d];(!t&&l.has(h)||t)&&n[h]===void 0&&e[h]===void 0?(o[h]=void 0,u++):(o[h]=OK(n[h],e[h]),o[h]===n[h]&&n[h]!==void 0&&u++)}return s===a&&u===s?n:o}return e}function R2(n,e){if(!e||Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(n[t]!==e[t])return!1;return!0}function r6(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function BO(n){if(!s6(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!s6(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function s6(n){return Object.prototype.toString.call(n)==="[object Object]"}function yve(n){return new Promise(e=>{setTimeout(e,n)})}function zO(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?OK(n,e):e}function xve(n,e,t=0){const r=[...n,e];return t&&r.length>t?r.slice(1):r}function bve(n,e,t=0){const r=[e,...n];return t&&r.length>t?r.slice(0,-1):r}var LF=Symbol();function MK(n,e){return!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===LF?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function IK(n,e){return typeof n=="function"?n(...e):!!n}var Ap,th,by,Eq,wve=(Eq=class extends b0{constructor(){super();G(this,Ap);G(this,th);G(this,by);F(this,by,e=>{if(!Ym&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){w(this,th)||this.setEventListener(w(this,by))}onUnsubscribe(){var e;this.hasListeners()||((e=w(this,th))==null||e.call(this),F(this,th,void 0))}setEventListener(e){var t;F(this,by,e),(t=w(this,th))==null||t.call(this),F(this,th,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){w(this,Ap)!==e&&(F(this,Ap,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof w(this,Ap)=="boolean"?w(this,Ap):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ap=new WeakMap,th=new WeakMap,by=new WeakMap,Eq),FF=new wve,wy,nh,_y,kq,_ve=(kq=class extends b0{constructor(){super();G(this,wy,!0);G(this,nh);G(this,_y);F(this,_y,e=>{if(!Ym&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){w(this,nh)||this.setEventListener(w(this,_y))}onUnsubscribe(){var e;this.hasListeners()||((e=w(this,nh))==null||e.call(this),F(this,nh,void 0))}setEventListener(e){var t;F(this,_y,e),(t=w(this,nh))==null||t.call(this),F(this,nh,e(this.setOnline.bind(this)))}setOnline(e){w(this,wy)!==e&&(F(this,wy,e),this.listeners.forEac
vendor: 31,212 bytes, line 586
586h(r=>{r(e)}))}isOnline(){return w(this,wy)}},wy=new WeakMap,nh=new WeakMap,_y=new WeakMap,kq),P2=new _ve;function $O(){let n,e;const t=new Promise((s,i)=>{n=s,e=i});t.status="pending",t.catch(()=>{});function r(s){Object.assign(t,s),delete t.resolve,delete t.reject}return t.resolve=s=>{r({status:"fulfilled",value:s}),n(s)},t.reject=s=>{r({status:"rejected",reason:s}),e(s)},t}function Sve(n){return Math.min(1e3*2**n,3e4)}function LK(n){return(n??"online")==="online"?P2.isOnline():!0}var FK=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function RR(n){return n instanceof FK}function BK(n){let e=!1,t=0,r=!1,s;const i=$O(),a=g=>{var y;r||(f(new FK(g)),(y=n.abort)==null||y.call(n))},o=()=>{e=!0},l=()=>{e=!1},u=()=>FF.isFocused()&&(n.networkMode==="always"||P2.isOnline())&&n.canRun(),d=()=>LK(n.networkMode)&&n.canRun(),h=g=>{var y;r||(r=!0,(y=n.onSuccess)==null||y.call(n,g),s==null||s(),i.resolve(g))},f=g=>{var y;r||(r=!0,(y=n.onError)==null||y.call(n,g),s==null||s(),i.reject(g))},p=()=>new Promise(g=>{var y;s=v=>{(r||u())&&g(v)},(y=n.onPause)==null||y.call(n)}).then(()=>{var g;s=void 0,r||(g=n.onContinue)==null||g.call(n)}),m=()=>{if(r)return;let g;const y=t===0?n.initialPromise:void 0;try{g=y??n.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(h).catch(v=>{var k;if(r)return;const x=n.retry??(Ym?0:3),b=n.retryDelay??Sve,E=typeof b=="function"?b(t,v):b,S=x===!0||typeof x=="number"&&t<x||typeof x=="function"&&x(t,v);if(e||!S){f(v);return}t++,(k=n.onFail)==null||k.call(n,t,v),yve(E).then(()=>u()?void 0:p()).then(()=>{e?f(v):m()})})};return{promise:i,cancel:a,continue:()=>(s==null||s(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?m():p().then(m),i)}}var Eve=n=>setTimeout(n,0);function kve(){let n=[],e=0,t=o=>{o()},r=o=>{o()},s=Eve;const i=o=>{e?n.push(o):s(()=>{t(o)})},a=()=>{const o=n;n=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{t(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{t=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var vs=kve(),Np,Cq,zK=(Cq=class{constructor(){G(this,Np)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),FO(this.gcTime)&&F(this,Np,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(Ym?1/0:5*60*1e3))}clearGcTimeout(){w(this,Np)&&(clearTimeout(w(this,Np)),F(this,Np,void 0))}},Np=new WeakMap,Cq),Sy,Tp,vo,jp,hi,Q1,Rp,gl,ou,Aq,Cve=(Aq=class extends zK{constructor(e){super();G(this,gl);G(this,Sy);G(this,Tp);G(this,vo);G(this,jp);G(this,hi);G(this,Q1);G(this,Rp);F(this,Rp,!1),F(this,Q1,e.defaultOptions),this.setOptions(e.options),this.observers=[],F(this,jp,e.client),F(this,vo,w(this,jp).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,F(this,Sy,Ave(this.options)),this.state=e.state??w(this,Sy),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=w(this,hi))==null?void 0:e.promise}setOptions(e){this.options={...w(this,Q1),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&w(this,vo).remove(this)}setData(e,t){const r=zO(this.state.data,e,this.options);return W(this,gl,ou).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(e,t){W(this,gl,ou).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var r,s;const t=(r=w(this,hi))==null?void 0:r.promise;return(s=w(this,hi))==null||s.cancel(e),t?t.then(Ii).catch(Ii):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(w(this,Sy))}isActive(){return this.observers.some(e=>So(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===LF||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Qh(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:!DK(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=w(this,hi))==null||t.continue()}onOnline(){var t;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=w(this,hi))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),w(this,vo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(w(this,hi)&&(w(this,Rp)?w(this,hi).cancel({revert:!0}):w(this,hi).cancelRetry()),this.scheduleGc()),w(this,vo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||W(this,gl,ou).call(this,{type:"invalidate"})}fetch(e,t){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(w(this,hi))return w(this,hi).continueRetry(),w(this,hi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(F(this,Rp,!0),r.signal)})},i=()=>{const f=MK(this.options,t),m=(()=>{const g={client:w(this,jp),queryKey:this.queryKey,meta:this.meta};return s(g),g})();return F(this,Rp,!1),this.options.persister?this.options.persister(f,m,this):f(m)},o=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:w(this,jp),state:this.state,fetchFn:i};return s(f),f})();(u=this.options.behavior)==null||u.onFetch(o,this),F(this,Tp,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&W(this,gl,ou).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta});const l=f=>{var p,m,g,y;RR(f)&&f.silent||W(this,gl,ou).call(this,{type:"error",error:f}),RR(f)||((m=(p=w(this,vo).config).onError)==null||m.call(p,f,this),(y=(g=w(this,vo).config).onSettled)==null||y.call(g,this.state.data,f,this)),this.scheduleGc()};return F(this,hi,BK({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,m,g,y;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(v){l(v);return}(m=(p=w(this,vo).config).onSuccess)==null||m.call(p,f,this),(y=(g=w(this,vo).config).onSettled)==null||y.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,p)=>{W(this,gl,ou).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{W(this,gl,ou).call(this,{type:"pause"})},onContinue:()=>{W(this,gl,ou).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),w(this,hi).start()}},Sy=new WeakMap,Tp=new WeakMap,vo=new WeakMap,jp=new WeakMap,hi=new WeakMap,Q1=new WeakMap,Rp=new WeakMap,gl=new WeakSet,ou=function(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...$K(r.data,this.options),fetchMeta:e.meta??null};case"success":return F(this,Tp,void 0),{...r,data:e.data,dataUpdateCount:r.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 RR(s)&&s.revert&&w(this,Tp)?{...w(this,Tp),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),vs.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),w(this,vo).notify({query:this,type:"updated",action:e})})},Aq);function $K(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:LK(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function Ave(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,r=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var uc,Nq,Nve=(Nq=class extends b0{constructor(e={}){super();G(this,uc);this.config=e,F(this,uc,new Map)}build(e,t,r){const s=t.queryKey,i=t.queryHash??IF(s,t);let a=this.get(i);return a||(a=new Cve({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(a)),a}add(e){w(this,uc).has(e.queryHash)||(w(this,uc).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=w(this,uc).get(e.queryHash);t&&(e.destroy(),t===e&&w(this,uc).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){vs.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return w(this,uc).get(e)}getAll(){return[...w(this,uc).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>t6(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>t6(e,r)):t}notify(e){vs.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){vs.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){vs.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},uc=new WeakMap,Nq),dc,Di,Pp,hc,Md,Tq,Tve=(Tq=class extends zK{constructor(e){super();G(this,hc);G(this,dc);G(this,Di);G(this,Pp);this.mutationId=e.mutationId,F(this,Di,e.mutationCache),F(this,dc,[]),this.state=e.state||UK(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){w(this,dc).includes(e)||(w(this,dc).push(e),this.clearGcTimeout(),w(this,Di).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){F(this,dc,w(this,dc).filter(t=>t!==e)),this.scheduleGc(),w(this,Di).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){w(this,dc).length||(this.state.status==="pending"?this.scheduleGc():w(this,Di).remove(this))}continue(){var e;return((e=w(this,Pp))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,a,o,l,u,d,h,f,p,m,g,y,v,x,b,E,S,k,C,A;const t=()=>{W(this,hc,Md).call(this,{type:"continue"})};F(this,Pp,BK({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(T,j)=>{W(this,hc,Md).call(this,{type:"failed",failureCount:T,error:j})},onPause:()=>{W(this,hc,Md).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>w(this,Di).canRun(this)}));const r=this.state.status==="pending",s=!w(this,Pp).canStart();try{if(r)t();else{W(this,hc,Md).call(this,{type:"pending",variables:e,isPaused:s}),await((a=(i=w(this,Di).config).onMutate)==null?void 0:a.call(i,e,this));const j=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,e));j!==this.state.context&&W(this,hc,Md).call(this,{type:"pending",context:j,variables:e,isPaused:s})}const T=await w(this,Pp).start();return await((d=(u=w(this,Di).config).onSuccess)==null?void 0:d.call(u,T,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,T,e,this.state.context)),await((m=(p=w(this,Di).config).onSettled)==null?void 0:m.call(p,T,null,this.state.variables,this.state.context,this)),await((y=(g=this.options).onSettled)==null?void 0:y.call(g,T,null,e,this.state.context)),W(this,hc,Md).call(this,{type:"success",data:T}),T}catch(T){try{throw await((x=(v=w(this,Di).config).onError)==null?void 0:x.call(v,T,e,this.state.context,this)),await((E=(b=this.options).onError)==null?void 0:E.call(b,T,e,this.state.context)),await((k=(S=w(this,Di).config).onSettled)==null?void 0:k.call(S,void 0,T,this.state.variables,this.state.context,this)),await((A=(C=this.options).onSettled)==null?void 0:A.call(C,void 0,T,e,this.state.context)),T}finally{W(this,hc,Md).call(this,{type:"error",error:T})}}finally{w(this,Di).runNext(this)}}},dc=new WeakMap,Di=new WeakMap,Pp=new WeakMap,hc=new WeakSet,Md=function(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),vs.batch(()=>{w(this,dc).forEach(r=>{r.onMutationUpdate(e)}),w(this,Di).notify({mutation:this,type:"updated",action:e})})},Tq);function UK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vu,vl,e_,jq,jve=(jq=class extends b0{constructor(e={}){super();G(this,vu);G(this,vl);G(this,e_);this.config=e,F(this,vu,new Set),F(this,vl,new Map),F(this,e_,0)}build(e,t,r){const s=new Tve({mutationCache:this,mutationId:++Ss(this,e_)._,options:e.defaultMutationOptions(t),state:r});return this.add(s),s}add(e){w(this,vu).add(e);const t=YE(e);if(typeof t=="string"){const r=w(this,vl).get(t);r?r.push(e):w(this,vl).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(w(this,vu).delete(e)){const t=YE(e);if(typeof t=="string"){const r=w(this,vl).get(t);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&w(this,vl).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=YE(e);if(typeof t=="string"){const r=w(this,vl).get(t),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const t=YE(e);if(typeof t=="string"){const s=(r=w(this,vl).get(t))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){vs.batch(()=>{w(this,vu).forEach(e=>{this.notify({type:"removed",mutation:e})}),w(this,vu).clear(),w(this,vl).clear()})}getAll(){return Array.from(w(this,vu))}find(e){const t={exact:!0,...e};return this.getAll().find(r=>n6(t,r))}findAll(e={}){return this.getAll().filter(t=>n6(e,t))}notify(e){vs.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return vs.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ii))))}},vu=new WeakMap,vl=new WeakMap,e_=new WeakMap,jq);function YE(n){var e;return(e=n.options.scope)==null?void 0:e.id}function i6(n){return{onFetch:(e,t)=>{var d,h,f,p,m;const r=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)||[],a=((m=e.state.data)==null?void 0:m.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let g=!1;const y=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},v=MK(e.options,e.fetchOptions),x=async(b,E,S)=>{if(g)return Promise.reject();if(E==null&&b.pages.length)return Promise.resolve(b);const C=(()=>{const D={client:e.client,queryKey:e.queryKey,pageParam:E,direction:S?"backward":"forward",meta:e.options.meta};return y(D),D})(),A=await v(C),{maxPages:T}=e.options,j=S?bve:xve;return{pages:j(b.pages,A,T),pageParams:j(b.pageParams,E,T)}};if(s&&i.length){const b=s==="backward",E=b?Rve:a6,S={pages:i,pageParams:a},k=E(r,S);o=await x(S,k,b)}else{const b=n??i.length;do{const E=l===0?a[0]??r.initialPageParam:a6(r,o);if(l>0&&E==null)break;o=await x(o,E),l++}while(l<b)}return o};e.options.persister?e.fetchFn=()=>{var g,y;return(y=(g=e.options).persister)==null?void 0:y.call(g,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=u}}}function a6(n,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?n.getNextPageParam(e[r],e,t[r],t):void 0}function Rve(n,{pages:e,pageParams:t}){var r;return e.length>0?(r=n.getPreviousPageParam)==null?void 0:r.call(n,e[0],e,t[0],t):void 0}var wr,rh,sh,Ey,ky,ih,Cy,Ay,Rq,Pve=(Rq=class{constructor(n={}){G(this,wr);G(this,rh);G(this,sh);G(this,Ey);G(this,ky);G(this,ih);G(this,Cy);G(this,Ay);F(this,wr,n.queryCache||new Nve),F(this,rh,n.mutationCache||new jve),F(this,sh,n.defaultOptions||{}),F(this,Ey,new Map),F(this,ky,new Map),F(this,ih,0)}mount(){Ss(this,ih)._++,w(this,ih)===1&&(F(this,Cy,FF.subscribe(async n=>{n&&(await this.resumePausedMutations(),w(this,wr).onFocus())})),F(this,Ay,P2.subscribe(async n=>{n&&(await this.resumePausedMutations(),w(this,wr).onOnline())})))}unmount(){var n,e;Ss(this,ih)._--,w(this,ih)===0&&((n=w(this,Cy))==null||n.call(this),F(this,Cy,void 0),(e=w(this,Ay))==null||e.call(this),F(this,Ay,void 0))}isFetching(n){return w(this,wr).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return w(this,rh).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=w(this,wr).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=w(this,wr).build(this,e),r=t.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(Qh(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(n){return w(this,wr).findAll(n).map(({queryKey:e,state:t})=>{const r=t.data;return[e,r]})}setQueryData(n,e,t){const r=this.defaultQueryOptions({queryKey:n}),s=w(this,wr).get(r.queryHash),i=s==null?void 0:s.state.data,a=vve(e,i);if(a!==void 0)return w(this,wr).build(this,r).setData(a,{...t,manual:!0})}setQueriesData(n,e,t){return vs.batch(()=>w(this,wr).findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=w(this,wr).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=w(this,wr);vs.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=w(this,wr);return vs.batch(()=>(t.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},e)))}cancelQueries(n,e={}){const t={revert:!0,...e},r=vs.batch(()=>w(this,wr).findAll(n).map(s=>s.cancel(t)));return Promise.all(r).then(Ii).catch(Ii)}invalidateQueries(n,e={}){return vs.batch(()=>(w(this,wr).findAll(n).forEach(t=>{t.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},r=vs.batch(()=>w(this,wr).findAll(n).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,t);return t.throwOnError||(i=i.catch(Ii)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ii)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=w(this,wr).build(this,e);return t.isStaleByTime(Qh(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Ii).catch(Ii)}fetchInfiniteQuery(n){return n.behavior=i6(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Ii).catch(Ii)}ensureInfiniteQueryData(n){return n.behavior=i6(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return P2.isOnline()?w(this,rh).resumePausedMutations():Promise.resolve()}getQueryCache(){return w(this,wr)}getMutationCache(){return w(this,rh)}getDefaultOptions(){return w(this,sh)}setDefaultOptions(n){F(this,sh,n)}setQueryDefaults(n,e){w(this,Ey).set(Xm(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...w(this,Ey).values()],t={};return e.forEach(r=>{h1(n,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(n,e){w(this,ky).set(Xm(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...w(this,ky).values()],t={};return e.forEach(r=>{h1(n,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...w(this,sh).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=IF(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===LF&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...w(this,sh).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){w(this,wr).clear(),w(this,rh).clear()}},wr=new WeakMap,rh=new WeakMap,sh=new WeakMap,Ey=new WeakMap,ky=new WeakMap,ih=new WeakMap,Cy=new WeakMap,Ay=new WeakMap,Rq),oa,hn,t_,Oi,Dp,Ny,ah,oh,n_,Ty,jy,Op,Mp,lh,Ry,Nn,kb,UO,VO,HO,WO,qO,GO,KO,VK,Pq,Dve=(Pq=class extends b0{constructor(e,t){super();G(this,Nn);G(this,oa);G(this,hn);G(this,t_);G(this,Oi);G(this,Dp);G(this,Ny);G(this,ah);G(this,oh);G(this,n_);G(this,Ty);G(this,jy);G(this,Op);G(this,Mp);G(this,lh);G(this,Ry,new Set);this.options=t,F(this,oa,e),F(this,oh,null),F(this,ah,$O()),this.options.experimental_prefetchInRender||w(this,ah).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(w(this,hn).addObserver(this),o6(w(this,hn),this.options)?W(this,Nn,kb).call(this):this.updateResult(),W(this,Nn,WO).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return YO(w(this,hn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return YO(w(this,hn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,W(this,Nn,qO).call(this),W(this,Nn,GO).call(this),w(this,hn).removeObserver(this)}setOptions(e){const t=this.options,r=w(this,hn);if(this.options=w(this,oa).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof So(this.options.enabled,w(this,hn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");W(this,Nn,KO).call(this),w(this,hn).setOptions(this.options),t._defaulted&&!R2(this.options,t)&&w(this,oa).getQueryCache().notify({type:"observerOptionsUpdated",query:w(this,hn),observer:this});const s=this.hasListeners();s&&l6(w(this,hn),r,this.options,t)&&W(this,Nn,kb).call(this),this.updateResult(),s&&(w(this,hn)!==r||So(this.options.enabled,w(this,hn))!==So(t.enabled,w(this,hn))||Qh(this.options.staleTime,w(this,hn))!==Qh(t.staleTime,w(this,hn)))&&W(this,Nn,UO).call(this);const i=W(this,Nn,VO).call(this);s&&(w(this,hn)!==r||So(this.options.enabled,w(this,hn))!==So(t.enabled,w(this,hn))||i!==w(this,lh))&&W(this,Nn,HO).call(this,i)}getOptimisticResult(e){const t=w(this,oa).getQueryCache().build(w(this,oa),e),r=this.createResult(t,e);return Mve(this,r)&&(F(this,Oi,r),F(this,Ny,this.options),F(this,Dp,w(this,hn).state)),r}getCurrentResult(){return w(this,Oi)}trackResult(e,t){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),t==null||t(s),Reflect.get(r,s))})}trackProp(e){w(this,Ry).add(e)}getCurrentQuery(){return w(this,hn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=w(this,oa).defaultQueryOptions(e),r=w(this,oa).getQueryCache().build(w(this,oa),t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return W(this,Nn,kb).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),w(this,Oi)))}createResult(e,t){var T;const r=w(this,hn),s=this.options,i=w(this,Oi),a=w(this,Dp),o=w(this,Ny),u=e!==r?e.state:w(this,t_),{state:d}=e;let h={...d},f=!1,p;if(t._optimisticResults){const j=this.hasListeners(),D=!j&&o6(e,t),R=j&&l6(e,r,t,s);(D||R)&&(h={...h,...$K(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:y}=h;p=h.data;let v=!1;if(t.placeholderData!==void 0&&p===void 0&&y==="pending"){let j;i!=null&&i.isPlaceholderData&&t.placeholderData===(o==null?void 0:o.placeholderData)?(j=i.data,v=!0):j=typeof t.placeholderData=="function"?t.placeholderData((T=w(this,jy))==null?void 0:T.state.data,w(this,jy)):t.placeholderData,j!==void 0&&(y="success",p=zO(i==null?void 0:i.data,j,t),f=!0)}if(t.select&&p!==void 0&&!v)if(i&&p===(a==null?void 0:a.data)&&t.select===w(this,n_))p=w(this,Ty);else try{F(this,n_,t.select),p=t.select(p),p=zO(i==null?void 0:i.data,p,t),F(this,Ty,p),F(this,oh,null)}catch(j){F(this,oh,j)}w(this,oh)&&(m=w(this,oh),p=w(this,Ty),g=Date.now(),y="error");const x=h.fetchStatus==="fetching",b=y==="pending",E=y==="error",S=b&&x,k=p!==void 0,A={status:y,fetchStatus:h.fetchStatus,isPending:b,isSuccess:y==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:h.dataUpdatedAt,error:m,errorUpdatedAt:g,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:E&&!k,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:E&&k,isStale:BF(e,t),refetch:this.refetch,promise:w(this,ah),isEnabled:So(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const j=M=>{A.status==="error"?M.reject(A.error):A.data!==void 0&&M.resolve(A.data)},D=()=>{const M=F(this,ah,A.promise=$O());j(M)},R=w(this,ah);switch(R.status){case"pending":e.queryHash===r.queryHash&&j(R);break;case"fulfilled":(A.status==="error"||A.data!==R.value)&&D();break;case"rejected":(A.status!=="error"||A.error!==R.reason)&&D();break}}return A}updateResult(){const e=w(this,Oi),t=this.createResult(w(this,hn),this.options);if(F(this,Dp,w(this,hn).state),F(this,Ny,this.options),w(this,Dp).data!==void 0&&F(this,jy,w(this,hn)),R2(t,e))return;F(this,Oi,t);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!w(this,Ry).size)return!0;const a=new Set(i??w(this,Ry));return this.options.throwOnError&&a.add("error"),Object.keys(w(this,Oi)).some(o=>{const l=o;return w(this,Oi)[l]!==e[l]&&a.has(l)})};W(this,Nn,VK).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&W(this,Nn,WO).call(this)}},oa=new WeakMap,hn=new WeakMap,t_=new WeakMap,Oi=new WeakMap,Dp=new WeakMap,Ny=new WeakMap,ah=new WeakMap,oh=new WeakMap,n_=new WeakMap,Ty=new WeakMap,jy=new WeakMap,Op=new WeakMap,Mp=new WeakMap,lh=new WeakMap,Ry=new WeakMap,Nn=new WeakSet,kb=function(e){W(this,Nn,KO).call(this);let t=w(this,hn).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(Ii)),t},UO=function(){W(this,Nn,qO).call(this);const e=Qh(this.options.staleTime,w(this,hn));if(Ym||w(this,Oi).isStale||!FO(e))return;const r=DK(w(this,Oi).dataUpdatedAt,e)+1;F(this,Op,setTimeout(()=>{w(this,Oi).isStale||this.updateResult()},r))},VO=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(w(this,hn)):this.options.refetchInterval)??!1},HO=function(e){W(this,Nn,GO).call(this),F(this,lh,e),!(Ym||So(this.options.enabled,w(this,hn))===!1||!FO(w(this,lh))||w(this,lh)===0)&&F(this,Mp,setInterval(()=>{(this.options.refetchIntervalInBackground||FF.isFocused())&&W(this,Nn,kb).call(this)},w(this,lh)))},WO=function(){W(this,Nn,UO).call(this),W(this,Nn,HO).call(this,W(this,Nn,VO).call(this))},qO=function(){w(this,Op)&&(clearTimeout(w(this,Op)),F(this,Op,void 0))},GO=function(){w(this,Mp)&&(clearInterval(w(this,Mp)),F(this,Mp,void 0))},KO=function(){const e=w(this,oa).getQueryCache().build(w(this,oa),this.options);if(e===w(this,hn))return;const t=w(this,hn);F(this,hn,e),F(this,t_,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},VK=function(e){vs.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(w(this,Oi))}),w(this,oa).getQueryCache().notify({query:w(this,hn),type:"observerResultsUpdated"})})},Pq);function Ove(n,e){return So(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&e.retryOnMount===!1)}function o6(n,e){return Ove(n,e)||n.state.data!==void 0&&YO(n,e,e.refetchOnMount)}function YO(n,e,t){if(So(e.enabled,n)!==!1&&Qh(e.staleTime,n)!=="static"){const r=typeof t=="function"?t(n):t;return r==="always"||r!==!1&&BF(n,e)}return!1}function l6(n,e,t,r){return(n!==e||So(r.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&BF(n,t)}function BF(n,e){return So(e.enabled,n)!==!1&&n.isStaleByTime(Qh(e.staleTime,n))}function Mve(n,e){return!R2(n.getCurrentResult(),e)}var ch,uh,la,yu,nd,Xk,XO,Dq,Ive=(Dq=class extends b0{constructor(t,r){super();G(this,nd);G(this,ch);G(this,uh);G(this,la);G(this,yu);F(this,ch,t),this.setOptions(r),this.bindMethods(),W(this,nd,Xk).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var s;const r=this.options;this.options=w(this,ch).defaultMutationOptions(t),R2(this.options,r)||w(this,ch).getMutationCache().notify({type:"observerOptionsUpdated",mutation:w(this,la),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Xm(r.mutationKey)!==Xm(this.options.mutationKey)?this.reset():((s=w(this,la))==null?void 0:s.state.status)==="pending"&&w(this,la).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=w(this,la))==null||t.removeObserver(this)}onMutationUpdate(t){W(this,nd,Xk).call(this),W(this,nd,XO).call(this,t)}getCurrentResult(){return w(this,uh)}reset(){var t;(t=w(this,la))==null||t.removeObserver(this),F(this,la,void 0),W(this,nd,Xk).call(this),W(this,nd,XO).call(this)}mutate(t,r){var s;return F(this,yu,r),(s=w(this,la))==null||s.removeObserver(this),F(this,la,w(this,ch).getMutationCache().build(w(this,ch),this.options)),w(this,la).addObserver(this),w(this,la).execute(t)}},ch=new WeakMap,uh=new WeakMap,la=new WeakMap,yu=new WeakMap,nd=new WeakSet,Xk=function(){var r;const t=((r=w(this,la))==null?void 0:r.state)??UK();F(this,uh,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.
586status==="idle",mutate:this.mutate,reset:this.reset})},XO=function(t){vs.batch(()=>{var r,s,i,a,o,l,u,d;if(w(this,yu)&&this.hasListeners()){const h=w(this,uh).variables,f=w(this,uh).context;(t==null?void 0:t.type)==="success"?((s=(r=w(this,yu)).onSuccess)==null||s.call(r,t.data,h,f),(a=(i=w(this,yu)).onSettled)==null||a.call(i,t.data,null,h,f)):(t==null?void 0:t.type)==="error"&&((l=(o=w(this,yu)).onError)==null||l.call(o,t.error,h,f),(d=(u=w(this,yu)).onSettled)==null||d.call(u,void 0,t.error,h,f))}this.listeners.forEach(h=>{h(w(this,uh))})})},Dq),HK=_.createContext(void 0),$n=n=>{const e=_.useContext(HK);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Lve=({client:n,children:e})=>(_.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),c.jsx(HK.Provider,{value:n,children:e})),WK=_.createContext(!1),Fve=()=>_.useContext(WK);WK.Provider;function Bve(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var zve=_.createContext(Bve()),$ve=()=>_.useContext(zve),Uve=(n,e)=>{(n.suspense||n.throwOnError||n.experimental_prefetchInRender)&&(e.isReset()||(n.retryOnMount=!1))},Vve=n=>{_.useEffect(()=>{n.clearReset()},[n])},Hve=({result:n,errorResetBoundary:e,throwOnError:t,query:r,suspense:s})=>n.isError&&!e.isReset()&&!n.isFetching&&r&&(s&&n.data===void 0||IK(t,[n.error,r])),Wve=n=>{if(n.suspense){const e=r=>r==="static"?r:Math.max(r??1e3,1e3),t=n.staleTime;n.staleTime=typeof t=="function"?(...r)=>e(t(...r)):e(t),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},qve=(n,e)=>n.isLoading&&n.isFetching&&!e,Gve=(n,e)=>(n==null?void 0:n.suspense)&&e.isPending,c6=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function Kve(n,e,t){var h,f,p,m,g;const r=Fve(),s=$ve(),i=$n(),a=i.defaultQueryOptions(n);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,a),a._optimisticResults=r?"isRestoring":"optimistic",Wve(a),Uve(a,s),Vve(s);const o=!i.getQueryCache().get(a.queryHash),[l]=_.useState(()=>new e(i,a)),u=l.getOptimisticResult(a),d=!r&&n.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(y=>{const v=d?l.subscribe(vs.batchCalls(y)):Ii;return l.updateResult(),v},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_.useEffect(()=>{l.setOptions(a)},[a,l]),Gve(a,u))throw c6(a,l,s);if(Hve({result:u,errorResetBoundary:s,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw u.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,a,u),a.experimental_prefetchInRender&&!Ym&&qve(u,r)){const y=o?c6(a,l,s):(g=i.getQueryCache().get(a.queryHash))==null?void 0:g.promise;y==null||y.catch(Ii).finally(()=>{l.updateResult()})}return a.notifyOnChangeProps?u:l.trackResult(u)}function pt(n,e){return Kve(n,Dve)}function kn(n,e){const t=$n(),[r]=_.useState(()=>new Ive(t,n));_.useEffect(()=>{r.setOptions(n)},[r,n]);const s=_.useSyncExternalStore(_.useCallback(a=>r.subscribe(vs.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=_.useCallback((a,o)=>{r.mutate(a,o).catch(Ii)},[r]);if(s.error&&IK(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/**
587 * @remix-run/router v1.23.0
588 *
589 * Copyright (c) Remix Software Inc.
590 *
591 * This source code is licensed under the MIT license found in the
592 * LICENSE.md file in the root directory of this source tree.
593 *
594 * @license MIT
595 */function f1(){return f1=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},f1.apply(this,arguments)}var zh;(function(n){n.Pop="POP",n.Push="PUSH",n.Replace="REPLACE"})(zh||(zh={}));const u6="popstate";function Yve(n){n===void 0&&(n={});function e(r,s){let{pathname:i,search:a,hash:o}=r.location;return ZO("",{pathname:i,search:a,hash:o},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function t(r,s){return typeof s=="string"?s:D2(s)}return Zve(e,t,null,n)}function $r(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function qK(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Xve(){return Math.random().toString(36).substr(2,8)}function d6(n,e){return{usr:n.state,key:n.key,idx:e}}function ZO(n,e,t,r){return t===void 0&&(t=null),f1({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof e=="string"?w0(e):e,{state:t,key:e&&e.key||r||Xve()})}function D2(n){let{pathname:e="/",search:t="",hash:r=""}=n;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function w0(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substr(t),n=n.substr(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substr(r),n=n.substr(0,r)),n&&(e.pathname=n)}return e}function Zve(n,e,t,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,a=s.history,o=zh.Pop,l=null,u=d();u==null&&(u=0,a.replaceState(f1({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function h(){o=zh.Pop;let y=d(),v=y==null?null:y-u;u=y,l&&l({action:o,location:g.location,delta:v})}function f(y,v){o=zh.Push;let x=ZO(g.location,y,v);u=d()+1;let b=d6(x,u),E=g.createHref(x);try{a.pushState(b,"",E)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(E)}i&&l&&l({action:o,location:g.location,delta:1})}function p(y,v){o=zh.Replace;let x=ZO(g.location,y,v);u=d();let b=d6(x,u),E=g.createHref(x);a.replaceState(b,"",E),i&&l&&l({action:o,location:g.location,delta:0})}function m(y){let v=s.location.origin!=="null"?s.location.origin:s.location.href,x=typeof y=="string"?y:D2(y);return x=x.replace(/ $/,"%20"),$r(v,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,v)}let g={get action(){return o},get location(){return n(s,a)},listen(y){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(u6,h),l=y,()=>{s.removeEventListener(u6,h),l=null}},createHref(y){return e(s,y)},createURL:m,encodeLocation(y){let v=m(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:p,go(y){return a.go(y)}};return g}var h6;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(h6||(h6={}));function Jve(n,e,t){return t===void 0&&(t="/"),Qve(n,e,t,!1)}function Qve(n,e,t,r){let s=typeof e=="string"?w0(e):e,i=zF(s.pathname||"/",t);if(i==null)return null;let a=GK(n);eye(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let u=dye(i);o=cye(a[l],u,r)}return o}function GK(n,e,t,r){e===void 0&&(e=[]),t===void 0&&(t=[]),r===void 0&&(r="");let s=(i,a,o)=>{let l={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};l.relativePath.startsWith("/")&&($r(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not val
595id. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=ef([r,l.relativePath]),d=t.concat(l);i.children&&i.children.length>0&&($r(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),GK(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:oye(u,i.index),routesMeta:d})};return n.forEach((i,a)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))s(i,a);else for(let l of KK(i.path))s(i,a,l)}),e}function KK(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,s=t.endsWith("?"),i=t.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let a=KK(r.join("/")),o=[];return o.push(...a.map(l=>l===""?i:[i,l].join("/"))),s&&o.push(...a),o.map(l=>n.startsWith("/")&&l===""?"/":l)}function eye(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:lye(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}const tye=/^:[\w-]+$/,nye=3,rye=2,sye=1,iye=10,aye=-2,f6=n=>n==="*";function oye(n,e){let t=n.split("/"),r=t.length;return t.some(f6)&&(r+=aye),e&&(r+=rye),t.filter(s=>!f6(s)).reduce((s,i)=>s+(tye.test(i)?nye:i===""?sye:iye),r)}function lye(n,e){return n.length===e.length&&n.slice(0,-1).every((r,s)=>r===e[s])?n[n.length-1]-e[e.length-1]:0}function cye(n,e,t){let{routesMeta:r}=n,s={},i="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],u=o===r.length-1,d=i==="/"?e:e.slice(i.length)||"/",h=p6({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d),f=l.route;if(!h&&u&&t&&!r[r.length-1].route.index&&(h=p6({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!h)return null;
vendor: 10,750 bytes, lines 595-604
595Object.assign(s,h.params),a.push({params:s,pathname:ef([i,h.pathname]),pathnameBase:mye(ef([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=ef([i,h.pathnameBase]))}return a}function p6(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=uye(n.path,n.caseSensitive,n.end),s=e.match(t);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),o=s.slice(1);return{params:r.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let g=o[h]||"";a=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const m=o[h];return p&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:n}}function uye(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),qK(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let r=[],s="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(r.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(r.push({paramName:"*"}),s+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?s+="\\/*$":n!==""&&n!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function dye(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return qK(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),n}}function zF(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}function hye(n,e){e===void 0&&(e="/");let{pathname:t,search:r="",hash:s=""}=typeof n=="string"?w0(n):n;return{pathname:t?t.startsWith("/")?t:fye(t,e):e,search:gye(r),hash:vye(s)}}function fye(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(s=>{s===".."?t.length>1&&t.pop():s!=="."&&t.push(s)}),t.length>1?t.join("/"):"/"}function PR(n,e,t,r){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function pye(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function $F(n,e){let t=pye(n);return e?t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase):t.map(r=>r.pathnameBase)}function UF(n,e,t,r){r===void 0&&(r=!1);let s;typeof n=="string"?s=w0(n):(s=f1({},n),$r(!s.pathname||!s.pathname.includes("?"),PR("?","pathname","search",s)),$r(!s.pathname||!s.pathname.includes("#"),PR("#","pathname","hash",s)),$r(!s.search||!s.search.includes("#"),PR("#","search","hash",s)));let i=n===""||s.pathname==="",a=i?"/":s.pathname,o;if(a==null)o=t;else{let h=e.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}o=h>=0?e[h]:"/"}let l=hye(s,o),u=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const ef=n=>n.join("/").replace(/\/\/+/g,"/"),mye=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),gye=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,vye=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function yye(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const YK=["post","put","patch","delete"];new Set(YK);const xye=["get",...YK];new Set(xye);/**
596 * React Router v6.30.1
597 *
598 * Copyright (c) Remix Software Inc.
599 *
600 * This source code is licensed under the MIT license found in the
601 * LICENSE.md file in the root directory of this source tree.
602 *
603 * @license MIT
604 */function p1(){return p1=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},p1.apply(this,arguments)}const VF=_.createContext(null),bye=_.createContext(null),Rf=_.createContext(null),vT=_.createContext(null),Sd=_.createContext({outlet:null,matches:[],isDataRoute:!1}),XK=_.createContext(null);function wye(n,e){let{relative:t}=e===void 0?{}:e;_0()||$r(!1);let{basename:r,navigator:s}=_.useContext(Rf),{hash:i,pathname:a,search:o}=JK(n,{relative:t}),l=a;return r!=="/"&&(l=a==="/"?r:ef([r,a])),s.createHref({pathname:l,search:o,hash:i})}function _0(){return _.useContext(vT)!=null}function Ql(){return _0()||$r(!1),_.useContext(vT).location}function ZK(n){_.useContext(Rf).static||_.useLayoutEffect(n)}function vr(){let{isDataRoute:n}=_.useContext(Sd);return n?Oye():_ye()}function _ye(){_0()||$r(!1);let n=_.useContext(VF),{basename:e,future:t,navigator:r}=_.useContext(Rf),{matches:s}=_.useContext(Sd),{pathname:i}=Ql(),a=JSON.stringify($F(s,t.v7_relativeSplatPath)),o=_.useRef(!1);return ZK(()=>{o.current=!0}),_.useCallback(function(u,d){if(d===void 0&&(d={}),!o.current)return;if(typeof u=="number"){r.go(u);return}let h=UF(u,JSON.parse(a),i,d.relative==="path");n==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:ef([e,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[e,r,a,i,n])}function Xc(){let{matches:n}=_.useContext(Sd),e=n[n.length-1];return e?e.params:{}}function JK(n,e){let{relative:t}=e===void 0?{}:e,{future:r}=_.useContext(Rf),{matches:s}=_.useContext(Sd),{pathname:i}=Ql(),a=JSON.stringify($F(s,r.v7_relativeSplatPath));return _.useMemo(()=>UF(n,JSON.parse(a),i,t==="path"),[n,a,i,t])}function Sye(n,e){return Eye(n,e)}function Eye(n,e,t,r){_0()||$r(!1);let{navigator:s}=_.useContext(Rf),{matches:i}=_.useContext(Sd),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let l=a?a.pathnameBase:"/";a&&a.route;let u=Ql(),d;if(e){var h;let y=typeof e=="string"?w0(e):e;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||$r(!1),d=y}else d=u;let f=d.pathname||"/",p=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=Jve(n,{pathname:p}),g=Tye(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},o,y.params),pathname:ef([l,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:ef([l,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,t,r);return e&&g?_.createElement(vT.Provider,{value:{location:p1({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:zh.Pop}},g):g}function kye(){let n=Dye(),e=yye(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return _.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},e),t?_.createElement("pre",{style:s},t):null,null)}const Cye=_.createElement(kye,null);class Aye extends _.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,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?_.createElement(Sd.Provider,{value:this.props.routeContext},_.createElement(XK.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Nye(n){let{routeContext:e,match:t,children:r}=n,s=_.useContext(VF);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Sd.Provider,{value:e},r)}function Tye(n,e,t,r){var s;if(e===void 0&&(e=[]),t===void 0&&(t=null),r===void 0&&(r=null),n==null){var i;if(!t)return null;if(t.errors)n=t.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let a=n,o=(s=t)==null?void 0:s.errors;if(o!=null){let d=a.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);d>=0||$r(!1),a=a.slice(0,Math.min(a.length,d+1))}let l=!1,u=-1;if(t&&r&&r.v7_partialHydration)for(let d=0;d<a.length;d++){let h=a[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=t,m=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){l=!0,u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,h,f)=>{let p,m=!1,g=null,y=null;t&&(p=o&&h.route.id?o[h.route.id]:void 0,g=h.route.errorElement||Cye,l&&(u<0&&f===0?(m=!0,y=null):u===f&&(m=!0,y=h.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,f+1)),x=()=>{let b;return p?b=g:m?b=y:h.route.Component?b=_.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,_.createElement(Nye,{match:h,routeContext:{outlet:d,matches:v,isDataRoute:t!=null},children:b})};return t&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?_.createElement(Aye,{location:t.location,revalidation:t.revalidation,component:g,error:p,children:x(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):x()},null)}var QK=function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n}(QK||{}),O2=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(O2||{});function jye(n){let e=_.useContext(VF);return e||$r(!1),e}function Rye(n){let e=_.useContext(bye);return e||$r(!1),e}function Pye(n){let e=_.useContext(Sd);return e||$r(!1),e}function eY(n){let e=Pye(),t=e.matches[e.matches.length-1];return t.route.id||$r(!1),t.route.id}function Dye(){var n;let e=_.useContext(XK),t=Rye(O2.UseRouteError),r=eY(O2.UseRouteError);return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function Oye(){let{router:n}=jye(QK.UseNavigateStable),e=eY(O2.UseNavigateStable),t=_.useRef(!1);return ZK(()=>{t.current=!0}),_.useCallback(function(s,i){i===void 0&&(i={}),t.current&&(typeof s=="number"?n.navigate(s):n.navigate(s,p1({fromRouteId:e},i)))},[n,e])}
604function Mye(n,e){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function yT(n){let{to:e,replace:t,state:r,relative:s}=n;_0()||$r(!1);let{future:i,static:a}=_.useContext(Rf),{matches:o}=_.useContext(Sd),{pathname:l}=Ql(),u=vr(),d=UF(e,$F(o,i.v7_relativeSplatPath),l,s==="path"),h=JSON.stringify(d);return _.useEffect(()=>u(JSON.parse(h),{replace:t,state:r,relative:s}),[u,h,s,t,r]),null}function _n(n){$r(!1)}function Iye(n){let{basename:e="/",children:t=null,location:r,navigationType:s=zh.Pop,navigator:i,static:a=!1,future:o}=n;_0()&&$r(!1);let l=e.replace(/^\/*/,"/"),u=_.useMemo(()=>({basename:l,navigator:i,static:a,future:p1({v7_relativeSplatPath:!1},o)}),[l,o,i,a]);typeof r=="string"&&(r=w0(r));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:m="default"}=r,g=_.useMemo(()=>{let y=zF(d,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:p,key:m},navigationType:s}},[l,d,h,f,p,m,s]);return g==null?null:_.createElement(Rf.Provider,{value:u},_.createElement(vT.Provider,{children:t,value:g}))}function Lye(n){let{children:e,location:t}=n;return Sye(JO(e),t)}new Promise(()=>{});function JO(n,e){e===void 0&&(e=[]);let t=[];return _.Children.forEach(n,(r,s)=>{if(!_.isValidElement(r))return;let i=[...e,s];if(r.type===_.Fragment){t.push.apply(t,JO(r.props.children,i));return}r.type!==_n&&$r(!1),!r.props.index||!r.props.children||$r(!1);let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=JO(r.props.children,i)),t.push(a)}),t}/**
605 * React Router DOM v6.30.1
606 *
607 * Copyright (c) Remix Software Inc.
608 *
609 * This source code is licensed under the MIT license found in the
610 * LICENSE.md file in the root directory of this source tree.
611 *
612 * @license MIT
613 */function QO(){return QO=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},QO.apply(this,arguments)}function Fye(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function Bye(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function zye(n,e){return n.button===0&&(!e||e==="_self")&&!Bye(n)}function eM(n){return n===void 0&&(n=""),new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let r=n[t];return e.concat(Array.isArray(r)?r.map(s=>[t,s]):[[t,r]])},[]))}function $ye(n,e){let t=eM(n);return e&&e.forEach((r,s)=>{t.has(s)||e.getAll(s).forEach(i=>{t.append(s,i)})}),t}const Uye=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Vye="6";try{window.__reactRouterVersion=Vye}catch{}const Hye="startTransition",m6=BN[Hye];function Wye(n){let{basename:e,children:t,future:r,window:s}=n,i=_.useRef();i.current==null&&(i.current=Yve({window:s,v5Compat:!0}));let a=i.current,[o,l]=_.useState({action:a.action,location:a.location}),{v7_startTransition:u}=r||{},d=_.useCallback(h=>{u&&m6?m6(()=>l(h)):l(h)},[l,u]);return _.useLayoutEffect(()=>a.listen(d),[a,d]),_.useEffect(()=>Mye(r),[r]),_.createElement(Iye,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,future:r})}const qye=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gye=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rt=_.forwardRef(function(e,t){let{onClick:r,relative:s,reloadDocument:i,replace:a,state:o,target:l,to:u,preventScrollReset:d,viewTransition:h}=e,f=Fye(e,Uye),{basename:p}=_.useContext(Rf),m,g=!1;if(typeof u=="string"&&Gye.test(u)&&(m=u,qye))try{let b=new URL(window.location.href),E=u.startsWith("//")?new URL(b.protocol+u):new URL(u),S=zF(E.pathname,p);E.origin===b.origin&&S!=null?u=S+E.search+E.hash:g=!0}catch{}let y=wye(u,{relative:s}),v=Kye(u,{replace:a,state:o,target:l,preventScrollReset:d,relative:s,viewTransition:h});function x(b){r&&r(b),b.defaultPrevented||v(b)}return _.createElement("a",QO({},f,{href:m||y,onClick:g||i?r:x,ref:t,target:l}))});var g6;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(g6||(g6={}));var v6;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(v6||(v6={}));function Kye(n,e){let{target:t,replace:r,state:s,preventScrollReset:i,relative:a,viewTransition:o}=e===void 0?{}:e,l=vr(),u=Ql(),d=JK(n,{relative:a});return _.useCallback(h=>{if(zye(h,t)){h.preventDefault();let f=r!==void 0?r:D2(u)===D2(d);l(n,{replace:f,state:s,preventScrollReset:i,relative:a,viewTransition:o})}},[u,l,d,r,s,t,n,i,a,o])}function OS(n){let e=_.useRef(eM(n)),t=_.useRef(!1),r=Ql(),s=_.useMemo(()=>$ye(r.search,t.current?null:e.current),[r.search]),i=vr(),a=_.useCallback((o,l)=>{const u=eM(typeof o=="function"?o(s):o);t.current=!0,i("?"+u,l)},[i,s]);return[s,a]}var Pc=function(){return Pc=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Pc.apply(this,arguments)};function S0(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function Yye(n,e,t,r){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(d){try{u(r.next(d))}catch(h){a(h)}}function l(d){try{u(r.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(o,l)}u((r=r.apply(n,e||[])).next())})}function Xye(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}const Zye=n=>n?(...e)=>n(...e):(...e)=>fetch(...e);
613class HF extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class Jye extends HF{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class y6 extends HF{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class x6 extends HF{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var tM;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(tM||(tM={}));class Qye{constructor(e,{headers:t={},customFetch:r,region:s=tM.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=Zye(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Yye(this,arguments,void 0,function*(t,r={}){var s;let i,a;try{const{headers:o,method:l,body:u,signal:d,timeout:h}=r;let f={},{region:p}=r;p||(p=this.region);const m=new URL(`${this.url}/${t}`);p&&p!=="any"&&(f["x-region"]=p,m.searchParams.set("forceFunctionRegion",p));let g;u&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",g=u):typeof u=="string"?(f["Content-Type"]="text/plain",g=u):typeof FormData<"u"&&u instanceof FormData?g=u:(f["Content-Type"]="application/json",g=JSON.stringify(u)):g=u;let y=d;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),d?(y=a.signal,d.addEventListener("abort",()=>a.abort())):y=a.signal);const v=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:g,signal:y}).catch(S=>{throw new Jye(S)}),x=v.headers.get("x-relay-error");if(x&&x==="true")throw new y6(v);if(!v.ok)throw new x6(v);let b=((s=v.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),E;return b==="application/json"?E=yield v.json():b==="application/octet-stream"||b==="application/pdf"?E=yield v.blob():b==="text/event-stream"?E=v:b==="multipart/form-data"?E=yield v.formData():E=yield v.text(),{data:E,error:null,response:v}}catch(o){return{data:null,error:o,response:o instanceof x6||o instanceof y6?o.context:void 0}}finally{i&&clearTimeout(i)}})}}var exe=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.co
613de=n.code}},txe=class{constructor(n){var e,t;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(t=n.isMaybeSingle)!==null&&t!==void 0?t:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}then(n,e){var t=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let a=null,o=null,l=null,u=i.status,d=i.statusText;if(i.ok){var h,f;if(t.method!=="HEAD"){var p;const v=await i.text();v===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((p=t.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?o=v:o=JSON.parse(v))}const g=(h=t.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),y=(f=i.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");g&&y&&y.length>1&&(l=parseInt(y[1])),t.isMaybeSingle&&t.method==="GET"&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,u=406,d="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var m;const g=await i.text();try{a=JSON.parse(g),Array.isArray(a)&&i.status===404&&(o=[],a=null,u=200,d="OK")}catch{i.status===404&&g===""?(u=204,d="No Content"):a={message:g}}if(a&&t.isMaybeSingle&&(!(a==null||(m=a.details)===null||m===void 0)&&m.includes("0 rows"))&&(a=null,u=200,d="OK"),a&&t.shouldThrowOnError)throw new exe(a)}return{error:a,data:o,count:l,status:u,statusText:d}});return this.shouldThrowOnError||(s=s.catch(i=>{var a;let o="";const l=i==null?void 0:i.cause;if(l){var u,d,h,f;const m=(u=l==null?void 0:l.message)!==null&&u!==void 0?u:"",g=(d=l==null?void 0:l.code)!==null&&d!==void 0?d:"";o=`${(h=i==null?void 0:i.name)!==null&&h!==void 0?h:"FetchError"}: ${i==null?void 0:i.message}`,o+=`
614
615Caused by: ${(f=l==null?void 0:l.name)!==null&&f!==void 0?f:"Error"}: ${m}`,g&&(o+=` (${g})`),l!=null&&l.stack&&(o+=`
616${l.stack}`)}else{var p;o=(p=i==null?void 0:i.stack)!==null&&p!==void 0?p:""}return{error:{message:`${(a=i==null?void 0:i.name)!==null&&a!==void 0?a:"FetchError"}: ${i==null?void 0:i.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),s.then(n,e)}returns(){return this}overrideTypes(){return this}},nxe=class extends txe{select(n){let e=!1;const t=(n??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",t),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:t,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${n}.${e?"asc":"desc"}${t===void 0?"":t?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:t=e}={}){const r=typeof t>"u"?"limit":`${t}.limit`;return this.url.searchParams.set(r,`${n}`),this}range(n,e,{foreignTable:t,referencedTable:r=t}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${n}`),this.url.searchParams.set(i,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
616explain({analyze:n=!1,verbose:e=!1,settings:t=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var a;const o=[n?"analyze":null,e?"verbose":null,t?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const b6=new RegExp("[,()]");var ov=class extends nxe{eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){const t=Array.from(new Set(e)).map(r=>typeof r=="string"&&b6.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(n,`in.(${t})`),this}notIn(n,e){const t=Array.from(new Set(e)).map(r=>typeof r=="string"&&b6.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(n,`not.in.(${t})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:t,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=t===void 0?"":`(${t})`;return this.url.searchParams.append(n,`${s}fts${i}.${e}`),this}match(n){return Object.entries(n).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(n,e,t){return this.url.searchParams.append(n,`not.${e}.${t}`),this}or(n,{foreignTable:e,referencedTable:t=e}={}){const r=t?`${t}.or`:"or";return this.url.searchParams.append(r,`(${n})`),this}filter(n,e,t){return this.url.searchParams.append(n,`${e}.${t}`),this}},rxe=class{constructor(n,{headers:e={},schema:t,fetch:r}){this.url=n,this.headers=new Headers(e),this.schema=t,this.fetch=r}select(n,e){const{head:t=!1,count:r}=e??{},s=t?"HEAD":"GET";let i=!1;const a=(n??"*").split("").map(o=>/\s/.test(o)&&!i?"":(o==='"'&&(i=!i),o)).join("");return this.url.searchParams.set("select",a),r&&this.headers.append("Prefer",`count=${r}`),new ov({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(n,{count:e,defaultToNull:t=!0}={}){var r;const s="POST";if(e&&this.headers.append("Prefer",`count=${e}`),t||this.headers.append("Prefer","missing=default"),Array.isArray(n)){const i=n.reduce((a,o)=>a.concat(Object.keys(o)),[]);if(i.length>0){const a=[...new Set(i)].map(o=>`"${o}"`);this.url.searchParams.set("columns",a.join(","))}}return new ov({method:s,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}
616upsert(n,{onConflict:e,ignoreDuplicates:t=!1,count:r,defaultToNull:s=!0}={}){var i;const a="POST";if(this.headers.append("Prefer",`resolution=${t?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),r&&this.headers.append("Prefer",`count=${r}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(n)){const o=n.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(o.length>0){const l=[...new Set(o)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new ov({method:a,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(n,{count:e}={}){var t;const r="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new ov({method:r,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}delete({count:n}={}){var e;const t="DELETE";return n&&this.headers.append("Prefer",`count=${n}`),new ov({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},sxe=class tY{constructor(e,{headers:t={},schema:r,fetch:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=s}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new rxe(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new tY(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:s=!1,count:i}={}){var a;let o;const l=new URL(`${this.url}/rpc/${e}`);let u;r||s?(o=r?"HEAD":"GET",Object.entries(t).filter(([h,f])=>f!==void 0).map(([h,f])=>[h,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([h,f])=>{l.searchParams.append(h,f)})):(o="POST",u=t);const d=new Headers(this.headers);return i&&d.set("Prefer",`count=${i}`),new ov({method:o,url:l,headers:d,schema:this.schemaName,body:u,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class ixe{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const t=process.versions;if(t&&t.node){const r=t.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
617import ws from "ws"
618new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
619
620Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const r=this.getWebSocketConstructor();return new r(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const axe="2.89.0",oxe=`realtime-js/${axe}`,nY="1.0.0",lxe="2.0.0",w6=nY,nM=1e4,cxe=1e3,uxe=100;var Vd;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Vd||(Vd={}));var cs;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(cs||(cs={}));var Pl;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(Pl||(Pl={}));var rM;(function(n){n.websocket="websocket"})(rM||(rM={}));var lp;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(lp||(lp={}));class dxe{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return t(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer((t=e.payload)===null||t===void 0?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,r;const s=(r=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var t,r;const s=(r=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,t,r){var s,i;const a=e.topic,o=(s=e.ref)!==null&&s!==void 0?s:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",u=e.payload.event,d=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+u.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let m=new DataView(p),g=0;m.setUint8(g++,this.KINDS.userBroadcastPush),m.setUint8(g++,l.length),m.setUint8(g++,o.length),m.setUint8(g++,a.length),m.setUint8(g++,u.length),m.setUint8(g++,h.length),m.setUint8(g++,t),Array.from(l,v=>m.setUint8(g++,v.charCodeAt(0))),Array.from(o,v=>m.setUint8(g++,v.charCodeAt(0))),Array.from(a,v=>m.setUint8(g++,v.charCodeAt(0))),Array.from(u,v=>m.setUint8(g++,v.charCodeAt(0))),Array.from(h,v=>m.setUint8(g++,v.charCodeAt(0)));var y=new Uint8Array(p.byteLength+r.byteLength);return y.set(new Uint8Array(p),0),y.set(new Uint8Array(r),p.byteLength),y.buffer}decode(e,t){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return t(r)}if(typeof e=="string"){const r=JSON.parse(e),[s,i,a,o,l]=r;return t({join_ref:s,ref:i,topic:a,event:o,payload:l})}return t({})}_binaryDecode(e){const t=new DataView(e),r=t.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,t,s
620)}}_decodeUserBroadcast(e,t,r){const s=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4);let l=this.HEADER_LENGTH+4;const u=r.decode(e.slice(l,l+s));l=l+s;const d=r.decode(e.slice(l,l+i));l=l+i;const h=r.decode(e.slice(l,l+a));l=l+a;const f=e.slice(l,e.byteLength),p=o===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,m={type:this.BROADCAST_EVENT,event:d,payload:p};return a>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||((t=e==null?void 0:e.constructor)===null||t===void 0?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>t.includes(r)))}}class rY{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var qn;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(qn||(qn={}));const _6=(n,e,t={})=>{var r;const s=(r=t.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,a)=>(i[a]=hxe(a,n,e,s),i),{}):{}},hxe=(n,e,t,r)=>{const s=e.find(o=>o.name===n),i=s==null?void 0:s.type,a=t[n];return i&&!r.includes(i)?sY(i,a):sM(a)},sY=(n,e)=>{if(n.charAt(0)==="_"){const t=n.slice(1,n.length);return gxe(e,t)}switch(n){case qn.bool:return fxe(e);case qn.float4:case qn.float8:case qn.int2:case qn.int4:case qn.int8:case qn.numeric:case qn.oid:return pxe(e);case qn.json:case qn.jsonb:return mxe(e);case qn.timestamp:return vxe(e);case qn.abstime:case qn.date:case qn.daterange:case qn.int4range:case qn.int8range:case qn.money:case qn.reltime:case qn.text:case qn.time:case qn.timestamptz:case qn.timetz:case qn.tsrange:case qn.tstzrange:return sM(e);default:return sM(e)}},sM=n=>n,fxe=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},pxe=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},mxe=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},gxe=(n,e)=>{if(typeof n!="string")return n;const t=n.length-1,r=n[t];if(n[0]==="{"&&r==="}"){let i;const a=n.slice(1,t);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>sY(e,o))}return n},vxe=n=>typeof n=="string"?n.replace(" ","T"):n,iY=n=>{const e=new URL(n);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class DR{constructor(e,t,r={},s=nM){this.channel=e,this.event=t,this.payload=r,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,t){var r;return this._hasReceived(e)&&t((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}
620_matchReceive({status:e,response:t}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var S6;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(S6||(S6={}));class gw{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=gw.syncState(this.state,s,i,a),this.pendingDiffs.forEach(l=>{this.state=gw.syncDiff(this.state,l,i,a)}),this.pendingDiffs=[],o()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=gw.syncDiff(this.state,s,i,a),o())}),this.onJoin((s,i,a)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:a})}),this.onLeave((s,i,a)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,s){const i=this.cloneDeep(e),a=this.transformState(t),o={},l={};return this.map(i,(u,d)=>{a[u]||(l[u]=d)}),this.map(a,(u,d)=>{const h=i[u];if(h){const f=d.map(y=>y.presence_ref),p=h.map(y=>y.presence_ref),m=d.filter(y=>p.indexOf(y.presence_ref)<0),g=h.filter(y=>f.indexOf(y.presence_ref)<0);m.length>0&&(o[u]=m),g.length>0&&(l[u]=g)}else o[u]=d}),this.syncDiff(i,{joins:o,leaves:l},r,s)}static syncDiff(e,t,r,s){const{joins:i,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(o,l)=>{var u;const d=(u=e[o])!==null&&u!==void 0?u:[];if(e[o]=this.cloneDeep(l),d.length>0){const h=e[o].map(p=>p.presence_ref),f=d.filter(p=>h.indexOf(p.presence_ref)<0);e[o].unshift(...f)}r(o,d,l)}),this.map(a,(o,l)=>{let u=e[o];if(!u)return;const d=l.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),e[o]=u,s(o,u,l),u.length===0&&delete e[o]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,r)=>{const s=e[r];return"metas"in s?t[r]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[r]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var E6;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(E6||(E6={}));var vw;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(vw||(vw={}));var du;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(du||(du={}));class Bv{constructor(e,t={config:{}},r){var s,i;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=cs.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new DR(this,Pl.join,this.params,this.timeout),this.rejoinTimer=new rY(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=cs.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=cs.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=cs.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=cs.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=cs.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Pl.reply,{},(a,o)=>{this._trigger(this._replyEventName(o),a)}),this.presence=new gw(this),this.broadcastEndpointURL=iY(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==cs.closed){const{config:{broadcast:a,presence:o,private:l}}=this.params,u=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[vw.PRESENCE]&&this.bindings[vw.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:d}),postgres_changes:u,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(du.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(du.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:p})=>{var m;if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(du.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,y=(m=g==null?void 0:g.length)!==null&&m!==void 0?m:0,v=[];for(let x=0;x<y;x++){const b=g[x],{filter:{event:E,schema:S,table:k,filter:C}}=b,A=p&&p[x];if(A&&A.event===E&&Bv.isFilterValueEqual(A.schema,S)&&Bv.isFilterValueEqual(A.table,k)&&Bv.isFilterValueEqual(A.filter,C))v.push(Object.assign(Object.assign({},b),{id:A.id}));else{this.unsubscribe(),this.state=cs.errored,e==null||e(du.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,e&&e(du.SUBSCRIBED);return}}).receive("error",p=>{this.state=cs.errored,e==null||e(du.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(du.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===cs.joined&&e===vw.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,r)}async httpSend(e,t,r={}){var s;if(t==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;
620try{const u=await o.json();l=u.error||u.message||l}catch{}return Promise.reject(new Error(l))}async send(e,t={}){var r,s;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=t.timeout)!==null&&r!==void 0?r: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 a,o,l;const u=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.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=cs.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Pl.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new DR(this,Pl.leave,{},e),r.receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=cs.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),a}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new DR(this,e,t,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>uxe){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var s,i;const a=e.toLocaleLowerCase(),{close:o,error:l,leave:u,join:d}=Pl;if(r&&[o,l,u,d].indexOf(a)>=0&&r!==this._joinRef())return;let f=this._onMessage(a,t,r);if(t&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(p=>{var m,g,y;return((m=p.filter)===null||m===void 0?void 0:m.event)==="*"||((y=(g=p.filter)===null||g===void 0?void 0:g.event)===null||y===void 0?void 0:y.toLocaleLowerCase())===a}).map(p=>p.callback(f,r)):(i=this.bindings[a])===null||i===void 0||i.filter(p=>{var m,g,y,v,x,b;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in p){const E=p.id,S=(m=p.filter)===null||m===void 0?void 0:m.event;return E&&((g=t.ids)===null||g===void 0?void 0:g.includes(E))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((y=t.data)===null||y===void 0?void 0:y.type.toLocaleLowerCase()))}else{const E=(x=(v=p==null?void 0:p.filter)===null||v===void 0?void 0:v.event)===null||x===void 0?void 0:x.toLocaleLowerCase();return E==="*"||E===((b=t==null?void 0:t.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===a}).map(p=>{if(typeof f=="object"&&"ids"in f){const m=f.data,{schema:g,table:y,commit_timestamp:v,type:x,errors:b}=m;f=Object.assign(Object.assign({},{schema:g,table:y,commit_timestamp:v,eventType:x,new:{},old:{},errors:b}),this._getPayloadRecords(m))}p.callback(f,r)}
620)}_isClosed(){return this.state===cs.closed}_isJoined(){return this.state===cs.joined}_isJoining(){return this.state===cs.joining}_isLeaving(){return this.state===cs.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){const s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&Bv.isEqual(s.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Pl.close,{},e)}_onError(e){this._on(Pl.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=cs.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=_6(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=_6(e.columns,e.old_record)),t}}const OR=()=>{},XE={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},yxe=[1e3,2e3,5e3,1e4],xxe=1e4,bxe=`
621  addEventListener("message", (e) => {
622    if (e.data.event === "start") {
623      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
624    }
625  });`;class wxe{constructor(e,t){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=nM,this.transport=null,this.heartbeatIntervalMs=XE.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=OR,this.ref=0,this.reconnectTimer=null,this.vsn=w6,this.logger=OR,this.conn=null,this.sendBuffer=[],this.serializer=new dxe,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>s?(...i)=>s(...i):(...i)=>fetch(...i),!(!((r=t==null?void 0:t.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${rM.websocket}`,this.httpEndpoint=iY(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=ixe.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t}
626
627To use Realtime in Node.js, you need to provide a WebSocket implementation:
628
629Option 1: Use Node.js 22+ which has native WebSocket support
630Option 2: Install and provide the "ws" package:
631
632  npm install ws
633
634  import ws from "ws"
635  const client = new RealtimeClient(url, {
636    ...options,
637    transport: ws
638  })`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,t??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Vd.connecting:return lp.Connecting;case Vd.open:return lp.Open;case Vd.closing:return lp.Closing;default:return lp.Closed}}isConnected(){return this.connectionState()===lp.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}
638channel(e,t={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new Bv(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){const{topic:t,event:r,payload:s,ref:i}=e,a=()=>{this.encode(e,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${t} ${r} (${i})`,s),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(cxe,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},XE.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>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 t=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply")try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:s,payload:i,ref:a}=t,o=a?`(${a})`:"",l=i.status||"";this.log("receive",`${l} ${r} ${s} ${o}`.trim(),i),this.channels.filter(u=>u._isMember(r)).forEach(u=>u._trigger(s,i,a)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Vd.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Vd.open||this.conn.readyState===Vd.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(t=>{this.log("error","error waiting for auth on connect",t),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this._terminateWorker()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}
638_triggerChanError(){this.channels.forEach(e=>e._trigger(Pl.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${r}${s}`}_workerObjectUrl(e){let t;if(e)t=e;else{const r=new Blob([bxe],{type:"application/javascript"});t=URL.createObjectURL(r)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,r=!1;if(e)t=e,r=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),t=this.accessTokenValue}else t=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(s=>{const i={access_token:t,version:oxe};t&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Pl.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new rY(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},XE.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,s,i,a,o,l,u,d,h,f,p;switch(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:nM,this.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:XE.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(o=e==null?void 0:e.heartbeatCallback)!==null&&o!==void 0?o:OR,this.vsn=(l=e==null?void 0:e.vsn)!==null&&l!==void 0?l:w6,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=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:m=>yxe[m-1]||xxe,this.vsn){case nY:this.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:(m,g)=>g(JSON.stringify(m)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:(m,g)=>g(JSON.parse(m));break;case lxe:this.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:this.serializer.encode.bind(this.serializer),this.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var m1=class extends Error{constructor(n,e){var t;super(n),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((t=e.icebergType)==null?void 0:t.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function _xe(n,e,t){const r=new URL(e,n);if(t)for(const[s,i]of Object.entries(t))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function Sxe(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function Exe(n){const e=n.fetchImpl??globalThis.fetch;return{async request({method:t,path:r,query:s,body:i,headers:a}){const o=_xe(n.baseUrl,r,s),l=await Sxe(n.auth),u=await e(o,{method:t,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},body:i?JSON.stringify(i):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!u.ok){const p=h?f:void 0,m=p==null?void 0:p.error;throw new m1((m==null?void 0:m.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:p})}return{status:u.status,headers:u.headers,data:f}}}}function ZE(n){return n.join("�")}var kxe=class{constructor(n,e=""){this.client=n,this.prefix=e}async listNamespaces(n){const e=n?{parent:ZE(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(n,e){const t={namespace:n.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:t})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ZE(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ZE(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ZE(n.namespace)}`}),!0}catch(e){if(e instanceof m1&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(n,e){try{return await this.createNamespace(n,e)}catch(t){if(t instanceof m1&&t.status===409)return;throw t}}};function Ug(n){return n.join("�")}var Cxe=class{constructor(n,e="",t){this.client=n,this.prefix=e,this.accessDelegation=t}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables`})).data.identifiers}async createTable(n,e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables`,body:e,headers:t})).data.metadata}async updateTable(n,e){const t=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables/${n.name}`,body:e});return{"metadata-location":t.data["metadata-location"],metadata:t.data.metadata}}async dropTable(n,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(n){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables/${n.name}`,headers:e})).data.metadata}async tableExists(n){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ug(n.namespace)}/tables/${n.name}`,headers:e}),!0}catch(t){if(t instanceof m1&&t.status===404)return!1;throw t}}async createTableIfNotExists(n,e){try{return await this.createTable(n,e)}catch(t){if(t instanceof m1&&t.status===409)return await this.loadTable({namespace:n.namespace,name:e.name});throw t}}},Axe=class{constructor(n){var r;let e="v1";n.catalogName&&(e+=`/${n.catalogName}`);const t=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=Exe({baseUrl:t,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=(r=n.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new kxe(this.client,e),this.tableOps=new Cxe(this.client,e,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,e){return this.namespaceOps.createNamespace(n,e)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}
638async createTable(n,e){return this.tableOps.createTable(n,e)}async updateTable(n,e){return this.tableOps.updateTable(n,e)}async dropTable(n,e){await this.tableOps.dropTable(n,e)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,e){return this.namespaceOps.createNamespaceIfNotExists(n,e)}async createTableIfNotExists(n,e){return this.tableOps.createTableIfNotExists(n,e)}},xT=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function cr(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var Nxe=class extends xT{constructor(n,e,t){super(n),this.name="StorageApiError",this.status=e,this.statusCode=t}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},iM=class extends xT{constructor(n,e){super(n),this.name="StorageUnknownError",this.originalError=e}};const WF=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),Txe=()=>Response,aM=n=>{if(Array.isArray(n))return n.map(t=>aM(t));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([t,r])=>{const s=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=aM(r)}),e},jxe=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Rxe=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function g1(n){"@babel/helpers - typeof";return g1=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},g1(n)}function Pxe(n,e){if(g1(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(g1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Dxe(n){var e=Pxe(n,"string");return g1(e)=="symbol"?e:e+""}function Oxe(n,e,t){return(e=Dxe(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function k6(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function Ot(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?k6(Object(t),!0).forEach(function(r){Oxe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):k6(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const MR=n=>{var e;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(e=n.error)===null||e===void 0?void 0:e.message)||JSON.stringify(n)},Mxe=async(n,e,t)=>{n instanceof await Txe()&&!(t!=null&&t.noResolveJson)?n.json().then(r=>{const s=n.status||500,i=(r==null?void 0:r.statusCode)||s+"";e(new Nxe(MR(r),s,i))}).catch(r=>{e(new iM(MR(r),r))}):e(new iM(MR(n),n))},Ixe=(n,e,t,r)=>{const s={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"||!r?s:(jxe(r)?(s.headers=Ot({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(r)):s.body=r,e!=null&&e.duplex&&(s.duplex=e.duplex),Ot(Ot({},s),t))};async function MS(n,e,t,r,s,i){return new Promise((a,o)=>{n(t,Ixe(e,r,s,i)).then(l=>{if(!l.ok)throw l;return r!=null&&r.noResolveJson?l:l.json()}).then(l=>a(l)).catch(l=>Mxe(l,o,r))})}async function v1(n,e,t,r){return MS(n,"GET",e,t,r)}async function fl(n,e,t,r,s){return MS(n,"POST",e,r,s,t)}async function oM(n,e,t,r,s){return MS(n,"PUT",e,r,s,t)}async function Lxe(n,e,t,r){return MS(n,"HEAD",e,Ot(Ot({},t),{},{noResolveJson:!0}),r)}async function qF(n,e,t,r,s){return MS(n,"DELETE",e,r,s,t)}var Fxe=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e}then(n,e){return this.execute().then(n,e)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(cr(e))return{data:null,error:e};throw e}}};let aY;aY=Symbol.toStringTag;var Bxe=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[aY]="BlobDownloadBuilder",this.promise=null}asStream(){return new Fxe(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(cr(e))return{data:null,error:e};throw e}}};const zxe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},C6={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var $xe=class{constructor(n,e={},t,r){this.shouldThrowOnError=!1,this.url=n,this.headers=e,this.bucketId=t,this.fetch=WF(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,e,t,r){var s=this;try{let i;const a=Ot(Ot({},C6),r);let o=Ot(Ot({},s.headers),n==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;typeof Blob<"u"&&t instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",t)):typeof FormData<"u"&&t instanceof FormData?(i=t,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=t,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),r!=null&&r.headers&&(o=Ot(Ot({},o),r.headers));const u=s._removeEmptyFolders(e),d=s._getFinalPath(u),h=await(n=="PUT"?oM:fl)(s.fetch,`${s.url}/object/${d}`,i,Ot({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{data:{path:u,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(s.shouldThrowOnError)throw i;if(cr(i))return{data:null,error:i};throw i}}async upload(n,e,t){return this.uploadOrUpdate("POST",n,e,t)}async uploadToSignedUrl(n,e,t,r){var s=this;const i=s._removeEmptyFolders(n),a=s._getFinalPath(i),o=new URL(s.url+`/object/upload/sign/${a}`);o.searchParams.set("token",e);try{let l;const u=Ot({upsert:C6.upsert},r),d=Ot(Ot({},s.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&t instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),l.append("",t)):typeof FormData<"u"&&t instanceof FormData?(l=t,l.append("cacheControl",u.cacheControl)):(l=t,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType),{data:{path:i,fullPath:(await oM(s.fetch,o.toString(),l,{headers:d})).Key},error:null}}catch(l){if(s.shouldThrowOnError)throw l;if(cr(l))return{data:null,error:l};throw l}}async createSignedUploadUrl(n,e){var t=this;try{let r=t._getFinalPath(n);const s=Ot({},t.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await fl(t.fetch,`${t.url}/object/upload/sign/${r}`,{},{headers:s}),a=new URL(t.url+i.url),o=a.searchParams.get("token");if(!o)throw new xT("No token returned by API");return{data:{signedUrl:a.toString(),path:n,token:o},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(cr(r))return{data:null,error:r};throw r}}async update(n,e,t){return this.uploadOrUpdate("PUT",n,e,t)}async move(n,e,t){var r=this;try{return{data:await fl(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:n,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:r.headers}),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(cr(s))return{data:null,error:s};throw s}}async copy(n,e,t){var r=this;try{return{data:{path:(await fl(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:n,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:r.headers})).Key},error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(cr(s))return{data:null,error:s};throw s}}async createSignedUrl(n,e,t){var r=this;try{let s=r._getFinalPath(n),i=await fl(r.fetch,`${r.url}/object/sign/${s}
638`,Ot({expiresIn:e},t!=null&&t.transform?{transform:t.transform}:{}),{headers:r.headers});const a=t!=null&&t.download?`&download=${t.download===!0?"":t.download}`:"";return i={signedUrl:encodeURI(`${r.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(cr(s))return{data:null,error:s};throw s}}async createSignedUrls(n,e,t){var r=this;try{const s=await fl(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:n},{headers:r.headers}),i=t!=null&&t.download?`&download=${t.download===!0?"":t.download}`:"";return{data:s.map(a=>Ot(Ot({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${i}`):null})),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(cr(s))return{data:null,error:s};throw s}}download(n,e){const t=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),s=r?`?${r}`:"",i=this._getFinalPath(n),a=()=>v1(this.fetch,`${this.url}/${t}/${i}${s}`,{headers:this.headers,noResolveJson:!0});return new Bxe(a,this.shouldThrowOnError)}async info(n){var e=this;const t=e._getFinalPath(n);try{return{data:aM(await v1(e.fetch,`${e.url}/object/info/${t}`,{headers:e.headers})),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(cr(r))return{data:null,error:r};throw r}}async exists(n){var e=this;const t=e._getFinalPath(n);try{return await Lxe(e.fetch,`${e.url}/object/${t}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(cr(r)&&r instanceof iM){const s=r.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:r}}throw r}}getPublicUrl(n,e){const t=this._getFinalPath(n),r=[],s=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&r.push(s);const i=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});a!==""&&r.push(a);let o=r.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${t}${o}`)}}}async remove(n){var e=this;try{return{data:await qF(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:n},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async list(n,e,t){var r=this;try{const s=Ot(Ot(Ot({},zxe),e),{},{prefix:n||""});return{data:await fl(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},t),error:null}}catch(s){if(r.shouldThrowOnError)throw s;if(cr(s))return{data:null,error:s};throw s}}async listV2(n,e){var t=this;try{const r=Ot({},n);return{data:await fl(t.fetch,`${t.url}/object/list-v2/${t.bucketId}`,r,{headers:t.headers},e),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(cr(r))return{data:null,error:r};throw r}}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const e=[];return n.width&&e.push(`width=${n.width}`),n.height&&e.push(`height=${n.height}`),n.resize&&e.push(`resize=${n.resize}`),n.format&&e.push(`format=${n.format}`),n.quality&&e.push(`quality=${n.quality}`),e.join("&")}};const oY="2.89.0",lY={"X-Client-Info":`storage-js/${oY}`};var Uxe=class{constructor(n,e={},t,r){this.shouldThrowOnError=!1;const s=new URL(n);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Ot(Ot({},lY),e),this.fetch=WF(t)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var e=this;try{const t=e.listBucketOptionsToQueryString(n);return{data:await v1(e.fetch,`${e.url}/bucket${t}`,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async getBucket(n){var e=this;try{return{data:await v1(e.fetch,`${e.url}/bucket/${n}`,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async createBucket(n,e={public:!1}){var t=this;try{return{data:await fl(t.fetch,`${t.url}/bucket`,{id:n,name:n,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(cr(r))return{data:null,error:r};throw r}}async updateBucket(n,e){var t=this;try{return{data:await oM(t.fetch,`${t.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(cr(r))return{data:null,error:r};throw r}}async emptyBucket(n){var e=this;try{return{data:await fl(e.fetch,`${e.url}/bucket/${n}/empty`,{},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async deleteBucket(n){var e=this;try{return{data:await qF(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}listBucketOptionsToQueryString(n){const e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Vxe=class{constructor(n,e={},t){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Ot(Ot({},lY),e),this.fetch=WF(t)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var e=this;try{return{data:await fl(e.fetch,`${e.url}/bucket`,{name:n},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async listBuckets(n){var e=this;try{const t=new URLSearchParams;(n==null?void 0:n.limit)!==void 0&&t.set("limit",n.limit.toString()),(n==null?void 0:n.offset)!==void 0&&t.set("offset",n.offset.toString()),n!=null&&n.sortColumn&&t.set("sortColumn",n.sortColumn),n!=null&&n.sortOrder&&t.set("sortOrder",n.sortOrder),n!=null&&n.search&&t.set("search",n.search);const r=t.toString(),s=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return{data:await v1(e.fetch,s,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}async deleteBucket(n){var e=this;try{return{data:await qF(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(cr(t))return{data:null,error:t};throw t}}from(n){var e=this;if(!Rxe(n))throw new xT("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const t=new Axe({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
638),r=this.shouldThrowOnError;return new Proxy(t,{get(s,i){const a=s[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(s,o),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}};const GF={"X-Client-Info":`storage-js/${oY}`,"Content-Type":"application/json"};var cY=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Ga(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var IR=class extends cY{constructor(n,e,t){super(n),this.name="StorageVectorsApiError",this.status=e,this.statusCode=t}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Hxe=class extends cY{constructor(n,e){super(n),this.name="StorageVectorsUnknownError",this.originalError=e}};const KF=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),Wxe=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},A6=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),qxe=async(n,e,t)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!(t!=null&&t.noResolveJson)){const r=n.status||500,s=n;if(typeof s.json=="function")s.json().then(i=>{const a=(i==null?void 0:i.statusCode)||(i==null?void 0:i.code)||r+"";e(new IR(A6(i),r,a))}).catch(()=>{const i=r+"";e(new IR(s.statusText||`HTTP ${r} error`,r,i))});else{const i=r+"";e(new IR(s.statusText||`HTTP ${r} error`,r,i))}}else e(new Hxe(A6(n),n))},Gxe=(n,e,t,r)=>{const s={method:n,headers:(e==null?void 0:e.headers)||{}};return r?(Wxe(r)?(s.headers=Ot({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(r)):s.body=r,Ot(Ot({},s),t)):s};async function Kxe(n,e,t,r,s,i){return new Promise((a,o)=>{n(t,Gxe(e,r,s,i)).then(l=>{if(!l.ok)throw l;if(r!=null&&r.noResolveJson)return l;const u=l.headers.get("content-type");return!u||!u.includes("application/json")?{}:l.json()}).then(l=>a(l)).catch(l=>qxe(l,o,r))})}async function Ka(n,e,t,r,s){return Kxe(n,"POST",e,r,s,t)}var Yxe=class{constructor(n,e={},t){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Ot(Ot({},GF),e),this.fetch=KF(t)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/CreateIndex`,n,{headers:e.headers})||{},error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async getIndex(n,e){var t=this;try{return{data:await Ka(t.fetch,`${t.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:t.headers}),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Ga(r))return{data:null,error:r};throw r}}async listIndexes(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/ListIndexes`,n,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async deleteIndex(n,e){var t=this;try{return{data:await Ka(t.fetch,`${t.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:t.headers})||{},error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Ga(r))return{data:null,error:r};throw r}}},Xxe=class{constructor(n,e={},t){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Ot(Ot({},GF),e),this.fetch=KF(t)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(n){var e=this;try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Ka(e.fetch,`${e.url}/PutVectors`,n,{headers:e.headers})||{},error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async getVectors(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/GetVectors`,n,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async listVectors(n){var e=this;try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
638if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:await Ka(e.fetch,`${e.url}/ListVectors`,n,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async queryVectors(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/QueryVectors`,n,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async deleteVectors(n){var e=this;try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Ka(e.fetch,`${e.url}/DeleteVectors`,n,{headers:e.headers})||{},error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}},Zxe=class{constructor(n,e={},t){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Ot(Ot({},GF),e),this.fetch=KF(t)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{},error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async getBucket(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:n},{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async listBuckets(n={}){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/ListVectorBuckets`,n,{headers:e.headers}),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}async deleteBucket(n){var e=this;try{return{data:await Ka(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{},error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Ga(t))return{data:null,error:t};throw t}}},Jxe=class extends Zxe{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new Qxe(this.url,this.headers,n,this.fetch)}async createBucket(n){var e=()=>super.createBucket,t=this;return e().call(t,n)}async getBucket(n){var e=()=>super.getBucket,t=this;return e().call(t,n)}async listBuckets(n={}){var e=()=>super.listBuckets,t=this;return e().call(t,n)}async deleteBucket(n){var e=()=>super.deleteBucket,t=this;return e().call(t,n)}},Qxe=class extends Yxe{constructor(n,e,t,r){super(n,e,r),this.vectorBucketName=t}async createIndex(n){var e=()=>super.createIndex,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName}))}async listIndexes(n={}){var e=()=>super.listIndexes,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName}))}async getIndex(n){var e=()=>super.getIndex,t=this;return e().call(t,t.vectorBucketName,n)}async deleteIndex(n){var e=()=>super.deleteIndex,t=this;return e().call(t,t.vectorBucketName,n)}index(n){return new e0e(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},e0e=class extends Xxe{constructor(n,e,t,r,s){super(n,e,s),this.vectorBucketName=t,this.indexName=r}async putVectors(n){var e=()=>super.putVectors,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(n){var e=()=>super.getVectors,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(n={}){var e=()=>super.listVectors,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(n){var e=()=>super.queryVectors,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(n){var e=()=>super.deleteVectors,t=this;return e().call(t,Ot(Ot({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},t0e=class extends Uxe{constructor(n,e={},t,r){super(n,e,t,r)}from(n){return new $xe(this.url,this.headers,n,this.fetch)}get vectors(){return new Jxe(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Vxe(this.url+"/iceberg",this.headers,this.fetch)}};const uY="2.89.0",lv=30*1e3,lM=3,LR=lM*lv,n0e="http://localhost:9999",r0e="supabase.auth.token",s0e={"X-Client-Info":`gotrue-js/${uY}`},cM="X-Supabase-Api-Version",dY={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},i0e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,a0e=10*60*1e3;
638class y1 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function wt(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class o0e extends y1{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}function l0e(n){return wt(n)&&n.name==="AuthApiError"}class cp extends y1{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Ed extends y1{constructor(e,t,r,s){super(e,r,s),this.name=t,this.status=r}}class Pa extends Ed{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function c0e(n){return wt(n)&&n.name==="AuthSessionMissingError"}class Vg extends Ed{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class JE extends Ed{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class QE extends Ed{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function u0e(n){return wt(n)&&n.name==="AuthImplicitGrantRedirectError"}class N6 extends Ed{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class d0e extends Ed{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class uM extends Ed{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function FR(n){return wt(n)&&n.name==="AuthRetryableFetchError"}class T6 extends Ed{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class dM extends Ed{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const M2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),j6=` 	
639\r=`.split(""),h0e=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<j6.length;e+=1)n[j6[e].charCodeAt(0)]=-2;for(let e=0;e<M2.length;e+=1)n[M2[e].charCodeAt(0)]=e;return n})();function R6(n,e,t){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(M2[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(M2[r]),e.queuedBits-=6}}function hY(n,e,t){const r=h0e[n];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function P6(n){const e=[],t=a=>{e.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{m0e(a,r,t)};for(let a=0;a<n.length;a+=1)hY(n.charCodeAt(a),s,i);return e.join("")}function f0e(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function p0e(n,e){for(let t=0;t<n.length;t+=1){let r=n.charCodeAt(t);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(n.charCodeAt(t+1)-56320&65535|s)+65536,t+=1}f0e(r,e)}}function m0e(n,e,t){if(e.utf8seq===0){if(n<=127){t(n);return}for(let r=1;r<6;r+=1)if(!(n>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function oy(n){const e=[],t={queue:0,queuedBits:0},r=s=>{e.push(s)};for(let s=0;s<n.length;s+=1)hY(n.charCodeAt(s),t,r);return new Uint8Array(e)}function g0e(n){const e=[];return p0e(n,t=>e.push(t)),new Uint8Array(e)}function vp(n){const e=[],t={queue:0,queuedBits:0},r=s=>{e.push(s)};
639return n.forEach(s=>R6(s,t,r)),R6(null,t,r),e.join("")}function v0e(n){return Math.round(Date.now()/1e3)+n}function y0e(){return Symbol("auth-callback")}const Us=()=>typeof window<"u"&&typeof document<"u",qf={tested:!1,writable:!1},fY=()=>{if(!Us())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(qf.tested)return qf.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),qf.tested=!0,qf.writable=!0}catch{qf.tested=!0,qf.writable=!1}return qf.writable};function x0e(n){const e={},t=new URL(n);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return t.searchParams.forEach((r,s)=>{e[s]=r}),e}const pY=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),b0e=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",cv=async(n,e,t)=>{await n.setItem(e,JSON.stringify(t))},Gf=async(n,e)=>{const t=await n.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},$s=async(n,e)=>{await n.removeItem(e)};class bT{constructor(){this.promise=new bT.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}bT.promiseConstructor=Promise;function BR(n){const e=n.split(".");if(e.length!==3)throw new dM("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!i0e.test(e[r]))throw new dM("JWT not in base64url format");return{header:JSON.parse(P6(e[0])),payload:JSON.parse(P6(e[1])),signature:oy(e[2]),raw:{header:e[0],payload:e[1]}}}async function w0e(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function _0e(n,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await n(i);if(!e(i,null,a)){r(a);return}}catch(a){if(!e(i,a)){s(a);return}}})()})}function S0e(n){return("0"+n.toString(16)).substr(-2)}function E0e(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=t.length;let s="";for(let i=0;i<56;i++)s+=t.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,S0e).join("")}async function k0e(n){const t=new TextEncoder().encode(n),r=await crypto.subtle.digest("SHA-256",t),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function C0e(n){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."),n;const t=await k0e(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Hg(n,e,t=!1){const r=E0e();let s=r;t&&(s+="/PASSWORD_RECOVERY"),await cv(n,`${e}-code-verifier`,s);const i=await C0e(r);return[i,r===i?"plain":"s256"]}const A0e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function N0e(n){const e=n.headers.get(cM);if(!e||!e.match(A0e))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function T0e(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function j0e(n){switch(n){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 R0e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Wg(n){if(!R0e.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function zR(){const n={};return new Proxy(n,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const r=t.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function P0e(n,e){return new Proxy(n,{get:(t,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;
639if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(t,r,s)}return!e.value&&typeof r=="string"&&(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."),e.value=!0),Reflect.get(t,r,s)}})}function D6(n){return JSON.parse(JSON.stringify(n))}const ep=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),D0e=[502,503,504];async function O6(n){var e;if(!b0e(n))throw new uM(ep(n),0);if(D0e.includes(n.status))throw new uM(ep(n),n.status);let t;try{t=await n.json()}catch(i){throw new cp(ep(i),i)}let r;const s=N0e(n);if(s&&s.getTime()>=dY["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?r=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(r=t.error_code),r){if(r==="weak_password")throw new T6(ep(t),n.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Pa}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new T6(ep(t),n.status,t.weak_password.reasons);throw new o0e(ep(t),n.status||500,r)}const O0e=(n,e,t,r)=>{const s={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),t))};async function Dt(n,e,t,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[cM]||(i[cM]=dY["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const a=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(a.redirect_to=r.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await M0e(n,e,t+o,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function M0e(n,e,t,r,s,i){const a=O0e(e,r,s,i);let o;try{o=await n(t,Object.assign({},a))}catch(l){throw console.error(l),new uM(ep(l),0)}if(o.ok||await O6(o),r!=null&&r.noResolveJson)return o;try{return await o.json()}catch(l){await O6(l)}}function rl(n){var e;let t=null;F0e(n)&&(t=Object.assign({},n),n.expires_at||(t.expires_at=v0e(n.expires_in)));const r=(e=n.user)!==null&&e!==void 0?e:n;return{data:{session:t,user:r},error:null}}function M6(n){const e=rl(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((t,r)=>t&&typeof r=="string",!0)&&(e.data.weak_password=n.weak_password),e}function Xd(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function I0e(n){return{data:n,error:null}}function L0e(n){const{action_link:e,email_otp:t,hashed_token:r,redirect_to:s,verification_type:i}=n,a=S0(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:t,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function I6(n){return n}function F0e(n){return n.access_token&&n.refresh_token&&n.expires_in}const $R=["global","local","others"];class B0e{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=pY(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=$R[0]){if($R.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${$R.join(", ")}`);try{return await Dt(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(wt(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,t={}){try{return await Dt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:Xd})}catch(r){if(wt(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:t}=e,r=S0(e,["options"]),s=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await Dt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:L0e,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(wt(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await Dt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Xd})}catch(t){if(wt(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,r,s,i,a,o,l;try{const u={nextPage:null,lastPage:0,total:0},d=await Dt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:I6});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>
6390&&(p.forEach(m=>{const g=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(m.split(";")[1].split("=")[1]);u[`${y}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(wt(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){Wg(e);try{return await Dt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Xd})}catch(t){if(wt(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){Wg(e);try{return await Dt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:Xd})}catch(r){if(wt(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,t=!1){Wg(e);try{return await Dt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:Xd})}catch(r){if(wt(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Wg(e.userId);try{const{data:t,error:r}=await Dt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:t,error:r}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _deleteFactor(e){Wg(e.userId),Wg(e.id);try{return{data:await Dt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,r,s,i,a,o,l;try{const u={nextPage:null,lastPage:0,total:0},d=await Dt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:I6});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(m=>{const g=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(m.split(";")[1].split("=")[1]);u[`${y}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(wt(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(e){try{return await Dt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await Dt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await Dt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(wt(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await Dt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await Dt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}}function L6(n={}){return{getItem:e=>n[e]||null,setItem:(e,t)=>{n[e]=t},removeItem:e=>{delete n[e]}}}const qg={debug:!!(globalThis&&fY()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class mY extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class z0e extends mY{}async function $0e(n,e,t){qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),qg.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",
639n,s.name);try{return await t()}finally{qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,s.name)}}else{if(e===0)throw qg.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new z0e(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(qg.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 t()}}))}function U0e(){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)}}function gY(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function V0e(n){return parseInt(n,16)}function H0e(n){const e=new TextEncoder().encode(n);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function W0e(n){var e;const{chainId:t,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:u,scheme:d,uri:h,version:f}=n;{if(!Number.isInteger(t))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${t}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=n.statement)===null||e===void 0)&&e.includes(`
640`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const p=gY(n.address),m=d?`${d}://${r}
640`:r,g=n.statement?`${n.statement}
641`:"",y=`${m} wants you to sign in with your Ethereum account:
642${p}
643
644${g}`;let v=`URI: ${h}
645Version: ${f}
646Chain ID: ${t}${a?`
647Nonce: ${a}`:""}
648Issued At: ${i.toISOString()}`;if(s&&(v+=`
649Expiration Time: ${s.toISOString()}`),o&&(v+=`
650Not Before: ${o.toISOString()}`),l&&(v+=`
651Request ID: ${l}`),u){let x=`
652Resources:`;for(const b of u){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);x+=`
653- ${b}`}v+=x}return`${y}
654${v}`}class Xr extends Error{constructor({message:e,code:t,cause:r,name:s}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=t}}class I2 extends Xr{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function q0e({error:n,options:e}){var t,r,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Xr({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((t=i.authenticatorSelection)===null||t===void 0?void 0:t.requireResidentKey)===!0)return new Xr({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Xr({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Xr({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new Xr({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new Xr({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Xr({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new Xr({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const a=window.location.hostname;if(vY(a)){if(i.rp.id!==a)return new Xr({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new Xr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Xr({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new Xr({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new Xr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function G0e({error:n,options:e}){const{publicKey:t}=e;if(!t)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Xr({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new Xr({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const r=window.location.hostname;if(vY(r)){if(t.rpId!==r)return new Xr({message:`The RP ID "${t.rpId}
654" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new Xr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new Xr({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new Xr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class K0e{createNewAbortSignal(){if(this.controller){const t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Y0e=new K0e;function X0e(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:e,user:t,excludeCredentials:r}=n,s=S0(n,["challenge","user","excludeCredentials"]),i=oy(e).buffer,a=Object.assign(Object.assign({},t),{id:oy(t.id).buffer}),o=Object.assign(Object.assign({},s),{challenge:i,user:a});if(r&&r.length>0){o.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const u=r[l];o.excludeCredentials[l]=Object.assign(Object.assign({},u),{id:oy(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return o}function Z0e(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:e,allowCredentials:t}=n,r=S0(n,["challenge","allowCredentials"]),s=oy(e).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(t&&t.length>0){i.allowCredentials=new Array(t.length);for(let a=0;a<t.length;a++){const o=t[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:oy(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function J0e(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const t=n;return{id:n.id,rawId:n.id,response:{attestationObject:vp(new Uint8Array(n.response.attestationObject)),clientDataJSON:vp(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Q0e(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const t=n,r=n.getClientExtensionResults(),s=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:vp(new Uint8Array(s.authenticatorData)),clientDataJSON:vp(new Uint8Array(s.clientDataJSON)),signature:vp(new Uint8Array(s.signature)),userHandle:s.userHandle?vp(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function vY(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function F6(){var n,e;return!!(Us()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator==null?void 0:navigator.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function ebe(n){try{const e=await navigator.credentials.create(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new I2("Browser returned unexpected credential type",e)}:{data:null,error:new I2("Empty credential response",e)}}catch(e){return{data:null,error:q0e({error:e,options:n})}}}async function tbe(n){try{const e=await navigator.credentials.get(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new I2("Browser returned unexpected credential type",e)}:{data:null,error:new I2("Empty credential response",e)}}catch(e){return{data:null,error:G0e({error:e,options:n})}}}const nbe={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},rbe={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function L2(...n){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of n)if(s)for(const i in s){const a=s[i];if(a!==void 0)if(Array.isArray(a))r[i]=a;else if(t(a))r[i]=a;else if(e(a)){const o=r[i];e(o)?r[i]=L2(o,a):r[i]=L2(a)}else r[i]=a}return r}function sbe(n,e){return L2(nbe,n,e||{})}function ibe(n,e){return L2(rbe,n,e||{})}class abe{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:s},i){try{const{data:a,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!a)return{data:null,error:o};const l=s??Y0e.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;u.name||(u.name=`${u.id}:${r}`),u.displayName||(u.displayName=u.name)}
654switch(a.webauthn.type){case"create":{const u=sbe(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:h}=await ebe({publicKey:u,signal:l});return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=ibe(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:h}=await tbe(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:l}));return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(a){return wt(a)?{data:null,error:a}:{data:null,error:new cp("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new y1("rpId is required for WebAuthn authentication")};try{if(!F6())return{data:null,error:new cp("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:s},{request:i});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:l.type,rpId:t,rpOrigins:r,credential_response:l.credential_response}})}catch(a){return wt(a)?{data:null,error:a}:{data:null,error:new cp("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new y1("rpId is required for WebAuthn registration")};try{if(!F6())return{data:null,error:new cp("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(d=>{var h;return(h=d.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:o};const{data:l,error:u}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:t,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:u}}catch(a){return wt(a)?{data:null,error:a}:{data:null,error:new cp("Unexpected error in register",a)}}}}U0e();const obe={url:n0e,storageKey:r0e,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:s0e,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function B6(n,e,t){return await t()}const Gg={};class x1{get jwks(){var e,t;return(t=(e=Gg[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){Gg[this.storageKey]=Object.assign(Object.assign({},Gg[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=Gg[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Gg[this.storageKey]=Object.assign(Object.assign({},Gg[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,s;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;const i=Object.assign(Object.assign({},obe),e);if(this.storageKey=i.storageKey,this.instanceID=(t=x1.nextInstanceID[this.storageKey])!==null&&t!==void 0?t:0,x1.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Us()){const a=`${this._logPrefix()} 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.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new B0e({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=pY(i.fetch),this.lock=i.lock||B6,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:this.persistSession&&Us()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=$0e:this.lock=B6,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),webauthn:new abe(this)}
654,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:fY()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=L6(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=L6(this.memoryStorage)),Us()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${uY}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...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{let t={},r="none";if(Us()&&(t=x0e(window.location.href),this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce")),Us()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(t,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),u0e(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:a,redirectType:o}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return wt(t)?this._returnResult({error:t}):this._returnResult({error:new cp("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,s;try{const i=await Dt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:rl}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(wt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var t,r,s;try{let i;if("email"in e){const{email:d,password:h,options:f}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await Hg(this.storage,this.storageKey)),i=await Dt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(t=f==null?void 0:f.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:m},xform:rl})}else if("phone"in e){const{phone:d,password:h,options:f}=e;i=await Dt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},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:rl})}else throw new JE("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await $s(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:a,options:o}=e;t=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:M6})}else if("phone"in e){const{phone:i,password:a,options:o}=e;t=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:M6})}else throw new JE("You must provide either an email or phone number and a password");const{data:r,error:s}=t;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new Vg;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.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:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,s,i,a,o,l,u,d,h,f;let p,m;if("message"in e)p=e.message,m=e.signature;else{const{chain:g,wallet:y,statement:v,options:x}=e;let b;if(Us())if(typeof y=="object")b=y;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")b=T.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) 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: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof y!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=y}const E=new URL((t=x==null?void 0:x.url)!==null&&t!==void 0?t:window.location.href),S=await b.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=gY(S[0]);let C=(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!C){const T=await b.request({method:"eth_chainId"});C=V0e(T)}const A={domain:E.host,address:k,statement:v,uri:E.href,version:"1",chainId:C,nonce:(s=x==null?void 0:x.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=x==null?void 0:x.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=x==null?void 0:x.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=W0e(A),m=await b.request({method:"personal_sign",params:[H0e(p),k]})}try{const{data:g,error:y}=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:m}
654,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:rl});if(y)throw y;if(!g||!g.session||!g.user){const v=new Vg;return this._returnResult({data:{user:null,session:null},error:v})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:y})}catch(g){if(wt(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var t,r,s,i,a,o,l,u,d,h,f,p;let m,g;if("message"in e)m=e.message,g=e.signature;else{const{chain:y,wallet:v,statement:x,options:b}=e;let E;if(Us())if(typeof v=="object")E=v;else{const k=window;if("solana"in k&&typeof k.solana=="object"&&("signIn"in k.solana&&typeof k.solana.signIn=="function"||"signMessage"in k.solana&&typeof k.solana.signMessage=="function"))E=k.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 v!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=v}const S=new URL((t=b==null?void 0:b.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in E&&E.signIn){const k=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),x?{statement:x}:null));let C;if(Array.isArray(k)&&k[0]&&typeof k[0]=="object")C=k[0];else if(k&&typeof k=="object"&&"signedMessage"in k&&"signature"in k)C=k;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)m=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),g=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${S.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(s=(r=b==null?void 0:b.signInWithSolana)===null||r===void 0?void 0:r.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}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.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(`
655`);const k=await E.signMessage(new TextEncoder().encode(m),"utf8");if(!k||!(k instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=k}}try{const{data:y,error:v}=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:vp(g)},!((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:rl});if(v)throw v;if(!y||!y.session||!y.user){const x=new Vg;return this._returnResult({data:{user:null,session:null},error:x})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:v})}catch(y){if(wt(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async _exchangeCodeForSession(e){const t=await Gf(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(t??"").split("/");try{if(!r&&this.flowType==="pkce")throw new d0e;const{data:i,error:a}=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:rl});if(await $s(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new Vg;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:a})}catch(i){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:t,provider:r,token:s,access_token:i,nonce:a}=e,o=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:rl}),{data:l,error:u}=o;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!l||!l.session||!l.user){const d=new Vg;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:u})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,r,s,i,a;try{if("email"in e){const{email:o,options:l}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Hg(this.storage,this.storageKey));const{error:h}=await Dt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(t=l==null?void 0:l.data)!==null&&t!==void 0?t:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:o,options:l}=e,{data:u,error:d}=await Dt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new JE("You must provide either an email or phone number.")}catch(o){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var t,r;try{let s,i;"options"in e&&(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:o}=await Dt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:rl});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,u=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(s){if(wt(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var t,r,s,i,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await Hg(this.storage,this.storageKey));const u=await Dt(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:(r=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}
655:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:I0e});return!((i=u.data)===null||i===void 0)&&i.url&&Us()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(o){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new Pa;const{error:s}=await Dt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(wt(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e,{error:a}=await Dt(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:a,error:o}=await Dt(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new JE("You must provide either an email or phone number and a type")}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await t()))();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 r=t();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await Gf(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<LR:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const a=await Gf(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=zR()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=P0e(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const t=await this._acquireLock(-1,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await Dt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Xd}):await this._useSession(async t=>{var r,s,i;const{data:a,error:o}=t;if(o)throw o;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Pa}:await Dt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Xd})})}catch(t){if(wt(t))return c0e(t)&&(await this._removeSession(),await $s(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new Pa;const a=s.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await Hg(this.storage,this.storageKey));const{data:u,error:d}=await Dt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({}
655,e),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:Xd});if(d)throw d;return a.user=u.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(r))return this._returnResult({data:{user:null},error:r});throw r}}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 Pa;const t=Date.now()/1e3;let r=t,s=!0,i=null;const{payload:a}=BR(e.access_token);if(a.exp&&(r=a.exp,s=r<=t),s){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)throw l;i={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(t){if(wt(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){const{data:a,error:o}=t;if(o)throw o;e=(r=a.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Pa;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Us())throw new QE("No browser detected.");if(e.error||e.error_description||e.error_code)throw new QE(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new N6("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new QE("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new N6("No code detected.");const{data:x,error:b}=await this._exchangeCodeForSession(e.code);if(b)throw b;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:x.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!i||!o||!a||!u)throw new QE("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(o);let f=d+h;l&&(f=parseInt(l));const p=f-d;p*1e3<=lv&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${h}s`);const m=f-h;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,d);const{data:g,error:y}=await this._getUser(i);if(y)throw y;const v={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:f,refresh_token:a,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:e.type},error:null})}catch(r){if(wt(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Gf(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;const{data:s,error:i}=t;if(i)return this._returnResult({error:i});const a=(r=s.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);
655if(o&&!(l0e(o)&&(o.status===404||o.status===401||o.status===403)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await $s(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=y0e(),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,s;try{const{data:{session:i},error:a}=t;if(a)throw a;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.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,t={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Hg(this.storage,this.storageKey,!0));try{return await Dt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:r,error:s}=await this._useSession(async i=>{var a,o,l,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:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Dt(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 Us()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(wt(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{const{error:s,data:{session:i}}=t;if(s)throw s;const{options:a,provider:o,token:l,access_token:u,nonce:d}=e,h=await Dt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:o,id_token:l,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:rl}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Vg}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await $s(this.storage,`${this.storageKey}-code-verifier`),wt(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,s;const{data:i,error:a}=t;if(a)throw a;return await Dt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const r=Date.now();return await _0e(async s=>(s>
6550&&await w0e(200*Math.pow(2,s-1)),this._debug(t,"refreshing attempt",s),await Dt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rl})),(s,i)=>{const a=200*Math.pow(2,s);return i&&FR(i)&&Date.now()+a-r<lv})}catch(r){if(this._debug(t,"error",r),wt(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),Us()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Gf(this.storage,this.storageKey);if(s&&this.userStorage){let a=await Gf(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await cv(this.userStorage,this.storageKey+"-user",a)),s.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:zR()}else if(s&&!s.user&&!s.user){const a=await Gf(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await $s(this.storage,this.storageKey+"-user"),await cv(this.storage,this.storageKey,s)):s.user=zR()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((t=s.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<LR;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${LR}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),FR(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(s.access_token);!o&&(a!=null&&a.user)?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new Pa;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new bT;const{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new Pa;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(s,"error",i),wt(i)){const a={data:null,error:i};return FR(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,t,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,t)}catch(l){i.push(l)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await $s(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),r=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&t.user&&await cv(this.userStorage,this.storageKey+"-user",{user:t.user});const s=Object.assign({},t);delete s.user;const i=D6(s);await cv(this.storage,this.storageKey,i)}else{const s=D6(t);await cv(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $s(this.storage,this.storageKey),await $s(this.storage,this.storageKey+"-code-verifier"),await $s(this.storage,this.storageKey+"-user"),this.userStorage&&await $s(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Us()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
655catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),lv);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/lv);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${lv}ms, refresh threshold is ${lM} ticks`),s<=lM&&await this._callRefreshToken(r.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof mY)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Us()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){const s=[`provider=${encodeURIComponent(t)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,a]=await Hg(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(o.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;const{data:s,error:i}=t;return i?this._returnResult({data:null,error:i}):await Dt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var r,s;const{data:i,error:a}=t;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:u}=await Dt(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(e.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?J0e(e.webauthn.credential_response):Q0e(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:l}=await Dt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({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),this._returnResult({data:o,error:l}))})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;const{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});const a=await Dt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:X0e(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Z0e(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){const{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=t==null?void 0:t.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){var e,t;const{data:{session:r},error:s}
655=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:i}=BR(r.access_token);let a=null;i.aal&&(a=i.aal);let o=a;((t=(e=r.user.factors)===null||e===void 0?void 0:e.filter(d=>d.status==="verified"))!==null&&t!==void 0?t:[]).length>0&&(o="aal2");const u=i.amr||[];return{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?await Dt(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Pa})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Pa});const a=await Dt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Us()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(wt(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Pa});const a=await Dt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Us()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(wt(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await Dt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Pa})})}catch(e){if(wt(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?(await Dt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Pa})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(o=>o.kid===e);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(o=>o.kid===e),r&&this.jwks_cached_at+a0e>s)return r;const{data:i,error:a}=await Dt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(o=>o.kid===e),!r)?null:r}async getClaims(e,t={}){try{let r=e;if(!r){const{data:p,error:m}
655=await this.getSession();if(m||!p.session)return this._returnResult({data:null,error:m});r=p.session.access_token}const{header:s,payload:i,signature:a,raw:{header:o,payload:l}}=BR(r);t!=null&&t.allowExpired||T0e(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,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!u){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:i,header:s,signature:a},error:null}}const d=j0e(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,g0e(`${o}.${l}`)))throw new dM("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(r){if(wt(r))return this._returnResult({data:null,error:r});throw r}}}x1.nextInstanceID={};const lbe=x1,cbe="2.89.0";let Cb="";typeof Deno<"u"?Cb="deno":typeof document<"u"?Cb="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Cb="react-native":Cb="node";const ube={"X-Client-Info":`supabase-js-${Cb}/${cbe}`},dbe={headers:ube},hbe={schema:"public"},fbe={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},pbe={};function b1(n){"@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(n)}function mbe(n,e){if(b1(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(b1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function gbe(n){var e=mbe(n,"string");return b1(e)=="symbol"?e:e+""}function vbe(n,e,t){return(e=gbe(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function z6(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function Sr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?z6(Object(t),!0).forEach(function(r){vbe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):z6(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const ybe=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),xbe=()=>Headers,bbe=(n,e,t)=>{const r=ybe(t),s=xbe();return async(i,a)=>{var o;const l=(o=await e())!==null&&o!==void 0?o:n;let u=new s(a==null?void 0:a.headers);return u.has("apikey")||u.set("apikey",n),u.has("Authorization")||u.set("Authorization",`Bearer ${l}`),r(i,Sr(Sr({},a),{},{headers:u}))}};function wbe(n){return n.endsWith("/")?n:n+"/"}function _be(n,e){var t,r;const{db:s,auth:i,realtime:a,global:o}=n,{db:l,auth:u,realtime:d,global:h}=e,f={db:Sr(Sr({},l),s),auth:Sr(Sr({},u),i),realtime:Sr(Sr({},d),a),storage:{},global:Sr(Sr(Sr({},h),o),{},{headers:Sr(Sr({},(t=h==null?void 0:h.headers)!==null&&t!==void 0?t:{}),(r=o==null?void 0:o.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return n.accessToken?f.accessToken=n.accessToken:delete f.accessToken,f}function Sbe(n){const e=n==null?void 0:n.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(wbe(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Ebe=class extends lbe{constructor(n){super(n)}},kbe=class{constructor(n,e,t){var r,s;this.supabaseUrl=n,this.supabaseKey=e;const i=Sbe(n);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:hbe,realtime:pbe,auth:Sr(Sr({},fbe),{},{storageKey:a}),global:dbe},l=_be(t??{},o);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=l.auth)!==null&&u!==void 0?u:{},this.headers,l.global.fetch)}this.fetch=bbe(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Sr({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new sxe(ne
655w URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new t0e(this.storageUrl.href,this.headers,this.fetch,t==null?void 0:t.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Qye(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},t={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,t)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,e,t;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return(e=(t=r.session)===null||t===void 0?void 0:t.access_token)!==null&&e!==void 0?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:t,storage:r,userStorage:s,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:u},d,h){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ebe({url:this.authUrl.href,headers:Sr(Sr({},f),d),storageKey:i,autoRefreshToken:n,persistSession:e,detectSessionInUrl:t,storage:r,userStorage:s,flowType:a,lock:o,debug:l,throwOnError:u,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new wxe(this.realtimeUrl.href,Sr(Sr({},n),{},{params:Sr(Sr({},{apikey:this.supabaseKey}),n==null?void 0:n.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,e)=>{this._handleTokenChanged(n,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(n,e,t){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==t?(this.changedAccessToken=t,this.realtime.setAuth(t)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Cbe=(n,e,t)=>new kbe(n,e,t);function Abe(){if(typeof window<"u"||typeof process>"u")return!1;const n=process.version;if(n==null)return!1;const e=n.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Abe()&&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 Nbe="https://delgyrqdrcihvvudekdx.supabase.co",Tbe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRlbGd5cnFkcmNpaHZ2dWRla2R4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjcyMDQ2OTUsImV4cCI6MjA4Mjc4MDY5NX0.hN9e_rgV5h7NwFjamAmR35Blfktg2MHpAlb0ibW3FNA",pe=Cbe(Nbe,Tbe,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),yY=_.createContext(void 0);function jbe({children:n}){const[e,t]=_.useState(null),[r,s]=_.useState(null),[i,a]=_.useState(!0);_.useEffect(()=>{const{data:{subscription:d}}=pe.auth.onAuthStateChange((h,f)=>{s(f),t((f==null?void 0:f.user)??null),a(!1)});return pe.auth.getSession().then(({data:{session:h}})=>{s(h),t((h==null?void 0:h.user)??null),a(!1)}),()=>d.unsubscribe()},[]);const o=async(d,h)=>{const{error:f}=await pe.auth.signInWithPassword({email:d,password:h});return{error:f}},l=async(d,h,f)=>{const p=`${window.location.origin}/`,{error:m}=await pe.auth.signUp({email:d,password:h,options:{emailRedirectTo:p,data:{display_name:f}}});return{error:m}},u=async()=>{await pe.auth.signOut()};return c.jsx(yY.Provider,{value:{user:e,session:r,isLoading:i,signIn:o,signUp:l,signOut:u},children:n})}function Vt(){const n=_.useContext(yY);if(n===void 0)throw new Error("useAuth must be used within an AuthProvider");return n}const xY=_.createContext(void 0);function Rbe({children:n}){const{user:e,session:t}=Vt(),[r,s]=_.useState(!1),[i,a]=_.useState(null),[o,l]=_.useState(),[u,d]=_.useState(!0),h=_.useCallback(async()=>{if(!(t!=null&&t.access_token)){s(!1),a(null),l(void 0),d(!1);return}try{const{data:f,error:p}=await pe.functions.invoke("check-subscription",{headers:{Authorization:`Bearer ${t.access_token}`}});p?(console.error("Error checking subscription:",p),s(!1),a(null)):(s(f.isPro||!1),a(f.subscriptionType||null),l(f.expiresAt))}
vendor: 24,017 bytes, line 655
655catch(f){console.error("Failed to check subscription:",f),s(!1),a(null)}finally{d(!1)}},[t==null?void 0:t.access_token]);return _.useEffect(()=>{e?h():(s(!1),a(null),l(void 0),d(!1))},[e,h]),_.useEffect(()=>{if(!e)return;const f=setInterval(h,6e4);return()=>clearInterval(f)},[e,h]),c.jsx(xY.Provider,{value:{isPro:r,subscriptionType:i,expiresAt:o,isLoading:u,checkSubscription:h},children:n})}function wT(){const n=_.useContext(xY);if(n===void 0)throw new Error("useSubscription must be used within a SubscriptionProvider");return n}const YF=_.createContext({});function XF(n){const e=_.useRef(null);return e.current===null&&(e.current=n()),e.current}const ZF=typeof window<"u",bY=ZF?_.useLayoutEffect:_.useEffect,_T=_.createContext(null);function JF(n,e){n.indexOf(e)===-1&&n.push(e)}function QF(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}const fd=(n,e,t)=>t>e?e:t<n?n:t;let F2=()=>{};const pd={},wY=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function _Y(n){return typeof n=="object"&&n!==null}const SY=n=>/^0[^.\s]+$/u.test(n);function e3(n){let e;return()=>(e===void 0&&(e=n()),e)}const Io=n=>n,Pbe=(n,e)=>t=>e(n(t)),IS=(...n)=>n.reduce(Pbe),w1=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r};class t3{constructor(){this.subscriptions=[]}add(e){return JF(this.subscriptions,e),()=>QF(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const zc=n=>n*1e3,Po=n=>n/1e3;function EY(n,e){return e?n*(1e3/e):0}const kY=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,Dbe=1e-7,Obe=12;function Mbe(n,e,t,r,s){let i,a,o=0;do a=e+(t-e)/2,i=kY(a,r,s)-n,i>0?t=a:e=a;while(Math.abs(i)>Dbe&&++o<Obe);return a}function LS(n,e,t,r){if(n===e&&t===r)return Io;const s=i=>Mbe(i,0,1,n,t);return i=>i===0||i===1?i:kY(s(i),e,r)}const CY=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,AY=n=>e=>1-n(1-e),NY=LS(.33,1.53,.69,.99),n3=AY(NY),TY=CY(n3),jY=n=>(n*=2)<1?.5*n3(n):.5*(2-Math.pow(2,-10*(n-1))),r3=n=>1-Math.sin(Math.acos(n)),RY=AY(r3),PY=CY(r3),Ibe=LS(.42,0,1,1),Lbe=LS(0,0,.58,1),DY=LS(.42,0,.58,1),Fbe=n=>Array.isArray(n)&&typeof n[0]!="number",OY=n=>Array.isArray(n)&&typeof n[0]=="number",$6={linear:Io,easeIn:Ibe,easeInOut:DY,easeOut:Lbe,circIn:r3,circInOut:PY,circOut:RY,backIn:n3,backInOut:TY,backOut:NY,anticipate:jY},Bbe=n=>typeof n=="string",U6=n=>{if(OY(n)){F2(n.length===4);const[e,t,r,s]=n;return LS(e,t,r,s)}else if(Bbe(n))return F2($6[n]!==void 0),$6[n];return n},ek=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],V6={value:null,addProjectionMetrics:null};function zbe(n,e){let t=new Set,r=new Set,s=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1},l=0;function u(h){a.has(h)&&(d.schedule(h),n()),l++,h(o)}const d={schedule:(h,f=!1,p=!1)=>{const g=p&&s?t:r;return f&&a.add(h),g.has(h)||g.add(h),h},cancel:h=>{r.delete(h),a.delete(h)},process:h=>{if(o=h,s){i=!0;return}s=!0,[t,r]=[r,t],t.forEach(u),e&&V6.value&&V6.value.frameloop[e].push(l),l=0,t.clear(),s=!1,i&&(i=!1,d.process(h))}};return d}const $be=40;function MY(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>t=!0,a=ek.reduce((b,E)=>(b[E]=zbe(i,e?E:void 0),b),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:d,update:h,preRender:f,render:p,postRender:m}=a,g=()=>{const b=pd.useManualTiming?s.timestamp:performance.now();t=!1,pd.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(b-s.timestamp,$be),1)),s.timestamp=b,s.isProcessing=!0,o.process(s),l.process(s),u.process(s),d.process(s),h.process(s),f.process(s),p.process(s),m.process(s),s.isProcessing=!1,t&&e&&(r=!1,n(g))},y=()=>{t=!0,r=!0,s.isProcessing||n(g)};return{schedule:ek.reduce((b,E)=>{const S=a[E];return b[E]=(k,C=!1,A=!1)=>(t||y(),S.schedule(k,C,A)),b},{}),cancel:b=>{for(let E=0;E<ek.length;E++)a[ek[E]].cancel(b)},state:s,steps:a}}const{schedule:sr,cancel:pf,state:Ys,steps:UR}=MY(typeof requestAnimationFrame<"u"?requestAnimationFrame:Io,!0);let Zk;function Ube(){Zk=void 0}const xa={now:()=>(Zk===void 0&&xa.set(Ys.isProcessing||pd.useManualTiming?Ys.timestamp:performance.now()),Zk),set:n=>{Zk=n,queueMicrotask(Ube)}},IY=n=>e=>typeof e=="string"&&e.startsWith(n),LY=IY("--"),Vbe=IY("var(--"),s3=n=>Vbe(n)?Hbe.test(n.split("/*")[0].trim()):!1,Hbe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,E0={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},_1={...E0,transform:n=>fd(0,1,n)},tk={...E0,default:1},yw=n=>Math.round(n*1e5)/1e5,i3=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Wbe(n){return n==null}const qbe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,a3=(n,e)=>t=>!!(typeof t=="string"&&qbe.test(t)&&t.startsWith(n)||e&&!Wbe(t)&&Object.prototype.hasOwnProperty.call(t,e)),FY=(n,e,t)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match(i3);return{[n]:parseFloat(s),[e]:parseFloat(i),[t]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},Gbe=n=>fd(0,255,n),VR={...E0,transform:n=>Math.round(Gbe(n))},yp={test:a3("rgb","red"),parse:FY("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+VR.transform(n)+", "+VR.transform(e)+", "+VR.transform(t)+", "+yw(_1.transform(r))+")"};function Kbe(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const hM={test:a3("#"),parse:Kbe,transform:yp.transform},FS=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Id=FS("deg"),$c=FS("%"),Mt=FS("px"),Ybe=FS("vh"),Xbe=FS("vw"),H6={...$c,parse:n=>$c.parse(n)/100,transform:n=>$c.transform(n*100)},zv={test:a3("hsl","hue"),parse:FY("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+$c.transform(yw(e))+", "+$c.transform(yw(t))+", "+yw(_1.transform(r))+")"},Zr={test:n=>yp.test(n)||hM.test(n)||zv.test(n),parse:n=>yp.test(n)?yp.parse(n):zv.test(n)?zv.parse(n):hM.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?yp.transform(n):zv.transform(n),getAnimatableNone:n=>{const e=Zr.parse(n);return e.alpha=0,Zr.transform(e)}},Zbe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Jbe(n){var e,t;return isNaN(n)&&typeof n=="string"&&(((e=n.match(i3))==null?void 0:e.length)||0)+(((t=n.match(Zbe))==null?void 0:t.length)||0)>0}const BY="number",zY="color",Qbe="var",ewe="var(",W6="${}",twe=/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 S1(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=e.replace(twe,l=>(Zr.test(l)?(r.color.push(i),s.push(zY),t.push(Zr.parse(l))):l.startsWith(ewe)?(r.var.push(i),s.push(Qbe),t.push(l)):(r.number.push(i),s.push(BY),t.push(parseFloat(l))),++i,W6)).split(W6);return{values:t,split:o,indexes:r,types:s}}function $Y(n){return S1(n).values}function UY(n){const{split:e,types:t}=S1(n),r=e.length;return s=>{let i="";for(let a=0;a<r;a++)if(i+=e[a],s[a]!==void 0){const o=t[a];o===BY?i+=yw(s[a]):o===zY?i+=Zr.transform(s[a]):i+=s[a]}return i}}const nwe=n=>typeof n=="number"?0:Zr.test(n)?Zr.getAnimatableNone(n):n;function rwe(n){const e=$Y(n);return UY(n)(e.map(nwe))}const mf={test:Jbe,parse:$Y,createTransformer:UY,getAnimatableNone:rwe};function HR(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function swe({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,i=0,a=0;if(!e)s=i=a=t;else{const o=t<.5?t*(1+e):t+e-t*e,l=2*t-o;s=HR(l,o,n+1/3),i=HR(l,o,n),a=HR(l,o,n-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function B2(n,e){return t=>t>0?e:n}const fr=(n,e,t)=>n+(e-n)*t,WR=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},iwe=[hM,yp,zv],awe=n=>iwe.find(e=>e.test(n));function q6(n){const e=awe(n);if(!e)return!1;let t=e.parse(n);return e===zv&&(t=swe(t)),t}const G6=(n,e)=>{const t=q6(n),r=q6(e);if(!t||!r)return B2(n,e);const s={...t};return i=>(s.red=WR(t.red,r.red,i),s.green=WR(t.green,r.green,i),s.blue=WR(t.blue,r.blue,i),s.alpha=fr(t.alpha,r.alpha,i),yp.transform(s))},fM=new Set(["none","hidden"]);function owe(n,e){return fM.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function lwe(n,e){return t=>fr(n,e,t)}function o3(n){return typeof n=="number"?lwe:typeof n=="string"?s3(n)?B2:Zr.test(n)?G6:dwe:Array.isArray(n)?VY:typeof n=="object"?Zr.test(n)?G6:cwe:B2}function VY(n,e){const t=[...n],r=t.length,s=n.map((i,a)=>o3(i)(i,e[a]));return i=>{for(let a=0;a<r;a++)t[a]=s[a](i);return t}}function cwe(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=o3(n[s])(n[s],e[s]));return s=>{for(const i in r)t[i]=r[i](s);return t}}function uwe(n,e){const t=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],a=n.indexes[i][r[i]],o=n.values[a]??0;t[s]=o,r[i]++}return t}const dwe=(n,e)=>{const t=mf.createTransformer(e),r=S1(n),s=S1(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?fM.has(n)&&!s.values.length||fM.has(e)&&!r.values.length?owe(n,e):IS(VY(uwe(r,s),s.values),t):B2(n,e)};function HY(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?fr(n,e,t):o3(n)(n,e)}const hwe=n=>{const e=({timestamp:t})=>n(t);return{start:(t=!0)=>sr.update(e,t),stop:()=>pf(e),now:()=>Ys.isProcessing?Ys.timestamp:xa.now()}},WY=(n,e,t=10)=>{let r="";const s=Math.max(Math.round(e/t),2);for(let i=0;i<s;i++)r+=Math.round(n(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},z2=2e4;function l3(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<z2;)e+=t,r=n.next(e);return e>=z2?1/0:e}function fwe(n,e=100,t){const r=t({...n,keyframes:[0,e]}),s=Math.min(l3(r),z2);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Po(s)}}const pwe=5;function qY(n,e,t){const r=Math.max(e-pwe,0);return EY(t-n(r),e-r)}const kr={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},qR=.001;function mwe({duration:n=kr.duration,bounce:e=kr.bounce,velocity:t=kr.velocity,mass:r=kr.mass}){let s,i,a=1-e;a=fd(kr.minDamping,kr.maxDamping,a),n=fd(kr.minDuration,kr.maxDuration,Po(n)),a<1?(s=u=>{const d=u*a,h=d*n,f=d-t,p=pM(u,a),m=Math.exp(-h);return qR-f/p*m},i=u=>{const h=u*a*n,f=h*t+t,p=Math.pow(a,2)*Math.pow(u,2)*n,m=Math.exp(-h),g=pM(Math.pow(u,2),a);return(-s(u)+qR>0?-1:1)*((f-p)*m)/g}):(s=u=>{const d=Math.exp(-u*n),h=(u-t)*n+1;return-qR+d*h},i=u=>{const d=Math.exp(-u*n),h=(t-u)*(n*n);return d*h});const o=5/n,l=vwe(s,i,o);if(n=zc(n),isNaN(l))return{stiffness:kr.stiffness,damping:kr.damping,duration:n};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:n}}}const gwe=12;function vwe(n,e,t){let r=t;for(let s=1;s<gwe;s++)r=r-n(r)/e(r);return r}function pM(n,e){return n*Math.sqrt(1-e*e)}const ywe=["duration","bounce"],xwe=["stiffness","damping","mass"];function K6(n,e){return e.some(t=>n[t]!==void 0)}function bwe(n){let e={velocity:kr.velocity,stiffness:kr.stiffness,damping:kr.damping,mass:kr.mass,isResolvedFromDuration:!1,...n};if(!K6(n,xwe)&&K6(n,ywe))if(n.visualDuration){const t=n.visualDuration,r=2*Math.PI/(t*1.2),s=r*r,i=2*fd(.05,1,1-(n.bounce||0))*Math.sqrt(s);e={...e,mass:kr.mass,stiffness:s,damping:i}}else{const t=mwe(n);e={...e,...t,mass:kr.mass},e.isResolvedFromDuration=!0}return e}function $2(n=kr.visualDuration,e=kr.bounce){const t=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:r,restDelta:s}=t;const i=t.keyframes[0],a=t.keyframes[t.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:h,velocity:f,isResolvedFromDuration:p}=bwe({...t,velocity:-Po(t.velocity||0)}),m=f||0,g=u/(2*Math.sqrt(l*d)),y=a-i,v=Po(Math.sqrt(l/d)),x=Math.abs(y)<5;r||(r=x?kr.restSpeed.granular:kr.restSpeed.default),s||(s=x?kr.restDelta.granular:kr.restDelta.default);let b;if(g<1){const S=pM(v,g);b=k=>{const C=Math.exp(-g*v*k);return a-C*((m+g*v*y)/S*Math.sin(S*k)+y*Math.cos(S*k))}}else if(g===1)b=S=>a-Math.exp(-v*S)*(y+(m+v*y)*S);else{const S=v*Math.sqrt(g*g-1);b=k=>{const C=Math.exp(-g*v*k),A=Math.min(S*k,300);return a-C*((m+g*v*y)*Math.sinh(A)+S*y*Math.cosh(A))/S}}const E={calculatedDuration:p&&h||null,next:S=>{const k=b(S);if(p)o.done=S>=h;else{let C=S===0?m:0;g<1&&(C=S===0?zc(m):qY(b,S,k));const A=Math.abs(C)<=r,T=Math.abs(a-k)<=s;o.done=A&&T}return o.value=o.done?a:k,o},toString:()=>{const S=Math.min(l3(E),z2),k=WY(C=>E.next(S*C).value,S,30);return S+"ms "+k},toTransition:()=>{}};return E}$2.applyToOptions=n=>{const e=fwe(n,100,$2);return n.ease=e.ease,n.duration=zc(e.duration),n.type="keyframes",n};function mM({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:d}){const h=n[0],f={done:!1,value:h},p=A=>o!==void 0&&A<o||l!==void 0&&A>l,m=A=>o===void 0?l:l===void 0||Math.abs(o-A)<Math.abs(l-A)?o:l;let g=t*e;const y=h+g,v=a===void 0?y:a(y);v!==y&&(g=v-h);const x=A=>-g*Math.exp(-A/r),b=A=>v+x(A),E=A=>{const T=x(A),j=b(A);f.done=Math.abs(T)<=u,f.value=f.done?v:j};let S,k;const C=A=>{p(f.value)&&(S=A,k=$2({keyframes:[f.value,m(f.value)],velocity:qY(b,A,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:A=>{let T=!1;return!k&&S===void 0&&(T=!0,E(A),C(A)),S!==void 0&&A>=S?k.next(A-S):(!T&&E(A),f)}}}function wwe(n,e,t){const r=[],s=t||pd.mix||HY,i=n.length-1;for(let a=0;a<i;a++){let o=s(n[a],n[a+1]);if(e){const l=Array.isArray(e)?e[a]||Io:e;o=IS(l,o)}r.push(o)}return r}function _we(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const i=n.length;if(F2(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=n[0]===n[1];n[0]>n[i-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=wwe(e,r,s),l=o.length,u=d=>{if(a&&d<n[0])return e[0];let h=0;if(l>1)for(;h<n.length-2&&!(d<n[h+1]);h++);const f=w1(n[h],n[h+1],d);return o[h](f)};return t?d=>u(fd(n[0],n[i-1],d)):u}function Swe(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=w1(0,e,r);n.push(fr(t,1,s))}}function Ewe(n){const e=[0];return Swe(e,n.length-1),e}function kwe(n,e){return n.map(t=>t*e)}function Cwe(n,e){return n.map(()=>e||DY).splice(0,n.length-1)}function xw({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=Fbe(r)?r.map(U6):U6(r),i={done:!1,value:e[0]},a=kwe(t&&t.length===e.length?t:Ewe(e),n),o=_we(a,e,{ease:Array.isArray(s)?s:Cwe(e,s)});return{calculatedDuration:n,next:l=>(i.value=o(l),i.done=l>=n,i)}}const Awe=n=>n!==null;function c3(n,{repeat:e,repeatType:t="loop"},r,s=1){const i=n.filter(Awe),o=s<0||e&&t!=="loop"&&e%2===1?0:i.length-1;return!o||r===void 0?i[o]:r}const Nwe={decay:mM,inertia:mM,tween:xw,keyframes:xw,spring:$2};function GY(n){typeof n.type=="string"&&(n.type=Nwe[n.type])}class u3{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Twe=n=>n/100;class d3 extends u3{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:t}=this.options;t&&t.updatedAt!==xa.now()&&this.tick(xa.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;GY(e);const{type:t=xw,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=e;let{keyframes:o}=e;const l=t||xw;l!==xw&&typeof o[0]!="number"&&(this.mixKeyframes=IS(Twe,HY(o[0],o[1])),o=[0,100]);const u=l({...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...o].reverse(),velocity:-a})),u.calculatedDuration===null&&(u.calculatedDuration=l3(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:f,repeatDelay:p,type:m,onUpdate:g,finalKeyframe:y}=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)),t?this.currentTime=e:this.updateTime(e);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?v<0:v>s;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let b=this.currentTime,E=r;if(h){const A=Math.min(this.currentTime,s)/o;let T=Math.floor(A),j=A%1;!j&&A>=1&&(j=1),j===1&&T--,T=Math.min(T,h+1),!!(T%2)&&(f==="reverse"?(j=1-j,p&&(j-=p/o)):f==="mirror"&&(E=a)),b=fd(0,1,j)*o}const S=x?{done:!1,value:d[0]}:E.next(b);i&&(S.value=i(S.value));let{done:k}=S;!x&&l!==null&&(k=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&m!==mM&&(S.value=c3(d,this.options,y,this.speed)),g&&g(S.value),C&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return Po(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Po(e)}get time(){return Po(this.currentTime)}set time(e){var t;e=zc(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),(t=this.driver)==null||t.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(xa.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Po(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=hwe,startTime:t}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),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(xa.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(e=this.options).onComplete)==null||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(e=this.options).onCancel)==null||t.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 t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),e.observe(this)}}function jwe(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const xp=n=>n*180/Math.PI,gM=n=>{const e=xp(Math.atan2(n[1],n[0]));return vM(e)},Rwe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:gM,rotateZ:gM,skewX:n=>xp(Math.atan(n[1])),skewY:n=>xp(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},vM=n=>(n=n%360,n<0&&(n+=360),n),Y6=gM,X6=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),Z6=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),Pwe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:X6,scaleY:Z6,scale:n=>(X6(n)+Z6(n))/2,rotateX:n=>vM(xp(Math.atan2(n[6],n[5]))),rotateY:n=>vM(xp(Math.atan2(-n[2],n[0]))),rotateZ:Y6,rotate:Y6,skewX:n=>xp(Math.atan(n[4])),skewY:n=>xp(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function yM(n){return n.includes("scale")?1:0}function xM(n,e){if(!n||n==="none")return yM(e);const t=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(t)r=Pwe,s=t;else{const o=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Rwe,s=o}if(!s)return yM(e);const i=r[e],a=s[1].split(",").map(Owe);return typeof i=="function"?i(a):a[i]}const Dwe=(n,e)=>{const{transform:t="none"}=getComputedStyle(n);return xM(t,e)};function Owe(n){return parseFloat(n.trim())}const k0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],C0=new Set(k0),J6=n=>n===E0||n===Mt,Mwe=new Set(["x","y","z"]),Iwe=k0.filter(n=>!Mwe.has(n));function Lwe(n){const e=[];return Iwe.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const Om={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>xM(e,"x"),y:(n,{transform:e})=>xM(e,"y")};Om.translateX=Om.x;Om.translateY=Om.y;const Mm=new Set;let bM=!1,wM=!1,_M=!1;function KY(){if(wM){const n=Array.from(Mm).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=Lwe(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))==null||o.set(a)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}wM=!1,bM=!1,Mm.forEach(n=>n.complete(_M)),Mm.clear()}function YY(){Mm.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(wM=!0)})}function Fwe(){_M=!0,YY(),KY(),_M=!1}class h3{constructor(e,t,r,s,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(Mm.add(this),bM||(bM=!0,sr.read(YY),sr.resolveKeyframes(KY))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&t){const o=r.readValue(t,a);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=a),s&&i===void 0&&s.set(e[0])}jwe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Mm.delete(this)}cancel(){this.state==="scheduled"&&(Mm.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Bwe=n=>n.startsWith("--");function zwe(n,e,t){Bwe(e)?n.style.setProperty(e,t):n.style[e]=t}const $we=e3(()=>window.ScrollTimeline!==void 0),Uwe={};function Vwe(n,e){const t=e3(n);return()=>Uwe[e]??t()}const XY=Vwe(()=>{try{document.createElement("div").animate({opacity:0}
655,{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ab=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,Q6={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ab([0,.65,.55,1]),circOut:Ab([.55,0,1,.45]),backIn:Ab([.31,.01,.66,-.59]),backOut:Ab([.33,1.53,.69,.99])};function ZY(n,e){if(n)return typeof n=="function"?XY()?WY(n,e):"ease-out":OY(n)?Ab(n):Array.isArray(n)?n.map(t=>ZY(t,e)||Q6.easeOut):Q6[n]}function Hwe(n,e,t,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const d={[e]:t};l&&(d.offset=l);const h=ZY(o,s);Array.isArray(h)&&(d.easing=h);const f={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),n.animate(d,f)}function JY(n){return typeof n=="function"&&"applyToOptions"in n}function Wwe({type:n,...e}){return JY(n)&&XY()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class qwe extends u3{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:t,name:r,keyframes:s,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,F2(typeof e.type!="string");const u=Wwe(e);this.animation=Hwe(t,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=c3(s,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(d):zwe(t,r,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;(t=(e=this.animation).finish)==null||t.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,t;this.isPseudoElement||(t=(e=this.animation).commitStyles)==null||t.call(e)}get duration(){var t,r;const e=((r=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:r.call(t).duration)||0;return Po(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Po(e)}get time(){return Po(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=zc(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:t}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&$we()?(this.animation.timeline=e,Io):t(this)}}const QY={anticipate:jY,backInOut:TY,circInOut:PY};function Gwe(n){return n in QY}function Kwe(n){typeof n.ease=="string"&&Gwe(n.ease)&&(n.ease=QY[n.ease])}const e8=10;class Ywe extends qwe{constructor(e){Kwe(e),GY(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:s,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const o=new d3({...a,autoplay:!1}),l=zc(this.finishedTime??this.time);t.setWithVelocity(o.sample(l-e8).value,o.sample(l).value,e8),o.stop()}}const t8=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(mf.test(n)||n==="0")&&!n.startsWith("url("));function Xwe(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Zwe(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=n[n.length-1],a=t8(s,e),o=t8(i,e);return!a||!o?!1:Xwe(n)||(t==="spring"||JY(t))&&r}function SM(n){n.duration=0,n.type="keyframes"}const Jwe=new Set(["opacity","clipPath","filter","transform"]),Qwe
655=e3(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function e1e(n){var d;const{motionValue:e,name:t,repeatDelay:r,repeatType:s,damping:i,type:a}=n;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=e.owner.getProps();return Qwe()&&t&&Jwe.has(t)&&(t!=="transform"||!u)&&!l&&!r&&s!=="mirror"&&i!==0&&a!=="inertia"}const t1e=40;class n1e extends u3{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",keyframes:o,name:l,motionValue:u,element:d,...h}){var m;super(),this.stop=()=>{var g,y;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=xa.now();const f={autoplay:e,delay:t,type:r,repeat:s,repeatDelay:i,repeatType:a,name:l,motionValue:u,element:d,...h},p=(d==null?void 0:d.KeyframeResolver)||h3;this.keyframeResolver=new p(o,(g,y,v)=>this.onKeyframesResolved(g,y,f,!v),l,u,d),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(e,t,r,s){this.keyframeResolver=void 0;const{name:i,type:a,velocity:o,delay:l,isHandoff:u,onUpdate:d}=r;this.resolvedAt=xa.now(),Zwe(e,i,a,o)||((pd.instantAnimations||!l)&&(d==null||d(c3(e,r,t))),e[0]=e[e.length-1],SM(r),r.repeat=0);const f={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>t1e?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},p=!u&&e1e(f)?new Ywe({...f,element:f.motionValue.owner.current}):new d3(f);p.finished.then(()=>this.notifyFinished()).catch(Io),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,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Fwe()),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 r1e=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function s1e(n){const e=r1e.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}function eX(n,e,t=1){const[r,s]=s1e(n);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const a=i.trim();return wY(a)?parseFloat(a):a}return s3(s)?eX(s,e,t+1):s}function f3(n,e){return(n==null?void 0:n[e])??(n==null?void 0:n.default)??n}const tX=new Set(["width","height","top","left","right","bottom",...k0]),i1e={test:n=>n==="auto",parse:n=>n},nX=n=>e=>e.test(n),rX=[E0,Mt,$c,Id,Xbe,Ybe,i1e],n8=n=>rX.find(nX(n));function a1e(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||SY(n):!0}const o1e=new Set(["brightness","contrast","saturate","opacity"]);function l1e(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(i3)||[];if(!r)return n;const s=t.replace(r,"");let i=o1e.has(e)?1:0;return r!==t&&(i*=100),e+"("+i+s+")"}const c1e=/\b([a-z-]*)\(.*?\)/gu,EM={...mf,getAnimatableNone:n=>{const e=n.match(c1e);return e?e.map(l1e).join(" "):n}},r8={...E0,transform:Math.round},u1e={rotate:Id,rotateX:Id,rotateY:Id,rotateZ:Id,scale:tk,scaleX:tk,scaleY:tk,scaleZ:tk,skew:Id,skewX:Id,skewY:Id,distance:Mt,translateX:Mt,translateY:Mt,translateZ:Mt,x:Mt,y:Mt,z:Mt,perspective:Mt,transformPerspective:Mt,opacity:_1,originX:H6,originY:H6,originZ:Mt},p3={borderWidth:Mt,borderTopWidth:Mt,borderRightWidth:Mt,borderBottomWidth:Mt,borderLeftWidth:Mt,borderRadius:Mt,radius:Mt,borderTopLeftRadius:Mt,borderTopRightRadius:Mt,borderBottomRightRadius:Mt,borderBottomLeftRadius:Mt,width:Mt,maxWidth:Mt,height:Mt,maxHeight:Mt,top:Mt,right:Mt,bottom:Mt,left:Mt,padding:Mt,paddingTop:Mt,paddingRight:Mt,paddingBottom:Mt,paddingLeft:Mt,margin:Mt,marginTop:Mt,marginRight:Mt,marginBottom:Mt,marginLeft:Mt,backgroundPositionX:Mt,backgroundPositionY:Mt,...u1e,zIndex:r8,fillOpacity:_1,strokeOpacity:_1,numOctaves:r8},d1e={...p3,color:Zr,backgroundColor:Zr,outlineColor:Zr,fill:Zr,stroke:Zr,borderColor:Zr,borderTopColor:Zr,borderRightColor:Zr,borderBottomColor:Zr,borderLeftColor:Zr,filter:EM,WebkitFilter:EM},sX=n=>d1e[n];function iX(n,e){let t=sX(n);return t!==EM&&(t=mf),t.getAnimatableNone?t.getAnimatableNone(e):void 0}
vendor: 14,884 bytes, lines 655-663
655const h1e=new Set(["auto","none","0"]);function f1e(n,e,t){let r=0,s;for(;r<n.length&&!s;){const i=n[r];typeof i=="string"&&!h1e.has(i)&&S1(i).values.length&&(s=n[r]),r++}if(s&&t)for(const i of e)n[i]=iX(t,s)}class p1e extends h3{constructor(e,t,r,s,i){super(e,t,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),s3(u))){const d=eX(u,t.current);d!==void 0&&(e[l]=d),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!tX.has(r)||e.length!==2)return;const[s,i]=e,a=n8(s),o=n8(i);if(a!==o)if(J6(a)&&J6(o))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else Om[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||a1e(e[s]))&&r.push(s);r.length&&f1e(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Om[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var o;const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(t);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Om[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function m1e(n,e,t){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const s=document.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}const aX=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function oX(n){return _Y(n)&&"offsetHeight"in n}const s8=30,g1e=n=>!isNaN(parseFloat(n));class v1e{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=xa.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=xa.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=g1e(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new t3);const r=this.events[e].add(t);return e==="change"?()=>{r(),sr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&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=xa.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>s8)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,s8);return EY(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Bx(n,e){return new v1e(n,e)}const{schedule:m3,cancel:Vqe}=MY(queueMicrotask,!1),cl={x:!1,y:!1};function lX(){return cl.x||cl.y}function y1e(n){return n==="x"||n==="y"?cl[n]?null:(cl[n]=!0,()=>{cl[n]=!1}):cl.x||cl.y?null:(cl.x=cl.y=!0,()=>{cl.x=cl.y=!1})}function cX(n,e){const t=m1e(n),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[t,s,()=>r.abort()]}function i8(n){return!(n.pointerType==="touch"||lX())}function x1e(n,e,t={}){const[r,s,i]=cX(n,t),a=o=>{if(!i8(o))return;const{target:l}=o,u=e(l,o);if(typeof u!="function"||!l)return;const d=h=>{i8(h)&&(u(h),l.removeEventListener("pointerleave",d))};l.addEventListener("pointerleave",d,s)};return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}const uX=(n,e)=>e?n===e?!0:uX(n,e.parentElement):!1,g3=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,b1e=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function w1e(n){return b1e.has(n.tagName)||n.tabIndex!==-1}const Jk=new WeakSet;function a8(n){return e=>{e.key==="Enter"&&n(e)}}function GR(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const _1e=(n,e)=>{const t=n.currentTarget;if(!t)return;const r=a8(()=>{if(Jk.has(t))return;GR(t,"down");const s=a8(()=>{GR(t,"up")}),i=()=>GR(t,"cancel");t.addEventListener("keyup",s,e),t.addEventListener("blur",i,e)});t.addEventListener("keydown",r,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",r),e)};function o8(n){return g3(n)&&!lX()}function S1e(n,e,t={}){const[r,s,i]=cX(n,t),a=o=>{const l=o.currentTarget;if(!o8(o))return;Jk.add(l);const u=e(l,o),d=(p,m)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),Jk.has(l)&&Jk.delete(l),o8(p)&&typeof u=="function"&&u(p,{success:m})},h=p=>{d(p,l===window||l===document||t.useGlobalTarget||uX(l,p.target))},f=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",f,s)};return r.forEach(o=>{(t.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),oX(o)&&(o.addEventListener("focus",u=>_1e(u,s)),!w1e(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function dX(n){return _Y(n)&&"ownerSVGElement"in n}function E1e(n){return dX(n)&&n.tagName==="svg"}const _i=n=>!!(n&&n.getVelocity),k1e=[...rX,Zr,mf],C1e=n=>k1e.find(nX(n)),v3=_.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function l8(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function A1e(...n){return e=>{let t=!1;const r=n.map(s=>{const i=l8(s,e);return!t&&typeof i=="function"&&(t=!0),i});if(t)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():l8(n[s],null)}}}}function N1e(...n){return _.useCallback(A1e(...n),n)}class T1e extends _.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=t.offsetParent,s=oX(r)&&r.offsetWidth||0,i=this.props.sizeRef.current;i.height=t.offsetHeight||0,i.width=t.offsetWidth||0,i.top=t.offsetTop,i.left=t.offsetLeft,i.right=s-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function j1e({children:n,isPresent:e,anchorX:t,root:r}){const s=_.useId(),i=_.useRef(null),a=_.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:o}=_.useContext(v3),l=N1e(i,n==null?void 0:n.ref);return _.useInsertionEffect(()=>{const{width:u,height:d,top:h,left:f,right:p}=a.current;if(e||!i.current||!u||!d)return;const m=t==="left"?`left: ${f}`:`right: ${p}`;i.current.dataset.motionPopId=s;const g=document.createElement("style");o&&(g.nonce=o);const y=r??document.head;return y.appendChild(g),g.sheet&&g.sheet.insertRule(`
656          [data-motion-pop-id="${s}"] {
657            position: absolute !important;
658            width: ${u}px !important;
659            height: ${d}px !important;
660            ${m}px !important;
661            top: ${h}px !important;
662          }
663        `),()=>{y.contains(g)&&y.removeChild(g)}},[e]),c.jsx(T1e,{isPresent:e,childRef:i,sizeRef:a,children:_.cloneElement(n,{ref:l})})}const R1e=({children:n,initial:e,isPresent:t,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a,anchorX:o,root:l})=>{const u=XF(P1e),d=_.useId();let h=!0,f=_.useMemo(()=>(h=!1,{id:d,initial:e,isPresent:t,custom:s,onExitComplete:p=>{u.set(p,!0);for(const m of u.values())if(!m)return;r&&r()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[t,u,r]);return i&&h&&(f={...f}),_.useMemo(()=>{u.forEach((p,m)=>u.set(m,!1))},[t]),_.useEffect(()=>{!t&&!u.size&&r&&r()},[t]),a==="popLayout"&&(n=c.jsx(j1e,{isPresent:t,anchorX:o,root:l,children:n})),c.jsx(_T.Provider,{value:f,children:n})};function P1e(){return new Map}function hX(n=!0){const e=_.useContext(_T);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:r,register:s}=e,i=_.useId();_.useEffect(()=>{if(n)return s(i)},[n]);const a=_.useCallback(()=>n&&r&&r(i),[i,r,n]);return!t&&r?[!1,a]:[!0]}const nk=n=>n.key||"";function c8(n){const e=[];return _.Children.forEach(n,t=>{_.isValidElement(t)&&e.push(t)}),e}const y3=({children:n,custom:e,initial:t=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1,anchorX:o="left",root:l})=>{const[u,d]=hX(a),h=_.useMemo(()=>c8(n),[n]),f=a&&!u?[]:h.map(nk),p=_.useRef(!0),m=_.useRef(h),g=XF(()=>new Map),[y,v]=_.useState(h),[x,b]=_.useState(h);bY(()=>{p.current=!1,m.current=h;for(let k=0;k<x.length;k++){const C=nk(x[k]);f.includes(C)?g.delete(C):g.get(C)!==!0&&g.set(C,!1)}},[x,f.length,f.join("-")]);const E=[];if(h!==y){let k=[...h];for(let C=0;C<x.length;C++){const A=x[C],T=nk(A);f.includes(T)||(k.splice(C,0,A),E.push(A))}return i==="wait"&&E.length&&(k=E),b(c8(k)),v(h),null}const{forceRender:S}=_.useContext(YF);return c.jsx(c.Fragment,{children:x.map(k=>{const C=nk(k),A=a&&!u?!1:h===x||f.includes(C),T=()=>{if(g.has(C))g.set(C,!0);else return;let j=!0;g.forEach(D=>{D||(j=!1)}),j&&(S==null||S(),b(m.current),a&&(d==null||d()),r&&r())};return c.jsx(R1e,{isPresent:A,initial:!p.current||t?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:l,onExitComplete:A?void 0:T,anchorX:o,children:k},C)})})},fX=_.createContext({strict:!1}),u8={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"]},zx={};for(const n in u8)zx[n]={isEnabled:e=>u8[n].some(t=>!!e[t])};function D1e(n){for(const e in n)zx[e]={...zx[e],...n[e]}}const O1e=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 U2(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||O1e.has(n)}let pX=n=>!U2(n);function M1e(n){typeof n=="function"&&(pX=e=>e.startsWith("on")?!U2(e):n(e))}try{M1e(require("@emotion/is-prop-valid").default)}catch{}function I1e(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||(pX(s)||t===!0&&U2(s)||!e&&!U2(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}const ST=_.createContext({});function ET(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function E1(n){return typeof n=="string"||Array.isArray(n)}const x3=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],b3=["initial",...x3];function kT(n){return ET(n.animate)||b3.some(e=>E1(n[e]))}function mX(n){return!!(kT(n)||n.variants)}function L1e(n,e){if(kT(n)){const{initial:t,animate:r}=n;return{initial:t===!1||E1(t)?t:void 0,animate:E1(r)?r:void 0}}return n.inherit!==!1?e:{}}function F1e(n){const{initial:e,animate:t}=L1e(n,_.useContext(ST));return _.useMemo(()=>({initial:e,animate:t}),[d8(e),d8(t)])}function d8(n){return Array.isArray(n)?n.join(" "):n}function h8(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const nb={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Mt.test(n))n=parseFloat(n);else return n;const t=h8(n,e.target.x),r=h8(n,e.target.y);return`${t}% ${r}%`}},B1e={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=mf.parse(n);if(s.length>5)return r;const i=mf.createTransformer(n),a=typeof s[0]!="number"?1:0,o=t.x.scale*e.x,l=t.y.scale*e.y;s[0+a]/=o,s[1+a]/=l;const u=fr(o,l,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}},kM={borderRadius:{...nb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:nb,borderTopRightRadius:nb,borderBottomLeftRadius:nb,borderBottomRightRadius:nb,boxShadow:B1e};function gX(n,{layout:e,layoutId:t}){return C0.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!kM[n]||n==="opacity")}const z1e={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$1e=k0.length;function U1e(n,e,t){let r="",s=!0;for(let i=0;i<$1e;i++){const a=k0[i],o=n[a];if(o===void 0)continue;let l=!0;if(typeof o=="number"?l=o===(a.startsWith("scale")?1:0):l=parseFloat(o)===0,!l||t){const u=aX(o,p3[a]);if(!l){s=!1;const d=z1e[a]||a;r+=`${d}(${u}) `}t&&(e[a]=u)}}return r=r.trim(),t?r=t(e,s?"":r):s&&(r="none"),r}function w3(n,e,t){const{style:r,vars:s,transformOrigin:i}=n;let a=!1,o=!1;for(const l in e){const u=e[l];if(C0.has(l)){a=!0;continue}else if(LY(l)){s[l]=u;continue}else{const d=aX(u,p3[l]);l.startsWith("origin")?(o=!0,i[l]=d):r[l]=d}}if(e.transform||(a||t?r.transform=U1e(e,n.transform,t):r.transform&&(r.transform="none")),o){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${l} ${u} ${d}`}}const _3=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function vX(n,e,t){for(const r in e)!_i(e[r])&&!gX(r,t)&&(n[r]=e[r])}function V1e({transformTemplate:n},e){return _.useMemo(()=>{const t=_3();return w3(t,e,n),Object.assign({},t.vars,t.style)}
vendor: 6,681 bytes, line 663
663,[e])}function H1e(n,e){const t=n.style||{},r={};return vX(r,t,n),Object.assign(r,V1e(n,e)),r}function W1e(n,e){const t={},r=H1e(n,e);return n.drag&&n.dragListener!==!1&&(t.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(t.tabIndex=0),t.style=r,t}const q1e={offset:"stroke-dashoffset",array:"stroke-dasharray"},G1e={offset:"strokeDashoffset",array:"strokeDasharray"};function K1e(n,e,t=1,r=0,s=!0){n.pathLength=1;const i=s?q1e:G1e;n[i.offset]=Mt.transform(-r);const a=Mt.transform(e),o=Mt.transform(t);n[i.array]=`${a} ${o}`}function yX(n,{attrX:e,attrY:t,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...o},l,u,d){if(w3(n,o,u),l){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:f}=n;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),t!==void 0&&(h.y=t),r!==void 0&&(h.scale=r),s!==void 0&&K1e(h,s,i,a,!1)}const xX=()=>({..._3(),attrs:{}}),bX=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Y1e(n,e,t,r){const s=_.useMemo(()=>{const i=xX();return yX(i,e,bX(r),n.transformTemplate,n.style),{...i.attrs,style:{...i.style}}},[e]);if(n.style){const i={};vX(i,n.style,n),s.style={...i,...s.style}}return s}const X1e=["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 S3(n){return typeof n!="string"||n.includes("-")?!1:!!(X1e.indexOf(n)>-1||/[A-Z]/u.test(n))}function Z1e(n,e,t,{latestValues:r},s,i=!1){const o=(S3(n)?Y1e:W1e)(e,r,s,n),l=I1e(e,typeof n=="string",i),u=n!==_.Fragment?{...l,...o,ref:t}:{},{children:d}=e,h=_.useMemo(()=>_i(d)?d.get():d,[d]);return _.createElement(n,{...u,children:h})}function f8(n){const e=[{},{}];return n==null||n.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function E3(n,e,t,r){if(typeof e=="function"){const[s,i]=f8(r);e=e(t!==void 0?t:n.custom,s,i)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,i]=f8(r);e=e(t!==void 0?t:n.custom,s,i)}return e}function Qk(n){return _i(n)?n.get():n}function J1e({scrapeMotionValuesFromProps:n,createRenderState:e},t,r,s){return{latestValues:Q1e(t,r,s,n),renderState:e()}}function Q1e(n,e,t,r){const s={},i=r(n,{});for(const f in i)s[f]=Qk(i[f]);let{initial:a,animate:o}=n;const l=kT(n),u=mX(n);e&&u&&!l&&n.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let d=t?t.initial===!1:!1;d=d||a===!1;const h=d?o:a;if(h&&typeof h!="boolean"&&!ET(h)){const f=Array.isArray(h)?h:[h];for(let p=0;p<f.length;p++){const m=E3(n,f[p]);if(m){const{transitionEnd:g,transition:y,...v}=m;for(const x in v){let b=v[x];if(Array.isArray(b)){const E=d?b.length-1:0;b=b[E]}b!==null&&(s[x]=b)}for(const x in g)s[x]=g[x]}}}return s}const wX=n=>(e,t)=>{const r=_.useContext(ST),s=_.useContext(_T),i=()=>J1e(n,e,r,s);return t?i():XF(i)};function k3(n,e,t){var i;const{style:r}=n,s={};for(const a in r)(_i(r[a])||e.style&&_i(e.style[a])||gX(a,n)||((i=t==null?void 0:t.getValue(a))==null?void 0:i.liveStyle)!==void 0)&&(s[a]=r[a]);return s}const e_e=wX({scrapeMotionValuesFromProps:k3,createRenderState:_3});function _X(n,e,t){const r=k3(n,e,t);for(const s in n)if(_i(n[s])||_i(e[s])){const i=k0.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=n[s]}return r}const t_e=wX({scrapeMotionValuesFromProps:_X,createRenderState:xX}),n_e=Symbol.for("motionComponentSymbol");function $v(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function r_e(n,e,t){return _.useCallback(r=>{r&&n.onMount&&n.onMount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):$v(t)&&(t.current=r))},[e])}const C3=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),s_e="framerAppearId",SX="data-"+C3(s_e),EX=_.createContext({});function i_e(n,e,t,r,s){var g,y;const{visualElement:i}=_.useContext(ST),a=_.useContext(fX),o=_.useContext(_T),l=_.useContext(v3).reducedMotion,u=_.useRef(null);r=r||a.renderer,!u.current&&r&&(u.current=r(n,{visualState:e,parent:i,props:t,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:l}));const d=u.current,h=_.useContext(EX);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&a_e(u.current,t,s,h);const f=_.useRef(!1);_.useInsertionEffect(()=>{d&&f.current&&d.update(t,o)});const p=t[SX],m=_.useRef(!!p&&!((g=window.MotionHandoffIsComplete)!=null&&g.call(window,p))&&((y=window.MotionHasOptimisedAnimation)==null?void 0:y.call(window,p)));return bY(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),m.current&&d.animationState&&d.animationState.animateChanges())}),_.useEffect(()=>{d&&(!m.current&&d.animationState&&d.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)==null||v.call(window,p)}),m.current=!1),d.enteringChildren=void 0)}),d}function a_e(n,e,t,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutCrossfade:d}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:kX(n.parent)),n.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&$v(o),visualElement:n,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:u})}function kX(n){if(n)return n.options.allowProjection!==!1?n.projection:kX(n.parent)}function KR(n,{forwardMotionProps:e=!1}={},t,r){t&&D1e(t);const s=S3(n)?t_e:e_e;function i(o,l){let u;const d={..._.useContext(v3),...o,layoutId:o_e(o)},{isStatic:h}=d,f=F1e(o),p=s(o,h);if(!h&&ZF){l_e();const m=c_e(d);u=m.MeasureLayout,f.visualElement=i_e(n,p,d,r,m.ProjectionNode)}return c.jsxs(ST.Provider,{value:f,children:[u&&f.visualElement?c.jsx(u,{visualElement:f.visualElement,...d}):null,Z1e(n,o,r_e(p,f.visualElement,l),p,h,e)]})}i.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const a=_.forwardRef(i);return a[n_e]=n,a}function o_e({layoutId:n}){const e=_.useContext(YF).id;return e&&n!==void 0?e+"-"+n:n}function l_e(n,e){_.useContext(fX).strict}function c_e(n){const{drag:e,layout:t}=zx;if(!e&&!t)return{};const r={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}
vendor: 17,356 bytes, line 663
663function u_e(n,e){if(typeof Proxy>"u")return KR;const t=new Map,r=(i,a)=>KR(i,a,n,e),s=(i,a)=>r(i,a);return new Proxy(s,{get:(i,a)=>a==="create"?r:(t.has(a)||t.set(a,KR(a,void 0,n,e)),t.get(a))})}function CX({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function d_e({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function h_e(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function YR(n){return n===void 0||n===1}function CM({scale:n,scaleX:e,scaleY:t}){return!YR(n)||!YR(e)||!YR(t)}function tp(n){return CM(n)||AX(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function AX(n){return p8(n.x)||p8(n.y)}function p8(n){return n&&n!=="0%"}function V2(n,e,t){const r=n-t,s=e*r;return t+s}function m8(n,e,t,r,s){return s!==void 0&&(n=V2(n,s,r)),V2(n,t,r)+e}function AM(n,e=0,t=1,r,s){n.min=m8(n.min,e,t,r,s),n.max=m8(n.max,e,t,r,s)}function NX(n,{x:e,y:t}){AM(n.x,e.translate,e.scale,e.originPoint),AM(n.y,t.translate,t.scale,t.originPoint)}const g8=.999999999999,v8=1.0000000000001;function f_e(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let i,a;for(let o=0;o<s;o++){i=t[o],a=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Vv(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,NX(n,a)),r&&tp(i.latestValues)&&Vv(n,i.latestValues))}e.x<v8&&e.x>g8&&(e.x=1),e.y<v8&&e.y>g8&&(e.y=1)}function Uv(n,e){n.min=n.min+e,n.max=n.max+e}function y8(n,e,t,r,s=.5){const i=fr(n.min,n.max,s);AM(n,e,t,i,r)}function Vv(n,e){y8(n.x,e.x,e.scaleX,e.scale,e.originX),y8(n.y,e.y,e.scaleY,e.scale,e.originY)}function TX(n,e){return CX(h_e(n.getBoundingClientRect(),e))}function p_e(n,e,t){const r=TX(n,t),{scroll:s}=e;return s&&(Uv(r.x,s.offset.x),Uv(r.y,s.offset.y)),r}const x8=()=>({translate:0,scale:1,origin:0,originPoint:0}),Hv=()=>({x:x8(),y:x8()}),b8=()=>({min:0,max:0}),ps=()=>({x:b8(),y:b8()}),NM={current:null},jX={current:!1};function m_e(){if(jX.current=!0,!!ZF)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>NM.current=n.matches;n.addEventListener("change",e),e()}else NM.current=!1}const g_e=new WeakMap;function v_e(n,e,t){for(const r in e){const s=e[r],i=t[r];if(_i(s))n.addValue(r,s);else if(_i(i))n.addValue(r,Bx(s,{owner:n}));else if(i!==s)if(n.hasValue(r)){const a=n.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=n.getStaticValue(r);n.addValue(r,Bx(a!==void 0?a:s,{owner:n}))}}for(const r in t)e[r]===void 0&&n.removeValue(r);return e}const w8=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class y_e{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=h3,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=xa.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,sr.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=kT(t),this.isVariantNode=mX(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(t,{},this);for(const f in h){const p=h[f];l[f]!==void 0&&_i(p)&&p.set(l[f])}}mount(e){var t;this.current=e,g_e.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((r,s)=>this.bindToMotionValue(s,r)),jX.current||m_e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:NM.current,(t=this.parent)==null||t.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),pf(this.notifyUpdate),pf(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const r=this.features[t];r&&(r.unmount(),r.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,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=C0.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=t.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&sr.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),t.owner&&t.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 zx){const t=zx[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;if(!this.features[e]&&s&&r(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):ps()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<w8.length;r++){const s=w8[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=v_e(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 t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Bx(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(wY(r)||SY(r))?r=parseFloat(r):!C1e(r)&&mf.test(t)&&(r=iX(e,t)),this.setBaseTarget(e,_i(r)?r.get():r)),_i(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var i;const{initial:t}=this.props;let r;if(typeof t=="string"||typeof t=="object"){const a=E3(this.props,t,(i=this.presenceContext)==null?void 0:i.custom);a&&(r=a[e])}if(t&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!_i(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new t3),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){m3.render(this.render)}}class RX extends y_e{constructor(){super(...arguments),this.KeyframeResolver=p1e}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;_i(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function PX(n,{style:e,vars:t},r,s){const i=n.style;let a;for(a in e)i[a]=e[a];s==null||s.applyProjectionStyles(i,r);for(a in t)i.setProperty(a,t[a])}function x_e(n){return window.getComputedStyle(n)}class b_e extends RX{constructor(){super(...arguments),this.type="html",this.renderInstance=PX}readValueFromInstance(e,t){var r;if(C0.has(t))return(r=this.projection)!=null&&r.isProjecting?yM(t):Dwe(e,t);{const s=x_e(e),i=(LY(t)?s.getPropertyValue(t):s[t])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return TX(e,t)}build(e,t,r){w3(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return k3(e,t,r)}}const DX=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 w_e(n,e,t,r){PX(n,e,void 0,r);for(const s in e.attrs)n.setAttribute(DX.has(s)?s:C3(s),e.attrs[s])}class __e extends RX{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ps}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(C0.has(t)){const r=sX(t);return r&&r.default||0}return t=DX.has(t)?t:C3(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return _X(e,t,r)}build(e,t,r){yX(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,s){w_e(e,t,r,s)}mount(e){this.isSVGTag=bX(e.tagName),super.mount(e)}}const S_e=(n,e)=>S3(n)?new __e(e):new b_e(e,{allowProjection:n!==_.Fragment});function ly(n,e,t){const r=n.getProps();return E3(r,e,t!==void 0?t:r.custom,n)}const TM=n=>Array.isArray(n);function E_e(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Bx(t))}function k_e(n){return TM(n)?n[n.length-1]||0:n}function C_e(n,e){const t=ly(n,e);let{transitionEnd:r={},transition:s={},...i}=t||{};i={...i,...r};for(const a in i){const o=k_e(i[a]);E_e(n,a,o)}}function A_e(n){return!!(_i(n)&&n.add)}function jM(n,e){const t=n.getValue("willChange");if(A_e(t))return t.add(e);if(!t&&pd.WillChange){const r=new pd.WillChange("auto");n.addValue("willChange",r),r.add(e)}}function OX(n){return n.props[SX]}const N_e=n=>n!==null;function T_e(n,{repeat:e,repeatType:t="loop"},r){const s=n.filter(N_e),i=e&&t!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const j_e={type:"spring",stiffness:500,damping:25,restSpeed:10},R_e=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),P_e={type:"keyframes",duration:.8},D_e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},O_e=(n,{keyframes:e})=>e.length>2?P_e:C0.has(n)?n.startsWith("scale")?R_e(e[1]):j_e:D_e;function M_e({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const A3=(n,e,t,r={},s,i)=>a=>{const o=f3(r,n)||{},l=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-zc(l);const d={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:f=>{e.set(f),o.onUpdate&&o.onUpdate(f)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:n,motionValue:e,element:i?void 0:s};M_e(o)||Object.assign(d,O_e(n,d)),d.duration&&(d.duration=zc(d.duration)),d.repeatDelay&&(d.repeatDelay=zc(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(SM(d),d.delay===0&&(h=!0)),(pd.instantAnimations||pd.skipAnimations)&&(h=!0,SM(d),d.delay=0),d.allowFlatten=!o.type&&!o.ease,h&&!i&&e.get()!==void 0){const f=T_e(d.keyframes,o);if(f!==void 0){sr.update(()=>{d.onUpdate(f),d.onComplete()});return}}return o.isSync?new d3(d):new n1e(d)};function I_e({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function MX(n,e,{delay:t=0,transitionOverride:r,type:s}={}){let{transition:i=n.getDefaultTransition(),transitionEnd:a,...o}=e;r&&(i=r);const l=[],u=s&&n.animationState&&n.animationState.getState()[s];for(const d in o){const h=n.getValue(d,n.latestValues[d]??null),f=o[d];if(f===void 0||u&&I_e(u,d))continue;const p={delay:t,...f3(i||{},d)},m=h.get();if(m!==void 0&&!h.isAnimating&&!Array.isArray(f)&&f===m&&!p.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const v=OX(n);if(v){const x=window.MotionHandoffAnimation(v,d,sr);x!==null&&(p.startTime=x,g=!0)}}jM(n,d),h.start(A3(d,h,f,n.shouldReduceMotion&&tX.has(d)?{type:!1}:p,n,g));const y=h.animation;y&&l.push(y)}return a&&Promise.all(l).then(()=>{sr.update(()=>{a&&C_e(n,a)})}),l}function IX(n,e,t,r=0,s=1){const i=Array.from(n).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),a=n.size,o=(a-1)*r;return typeof t=="function"?t(i,a):s===1?i*r:o-i*r}function RM(n,e,t={}){var l;const r=ly(n,e,t.type==="exit"?(l=n.presenceContext)==null?void 0:l.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=r||{};t.transitionOverride&&(s=t.transitionOverride);const i=r?()=>Promise.all(MX(n,r,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:f}=s;return L_e(n,e,u,d,h,f,t)}:()=>Promise.resolve(),{when:o}=s;if(o){const[u,d]=o==="beforeChildren"?[i,a]:[a,i];return u().then(()=>d())}else return Promise.all([i(),a(t.delay)])}function L_e(n,e,t=0,r=0,s=0,i=1,a){const o=[];for(const l of n.variantChildren)l.notify("AnimationStart",e),o.push(RM(l,e,{...a,delay:t+(typeof r=="function"?0:r)+IX(n.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function F_e(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>RM(n,i,t));r=Promise.all(s)}else if(typeof e=="string")r=RM(n,e,t);else{const s=typeof e=="function"?ly(n,e,t.custom):e;r=Promise.all(MX(n,s,t))}return r.then(()=>{n.notify("AnimationComplete",e)})}function LX(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}const B_e=b3.length;function FX(n){if(!n)return;if(!n.isControllingVariants){const t=n.parent?FX(n.parent)||{}:{};return n.props.initial!==void 0&&(t.initial=n.props.initial),t}const e={};for(let t=0;t<B_e;t++){const r=b3[t],s=n.props[r];(E1(s)||s===!1)&&(e[r]=s)}return e}const z_e=[...x3].reverse(),$_e=x3.length;function U_e(n){return e=>Promise.all(e.map(({animation:t,options:r})=>F_e(n,t,r)))}function V_e(n){let e=U_e(n),t=_8(),r=!0;const s=l=>(u,d)=>{var f;const h=ly(n,d,l==="exit"?(f=n.presenceContext)==null?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...g}=h;u={...u,...g,...m}}return u};function i(l){e=l(n)}function a(l){const{props:u}=n,d=FX(n.parent)||{},h=[],f=new Set;let p={},m=1/0;for(let y=0;y<$_e;y++){const v=z_e[y],x=t[v],b=u[v]!==void 0?u[v]:d[v],E=E1(b),S=v===l?x.isActive:null;S===!1&&(m=y);let k=b===d[v]&&b!==u[v]&&E;if(k&&r&&n.manuallyAnimateOnMount&&(k=!1),x.protectedKeys={...p},!x.isActive&&S===null||!b&&!x.prevProp||ET(b)||typeof b=="boolean")continue;const C=H_e(x.prevProp,b);let A=C||v===l&&x.isActive&&!k&&E||y>m&&E,T=!1;const j=Array.isArray(b)?b:[b];let D=j.reduce(s(v),{});S===!1&&(D={});const{prevResolvedValues:R={}}=x,M={...R,...D},N=I=>{A=!0,f.has(I)&&(T=!0,f.delete(I)),x.needsAnimating[I]=!0;const B=n.getValue(I);B&&(B.liveStyle=!1)};for(const I in M){const B=D[I],$=R[I];if(p.hasOwnProperty(I))continue;let ie=!1;TM(B)&&TM($)?ie=!LX(B,$):ie=B!==$,ie?B!=null?N(I):f.add(I):B!==void 0&&f.has(I)?N(I):x.protectedKeys[I]=!0}x.prevProp=b,x.prevResolvedValues=D,x.isActive&&(p={...p,...D}),r&&n.blockInitialAnimation&&(A=!1);const U=k&&C;A&&(!U||T)&&h.push(...j.map(I=>{const B={type:v};
vendor: 22,043 bytes, line 663
663if(typeof I=="string"&&r&&!U&&n.manuallyAnimateOnMount&&n.parent){const{parent:$}=n,ie=ly($,I);if($.enteringChildren&&ie){const{delayChildren:ne}=ie.transition||{};B.delay=IX($.enteringChildren,n,ne)}}return{animation:I,options:B}}))}if(f.size){const y={};if(typeof u.initial!="boolean"){const v=ly(n,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(y.transition=v.transition)}f.forEach(v=>{const x=n.getBaseTarget(v),b=n.getValue(v);b&&(b.liveStyle=!0),y[v]=x??null}),h.push({animation:y})}let g=!!h.length;return r&&(u.initial===!1||u.initial===u.animate)&&!n.manuallyAnimateOnMount&&(g=!1),r=!1,g?e(h):Promise.resolve()}function o(l,u){var h;if(t[l].isActive===u)return Promise.resolve();(h=n.variantChildren)==null||h.forEach(f=>{var p;return(p=f.animationState)==null?void 0:p.setActive(l,u)}),t[l].isActive=u;const d=a(l);for(const f in t)t[f].protectedKeys={};return d}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>t,reset:()=>{t=_8()}}}function H_e(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!LX(e,n):!1}function Kf(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _8(){return{animate:Kf(!0),whileInView:Kf(),whileHover:Kf(),whileTap:Kf(),whileDrag:Kf(),whileFocus:Kf(),exit:Kf()}}class Pf{constructor(e){this.isMounted=!1,this.node=e}update(){}}class W_e extends Pf{constructor(e){super(e),e.animationState||(e.animationState=V_e(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ET(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let q_e=0;class G_e extends Pf{constructor(){super(...arguments),this.id=q_e++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>{t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const K_e={animation:{Feature:W_e},exit:{Feature:G_e}};function k1(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}function BS(n){return{point:{x:n.pageX,y:n.pageY}}}const Y_e=n=>e=>g3(e)&&n(e,BS(e));function bw(n,e,t,r){return k1(n,e,Y_e(t),r)}const BX=1e-4,X_e=1-BX,Z_e=1+BX,zX=.01,J_e=0-zX,Q_e=0+zX;function $i(n){return n.max-n.min}function eSe(n,e,t){return Math.abs(n-e)<=t}function S8(n,e,t,r=.5){n.origin=r,n.originPoint=fr(e.min,e.max,n.origin),n.scale=$i(t)/$i(e),n.translate=fr(t.min,t.max,n.origin)-n.originPoint,(n.scale>=X_e&&n.scale<=Z_e||isNaN(n.scale))&&(n.scale=1),(n.translate>=J_e&&n.translate<=Q_e||isNaN(n.translate))&&(n.translate=0)}function ww(n,e,t,r){S8(n.x,e.x,t.x,r?r.originX:void 0),S8(n.y,e.y,t.y,r?r.originY:void 0)}function E8(n,e,t){n.min=t.min+e.min,n.max=n.min+$i(e)}function tSe(n,e,t){E8(n.x,e.x,t.x),E8(n.y,e.y,t.y)}function k8(n,e,t){n.min=e.min-t.min,n.max=n.min+$i(e)}function H2(n,e,t){k8(n.x,e.x,t.x),k8(n.y,e.y,t.y)}function po(n){return[n("x"),n("y")]}const $X=({current:n})=>n?n.ownerDocument.defaultView:null,C8=(n,e)=>Math.abs(n-e);function nSe(n,e){const t=C8(n.x,e.x),r=C8(n.y,e.y);return Math.sqrt(t**2+r**2)}class UX{constructor(e,t,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:a=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=ZR(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,m=nSe(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!m)return;const{point:g}=f,{timestamp:y}=Ys;this.history.push({...g,timestamp:y});const{onStart:v,onMove:x}=this.handlers;p||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=XR(p,this.transformPagePoint),sr.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=ZR(f.type==="pointercancel"?this.lastMoveEventInfo:XR(p,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,v),g&&g(f,v)},!g3(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=s||window;const o=BS(e),l=XR(o,this.transformPagePoint),{point:u}=l,{timestamp:d}=Ys;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=t;h&&h(e,ZR(l,this.history)),this.removeListeners=IS(bw(this.contextWindow,"pointermove",this.handlePointerMove),bw(this.contextWindow,"pointerup",this.handlePointerUp),bw(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),pf(this.updatePoint)}}function XR(n,e){return e?{point:e(n.point)}:n}function A8(n,e){return{x:n.x-e.x,y:n.y-e.y}}function ZR({point:n},e){return{point:n,delta:A8(n,VX(e)),offset:A8(n,rSe(e)),velocity:sSe(e,.1)}}function rSe(n){return n[0]}function VX(n){return n[n.length-1]}function sSe(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=VX(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>zc(e)));)t--;if(!r)return{x:0,y:0};const i=Po(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function iSe(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?fr(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?fr(t,n,r.max):Math.min(n,t)),n}function N8(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function aSe(n,{top:e,left:t,bottom:r,right:s}){return{x:N8(n.x,t,s),y:N8(n.y,e,r)}}function T8(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function oSe(n,e){return{x:T8(n.x,e.x),y:T8(n.y,e.y)}}function lSe(n,e){let t=.5;const r=$i(n),s=$i(e);return s>r?t=w1(e.min,e.max-r,n.min):r>s&&(t=w1(n.min,n.max-s,e.min)),fd(0,1,t)}function cSe(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const PM=.35;function uSe(n=PM){return n===!1?n=0:n===!0&&(n=PM),{x:j8(n,"left","right"),y:j8(n,"top","bottom")}}function j8(n,e,t){return{min:R8(n,e),max:R8(n,t)}}function R8(n,e){return typeof n=="number"?n:n[e]||0}const dSe=new WeakMap;class hSe{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=ps(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(BS(h).point)},a=(h,f)=>{const{drag:p,dragPropagation:m,onDragStart:g}=this.getProps();if(p&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=y1e(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),po(v=>{let x=this.getAxisMotionValue(v).get()||0;if($c.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const E=b.layout.layoutBox[v];E&&(x=$i(E)*(parseFloat(x)/100))}}this.originPoint[v]=x}),g&&sr.postRender(()=>g(h,f)),jM(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},o=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:g,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:v}=f;if(m&&this.currentDirection===null){this.currentDirection=fSe(v),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),y&&y(h,f)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>po(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 UX(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:$X(this.visualElement)})}stop(e,t){const r=e||this.latestPointerEvent,s=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:a}=s;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&sr.postRender(()=>o(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!rk(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=iSe(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:t}=this.getProps(),r=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&&$v(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=aSe(r.layoutBox,e):this.constraints=!1,this.elastic=uSe(t),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&po(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=cSe(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!$v(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=p_e(r,s.root,this.visualElement.getTransformPagePoint());let a=oSe(s.layout.layoutBox,i);if(t){const o=t(d_e(a));this.hasMutatedConstraints=!!o,o&&(a=CX(o))}return a}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=po(d=>{if(!rk(d,t,this.currentDirection))return;let h=l&&l[d]||{};a&&(h={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?e[d]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return jM(this.visualElement,e),r.start(A3(e,r,0,t,this.visualElement,!1))}stopAnimation(){po(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){po(e=>{var t;return(t=this.getAxisMotionValue(e).animation)==null?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)==null?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[t];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){po(t=>{const{drag:r}=this.getProps();if(!rk(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[t];i.set(e[t]-fr(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!$v(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};po(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();s[a]=lSe({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),po(a=>{if(!rk(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(fr(l,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;dSe.set(this.visualElement,this);const e=this.visualElement.current,t=bw(e,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();$v(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),sr.read(r);const a=k1(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(po(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())});return()=>{a(),t(),i(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=PM,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function rk(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function fSe(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class pSe extends Pf{constructor(e){super(e),this.removeGroupControls=Io,this.removeListeners=Io,this.controls=new hSe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Io}unmount(){this.removeGroupControls(),this.removeListeners()}}const P8=n=>(e,t)=>{n&&sr.postRender(()=>n(e,t))};class mSe extends Pf{constructor(){super(...arguments),this.removePointerDownListener=Io}onPointerDown(e){this.session=new UX(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:$X(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:P8(e),onStart:P8(t),onMove:r,onEnd:(i,a)=>{delete this.session,s&&sr.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=bw(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 eC={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let JR=!1;class gSe extends _.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),r&&r.register&&s&&r.register(i),JR&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),eC.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,JR=!0,s||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||sr.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),m3.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;JR=!0,s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function HX(n){const[e,t]=hX(),r=_.useContext(YF);return c.jsx(gSe,{...n,layoutGroup:r,switchLayoutGroup:_.useContext(EX),isPresent:e,safeToRemove:t})}function vSe(n,e,t){const r=_i(n)?n:Bx(n);return r.start(A3("",r,e,t)),r.animation}const ySe=(n,e)=>n.depth-e.depth;class xSe{constructor(){this.children=[],this.isDirty=!1}add(e){JF(this.children,e),this.isDirty=!0}remove(e){QF(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ySe),this.isDirty=!1,this.children.forEach(e)}}function bSe(n,e){const t=xa.now(),r=({timestamp:s})=>{const i=s-t;i>=e&&(pf(r),n(i-e))};return sr.setup(r,!0),()=>pf(r)}const WX=["TopLeft","TopRight","BottomLeft","BottomRight"],wSe=WX.length,D8=n=>typeof n=="string"?parseFloat(n):n,O8=n=>typeof n=="number"||Mt.test(n);function _Se(n,e,t,r,s,i){s?(n.opacity=fr(0,t.opacity??1,SSe(r)),n.opacityExit=fr(e.opacity??1,0,ESe(r))):i&&(n.opacity=fr(e.opacity??1,t.opacity??1,r));for(let a=0;a<wSe;a++){const o=`border${WX[a]}Radius`;let l=M8(e,o),u=M8(t,o);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||O8(l)===O8(u)?(n[o]=Math.max(fr(D8(l),D8(u),r),0),($c.test(u)||$c.test(l))&&(n[o]+="%")):n[o]=u}(e.rotate||t.rotate)&&(n.rotate=fr(e.rotate||0,t.rotate||0,r))}function M8(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const SSe=qX(0,.5,RY),ESe=qX(.5,.95,Io);function qX(n,e,t){return r=>r<n?0:r>e?1:t(w1(n,e,r))}function I8(n,e){n.min=e.min,n.max=e.max}function el(n,e){I8(n.x,e.x),I8(n.y,e.y)}function L8(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function F8(n,e,t,r,s){return n-=e,n=V2(n,1/t,r),s!==void 0&&(n=V2(n,1/s,r)),n}function kSe(n,e=0,t=1,r=.5,s,i=n,a=n){if($c.test(e)&&(e=parseFloat(e),e=fr(a.min,a.max,e/100)-a.min),typeof e!="number")return;let o=fr(i.min,i.max,r);n===i&&(o-=e),n.min=F8(n.min,e,t,o,s),n.max=F8(n.max,e,t,o,s)}function B8(n,e,[t,r,s],i,a){kSe(n,e[t],e[r],e[s],e.scale,i,a)}const CSe=["x","scaleX","originX"],ASe=["y","scaleY","originY"];function z8(n,e,t,r){B8(n.x,e,CSe,t?t.x:void 0,r?r.x:void 0),B8(n.y,e,ASe,t?t.y:void 0,r?r.y:void 0)}function $8(n){return n.translate===0&&n.scale===1}function GX(n){return $8(n.x)&&$8(n.y)}function U8(n,e){return n.min===e.min&&n.max===e.max}function NSe(n,e){return U8(n.x,e.x)&&U8(n.y,e.y)}function V8(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function KX(n,e){return V8(n.x,e.x)&&V8(n.y,e.y)}function H8(n){return $i(n.x)/$i(n.y)}function W8(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class TSe{constructor(){this.members=[]}add(e){JF(this.members,e),e.scheduleRender()}remove(e){if(QF(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(s=>e===s);if(t===0)return!1;let r;for(let s=t;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function jSe(n,e,t){let r="";const s=n.x.translate/e.x,i=n.y.translate/e.y,a=(t==null?void 0:t.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:f,skewX:p,skewY:m}=t;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),f&&(r+=`rotateY(${f}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=n.x.scale*e.x,l=n.y.scale*e.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const QR=["","X","Y","Z"],RSe=1e3;let PSe=0;function eP(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function YX(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const t=OX(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:s,layoutId:i}=n.options;window.MotionCancelOptimisedAnimation(t,"transform",sr,!(s||i))}const{parent:r}=n;r&&!r.hasCheckedOptimisedAppear&&YX(r)}function XX({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=e==null?void 0:e()){this.id=PSe++,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=()=>
vendor: 10,579 bytes, line 663
663{this.projectionUpdateScheduled=!1,this.nodes.forEach(MSe),this.nodes.forEach(BSe),this.nodes.forEach(zSe),this.nodes.forEach(ISe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new xSe)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new t3),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=dX(a)&&!E1e(a),this.instance=a;const{layoutId:o,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),n){let d,h=0;const f=()=>this.root.updateBlockedByResize=!1;sr.read(()=>{h=window.innerWidth}),n(a,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=bSe(f,250),eC.hasAnimatedSinceResize&&(eC.hasAnimatedSinceResize=!1,this.nodes.forEach(K8)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&u&&(o||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||WSe,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=u.getProps(),v=!this.targetLayout||!KX(this.targetLayout,p),x=!h&&f;if(this.options.layoutRoot||this.resumeFrom||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...f3(m,"layout"),onPlay:g,onComplete:y};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(d,x)}else h||K8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),pf(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($Se),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YX(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:o,layout:l}=this.options;if(o===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(q8);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(G8);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(FSe),this.nodes.forEach(DSe),this.nodes.forEach(OSe)):this.nodes.forEach(G8),this.clearAllSnapshots();const o=xa.now();Ys.delta=fd(0,1e3/60,o-Ys.timestamp),Ys.timestamp=o,Ys.isProcessing=!0,UR.update.process(Ys),UR.preRender.process(Ys),UR.render.process(Ys),Ys.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,m3.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(LSe),this.sharedNodes.forEach(USe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,sr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){sr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$i(this.snapshot.measuredBox.x)&&!$i(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 l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ps(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!GX(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;a&&this.instance&&(o||tp(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),qSe(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:a}=this.options;if(!a)return ps();const o=a.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(GSe))){const{scroll:d}=this.root;d&&(Uv(o.x,d.offset.x),Uv(o.y,d.offset.y))}return o}removeElementScroll(a){var l;const o=ps();if(el(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;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&&el(o,a),Uv(o.x,h.offset.x),Uv(o.y,h.offset.y))}return o}applyTransform(a,o=!1){const l=ps();el(l,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];!o&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Vv(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),tp(d.latestValues)&&Vv(l,d.latestValues)}return tp(this.latestValues)&&Vv(l,this.latestValues),l}removeTransform(a){const o=ps();el(o,a);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!tp(u.latestValues))continue;CM(u.latestValues)&&u.updateSnapshot();const d=ps(),h=u.measurePageBox();el(d,h),z8(o,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return tp(this.latestValues)&&z8(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.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!==Ys.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var p;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&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=Ys.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=ps(),this.targetWithTransforms=ps()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),tSe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):el(this.target,this.layout.layoutBox),NX(this.target,this.targetDelta)):el(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||CM(this.parent.latestValues)||AX(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ps(),this.relativeTargetOrigin=ps(),H2(this.relativeTargetOrigin,o,l),el(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var m;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&
vendor: 5,279 bytes, line 663
663(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ys.timestamp&&(l=!1),l)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;el(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;f_e(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=ps());const{target:p}=a;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(L8(this.prevProjectionDelta.x,this.projectionDelta.x),L8(this.prevProjectionDelta.y,this.projectionDelta.y)),ww(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!W8(this.projectionDelta.x,this.prevProjectionDelta.x)||!W8(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Hv(),this.projectionDelta=Hv(),this.projectionDeltaWithTransform=Hv()}setAnimationOrigin(a,o=!1){const l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},h=Hv();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const f=ps(),p=l?l.source:void 0,m=this.layout?this.layout.source:void 0,g=p!==m,y=this.getStack(),v=!y||y.members.length<=1,x=!!(g&&!v&&this.options.crossfade===!0&&!this.path.some(HSe));this.animationProgress=0;let b;this.mixTargetDelta=E=>{const S=E/1e3;Y8(h.x,a.x,S),Y8(h.y,a.y,S),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(H2(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),VSe(this.relativeTarget,this.relativeTargetOrigin,f,S),b&&NSe(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=ps()),el(b,this.relativeTarget)),g&&(this.animationValues=d,_Se(d,u,this.latestValues,S,x,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,u;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(pf(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=sr.update(()=>{eC.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Bx(0)),this.currentAnimation=vSe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),a.onUpdate&&a.onUpdate(d)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RSe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:d}=a;if(!(!o||!l||!u)){if(this!==a&&this.layout&&u&&ZX(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||ps();const h=$i(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+h;const f=$i(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}el(o,l),Vv(o,d),ww(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new TSe),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}
vendor: 4,185 bytes, line 663
663resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&eP("z",a,u,this.animationValues);for(let d=0;d<QR.length;d++)eP(`rotate${QR[d]}`,a,u,this.animationValues),eP(`skew${QR[d]}`,a,u,this.animationValues);a.render();for(const d in u)a.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=Qk(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=Qk(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!tp(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=jSe(this.projectionDeltaWithTransform,this.treeScale,d);l&&(h=l(d,h)),a.transform=h;const{x:f,y:p}=this.projectionDelta;a.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,u.animationValues?a.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:a.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in kM){if(d[m]===void 0)continue;const{correct:g,applyTo:y,isCSSVariable:v}=kM[m],x=h==="none"?d[m]:g(d[m],u);if(y){const b=y.length;for(let E=0;E<b;E++)a[y[E]]=x}else v?this.options.visualElement.renderState.vars[m]=x:a[m]=x}this.options.layoutId&&(a.pointerEvents=u===this?Qk(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(q8),this.root.sharedNodes.clear()}}}function DSe(n){n.updateLayout()}function OSe(n){var t;const e=((t=n.resumeFrom)==null?void 0:t.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=n.layout,{animationType:i}=n.options,a=e.source!==n.layout.source;i==="size"?po(h=>{const f=a?e.measuredBox[h]:e.layoutBox[h],p=$i(f);f.min=r[h].min,f.max=f.min+p}):ZX(i,e.layoutBox,r)&&po(h=>{const f=a?e.measuredBox[h]:e.layoutBox[h],p=$i(r[h]);f.max=f.min+p,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[h].max=n.relativeTarget[h].min+p)});const o=Hv();ww(o,r,e.layoutBox);const l=Hv();a?ww(l,n.applyTransform(s,!0),e.measuredBox):ww(l,r,e.layoutBox);const u=!GX(o);let d=!1;if(!n.resumeFrom){const h=n.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:p}=h;if(f&&p){const m=ps();H2(m,e.layoutBox,f.layoutBox);const g=ps();H2(g,r,p.layoutBox),KX(m,g)||(d=!0),h.options.layoutRoot&&(n.relativeTarget=g,n.relativeTargetOrigin=m,n.relativeParent=h)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function MSe(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function ISe(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function LSe(n){n.clearSnapshot()}function q8(n){n.clearMeasurements()}function G8(n){n.isLayoutDirty=!1}function FSe(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function K8(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function BSe(n){n.resolveTargetDelta()}
vendor: 4,321 bytes, line 663
663function zSe(n){n.calcProjection()}function $Se(n){n.resetSkewAndRotation()}function USe(n){n.removeLeadSnapshot()}function Y8(n,e,t){n.translate=fr(e.translate,0,t),n.scale=fr(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function X8(n,e,t,r){n.min=fr(e.min,t.min,r),n.max=fr(e.max,t.max,r)}function VSe(n,e,t,r){X8(n.x,e.x,t.x,r),X8(n.y,e.y,t.y,r)}function HSe(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const WSe={duration:.45,ease:[.4,0,.1,1]},Z8=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),J8=Z8("applewebkit/")&&!Z8("chrome/")?Math.round:Io;function Q8(n){n.min=J8(n.min),n.max=J8(n.max)}function qSe(n){Q8(n.x),Q8(n.y)}function ZX(n,e,t){return n==="position"||n==="preserve-aspect"&&!eSe(H8(e),H8(t),.2)}function GSe(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const KSe=XX({attachResizeListener:(n,e)=>k1(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tP={current:void 0},JX=XX({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!tP.current){const n=new KSe({});n.mount(window),n.setOptions({layoutScroll:!0}),tP.current=n}return tP.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),YSe={pan:{Feature:mSe},drag:{Feature:pSe,ProjectionNode:JX,MeasureLayout:HX}};function eU(n,e,t){const{props:r}=n;n.animationState&&r.whileHover&&n.animationState.setActive("whileHover",t==="Start");const s="onHover"+t,i=r[s];i&&sr.postRender(()=>i(e,BS(e)))}class XSe extends Pf{mount(){const{current:e}=this.node;e&&(this.unmount=x1e(e,(t,r)=>(eU(this.node,r,"Start"),s=>eU(this.node,s,"End"))))}unmount(){}}class ZSe extends Pf{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=IS(k1(this.node.current,"focus",()=>this.onFocus()),k1(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function tU(n,e,t){const{props:r}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&r.whileTap&&n.animationState.setActive("whileTap",t==="Start");const s="onTap"+(t==="End"?"":t),i=r[s];i&&sr.postRender(()=>i(e,BS(e)))}class JSe extends Pf{mount(){const{current:e}=this.node;e&&(this.unmount=S1e(e,(t,r)=>(tU(this.node,r,"Start"),(s,{success:i})=>tU(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const DM=new WeakMap,nP=new WeakMap,QSe=n=>{const e=DM.get(n.target);e&&e(n)},eEe=n=>{n.forEach(QSe)};function tEe({root:n,...e}){const t=n||document;nP.has(t)||nP.set(t,{});const r=nP.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(eEe,{root:n,...e})),r[s]}function nEe(n,e,t){const r=tEe(e);return DM.set(n,t),r.observe(n),()=>{DM.delete(n),r.unobserve(n)}}const rEe={some:0,all:1};class sEe extends Pf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:i}=e,a={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:rEe[s]},o=l=>{const{isIntersecting:u}=l;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(l)};return nEe(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(iEe(e,t))&&this.startObserver()}unmount(){}}function iEe({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const aEe={inView:{Feature:sEe},tap:{Feature:JSe},focus:{Feature:ZSe},hover:{Feature:XSe}},oEe={layout:{ProjectionNode:JX,MeasureLayout:HX}},lEe={...K_e,...aEe,...YSe,...oEe}
663,Oc=u_e(lEe,S_e),C1=Sg("inline-flex items-center justify-center gap-2 whitespace-nowrap 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-11 w-11"}},defaultVariants:{variant:"default",size:"default"}}),xe=_.forwardRef(({className:n,variant:e,size:t,asChild:r=!1,...s},i)=>{const a=r?Nf:"button";return c.jsx(a,{className:ke(C1({variant:e,size:t,className:n})),ref:i,...s})});xe.displayName="Button";function N3(){const{user:n,isLoading:e}=Vt(),{data:t,isLoading:r,error:s,refetch:i}=pt({queryKey:["user-role",n==null?void 0:n.id],enabled:!!(n!=null&&n.id),retry:2,retryDelay:a=>Math.min(1e3*2**a,4e3),refetchOnMount:"always",staleTime:3e4,gcTime:5*6e4,queryFn:async()=>{if(!(n!=null&&n.id))return!1;const a=await pe.rpc("has_role",{_user_id:n.id,_role:"admin"});if(!a.error)return a.data;const o=await pe.from("user_roles").select("id").eq("user_id",n.id).eq("role","admin").maybeSingle();if(o.error)throw a.error;return!!o.data}});return{isAdmin:t??!1,isLoading:e||r,error:s,refetch:i,user:n}}/*! Capacitor: https://capacitorjs.com/ - MIT License */var $x;(function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"})($x||($x={}));class rP extends Error{constructor(e,t,r){super(e),this.message=e,this.code=t,this.data=r}}const cEe=n=>{var e,t;return n!=null&&n.androidBridge?"android":!((t=(e=n==null?void 0:n.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||t===void 0)&&t.bridge?"ios":"web"},uEe=n=>{const e=n.CapacitorCustomPlatform||null,t=n.Capacitor||{},r=t.Plugins=t.Plugins||{},s=()=>e!==null?e.name:cEe(n),i=()=>s()!=="web",a=h=>{const f=u.get(h);return!!(f!=null&&f.platforms.has(s())||o(h))},o=h=>{var f;return(f=t.PluginHeaders)===null||f===void 0?void 0:f.find(p=>p.name===h)},l=h=>n.console.error(h),u=new Map,d=(h,f={})=>{const p=u.get(h);if(p)return console.warn(`Capacitor plugin "${h}" already registered. Cannot register plugins twice.`),p.proxy;const m=s(),g=o(h);let y;const v=async()=>(!y&&m in f?y=typeof f[m]=="function"?y=await f[m]():y=f[m]:e!==null&&!y&&"web"in f&&(y=typeof f.web=="function"?y=await f.web():y=f.web),y),x=(A,T)=>{var j,D;if(g){const R=g==null?void 0:g.methods.find(M=>T===M.name);if(R)return R.rtype==="promise"?M=>t.nativePromise(h,T.toString(),M):(M,N)=>t.nativeCallback(h,T.toString(),M,N);if(A)return(j=A[T])===null||j===void 0?void 0:j.bind(A)}else{if(A)return(D=A[T])===null||D===void 0?void 0:D.bind(A);throw new rP(`"${h}" plugin is not implemented on ${m}`,$x.Unimplemented)}},b=A=>{let T;const j=(...D)=>{const R=v().then(M=>{const N=x(M,A);if(N){const U=N(...D);return T=U==null?void 0:U.remove,U}else throw new rP(`"${h}.${A}()" is not implemented on ${m}`,$x.Unimplemented)});return A==="addListener"&&(R.remove=async()=>T()),R};return j.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(j,"name",{value:A,writable:!1,configurable:!1}),j},E=b("addListener"),S=b("removeListener"),k=(A,T)=>{const j=E({eventName:A},T),D=async()=>{const M=await j;S({eventName:A,callbackId:M},T)},R=new Promise(M=>j.then(()=>M({remove:D})));return R.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await D()},R},C=new Proxy({},{get(A,T){switch(T){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return g?k:E;case"removeListener":return S;default:return b(T)}}});return r[h]=C,u.set(h,{name:h,proxy:C,platforms:new Set([...Object.keys(f),...g?[m]:[]])}),C};return t.convertFileSrc||(t.convertFileSrc=h=>h),t.getPlatform=s,t.handleError=l,t.isNativePlatform=i,t.isPluginAvailable=a,t.registerPlugin=d,t.Exception=rP,t.DEBUG=!!t.DEBUG,t.isLoggingEnabled=!!t.isLoggingEnabled,t},dEe=n=>n.Capacitor=uEe(n),Ao=dEe(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),zS=Ao.registerPlugin;class T3{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let r=!1;this.listeners[e]||(this.listeners[e]=[],r=!0),this.listeners[e].push(t);const i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i),r&&this.sendRetainedArgumentsForEvent(e);const a=async()=>this.removeListener(e,t);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,r){const s=this.listeners[e];if(!s){if(r){let i=this.retainedEventArguments[e];i||(i=[]),i.push(t),this.retainedEventArguments[e]=i}return}s.forEach(i=>
663i(t))}hasListeners(e){var t;return!!(!((t=this.listeners[e])===null||t===void 0)&&t.length)}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:r=>{this.notifyListeners(t,r)}}}unimplemented(e="not implemented"){return new Ao.Exception(e,$x.Unimplemented)}unavailable(e="not available"){return new Ao.Exception(e,$x.Unavailable)}async removeListener(e,t){const r=this.listeners[e];if(!r)return;const s=r.indexOf(t);this.listeners[e].splice(s,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(r=>{this.notifyListeners(e,r)}))}}const nU=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),rU=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class hEe extends T3{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach(r=>{if(r.length<=0)return;let[s,i]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");s=rU(s).trim(),i=rU(i).trim(),t[s]=i}),t}async setCookie(e){try{const t=nU(e.key),r=nU(e.value),s=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${r||""}${s}; path=${i}; ${a};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}zS("CapacitorCookies",{web:()=>new hEe});const fEe=async n=>new Promise((e,t)=>{const r=new FileReader;r.onload=()=>{const s=r.result;e(s.indexOf(",")>=0?s.split(",")[1]:s)},r.onerror=s=>t(s),r.readAsDataURL(n)}),pEe=(n={})=>{const e=Object.keys(n);return Object.keys(n).map(s=>s.toLocaleLowerCase()).reduce((s,i,a)=>(s[i]=n[e[a]],s),{})},mEe=(n,e=!0)=>n?Object.entries(n).reduce((r,s)=>{const[i,a]=s;let o,l;return Array.isArray(a)?(l="",a.forEach(u=>{o=e?encodeURIComponent(u):u,l+=`${i}=${o}&`}),l.slice(0,-1)):(o=e?encodeURIComponent(a):a,l=`${i}=${o}`),`${r}&${l}`},"").substr(1):null,gEe=(n,e={})=>{const t=Object.assign({method:n.method||"GET",headers:n.headers},e),s=pEe(n.headers)["content-type"]||"";
663if(typeof n.data=="string")t.body=n.data;else if(s.includes("application/x-www-form-urlencoded")){const i=new URLSearchParams;for(const[a,o]of Object.entries(n.data||{}))i.set(a,o);t.body=i.toString()}else if(s.includes("multipart/form-data")||n.data instanceof FormData){const i=new FormData;if(n.data instanceof FormData)n.data.forEach((o,l)=>{i.append(l,o)});else for(const o of Object.keys(n.data))i.append(o,n.data[o]);t.body=i;const a=new Headers(t.headers);a.delete("content-type"),t.headers=a}else(s.includes("application/json")||typeof n.data=="object")&&(t.body=JSON.stringify(n.data));return t};class vEe extends T3{async request(e){const t=gEe(e,e.webFetchExtra),r=mEe(e.params,e.shouldEncodeUrlParams),s=r?`${e.url}?${r}`:e.url,i=await fetch(s,t),a=i.headers.get("content-type")||"";let{responseType:o="text"}=i.ok?e:{};a.includes("application/json")&&(o="json");let l,u;switch(o){case"arraybuffer":case"blob":u=await i.blob(),l=await fEe(u);break;case"json":l=await i.json();break;case"document":case"text":default:l=
vendor: 6,923 bytes, line 663
663await i.text()}const d={};return i.headers.forEach((h,f)=>{d[f]=h}),{data:l,headers:d,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}zS("CapacitorHttp",{web:()=>new vEe});var sU;(function(n){n.Dark="DARK",n.Light="LIGHT",n.Default="DEFAULT"})(sU||(sU={}));var iU;(function(n){n.StatusBar="StatusBar",n.NavigationBar="NavigationBar"})(iU||(iU={}));class yEe extends T3{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}zS("SystemBars",{web:()=>new yEe});function $S(){const[n,e]=_.useState(()=>{const t=Ao.isNativePlatform(),r=Ao.getPlatform();return{isNative:t,isIOS:r==="ios",isAndroid:r==="android",isWeb:r==="web",platform:r}});return _.useEffect(()=>{const t=Ao.isNativePlatform(),r=Ao.getPlatform();e({isNative:t,isIOS:r==="ios",isAndroid:r==="android",isWeb:r==="web",platform:r})},[]),n}const Nb={isNative:()=>Ao.isNativePlatform(),isIOS:()=>Ao.getPlatform()==="ios",isAndroid:()=>Ao.getPlatform()==="android",isWeb:()=>Ao.getPlatform()==="web",getPlatform:()=>Ao.getPlatform()};var xEe=_.createContext(void 0);function kg(n){const e=_.useContext(xEe);return n||e||"ltr"}var sP=0;function CT(){_.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??aU()),document.body.insertAdjacentElement("beforeend",n[1]??aU()),sP++,()=>{sP===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),sP--}},[])}function aU(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var iP="focusScope.autoFocusOnMount",aP="focusScope.autoFocusOnUnmount",oU={bubbles:!1,cancelable:!0},bEe="FocusScope",US=_.forwardRef((n,e)=>{const{loop:t=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=n,[o,l]=_.useState(null),u=Pr(s),d=Pr(i),h=_.useRef(null),f=Ct(e,g=>l(g)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let g=function(b){if(p.paused||!o)return;const E=b.target;o.contains(E)?h.current=E:Ld(h.current,{select:!0})},y=function(b){if(p.paused||!o)return;const E=b.relatedTarget;E!==null&&(o.contains(E)||Ld(h.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Ld(o)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const x=new MutationObserver(v);return o&&x.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),x.disconnect()}}},[r,o,p.paused]),_.useEffect(()=>{if(o){cU.add(p);const g=document.activeElement;if(!o.contains(g)){const v=new CustomEvent(iP,oU);o.addEventListener(iP,u),o.dispatchEvent(v),v.defaultPrevented||(wEe(CEe(QX(o)),{select:!0}),document.activeElement===g&&Ld(o))}return()=>{o.removeEventListener(iP,u),setTimeout(()=>{const v=new CustomEvent(aP,oU);o.addEventListener(aP,d),o.dispatchEvent(v),v.defaultPrevented||Ld(g??document.body,{select:!0}),o.removeEventListener(aP,d),cU.remove(p)},0)}}},[o,u,d,p]);const m=_.useCallback(g=>{if(!t&&!r||p.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(y&&v){const x=g.currentTarget,[b,E]=_Ee(x);b&&E?!g.shiftKey&&v===E?(g.preventDefault(),t&&Ld(b,{select:!0})):g.shiftKey&&v===b&&(g.preventDefault(),t&&Ld(E,{select:!0})):v===x&&g.preventDefault()}},[t,r,p.paused]);return c.jsx(st.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});US.displayName=bEe;function wEe(n,{select:e=!1}={}){const t=document.activeElement;for(const r of n)if(Ld(r,{select:e}),document.activeElement!==t)return}function _Ee(n){const e=QX(n),t=lU(e,n),r=lU(e.reverse(),n);return[t,r]}function QX(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function lU(n,e){for(const t of n)if(!SEe(t,{upTo:e}))return t}function SEe(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function EEe(n){return n instanceof HTMLInputElement&&"select"in n}function Ld(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&EEe(n)&&e&&n.select()}}var cU=kEe();function kEe(){let n=[];return{add(e){const t=n[0];e!==t&&(t==null||t.pause()),n=uU(n,e),n.unshift(e)},remove(e){var t;n=uU(n,e),(t=n[0])==null||t.resume()}}}function uU(n,e){const t=[...n],r=t.indexOf(e);return r!==-1&&t.splice(r,1),t}function CEe(n){return n.filter(e=>e.tagName!=="A")}var oP="rovingFocusGroup.onEntryFocus",AEe={bubbles:!1,cancelable:!0},VS="RovingFocusGroup",[OM,eZ,NEe]=SS(VS),[TEe,A0]=Hr(VS,[NEe]),[jEe,REe]=TEe(VS),tZ=_.forwardRef((n,e)=>c.jsx(OM.Provider,{scope:n.__scopeRovingFocusGroup,children:c.jsx(OM.Slot,{scope:n.__scopeRovingFocusGroup,children:c.jsx(PEe,{...n,ref:e})})}));tZ.displayName=VS;var PEe=_.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=n,f=_.useRef(null),p=Ct(e,f),m=kg(i),[g,y]=Zi({prop:a,defaultProp:o??null,onChange:l,caller:VS}),[v,x]=_.useState(!1),b=Pr(u),E=eZ(t),S=_.useRef(!1),[k,C]=_.useState(0);return _.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(oP,b),()=>A.removeEventListener(oP,b)},[b]),c.jsx(jEe,{scope:t,orientation:r,dir:m,loop:s,currentTabStopId:g,onItemFocus:_.useCallback(A=>y(A),[y]),onItemShiftTab:_.useCallback(()=>x(!0),[]),onFocusableItemAdd:_.useCallback(()=>C(A=>A+1),[]),onFocusableItemRemove:_.useCallback(()=>C(A=>A-1),[]),children:c.jsx(st.div,{tabIndex:v||k===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...n.style},onMouseDown:$e(n.onMouseDown,()=>{S.current=!0}),onFocus:$e(n.onFocus,A=>{const T=!S.current;if(A.target===A.currentTarget&&T&&!v){const j=new CustomEvent(oP,AEe);if(A.currentTarget.dispatchEvent(j),!j.defaultPrevented){const D=E().filter(q=>q.focusable),R=D.find(q=>q.active),M=D.find(q=>
vendor: 4,798 bytes, line 663
663q.id===g),U=[R,M,...D].filter(Boolean).map(q=>q.ref.current);sZ(U,d)}}S.current=!1}),onBlur:$e(n.onBlur,()=>x(!1))})})}),nZ="RovingFocusGroupItem",rZ=_.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...o}=n,l=Ja(),u=i||l,d=REe(nZ,t),h=d.currentTabStopId===u,f=eZ(t),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:g}=d;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),c.jsx(OM.ItemSlot,{scope:t,id:u,focusable:r,active:s,children:c.jsx(st.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...o,ref:e,onMouseDown:$e(n.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:$e(n.onFocus,()=>d.onItemFocus(u)),onKeyDown:$e(n.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=MEe(y,d.orientation,d.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=f().filter(E=>E.focusable).map(E=>E.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const E=b.indexOf(y.currentTarget);b=d.loop?IEe(b,E+1):b.slice(E+1)}setTimeout(()=>sZ(b))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:g!=null}):a})})});rZ.displayName=nZ;var DEe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function OEe(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function MEe(n,e,t){const r=OEe(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return DEe[r]}function sZ(n,e=!1){const t=document.activeElement;for(const r of n)if(r===t||(r.focus({preventScroll:e}),document.activeElement!==t))return}function IEe(n,e){return n.map((t,r)=>n[(e+r)%n.length])}var j3=tZ,R3=rZ,LEe=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Kg=new WeakMap,sk=new WeakMap,ik={},lP=0,iZ=function(n){return n&&(n.host||iZ(n.parentNode))},FEe=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=iZ(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},BEe=function(n,e,t,r){var s=FEe(e,Array.isArray(n)?n:[n]);ik[t]||(ik[t]=new WeakMap);var i=ik[t],a=[],o=new Set,l=new Set(s),u=function(h){!h||o.has(h)||(o.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(f){if(o.has(f))d(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",g=(Kg.get(f)||0)+1,y=(i.get(f)||0)+1;Kg.set(f,g),i.set(f,y),a.push(f),g===1&&m&&sk.set(f,!0),y===1&&f.setAttribute(t,"true"),m||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return d(e),o.clear(),lP++,function(){a.forEach(function(h){var f=Kg.get(h)-1,p=i.get(h)-1;Kg.set(h,f),i.set(h,p),f||(sk.has(h)||h.removeAttribute(r),sk.delete(h)),p||h.removeAttribute(t)}),lP--,lP||(Kg=new WeakMap,Kg=new WeakMap,sk=new WeakMap,ik={})}},AT=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),s=LEe(n);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),BEe(r,s,t,"aria-hidden")):function(){return null}},tC="right-scroll-bar-position",nC="width-before-scroll-bar",zEe="with-scroll-bars-hidden",$Ee="--removed-body-scroll-bar-size";function cP(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function UEe(n,e){var t=_.useState(function(){return{value:n,callback:e,facade:{get current(){return t.value},set current(r){var s=t.value;s!==r&&(t.value=r,t.callback(r,s))}}}})[0];return t.callback=e,t.facade}var VEe=typeof window<"u"?_.useLayoutEffect:_.useEffect,dU=new WeakMap;function HEe(n,e){var t=UEe(null,function(r){return n.forEach(function(s){return cP(s,r)})});return VEe(function(){var r=dU.get(t);if(r){var s=new Set(r),i=new Set(n),a=t.current;s.forEach(function(o){i.has(o)||cP(o,null)}),i.forEach(function(o){s.has(o)||cP(o,a)})}dU.set(t,n)},[n]),t}function WEe(n){return n}function qEe(n,e){e===void 0&&(e=WEe);var t=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:n},useMedium:function(i){var a=e(i,r);return t.push(a),function(){t=t.filter(function(o){return o!==a})}},assignSyncMedium:function(i){for(r=!0;t.length;){var a=t;t=[],a.forEach(i)}t={push:function(o){return i(o)},filter:function(){return t}}},assignMedium:function(i){r=!0;var a=[];if(t.length){var o=t;t=[],o.forEach(i),a=t}var l=function(){var d=a;a=[],d.forEach(i)},u=function(){return Promise.resolve().then(l)};
vendor: 5,759 bytes, lines 663-700
663u(),t={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),t}}}};return s}function GEe(n){n===void 0&&(n={});var e=qEe(null);return e.options=Pc({async:!0,ssr:!1},n),e}var aZ=function(n){var e=n.sideCar,t=S0(n,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,Pc({},t))};aZ.isSideCarExport=!0;function KEe(n,e){return n.useMedium(e),aZ}var oZ=GEe(),uP=function(){},NT=_.forwardRef(function(n,e){var t=_.useRef(null),r=_.useState({onScrollCapture:uP,onWheelCapture:uP,onTouchMoveCapture:uP}),s=r[0],i=r[1],a=n.forwardProps,o=n.children,l=n.className,u=n.removeScrollBar,d=n.enabled,h=n.shards,f=n.sideCar,p=n.noRelative,m=n.noIsolation,g=n.inert,y=n.allowPinchZoom,v=n.as,x=v===void 0?"div":v,b=n.gapMode,E=S0(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,k=HEe([t,e]),C=Pc(Pc({},E),s);return _.createElement(_.Fragment,null,d&&_.createElement(S,{sideCar:oZ,removeScrollBar:u,shards:h,noRelative:p,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:t,gapMode:b}),a?_.cloneElement(_.Children.only(o),Pc(Pc({},C),{ref:k})):_.createElement(x,Pc({},C,{className:l,ref:k}),o))});NT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NT.classNames={fullWidth:nC,zeroRight:tC};var YEe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function XEe(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=YEe();return e&&n.setAttribute("nonce",e),n}function ZEe(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function JEe(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var QEe=function(){var n=0,e=null;return{add:function(t){n==0&&(e=XEe())&&(ZEe(e,t),JEe(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},eke=function(){var n=QEe();return function(e,t){_.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&t])}},lZ=function(){var n=eke(),e=function(t){var r=t.styles,s=t.dynamic;return n(r,s),null};return e},tke={left:0,top:0,right:0,gap:0},dP=function(n){return parseInt(n||"",10)||0},nke=function(n){var e=window.getComputedStyle(document.body),t=e[n==="padding"?"paddingLeft":"marginLeft"],r=e[n==="padding"?"paddingTop":"marginTop"],s=e[n==="padding"?"paddingRight":"marginRight"];return[dP(t),dP(r),dP(s)]},rke=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return tke;var e=nke(n),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-t+e[2]-e[0])}},ske=lZ(),cy="data-scroll-locked",ike=function(n,e,t,r){var s=n.left,i=n.top,a=n.right,o=n.gap;return t===void 0&&(t="margin"),`
664  .`.concat(zEe,` {
665   overflow: hidden `).concat(r,`;
666   padding-right: `).concat(o,"px ").concat(r,`;
667  }
668  body[`).concat(cy,`] {
669    overflow: hidden `).concat(r,`;
670    overscroll-behavior: contain;
671    `).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&`
672    padding-left: `.concat(s,`px;
673    padding-top: `).concat(i,`px;
674    padding-right: `).concat(a,`px;
675    margin-left:0;
676    margin-top:0;
677    margin-right: `).concat(o,"px ").concat(r,`;
678    `),t==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
679  }
680  
681  .`).concat(tC,` {
682    right: `).concat(o,"px ").concat(r,`;
683  }
684  
685  .`).concat(nC,` {
686    margin-right: `).concat(o,"px ").concat(r,`;
687  }
688  
689  .`).concat(tC," .").concat(tC,` {
690    right: 0 `).concat(r,`;
691  }
692  
693  .`).concat(nC," .").concat(nC,` {
694    margin-right: 0 `).concat(r,`;
695  }
696  
697  body[`).concat(cy,`] {
698    `).concat($Ee,": ").concat(o,`px;
699  }
700`)},hU=function(){var n=parseInt(document.body.getAttribute(cy)||"0",10);return isFinite(n)?n:0},ake=function(){_.useEffect(function(){return document.body.setAttribute(cy,(hU()+1).toString()),function(){var n=hU()-1;n<=0?document.body.removeAttribute(cy):document.body.setAttribute(cy,n.toString())}},[])},oke=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,s=r===void 0?"margin":r;ake();var i=_.useMemo(function(){return rke(s)},[s]);return _.createElement(ske,{styles:ike(i,!e,s,t?"":"!important")})},MM=!1;if(typeof window<"u")try{var ak=Object.defineProperty({},"passive",{get:function(){return MM=!0,!0}});window.addEventListener("test",ak,ak),window.removeEventListener("test",ak,ak)}catch{MM=!1}var Yg=MM?{passive:!1}:!1,lke=function(n){return n.tagName==="TEXTAREA"},cZ=function(n,e){if(!(n instanceof Element))return!1;var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!lke(n)&&t[e]==="visible")},cke=function(n){return cZ(n,"overflowY")},uke=function(n){return cZ(n,"overflowX")},fU=function(n,e){var t=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=uZ(n,r);if(s){var i=dZ(n,r),a=i[1],o=i[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==t.body);return!1},dke=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},hke=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},uZ=function(n,e){return n==="v"?cke(e):uke(e)},dZ=function(n,e){return n==="v"?dke(e):hke(e)},fke=function(n,e){return n==="h"&&e==="rtl"?-1:1},pke=function(n,e,t,r,s){var i=fke(n,window.getComputedStyle(e).direction),a=i*r,o=t.target,l=e.contains(o),u=!1,d=a>0,h=0,f=0;do{if(!o)break;var p=dZ(n,o),m=p[0],g=p[1],y=p[2],v=g-y-i*m;(m||v)&&uZ(n,o)&&(h+=v,f+=m);var x=o.parentNode;o=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));
vendor: 21,528 bytes, lines 700-703
700return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},ok=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},pU=function(n){return[n.deltaX,n.deltaY]},mU=function(n){return n&&"current"in n?n.current:n},mke=function(n,e){return n[0]===e[0]&&n[1]===e[1]},gke=function(n){return`
701  .block-interactivity-`.concat(n,` {pointer-events: none;}
702  .allow-interactivity-`).concat(n,` {pointer-events: all;}
703`)},vke=0,Xg=[];function yke(n){var e=_.useRef([]),t=_.useRef([0,0]),r=_.useRef(),s=_.useState(vke++)[0],i=_.useState(lZ)[0],a=_.useRef(n);_.useEffect(function(){a.current=n},[n]),_.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var g=Xye([n.lockRef.current],(n.shards||[]).map(mU),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var o=_.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var v=ok(g),x=t.current,b="deltaX"in g?g.deltaX:x[0]-v[0],E="deltaY"in g?g.deltaY:x[1]-v[1],S,k=g.target,C=Math.abs(b)>Math.abs(E)?"h":"v";if("touches"in g&&C==="h"&&k.type==="range")return!1;var A=fU(C,k);if(!A)return!0;if(A?S=C:(S=C==="v"?"h":"v",A=fU(C,k)),!A)return!1;if(!r.current&&"changedTouches"in g&&(b||E)&&(r.current=S),!S)return!0;var T=r.current||S;return pke(T,y,g,T==="h"?b:E,!0)},[]),l=_.useCallback(function(g){var y=g;if(!(!Xg.length||Xg[Xg.length-1]!==i)){var v="deltaY"in y?pU(y):ok(y),x=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&mke(S.delta,v)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var b=(a.current.shards||[]).map(mU).filter(Boolean).filter(function(S){return S.contains(y.target)}),E=b.length>0?o(y,b[0]):!a.current.noIsolation;E&&y.cancelable&&y.preventDefault()}}},[]),u=_.useCallback(function(g,y,v,x){var b={name:g,delta:y,target:v,should:x,shadowParent:xke(v)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(E){return E!==b})},1)},[]),d=_.useCallback(function(g){t.current=ok(g),r.current=void 0},[]),h=_.useCallback(function(g){u(g.type,pU(g),g.target,o(g,n.lockRef.current))},[]),f=_.useCallback(function(g){u(g.type,ok(g),g.target,o(g,n.lockRef.current))},[]);_.useEffect(function(){return Xg.push(i),n.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Yg),document.addEventListener("touchmove",l,Yg),document.addEventListener("touchstart",d,Yg),function(){Xg=Xg.filter(function(g){return g!==i}),document.removeEventListener("wheel",l,Yg),document.removeEventListener("touchmove",l,Yg),document.removeEventListener("touchstart",d,Yg)}},[]);var p=n.removeScrollBar,m=n.inert;return _.createElement(_.Fragment,null,m?_.createElement(i,{styles:gke(s)}):null,p?_.createElement(oke,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function xke(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const bke=KEe(oZ,yke);var HS=_.forwardRef(function(n,e){return _.createElement(NT,Pc({},n,{ref:e,sideCar:bke}))});HS.classNames=NT.classNames;var IM=["Enter"," "],wke=["ArrowDown","PageUp","Home"],hZ=["ArrowUp","PageDown","End"],_ke=[...wke,...hZ],Ske={ltr:[...IM,"ArrowRight"],rtl:[...IM,"ArrowLeft"]},Eke={ltr:["ArrowLeft"],rtl:["ArrowRight"]},WS="Menu",[A1,kke,Cke]=SS(WS),[Cg,fZ]=Hr(WS,[Cke,jf,A0]),TT=jf(),pZ=A0(),[Ake,Ag]=Cg(WS),[Nke,qS]=Cg(WS),mZ=n=>{const{__scopeMenu:e,open:t=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=n,o=TT(e),[l,u]=_.useState(null),d=_.useRef(!1),h=Pr(i),f=kg(s);return _.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),c.jsx(dT,{...o,children:c.jsx(Ake,{scope:e,open:t,onOpenChange:h,content:l,onContentChange:u,children:c.jsx(Nke,{scope:e,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:a,children:r})})})};mZ.displayName=WS;var Tke="MenuAnchor",P3=_.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n,s=TT(t);return c.jsx(DS,{...s,...r,ref:e})});P3.displayName=Tke;var D3="MenuPortal",[jke,gZ]=Cg(D3,{forceMount:void 0}),vZ=n=>{const{__scopeMenu:e,forceMount:t,children:r,container:s}=n,i=Ag(D3,e);return c.jsx(jke,{scope:e,forceMount:t,children:c.jsx(ss,{present:t||i.open,children:c.jsx(m0,{asChild:!0,container:s,children:r})})})};vZ.displayName=D3;var Lo="MenuContent",[Rke,O3]=Cg(Lo),yZ=_.forwardRef((n,e)=>{const t=gZ(Lo,n.__scopeMenu),{forceMount:r=t.forceMount,...s}=n,i=Ag(Lo,n.__scopeMenu),a=qS(Lo,n.__scopeMenu);return c.jsx(A1.Provider,{scope:n.__scopeMenu,children:c.jsx(ss,{present:r||i.open,children:c.jsx(A1.Slot,{scope:n.__scopeMenu,children:a.modal?c.jsx(Pke,{...s,ref:e}):c.jsx(Dke,{...s,ref:e})})})})}),Pke=_.forwardRef((n,e)=>{const t=Ag(Lo,n.__scopeMenu),r=_.useRef(null),s=Ct(e,r);return _.useEffect(()=>{const i=r.current;if(i)return AT(i)},[]),c.jsx(M3,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:$e(n.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),Dke=_.forwardRef((n,e)=>{const t=Ag(Lo,n.__scopeMenu);return c.jsx(M3,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),Oke=df("MenuContent.ScrollLock"),M3=_.forwardRef((n,e)=>{const{__scopeMenu:t,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=n,y=Ag(Lo,t),v=qS(Lo,t),x=TT(t),b=pZ(t),E=kke(t),[S,k]=_.useState(null),C=_.useRef(null),A=Ct(e,C,y.onContentChange),T=_.useRef(0),j=_.useRef(""),D=_.useRef(0),R=_.useRef(null),M=_.useRef("right"),N=_.useRef(0),U=m?HS:_.Fragment,q=m?{as:Oke,allowPinchZoom:!0}:void 0,I=$=>{var le,ve;const ie=j.current+$,ne=E().filter(_e=>!_e.disabled),L=document.activeElement,te=(le=ne.find(_e=>_e.ref.current===L))==null?void 0:le.textValue,ae=ne.map(_e=>_e.textValue),de=qke(ae,ie,te),ue=(ve=ne.find(_e=>_e.textValue===de))==null?void 0:ve.ref.current;(function _e(Ne){j.current=Ne,window.clearTimeout(T.current),Ne!==""&&(T.current=window.setTimeout(()=>_e(""),1e3))})(ie),ue&&setTimeout(()=>ue.focus())};_.useEffect(()=>()=>window.clearTimeout(T.current),[]),CT();const B=_.useCallback($=>{var ne,L;return M.current===((ne=R.current)==null?void 0:ne.side)&&Kke($,(L=R.current)==null?void 0:L.area)},[]);return c.jsx(Rke,{scope:t,searchRef:j,onItemEnter:_.useCallback($=>{B($)&&$.preventDefault()},[B]),onItemLeave:_.useCallback($=>{var ie;B($)||((ie=C.current)==null||ie.focus(),k(null))},[B]),onTriggerLeave:_.useCallback($=>{B($)&&$.preventDefault()},[B]),pointerGraceTimerRef:D,onPointerGraceIntentChange:_.useCallback($=>{R.current=$},[]),children:c.jsx(U,{...q,children:c.jsx(US,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,$=>{var ie;$.preventDefault(),(ie=C.current)==null||ie.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:c.jsx(_g,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:c.jsx(j3,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:k,onEntryFocus:$e(l,$=>{v.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(hT,{role:"menu","aria-orientation":"vertical","data-state":OZ(y.open),"data-radix-menu-content":"",dir:v.dir,...x,...g,ref:A,style:{outline:"none",...g.style},onKeyDown:$e(g.onKeyDown,$=>{const ne=$.target.closest("[data-radix-menu-content]")===$.currentTarget,L=$.ctrlKey||$.altKey||$.metaKey,te=$.key.length===1;ne&&($.key==="Tab"&&$.preventDefault(),!L&&te&&I($.key));const ae=C.current;if($.target!==ae||!_ke.includes($.key))return;$.preventDefault();const ue=E().filter(le=>!le.disabled).map(le=>le.ref.current);hZ.includes($.key)&&ue.reverse(),Hke(ue)}),onBlur:$e(n.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(T.current),j.current="")}),onPointerMove:$e(n.onPointerMove,N1($=>{const ie=$.target,ne=N.current!==$.clientX;if($.currentTarget.contains(ie)&&ne){const L=$.clientX>N.current?"right":"left";M.current=L,N.current=$.clientX}}))})})})})})})});yZ.displayName=Lo;var Mke="MenuGroup",I3=_.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n;return c.jsx(st.div,{role:"group",...r,ref:e})});I3.displayName=Mke;var Ike="MenuLabel",xZ=_.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n;return c.jsx(st.div,{...r,ref:e})});xZ.displayName=Ike;var W2="MenuItem",gU="menu.itemSelect",jT=_.forwardRef((n,e)=>{const{disabled:t=!1,onSelect:r,...s}=n,i=_.useRef(null),a=qS(W2,n.__scopeMenu),o=O3(W2,n.__scopeMenu),l=Ct(e,i),u=_.useRef(!1),d=()=>{const h=i.current;if(!t&&h){const f=new CustomEvent(gU,{bubbles:!0,cancelable:!0});h.addEventListener(gU,p=>r==null?void 0:r(p),{once:!0}),hF(h,f),f.defaultPrevented?u.current=!1:a.onClose()}};return c.jsx(bZ,{...s,ref:l,disabled:t,onClick:$e(n.onClick,d),onPointerDown:h=>{var f;(f=n.onPointerDown)==null||f.call(n,h),u.current=!0},onPointerUp:$e(n.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:$e(n.onKeyDown,h=>{const f=o.searchRef.current!=="";t||f&&h.key===" "||IM.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});jT.displayName=W2;var bZ=_.forwardRef((n,e)=>{const{__scopeMenu:t,disabled:r=!1,textValue:s,...i}=n,a=O3(W2,t),o=pZ(t),l=_.useRef(null),u=Ct(e,l),[d,h]=_.useState(!1),[f,p]=_.useState("");return _.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),c.jsx(A1.ItemSlot,{scope:t,disabled:r,textValue:s??f,children:c.jsx(R3,{asChild:!0,...o,focusable:!r,children:c.jsx(st.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:$e(n.onPointerMove,N1(m=>{r?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(n.onPointerLeave,N1(m=>a.onItemLeave(m))),onFocus:$e(n.onFocus,()=>h(!0)),onBlur:$e(n.onBlur,()=>h(!1))})})})}),Lke="MenuCheckboxItem",wZ=_.forwardRef((n,e)=>{const{checked:t=!1,onCheckedChange:r,...s}=n;return c.jsx(CZ,{scope:n.__scopeMenu,checked:t,children:c.jsx(jT,{role:"menuitemcheckbox","aria-checked":q2(t)?"mixed":t,...s,ref:e,"data-state":F3(t),onSelect:$e(s.onSelect,()=>r==null?void 0:r(q2(t)?!0:!t),{checkForDefaultPrevented:!1})})})});wZ.displayName=Lke;var _Z="MenuRadioGroup",[Fke,Bke]=Cg(_Z,{value:void 0,onValueChange:()=>{}}),SZ=_.forwardRef((n,e)=>{const{value:t,onValueChange:r,...s}=n,i=Pr(r);return c.jsx(Fke,{scope:n.__scopeMenu,value:t,onValueChange:i,children:c.jsx(I3,{...s,ref:e})})});SZ.displayName=_Z;var EZ="MenuRadioItem",kZ=_.forwardRef((n,e)=>{const{value:t,...r}=n,s=Bke(EZ,n.__scopeMenu),i=t===s.value;return c.jsx(CZ,{scope:n.__scopeMenu,checked:i,children:c.jsx(jT,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":F3(i),onSelect:$e(r.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,t)},{checkForDefaultPrevented:!1})})})});kZ.displayName=EZ;var L3="MenuItemIndicator",[CZ,zke]=Cg(L3,{checked:!1}),AZ=_.forwardRef((n,e)=>{const{__scopeMenu:t,forceMount:r,...s}=n,i=zke(L3,t);return c.jsx(ss,{present:r||q2(i.checked)||i.checked===!0,children:c.jsx(st.span,{...s,ref:e,"data-state":F3(i.checked)})})});AZ.displayName=L3;var $ke="MenuSeparator",NZ=_.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n;return c.jsx(st.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});NZ.displayName=$ke;var Uke="MenuArrow",TZ=_.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n,s=TT(t);return c.jsx(fT,{...s,...r,ref:e})});TZ.displayName=Uke;var Vke="MenuSub",[Wqe,jZ]=Cg(Vke),Tb="MenuSubTrigger",RZ=_.forwardRef((n,e)=>{const t=Ag(Tb,n.__scopeMenu),r=qS(Tb,n.__scopeMenu),s=jZ(Tb,n.__scopeMenu),i=O3(Tb,n.__scopeMenu),a=_.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=i,u={__scopeMenu:n.__scopeMenu},d=_.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return _.useEffect(()=>d,[d]),_.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),l(null)}},[o,l]),c.jsx(P3,{asChild:!0,...u,children:c.jsx(bZ,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":s.contentId,"data-state":OZ(t.open),...n,ref:tT(e,s.onTriggerChange),onClick:h=>{var f;(f=n.onClick)==null||f.call(n,h),!(n.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:$e(n.onPointerMove,N1(h=>{i.onItemEnter(h),!h.defaultPrevented&&!n.disabled&&!t.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{t.onOpenChange(!0),d()},100))})),onPointerLeave:$e(n.onPointerLeave,N1(h=>{var p,m;d();const f=(p=t.content)==null?void 0:p.getBoundingClientRect();if(f){const g=(m=t.content)==null?void 0:m.dataset.side,y=g==="right",v=y?-5:5,x=f[y?"left":"right"],b=f[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+v,y:h.clientY},{x,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x,y:f.bottom}],side:g}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(n.onKeyDown,h=>{var p;const f=i.searchRef.current!=="";n.disabled||f&&h.key===" "||Ske[r.dir].includes(h.key)&&(t.onOpenChange(!0),(p=t.content)==null||p.focus(),h.preventDefault())})})})});RZ.displayName=Tb;var PZ="MenuSubContent",DZ=_.forwardRef((n,e)=>{const t=gZ(Lo,n.__scopeMenu),{forceMount:r=t.forceMount,...s}=n,i=Ag(Lo,n.__scopeMenu),a=qS(Lo,n.__scopeMenu),o=jZ(PZ,n.__scopeMenu),l=_.useRef(null),u=Ct(e,l);return c.jsx(A1.Provider,{scope:n.__scopeMenu,children:c.jsx(ss,{present:r||i.open,children:c.jsx(A1.Slot,{scope:n.__scopeMenu,children:c.jsx(M3,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;a.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:$e(n.onFocusOutside,d=>{d.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(n.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:$e(n.onKeyDown,d=>{var p;const h=d.currentTarget.contains(d.target),f=Eke[a.dir].includes(d.key);h&&f&&(i.onOpenChange(!1),(p=o.trigger)==null||p.focus(),d.preventDefault())})})})})})});DZ.displayName=PZ;function OZ(n){return n?"open":"closed"}function q2(n){return n==="indeterminate"}function F3(n){return q2(n)?"indeterminate":n?"checked":"unchecked"}function Hke(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}function Wke(n,e){return n.map((t,r)=>n[(e+r)%n.length])}function qke(n,e,t){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let a=Wke(n,Math.max(i,0));s.length===1&&(a=a.filter(u=>u!==t));const l=a.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return l!==t?l:void 0}function Gke(n,e){const{x:t,y:r}=n;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const o=e[i],l=e[a],u=o.x,d=o.y,h=l.x,f=l.y;d>r!=f>r&&t<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function Kke(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return Gke(t,e)}function N1(n){return e=>e.pointerType==="mouse"?n(e):void 0}var Yke=mZ,Xke=P3,Zke=vZ,Jke=yZ,Qke=I3,eCe=xZ,tCe=jT,nCe=wZ,rCe=SZ,sCe=kZ,iCe=AZ,aCe=NZ,oCe=TZ,lCe=RZ,cCe=DZ,RT="DropdownMenu",[uCe,qqe]=Hr(RT,[fZ]),ra=fZ(),[dCe,MZ]=uCe(RT),IZ=n=>{const{__scopeDropdownMenu:e,children:t,dir:r,open:s,defaultOpen:i,onOpenChange:a,modal:o=!0}=n,l=ra(e),u=_.useRef(null),[d,h]=Zi({prop:s,defaultProp:i??!1,onChange:a,caller:RT});return c.jsx(dCe,{scope:e,triggerId:Ja(),triggerRef:u,contentId:Ja(),open:d,onOpenChange:h,onOpenToggle:_.useCallback(()=>h(f=>!f),[h]),modal:o,children:c.jsx(Yke,{...l,open:d,onOpenChange:h,dir:r,modal:o,children:t})})};IZ.displayName=RT;var LZ="DropdownMenuTrigger",FZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,disabled:r=!1,...s}=n,i=MZ(LZ,t),a=ra(t);return c.jsx(Xke,{asChild:!0,...a,children:c.jsx(st.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":r?"":void 0,disabled:r,...s,ref:tT(e,i.triggerRef),onPointerDown:$e(n.onPointerDown,o=>{!r&&o.button===0&&o.ctrlKey===!1&&(i.onOpenToggle(),i.open||o.preventDefault())}),onKeyDown:$e(n.onKeyDown,o=>{r||(["Enter"," "].includes(o.key)&&i.onOpenToggle(),o.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});FZ.displayName=LZ;var hCe="DropdownMenuPortal",BZ=n=>{const{__scopeDropdownMenu:e,...t}=n,r=ra(e);return c.jsx(Zke,{...r,...t})};BZ.displayName=hCe;var zZ="DropdownMenuContent",$Z=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=MZ(zZ,t),i=ra(t),a=_.useRef(!1);return c.jsx(Jke,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:$e(n.onCloseAutoFocus,o=>{var l;a.current||(l=s.triggerRef.current)==null||l.focus(),a.current=!1,o.preventDefault()}),onInteractOutside:$e(n.onInteractOutside,o=>{const l=o.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!s.modal||d)&&(a.current=!0)}),style:{...n.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)"}})});$Z.displayName=zZ;var fCe="DropdownMenuGroup",pCe=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(Qke,{...s,...r,ref:e})});pCe.displayName=fCe;var mCe="DropdownMenuLabel",UZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(eCe,{...s,...r,ref:e})});UZ.displayName=mCe;var gCe="DropdownMenuItem",VZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(tCe,{...s,...r,ref:e})});VZ.displayName=gCe;var vCe="DropdownMenuCheckboxItem",HZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(nCe,{...s,...r,ref:e})});HZ.displayName=vCe;var yCe="DropdownMenuRadioGroup",xCe=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(rCe,{...s,...r,ref:e})});xCe.displayName=yCe;var bCe="DropdownMenuRadioItem",WZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(sCe,{...s,...r,ref:e})});WZ.displayName=bCe;var wCe="DropdownMenuItemIndicator",qZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(iCe,{...s,...r,ref:e})});qZ.displayName=wCe;var _Ce="DropdownMenuSeparator",GZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(aCe,{...s,...r,ref:e})});GZ.displayName=_Ce;var SCe="DropdownMenuArrow",ECe=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(oCe,{...s,...r,ref:e})});ECe.displayName=SCe;var kCe="DropdownMenuSubTrigger",KZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(lCe,{...s,...r,ref:e})});KZ.displayName=kCe;var CCe="DropdownMenuSubContent",YZ=_.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...r}=n,s=ra(t);return c.jsx(cCe,{...s,...r,ref:e,style:{...n.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)"}})});YZ.displayName=CCe;var ACe=IZ,NCe=FZ,TCe=BZ,XZ=$Z,ZZ=UZ,JZ=VZ,QZ=HZ,eJ=WZ,tJ=qZ,nJ=GZ,rJ=KZ,sJ=YZ;const B3=ACe,z3=NCe,jCe=_.forwardRef(({className:n,inset:e,children:t,...r},s)=>c.jsxs(rJ,{ref:s,className:ke("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",n),...r,children:[t,c.jsx(cd,{className:"ml-auto h-4 w-4"})]}));jCe.displayName=rJ.displayName;const RCe=_.forwardRef(({className:n,...e},t)=>c.jsx(sJ,{ref:t,className:ke("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]:sli
703de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...e}));RCe.displayName=sJ.displayName;const PT=_.forwardRef(({className:n,sideOffset:e=4,...t},r)=>c.jsx(TCe,{children:c.jsx(XZ,{ref:r,sideOffset:e,className:ke("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",n),...t})}));PT.displayName=XZ.displayName;const Do=_.forwardRef(({className:n,inset:e,...t},r)=>c.jsx(JZ,{ref:r,className:ke("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",n),...t}));Do.displayName=JZ.displayName;const PCe=_.forwardRef(({className:n,children:e,checked:t,...r},s)=>c.jsxs(QZ,{ref:s,className:ke("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",n),checked:t,...r,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(tJ,{children:c.jsx(Go,{className:"h-4 w-4"})})}),e]}));PCe.displayName=QZ.displayName;const DCe=_.forwardRef(({className:n,children:e,...t},r)=>c.jsxs(eJ,{ref:r,className:ke("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",n),...t,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(tJ,{children:c.jsx(jG,{className:"h-2 w-2 fill-current"})})}),e]}));DCe.displayName=eJ.displayName;const OCe=_.forwardRef(({className:n,inset:e,...t},r)=>c.jsx(ZZ,{ref:r,className:ke("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",n),...t}));OCe.displayName=ZZ.displayName;const G2=_.forwardRef(({className:n,...e},t)=>c.jsx(nJ,{ref:t,className:ke("-mx-1 my-1 h-px bg-muted",n),...e}));G2.displayName=nJ.displayName;function MCe(){const{setTheme:n,theme:e}=tK(),t=()=>{n(e==="dark"?"light":"dark")};return c.jsxs(xe,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[c.jsx(jO,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),c.jsx(FG,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),c.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}const ICe="/assets/logo-icon-BxoDBKLm.png";function LCe(){const{user:n,signOut:e,isLoading:t}=Vt(),{isAdmin:r}=N3(),{isIOS:s,isNative:i}=$S(),a=vr(),[o,l]=_.useState(!1),u=async()=>{await e(),a("/")},d=[{to:"/personas",label:"Heroes"},{to:"/library",label:"Library"},{to:"/study",label:"Scripture Study"},{to:"/debate",label:"Discussion"},{to:"/about",label:"About"}];return c.jsxs("header",{className:ke("border-b border-border bg-card/80 backdrop-blur-sm sticky top-0 z-50",i&&s&&"pt-safe-top"),children:[c.jsxs("div",{className:"container mx-auto px-4 h-16 flex items-center justify-between",children:[c.jsxs(Rt,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[c.jsx("img",{src:ICe,alt:"Heroes of the Faith",className:"h-8 w-8 rounded object-cover",width:"32",height:"32"}),c.jsx("span",{className:"font-serif text-xl font-semibold tracking-tight",children:"Heroes of the Faith"})]}),c.jsx("nav",{className:"hidden md:flex items-center gap-6",children:d.map(h=>c.jsx(Rt,{to:h.to,className:"text-foreground/80 hover:text-gold transition-colors text-sm font-medium uppercase tracking-[0.15em] hover:-translate-y-0.5 transition-all duration-200",children:h.label},h.to))}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(MCe,{}),c.jsx(xe,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>l(!o),children:o?c.jsx(Ho,{className:"h-5 w-5"}):c.jsx(LG,{className:"h-5 w-5"})}),t?c.jsx("div",{className:"h-9 w-20 bg-muted animate-pulse rounded"}):n?c.jsxs(B3,{children:[c.jsx(z3,{asChild:!0,children:c.jsxs(xe,{variant:"ghost",size:"sm",className:"gap-2",children:[c.jsx(Js,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Account"})]})}),c.jsxs(PT,{align:"end",className:"w-48 bg-popover",children:[c.jsx(Do,{asChild:!0,children:c.jsx(Rt,{to:"/conversations",className:"cursor-pointer",children:"My Conversations"})}),c.jsx(Do,{asChild:!0,children:c.jsx(Rt,{to:"/account",className:"cursor-pointer",children:"Account Settings"})}),r&&c.jsxs(c.Fragment,{children:[c.jsx(G2,{}),c.jsx(Do,{asChild:!0,children:c.jsxs(Rt,{to:"/admin",className:"cursor-pointer text-gold",children:[c.jsx(npe,{className:"h-4 w-4 mr-2"}),"Admin Portal"]})})]}),c.jsx(G2,{}),c.jsxs(Do,{onClick:u,className:"cursor-pointer text-accent",children:[c.jsx(IG,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]}):c.jsx(xe,{asChild:!0,variant:"outline",size:"sm",children:c.jsx(Rt,{to:"/auth",children:"Sign In"})})]})]}),c.jsx(y3,{children:o&&c.jsx(Oc.div,{initial:{height:0,opacity:0}
703,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",stiffness:300,damping:30},className:"md:hidden overflow-hidden bg-card border-b border-border",children:c.jsx("nav",{className:"container mx-auto px-4 py-4 flex flex-col gap-2",children:d.map((h,f)=>c.jsx(Oc.div,{initial:{x:-20,opacity:0},animate:{x:0,opacity:1},transition:{delay:f*.05,type:"spring",stiffness:300,damping:25},children:c.jsx(Rt,{to:h.to,onClick:()=>l(!1),className:"flex items-center gap-3 px-4 py-3 rounded-lg text-foreground hover:bg-muted transition-colors",children:c.jsx("span",{className:"font-medium",children:h.label})})},h.to))})})})]})}function FCe(){const{isIOS:n,isNative:e}=$S();return c.jsx("footer",{className:ke("border-t border-border bg-card/50 mt-auto",e&&n&&"pb-safe-bottom"),children:c.jsxs("div",{className:"container mx-auto px-4 py-8",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[c.jsxs("div",{className:"text-center md:text-left",children:[c.jsx("p",{className:"font-serif text-lg font-semibold",children:"Heroes of the Faith"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"A scholarly archive of Christian history"})]}),c.jsxs("nav",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[c.jsx(Rt,{to:"/pers
703onas",className:"hover:text-foreground transition-colors",children:"Browse"}),c.jsx(Rt,{to:"/about",className:"hover:text-foreground transition-colors",children:"About"}),c.jsx(Rt,{to:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy"}),c.jsx(Rt,{to:"/terms",className:"hover:text-foreground transition-colors",children:"Terms"})]})]}),c.jsx("div",{className:"mt-6 pt-6 border-t border-border text-center text-xs text-muted-foreground",children:c.jsxs("p",{children:["© ",new Date().getFullYear()," Heroes of the Faith. All rights reserved."]})})]})})}function BCe({children:n}){return c.jsx(Oc.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.3,ease:"easeOut"},children:n})}function T1(n,[e,t]){return Math.min(t,Math.max(e,n))}function zCe(n,e){return _.useReducer((t,r)=>e[t][r]??t,n)}var $3="ScrollArea",[iJ,Gqe]=Hr($3),[$Ce,Ko]=iJ($3),aJ=_.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=n,[o,l]=_.useState(null),[u,d]=_.useState(null),[h,f]=_.useState(null),[p,m]=_.useState(null),[g,y]=_.useState(null),[v,x]=_.useState(0),[b,E]=_.useState(0),[S,k]=_.useState(!1),[C,A]=_.useState(!1),T=Ct(e,D=>
vendor: 6,037 bytes, line 703
703l(D)),j=kg(s);return c.jsx($Ce,{scope:t,type:r,dir:j,scrollHideDelay:i,scrollArea:o,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:k,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:C,onScrollbarYEnabledChange:A,onCornerWidthChange:x,onCornerHeightChange:E,children:c.jsx(st.div,{dir:j,...a,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":b+"px",...n.style}})})});aJ.displayName=$3;var oJ="ScrollAreaViewport",lJ=_.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...i}=n,a=Ko(oJ,t),o=_.useRef(null),l=Ct(e,o,a.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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}),c.jsx(st.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...n.style},children:c.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});lJ.displayName=oJ;var Zc="ScrollAreaScrollbar",U3=_.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ko(Zc,n.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,o=n.orientation==="horizontal";return _.useEffect(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),s.type==="hover"?c.jsx(UCe,{...r,ref:e,forceMount:t}):s.type==="scroll"?c.jsx(VCe,{...r,ref:e,forceMount:t}):s.type==="auto"?c.jsx(cJ,{...r,ref:e,forceMount:t}):s.type==="always"?c.jsx(V3,{...r,ref:e}):null});U3.displayName=Zc;var UCe=_.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ko(Zc,n.__scopeScrollArea),[i,a]=_.useState(!1);return _.useEffect(()=>{const o=s.scrollArea;let l=0;if(o){const u=()=>{window.clearTimeout(l),a(!0)},d=()=>{l=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return o.addEventListener("pointerenter",u),o.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),o.removeEventListener("pointerenter",u),o.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),c.jsx(ss,{present:t||i,children:c.jsx(cJ,{"data-state":i?"visible":"hidden",...r,ref:e})})}),VCe=_.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ko(Zc,n.__scopeScrollArea),i=n.orientation==="horizontal",a=OT(()=>l("SCROLL_END"),100),[o,l]=zCe("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 _.useEffect(()=>{if(o==="idle"){const u=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[o,s.scrollHideDelay,l]),_.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const p=u[d];h!==p&&(l("SCROLL"),a()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,i,l,a]),c.jsx(ss,{present:t||o!=="hidden",children:c.jsx(V3,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:$e(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),cJ=_.forwardRef((n,e)=>{const t=Ko(Zc,n.__scopeScrollArea),{forceMount:r,...s}=n,[i,a]=_.useState(!1),o=n.orientation==="horizontal",l=OT(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,d=t.viewport.offsetHeight<t.viewport.scrollHeight;a(o?u:d)}},10);return Ux(t.viewport,l),Ux(t.content,l),c.jsx(ss,{present:r||i,children:c.jsx(V3,{"data-state":i?"visible":"hidden",...s,ref:e})})}),V3=_.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=Ko(Zc,n.__scopeScrollArea),i=_.useRef(null),a=_.useRef(0),[o,l]=_.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=pJ(o.viewport,o.content),d={...r,sizes:o,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function h(f,p){return YCe(f,a.current,o,p)}return t==="horizontal"?c.jsx(HCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollLeft,p=vU(f,o,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))}}):t==="vertical"?c.jsx(WCe,{...d,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollTop,p=vU(f,o);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}),HCe=_.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,i=Ko(Zc,n.__scopeScrollArea),[a,o]=_.useState(),l=_.useRef(null),u=Ct(e,l,i.onScrollbarXChange);return _.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),c.jsx(dJ,{"data-orientation":"horizontal",...s,ref:u,sizes:t,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":DT(t)+"px",...n.style},onThumbPointerDown:d=>n.onThumbPointerDown(d.x),onDragScroll:d=>n.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollLeft+d.deltaX;n.onWheelScroll(f),gJ(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Y2(a.paddingLeft),paddingEnd:Y2(a.paddingRight)}})}})}),WCe=_.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,i=Ko(Zc,n.__scopeScrollArea),[a,o]=_.useState(),l=_.useRef(null),u=Ct(e,l,i.onScrollbarYChange);return _.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),c.jsx(dJ,{"data-orientation":"vertical",...s,ref:u,sizes:t,style:{to
vendor: 6,004 bytes, line 703
703p: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":DT(t)+"px",...n.style},onThumbPointerDown:d=>n.onThumbPointerDown(d.y),onDragScroll:d=>n.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(i.viewport){const f=i.viewport.scrollTop+d.deltaY;n.onWheelScroll(f),gJ(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Y2(a.paddingTop),paddingEnd:Y2(a.paddingBottom)}})}})}),[qCe,uJ]=iJ(Zc),dJ=_.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=n,p=Ko(Zc,t),[m,g]=_.useState(null),y=Ct(e,T=>g(T)),v=_.useRef(null),x=_.useRef(""),b=p.viewport,E=r.content-r.viewport,S=Pr(d),k=Pr(l),C=OT(h,10);function A(T){if(v.current){const j=T.clientX-v.current.left,D=T.clientY-v.current.top;u({x:j,y:D})}}return _.useEffect(()=>{const T=j=>{const D=j.target;(m==null?void 0:m.contains(D))&&S(j,E)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[b,m,E,S]),_.useEffect(k,[r,k]),Ux(m,C),Ux(p.content,C),c.jsx(qCe,{scope:t,scrollbar:m,hasThumb:s,onThumbChange:Pr(i),onThumbPointerUp:Pr(a),onThumbPositionChange:k,onThumbPointerDown:Pr(o),children:c.jsx(st.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:$e(n.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),v.current=m.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(T))}),onPointerMove:$e(n.onPointerMove,A),onPointerUp:$e(n.onPointerUp,T=>{const j=T.target;j.hasPointerCapture(T.pointerId)&&j.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),v.current=null})})})}),K2="ScrollAreaThumb",hJ=_.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=uJ(K2,n.__scopeScrollArea);return c.jsx(ss,{present:t||s.hasThumb,children:c.jsx(GCe,{ref:e,...r})})}),GCe=_.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,i=Ko(K2,t),a=uJ(K2,t),{onThumbPositionChange:o}=a,l=Ct(e,h=>a.onThumbChange(h)),u=_.useRef(void 0),d=OT(()=>{u.current&&(u.current(),u.current=void 0)},100);return _.useEffect(()=>{const h=i.viewport;if(h){const f=()=>{if(d(),!u.current){const p=XCe(h,o);u.current=p,o()}};return o(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,d,o]),c.jsx(st.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(n.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),m=h.clientX-p.left,g=h.clientY-p.top;a.onThumbPointerDown({x:m,y:g})}),onPointerUp:$e(n.onPointerUp,a.onThumbPointerUp)})});hJ.displayName=K2;var H3="ScrollAreaCorner",fJ=_.forwardRef((n,e)=>{const t=Ko(H3,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?c.jsx(KCe,{...n,ref:e}):null});fJ.displayName=H3;var KCe=_.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=Ko(H3,t),[i,a]=_.useState(0),[o,l]=_.useState(0),u=!!(i&&o);return Ux(s.scrollbarX,()=>{var h;const d=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(d),l(d)}),Ux(s.scrollbarY,()=>{var h;const d=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(d),a(d)}),u?c.jsx(st.div,{...r,ref:e,style:{width:i,height:o,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Y2(n){return n?parseInt(n,10):0}function pJ(n,e){const t=n/e;return isNaN(t)?0:t}function DT(n){const e=pJ(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function YCe(n,e,t,r="ltr"){const s=DT(t),i=s/2,a=e||i,o=s-a,l=t.scrollbar.paddingStart+a,u=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return mJ([l,u],h)(n)}function vU(n,e,t="ltr"){const r=DT(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,o=i-r,l=t==="ltr"?[0,a]:[a*-1,0],u=T1(n,l);return mJ([0,a],[0,o])(u)}function mJ(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function gJ(n,e){return n>0&&n<e}var XCe=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return function s(){const i={left:n.scrollLeft,top:n.scrollTop},a=t.left!==i.left,o=t.top!==i.top;(a||o)&&e(),t=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function OT(n,e){const t=Pr(n),r=_.useRef(0);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),_.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Ux(n,e){const t=Pr(e);Dr(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var vJ=aJ,ZCe=lJ,JCe=fJ;const Or=_.forwardRef(({className:n,children:e,...t},r)=>c.jsxs(vJ,{ref:r,className:ke("relative overflow-hidden",n),...t,children:[c.jsx(ZCe,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(yJ,{}),c.jsx(JCe,{})]}));Or.displayName=vJ.displayName;const yJ=_.forwardRef(({className:n,orientation:e="vertical",...t},r)=>c.jsx(U3,{ref:r,orientation:e,className:ke("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]",n),...t,children:c.jsx(hJ,{className:"relative flex-1 rounded-full bg-border"})}));yJ.displayName=U3.displayName;
703function QCe({isOpen:n,onClose:e}){const[t,r]=_.useState([]),[s,i]=_.useState(""),[a,o]=_.useState(!1),l=_.useRef(null),u=_.useRef(null),d=Ql();_.useEffect(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[t]),_.useEffect(()=>{n&&u.current&&setTimeout(()=>{var m;return(m=u.current)==null?void 0:m.focus()},100)},[n]);const h=()=>{const m=d.pathname;return m==="/"||m===""?{page:"homepage",description:"the homepage"}:m==="/personas"?{page:"personas",description:"the Heroes archive listing all historical figures"}:m.startsWith("/persona/")?{page:"persona-profile",slug:m.replace("/persona/",""),description:"viewing a hero's profile page"}:m.startsWith("/chat/")?{page:"chat",slug:m.replace("/chat/",""),description:"in conversation with a historical figure"}:m==="/debate/setup"?{page:"debate-setup",description:"setting up a theological debate"}:m.startsWith("/debate/room/")?{page:"debate-room",description:"watching a theological debate"}:m==="/study/workspace"?{page:"study-workspace",description:"the Bible Study Workspace"}:m==="/study/notes"?{page:"notes-archive",description:"the Notes Archive"}:m==="/study/journal"?{page:"journal",description:"the Daily Journal"}:m==="/study"?{page:"study-hub",description:"the Study Hub"}:m==="/about"?{page:"about",description:"the About page"}:{page:"unknown",description:"the site"}},f=async()=>{var y,v,x,b;if(!s.trim()||a)return;const m=s.trim();i(""),r(E=>[...E,{role:"user",content:m}]),o(!0);const g=h();try{const E=await fetch("https://delgyrqdrcihvvudekdx.supabase.co/functions/v1/archivist-chat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRlbGd5cnFkcmNpaHZ2dWRla2R4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjcyMDQ2OTUsImV4cCI6MjA4Mjc4MDY5NX0.hN9e_rgV5h7NwFjamAmR35Blfktg2MHpAlb0ibW3FNA"},body:JSON.stringify({messages:[...t,{role:"user",content:m}],context:g})});if(!E.ok){const A=await E.json().catch(()=>({}));throw new Error(A.error||"Failed to get response")}const S=(y=E.body)==null?void 0:y.getReader();if(!S)throw new Error("No response body");const k=new TextDecoder;let C="";for(r(A=>[...A,{role:"assistant",content:""}]);;){const{done:A,value:T}=await S.read();if(A)break;const D=k.decode(T,{stream:!0}).split(`
704`);for(const R of D)if(R.startsWith("data: ")){const M=R.slice(6).trim();if(M==="[DONE]")continue;try{const U=(b=(x=(v=JSON.parse(M).choices)==null?void 0:v[0])==null?void 0:x.delta)==null?void 0:b.content;U&&(C+=U,r(q=>{const I=[...q];return I[I.length-1]={role:"assistant",content:C},I}))}catch{}}}}catch(E){console.error("Archivist error:",E),r(S=>[...S,{role:"assistant",content:"I apologize, but I am unable to respond at this moment. Perhaps you might explore the archives directly, or return shortly when I am better prepared to assist."}])}finally{o(!1)}},p=m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),f())};return n?c.jsxs("div",{className:"fixed bottom-6 right-6 z-50 w-[380px] max-w-[calc(100vw-3rem)] h-[500px] max-h-[calc(100vh-6rem)] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/30",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/15 flex items-center justify-center",children:c.jsx(AO,{className:"w-4 h-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"The Archivist"}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Your guide to the archives"})]})]}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:e,children:c.jsx(Ho,{className:"h-4 w-4"})})]}),c.jsx(Or,{className:"flex-1 p-4",ref:l,children:t.length===0?c.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[c.jsx(AO,{className:"w-10 h-10 text-primary/40 mb-3"}),c.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Welcome. I am here to help you navigate these archives, understand the lives and writings of the faithful, or explore the depths of theological thought."}
704),c.jsx("p",{className:"text-xs text-muted-foreground/70 mt-3",children:"Ask me anything about the heroes, their eras, or how to use this site."})]}):c.jsx("div",{className:"space-y-4",children:t.map((m,g)=>c.jsx("div",{className:`flex ${m.role==="user"?"justify-end":"justify-start"}`,children:c.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-lg text-sm leading-relaxed ${m.role==="user"?"bg-primary text-primary-foreground":"bg-muted/50 text-foreground"}`,children:m.content||c.jsx(et,{className:"w-4 h-4 animate-spin text-muted-foreground"})})},g))})}),c.jsx("div",{className:"p-3 border-t border-border bg-muted/20",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx("textarea",{ref:u,value:s,onChange:m=>i(m.target.value),onKeyDown:p,placeholder:"Ask the Archivist...",className:"flex-1 resize-none bg-background border border-border rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary placeholder:text-muted-foreground/60",rows:1,disabled:a}),c.jsx(xe,{onClick:f,disabled:!s.trim()||a,size:"icon",className:"shrink-0",children:a?c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(TS,{className:"h-4 w-4"})})]})})]}):null}function e2e(){const[n,e]=_.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>e(!0),className:"fixed bottom-6 right-6 z-50 w-12 h-12 rounded-full bg-primary/90 hover:bg-primary text-primary-foreground shadow-lg flex items-center justify-center transition-colors duration-200","aria-label":"Open The Archivist",style:{boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},children:c.jsx(AO,{className:"w-5 h-5"})}),c.jsx(QCe,{isOpen:n,onClose:()=>e(!1)})]})}const t2e="modulepreload",n2e=function(n){return"/"+n},yU={},Wv=function(e,t,r){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(t.map(l=>{if(l=n2e(l),l in yU)return;yU[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":t2e,u||(h.as="script"),h.crossOrigin="",h.href=l,o&&h.setAttribute("nonce",o),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 ${l}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return e().catch(i)})},xU=zS("Network",{web:()=>Wv(()=>import("./web-mWY_f9Pd.js"),[]).then(n=>new n.NetworkWeb)});function xJ(){const[n,e]=_.useState({isOnline:navigator.onLine,connectionType:"unknown"});return _.useEffect(()=>{let t;return(async()=>{if(Nb.isNative())try{const s=await xU.getStatus();e({isOnline:s.connected,connectionType:s.connectionType}),t=await xU.addListener("networkStatusChange",i=>{e({isOnline:i.connected,connectionType:i.connectionType})})}catch(s){console.debug("Network plugin not available:",s)}else{const s=()=>e(a=>({...a,isOnline:!0})),i=()=>e(a=>({...a,isOnline:!1}));return window.addEventListener("online",s),window.addEventListener("offline",i),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}}})(),()=>{t&&typeof t.remove=="function"&&t.remove()}},[]),n}function r2e({className:n}){const{isOnline:e}=xJ(),{isNative:t}=$S();return e?null:c.jsxs("div",{className:ke("bg-amber-500 text-amber-950 px-4 py-2 flex items-center justify-center gap-2 text-sm font-medium",t&&"pt-safe-top",n),children:[c.jsx(cpe,{className:"h-4 w-4"}),c.jsx("span",{children:"You're offline — reading downloaded books only"})]})}function cn({children:n}){return c.jsxs("div",{className:"min-h-screen flex flex-col",children:[c.jsx(r2e,{}),c.jsx(LCe,{}),c.jsx("main",{className:"flex-1",children:c.jsx(BCe,{children:n})}),c.jsx(FCe,{}),c.jsx(e2e,{})]})}function s2e(n){return Object.prototype.toString.call(n)==="[object Object]"}function bU(n){return s2e(n)||Array.isArray(n)}
vendor: 5,761 bytes, line 704
704function i2e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function W3(n,e){const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;const s=JSON.stringify(Object.keys(n.breakpoints||{})),i=JSON.stringify(Object.keys(e.breakpoints||{}));return s!==i?!1:t.every(a=>{const o=n[a],l=e[a];return typeof o=="function"?`${o}`==`${l}`:!bU(o)||!bU(l)?o===l:W3(o,l)})}function wU(n){return n.concat().sort((e,t)=>e.name>t.name?1:-1).map(e=>e.options)}function a2e(n,e){if(n.length!==e.length)return!1;const t=wU(n),r=wU(e);return t.every((s,i)=>{const a=r[i];return W3(s,a)})}function q3(n){return typeof n=="number"}function LM(n){return typeof n=="string"}function MT(n){return typeof n=="boolean"}function _U(n){return Object.prototype.toString.call(n)==="[object Object]"}function pr(n){return Math.abs(n)}function G3(n){return Math.sign(n)}function _w(n,e){return pr(n-e)}function o2e(n,e){if(n===0||e===0||pr(n)<=pr(e))return 0;const t=_w(pr(n),pr(e));return pr(t/n)}function l2e(n){return Math.round(n*100)/100}function j1(n){return R1(n).map(Number)}function Hl(n){return n[GS(n)]}function GS(n){return Math.max(0,n.length-1)}function K3(n,e){return e===GS(n)}function SU(n,e=0){return Array.from(Array(n),(t,r)=>e+r)}function R1(n){return Object.keys(n)}function bJ(n,e){return[n,e].reduce((t,r)=>(R1(r).forEach(s=>{const i=t[s],a=r[s],o=_U(i)&&_U(a);t[s]=o?bJ(i,a):a}),t),{})}function FM(n,e){return typeof e.MouseEvent<"u"&&n instanceof e.MouseEvent}function c2e(n,e){const t={start:r,center:s,end:i};function r(){return 0}function s(l){return i(l)/2}function i(l){return e-l}function a(l,u){return LM(n)?t[n](l):n(e,l,u)}return{measure:a}}function P1(){let n=[];function e(s,i,a,o={passive:!0}){let l;if("addEventListener"in s)s.addEventListener(i,a,o),l=()=>s.removeEventListener(i,a,o);else{const u=s;u.addListener(a),l=()=>u.removeListener(a)}return n.push(l),r}function t(){n=n.filter(s=>s())}const r={add:e,clear:t};return r}function u2e(n,e,t,r){const s=P1(),i=1e3/60;let a=null,o=0,l=0;function u(){s.add(n,"visibilitychange",()=>{n.hidden&&m()})}function d(){p(),s.clear()}function h(y){if(!l)return;a||(a=y,t(),t());const v=y-a;for(a=y,o+=v;o>=i;)t(),o-=i;const x=o/i;r(x),l&&(l=e.requestAnimationFrame(h))}function f(){l||(l=e.requestAnimationFrame(h))}function p(){e.cancelAnimationFrame(l),a=null,o=0,l=0}function m(){a=null,o=0}return{init:u,destroy:d,start:f,stop:p,update:t,render:r}}function d2e(n,e){const t=e==="rtl",r=n==="y",s=r?"y":"x",i=r?"x":"y",a=!r&&t?-1:1,o=d(),l=h();function u(m){const{height:g,width:y}=m;return r?g:y}function d(){return r?"top":t?"right":"left"}function h(){return r?"bottom":t?"left":"right"}function f(m){return m*a}return{scroll:s,cross:i,startEdge:o,endEdge:l,measureSize:u,direction:f}}function Zm(n=0,e=0){const t=pr(n-e);function r(u){return u<n}function s(u){return u>e}function i(u){return r(u)||s(u)}function a(u){return i(u)?r(u)?n:e:u}function o(u){return t?u-t*Math.ceil((u-e)/t):u}return{length:t,max:e,min:n,constrain:a,reachedAny:i,reachedMax:s,reachedMin:r,removeOffset:o}}function wJ(n,e,t){const{constrain:r}=Zm(0,n),s=n+1;let i=a(e);function a(f){return t?pr((s+f)%s):r(f)}function o(){return i}function l(f){return i=a(f),h}function u(f){return d().set(o()+f)}function d(){return wJ(n,o(),t)}const h={get:o,set:l,add:u,clone:d};return h}function h2e(n,e,t,r,s,i,a,o,l,u,d,h,f,p,m,g,y,v,x){const{cross:b,direction:E}=n,S=["INPUT","SELECT","TEXTAREA"],k={passive:!1},C=P1(),A=P1(),T=Zm(50,225).constrain(p.measure(20)),j={mouse:300,touch:400},D={mouse:500,touch:600},R=m?43:25;let M=!1,N=0,U=0,q=!1,I=!1,B=!1,$=!1;function ie(Se){if(!x)return;function Ce(X){(MT(x)||x(Se,X))&&ue(X)}const O=e;C.add(O,"dragstart",X=>X.preventDefault(),k).add(O,"touchmove",()=>{},k).add(O,"touchend",()=>{}).add(O,"touchstart",Ce).add(O,"mousedown",Ce).add(O,"touchcancel",ve).add(O,"contextmenu",ve).add(O,"click",_e,!0)}function ne(){C.clear(),A.clear()}function L(){const Se=$?t:e;A.add(Se,"touchmove",le,k).add(Se,"touchend",ve).add(Se,"mousemove",le,k).add(Se,"mouseup",ve)}function te(Se){const Ce=Se.nodeName||"";return S.includes(Ce)}function ae(){return(m?D:j)[$?"mouse":"touch"]}function de(Se,Ce){const O=h.add(G3(Se)*-1),X=d.byDistance(Se,!m).distance;return m||pr(Se)<T?X:y&&Ce?X*.5:d.byIndex(O.get(),0).distance}function ue(Se){const Ce=FM(Se,r);$=Ce,B=m&&Ce&&!Se.buttons&&M,M=_w(s.get(),a.get())>=2,!(Ce&&Se.button!==0)&&(te(Se.target)||(q=!0,i.pointerDown(Se),u.useFriction(0).useDuration(0),s.set(a),L(),N=i.readPoint(Se),U=i.readPoint(Se,b),f.emit("pointerDown")))}function le(Se){if(!FM(Se,r)&&Se.touches.length>=2)return ve(Se);const O=i.readPoint(Se),X=i.readPoint(Se,b),ee=_w(O,N),V=_w(X,U);if(!I&&!$&&(!Se.cancelable||(I=ee>V,!I)))return ve(Se);const H=i.pointerMove(Se);ee>g&&(B=!0),u.useFriction(.3).useDuration(.75),o.start(),s.add(E(H)),Se.preventDefault()}function ve(Se){const O=d.byDistance(0,!1).index!==h.get(),X=i.pointerUp(Se)*ae(),ee=de(E(X),O),V=o2e(X,ee),H=R-10*V,se=v+V/50;I=!1,q=!1,A.clear(),u.useDuration(H).useFriction(se),l.distance(ee,!m),$=!1,f.emit("pointerUp")}function _e(Se){B&&(Se.stopPropagation(),Se.preventDefault(),B=!1)}function Ne(){return q}return{init:ie,destroy:ne,pointerDown:Ne}}function f2e(n,e){let r,s;function i(h){return h.timeStamp}function a(h,f){const m=`client${(f||n.scroll)==="x"?"X":"Y"}`;return(FM(h,e)?h:h.touches[0])[m]}function o(h){return r=h,s=h,a(h)}function l(h){const f=a(h)-a(s),p=i(h)-i(r)>170;return s=h,p&&(r=h),f}function u(h){if(!r||!s)return 0;const f=a(s)-a(r),p=i(h)-i(r),m=i(h)-i(s)>170,g=f/p;return p&&!m&&pr(g)>.1?g:0}return{pointerDown:o,pointerMove:l,pointerUp:u,readPoint:a}}function p2e(){function n(t){const{offsetTop:r,offsetLeft:s,offsetWidth:i,offsetHeight:a}=t;
vendor: 10,153 bytes, line 704
704return{top:r,right:s+i,bottom:r+a,left:s,width:i,height:a}}return{measure:n}}function m2e(n){function e(r){return n*(r/100)}return{measure:e}}function g2e(n,e,t,r,s,i,a){const o=[n].concat(r);let l,u,d=[],h=!1;function f(y){return s.measureSize(a.measure(y))}function p(y){if(!i)return;u=f(n),d=r.map(f);function v(x){for(const b of x){if(h)return;const E=b.target===n,S=r.indexOf(b.target),k=E?u:d[S],C=f(E?n:r[S]);if(pr(C-k)>=.5){y.reInit(),e.emit("resize");break}}}l=new ResizeObserver(x=>{(MT(i)||i(y,x))&&v(x)}),t.requestAnimationFrame(()=>{o.forEach(x=>l.observe(x))})}function m(){h=!0,l&&l.disconnect()}return{init:p,destroy:m}}function v2e(n,e,t,r,s,i){let a=0,o=0,l=s,u=i,d=n.get(),h=0;function f(){const k=r.get()-n.get(),C=!l;let A=0;return C?(a=0,t.set(r),n.set(r),A=k):(t.set(n),a+=k/l,a*=u,d+=a,n.add(a),A=d-h),o=G3(A),h=d,S}function p(){const k=r.get()-e.get();return pr(k)<.001}function m(){return l}function g(){return o}function y(){return a}function v(){return b(s)}function x(){return E(i)}function b(k){return l=k,S}function E(k){return u=k,S}const S={direction:g,duration:m,velocity:y,seek:f,settled:p,useBaseFriction:x,useBaseDuration:v,useFriction:E,useDuration:b};return S}function y2e(n,e,t,r,s){const i=s.measure(10),a=s.measure(50),o=Zm(.1,.99);let l=!1;function u(){return!(l||!n.reachedAny(t.get())||!n.reachedAny(e.get()))}function d(p){if(!u())return;const m=n.reachedMin(e.get())?"min":"max",g=pr(n[m]-e.get()),y=t.get()-e.get(),v=o.constrain(g/a);t.subtract(y*v),!p&&pr(y)<i&&(t.set(n.constrain(t.get())),r.useDuration(25).useBaseFriction())}function h(p){l=!p}return{shouldConstrain:u,constrain:d,toggleActive:h}}function x2e(n,e,t,r,s){const i=Zm(-e+n,0),a=h(),o=d(),l=f();function u(m,g){return _w(m,g)<=1}function d(){const m=a[0],g=Hl(a),y=a.lastIndexOf(m),v=a.indexOf(g)+1;return Zm(y,v)}function h(){return t.map((m,g)=>{const{min:y,max:v}=i,x=i.constrain(m),b=!g,E=K3(t,g);return b?v:E||u(y,x)?y:u(v,x)?v:x}).map(m=>parseFloat(m.toFixed(3)))}function f(){if(e<=n+s)return[i.max];if(r==="keepSnaps")return a;const{min:m,max:g}=o;return a.slice(m,g)}return{snapsContained:l,scrollContainLimit:o}}function b2e(n,e,t){const r=e[0],s=t?r-n:Hl(e);return{limit:Zm(s,r)}}function w2e(n,e,t,r){const i=e.min+.1,a=e.max+.1,{reachedMin:o,reachedMax:l}=Zm(i,a);function u(f){return f===1?l(t.get()):f===-1?o(t.get()):!1}function d(f){if(!u(f))return;const p=n*(f*-1);r.forEach(m=>m.add(p))}return{loop:d}}function _2e(n){const{max:e,length:t}=n;function r(i){const a=i-e;return t?a/-t:0}return{get:r}}function S2e(n,e,t,r,s){const{startEdge:i,endEdge:a}=n,{groupSlides:o}=s,l=h().map(e.measure),u=f(),d=p();function h(){return o(r).map(g=>Hl(g)[a]-g[0][i]).map(pr)}function f(){return r.map(g=>t[i]-g[i]).map(g=>-pr(g))}function p(){return o(u).map(g=>g[0]).map((g,y)=>g+l[y])}return{snaps:u,snapsAligned:d}}function E2e(n,e,t,r,s,i){const{groupSlides:a}=s,{min:o,max:l}=r,u=d();function d(){const f=a(i),p=!n||e==="keepSnaps";return t.length===1?[i]:p?f:f.slice(o,l).map((m,g,y)=>{const v=!g,x=K3(y,g);if(v){const b=Hl(y[0])+1;return SU(b)}if(x){const b=GS(i)-Hl(y)[0]+1;return SU(b,Hl(y)[0])}return m})}return{slideRegistry:u}}function k2e(n,e,t,r,s){const{reachedAny:i,removeOffset:a,constrain:o}=r;function l(m){return m.concat().sort((g,y)=>pr(g)-pr(y))[0]}function u(m){const g=n?a(m):o(m),y=e.map((x,b)=>({diff:d(x-g,0),index:b})).sort((x,b)=>pr(x.diff)-pr(b.diff)),{index:v}=y[0];return{index:v,distance:g}}function d(m,g){const y=[m,m+t,m-t];if(!n)return m;if(!g)return l(y);const v=y.filter(x=>G3(x)===g);return v.length?l(v):Hl(y)-t}function h(m,g){const y=e[m]-s.get(),v=d(y,g);return{index:m,distance:v}}function f(m,g){const y=s.get()+m,{index:v,distance:x}=u(y),b=!n&&i(y);if(!g||b)return{index:v,distance:m};const E=e[v]-x,S=m+d(E,0);return{index:v,distance:S}}return{byDistance:f,byIndex:h,shortcut:d}}function C2e(n,e,t,r,s,i,a){function o(h){const f=h.distance,p=h.index!==e.get();i.add(f),f&&(r.duration()?n.start():(n.update(),n.render(1),n.update())),p&&(t.set(e.get()),e.set(h.index),a.emit("select"))}function l(h,f){const p=s.byDistance(h,f);o(p)}function u(h,f){const p=e.clone().set(h),m=s.byIndex(p.get(),f);o(m)}return{distance:l,index:u}}function A2e(n,e,t,r,s,i,a,o){const l={passive:!0,capture:!0};let u=0;function d(p){if(!o)return;function m(g){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),n.scrollLeft=0;const x=t.findIndex(b=>b.includes(g));q3(x)&&(s.useDuration(0),r.index(x,0),a.emit("slideFocus"))}i.add(document,"keydown",h,!1),e.forEach((g,y)=>{i.add(g,"focus",v=>{(MT(o)||o(p,v))&&m(y)},l)})}function h(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function jb(n){let e=n;function t(){return e}function r(l){e=a(l)}function s(l){e+=a(l)}function i(l){e-=a(l)}function a(l){return q3(l)?l:l.get()}return{get:t,set:r,add:s,subtract:i}}function _J(n,e){const t=n.scroll==="x"?a:o,r=e.style;let s=null,i=!1;function a(f){return`translate3d(${f}px,0px,0px)`}function o(f){return`translate3d(0px,${f}px,0px)`}function l(f){if(i)return;const p=l2e(n.direction(f));p!==s&&(r.transform=t(p),s=p)}function u(f){i=!f}function d(){i||(r.transform="",e.getAttribute("style")||e.removeAttribute("style"))}return{clear:d,to:l,toggleActive:u}}function N2e(n,e,t,r,s,i,a,o,l){const d=j1(s),h=j1(s).reverse(),f=v().concat(x());function p(C,A){return C.reduce((T,j)=>T-s[j],A)}function m(C,A){return C.reduce((T,j)=>p(T,A)>0?T.concat([j]):T,[])}function g(C){return i.map((A,T)=>({start:A-r[T]+.5+C,end:A+e-.5+C}))}function y(C,A,T){const j=g(A);return C.map(D=>{const R=T?0:-t,M=T?t:0,N=T?"end":"start",U=j[D][N];return{index:D,loopPoint:U,slideLocation:jb(-1),translate:_J(n,l[D]),target:()=>o.get()>U?R:M}})}function v(){const C=a[0],A=m(h,C);return y(A,t,!1)}function x(){const C=e-a[0]-1,A=m(d,C);return y(A,-t,!0)}function b(){return f.every(({index:C})=>{const A=d.filter(T=>T!==C);return p(A,e)<=.1})}function E(){f.forEach(C=>{const{target:A,translate:T,slideLocation:j}=C,D=A();D!==j.get()&&(T.to(D),j.set(D))})}function S(){f.forEach(C=>C.translate.clear())}return{canLoop:b,clear:S,loop:E,loopPoints:f}}function T2e(n,e,t){let r,s=!1;function i(l){if(!t)return;function u(d){for(const h of d)if(h.type==="childList"){l.reInit(),e.emit("slidesChanged");break}}r=new MutationObserver(d=>{s||(MT(t)||t(l,d))&&u(d)}),r.observe(n,{childList:!0})}function a(){r&&r.disconnect(),s=!0}return{init:i,destroy:a}}function j2e(n,e,t,r){const s={};let i=null,a=null,o,l=!1;function u(){o=new IntersectionObserver(m=>{l||(m.forEach(g=>{const y=e.indexOf(g.target);s[y]=g}),i=null,a=null,t.emit("slidesInView"))},{root:n.parentElement,threshold:r}),e.forEach(m=>o.observe(m))}function d(){o&&o.disconnect(),l=!0}function h(m){return R1(s).reduce((g,y)=>{const v=parseInt(y),{isIntersecting:x}=s[v];return(m&&x||!m&&!x)&&g.push(v),g},[])}function f(m=!0){if(m&&i)return i;if(!m&&a)return a;const g=h(m);return m&&(i=g),m||(a=g),g}return{init:u,destroy:d,get:f}}function R2e(n,e,t,r,s,i){const{measureSize:a,startEdge:o,endEdge:l}=n,u=t[0]&&s,d=m(),h=g(),f=t.map(a),p=y();function m(){if(!u)return 0;const x=t[0];return pr(e[o]-x[o])}function g(){if(!u)return 0;const x=i.getComputedStyle(Hl(r));return parseFloat(x.getPropertyValue(`margin-${l}`))}function y(){return t.map((x,b,E)=>{const S=!b,k=K3(E,b);return S?f[b]+d:k?f[b]+h:E[b+1][o]-x[o]}).map(pr)}return{slideSizes:f,slideSizesWithGaps:p,startGap:d,endGap:h}}function P2e(n,e,t,r,s,i,a,o,l){const{startEdge:u,endEdge:d,direction:h}=n,f=q3(t);function p(v,x){return j1(v).filter(b=>b%x===0).map(b=>v.slice(b,b+x))}function m(v){return v.length?j1(v).reduce((x,b,E)=>{const S=Hl(x)||0,k=S===0,C=b===GS(v),A=s[u]-i[S][u],T=s[u]-i[b][d],j=!r&&k?h(a):0,D=!r&&C?h(o):0,R=pr(T-D-(A+j));return E&&R>e+l&&x.push(b),C&&x.push(v.length),x},[]).map((x,b,E)=>{const S=Math.max(E[b-1]||0);return v.slice(S,x)}):[]}function g(v){return f?p(v,t):m(v)}return{groupSlides:g}}function D2e(n,e,t,r,s,i,a){const{align:o,axis:l,direction:u,startIndex:d,loop:h,duration:f,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:y,skipSnaps:v,containScroll:x,watchResize:b,watchSlides:E,watchDrag:S,watchFocus:k}=i,C=2,A=p2e(),T=A.measure(e),j=t.map(A.measure),D=d2e(l,u),R=D.measureSize(T),M=m2e(R),N=c2e(o,R),U=!h&&!!x,q=h||!!x,{slideSizes:I,slideSizesWithGaps:B,startGap:$,endGap:ie}=R2e(D,T,j,t,q,s),ne=P2e(D,R,y,h,T,j,$,ie,C),{snaps:L,snapsAligned:te}=S2e(D,N,T,j,ne),ae=-Hl(L)+Hl(B),{snapsContained:de,scrollContainLimit:ue}=x2e(R,ae,te,x,C),le=U?de:te,{limit:ve}=b2e(ae,le,h),_e=wJ(GS(le),d,h),Ne=_e.clone(),Pe=j1(t),Se=({dragHandler:rt,scrollBody:Pt,scrollBounds:en,options:{loop:gt}})=>{gt||en.constrain(rt.pointerDown()),Pt.seek()},Ce=({scrollBody:rt,translate:Pt,location:en,offsetLocation:gt,previousLocation:Wt,scrollLooper:wn,slideLooper:J,dragHandler:Me,animation:Be,eventHandler:Qe,scrollBounds:ye,options:{loop:De}},K)=>{const Ie=rt.settled(),St=!ye.shouldConstrain(),P=De?Ie:Ie&&St,Ae=P&&!Me.pointerDown();Ae&&Be.stop();const je=en.get()*K+Wt.get()*(1-K);gt.set(je),De&&(wn.loop(rt.direction()),J.loop()),Pt.to(gt.get()),Ae&&Qe.emit("settle"),P||Qe.emit("scroll")},O=u2e(r,s,()=>Se(lt),rt=>Ce(lt,rt)),X=.68,ee=le[_e.get()],V=jb(ee),H=jb(ee),se=jb(ee),z=jb(ee),Q=v2e(V,se,H,z,f,X),Y=k2e(h,le,ae,ve,z),ce=C2e(O,_e,Ne,Q,Y,z,a),he=_2e(ve),ge=P1(),Ee=j2e(e,t,a,g),{slideRegistry:Le}=E2e(U,x,le,ue,ne,Pe),qe=A2e(n,t,Le,ce,Q,ge,a,k),lt={ownerDocument:r,ownerWindow:s,eventHandler:a,containerRect:T,slideRects:j,animation:O,axis:D,dragHandler:h2e(D,n,r,s,z,f2e(D,s),V,O,ce,Q,Y,_e,a,M,p,m,v,X,S),eventStore:ge,percentOfView:M,index:_e,indexPrevious:Ne,limit:ve,location:V,offsetLocation:se,previousLocation:H,options:i,resizeHandler:g2e(e,a,s,t,D,b,A),scrollBody:Q,scrollBounds:y2e(ve,se,z,Q,M),scrollLooper:w2e(ae,ve,se,[V,se,H,z]),scrollProgress:he,scrollSnapList:le.map(he.get),scrollSnaps:le,scrollTarget:Y,scrollTo:ce,slideLooper:N2e(D,R,ae,I,B,L,le,se,t),slideFocus:qe,slidesHandler:T2e(e,a,E),slidesInView:Ee,slideIndexes:Pe,slideRegistry:Le,slidesToScroll:ne,target:z,translate:_J(D,e)};return lt}function O2e(){let n={},e;function t(u){e=u}function r(u){return n[u]||[]}function s(u){return r(u).forEach(d=>d(e,u)),l}
704function i(u,d){return n[u]=r(u).concat([d]),l}function a(u,d){return n[u]=r(u).filter(h=>h!==d),l}function o(){n={}}const l={init:t,emit:s,off:a,on:i,clear:o};return l}const M2e={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function I2e(n){function e(i,a){return bJ(i,a||{})}function t(i){const a=i.breakpoints||{},o=R1(a).filter(l=>n.matchMedia(l).matches).map(l=>a[l]).reduce((l,u)=>e(l,u),{});return e(i,o)}function r(i){return i.map(a=>R1(a.breakpoints||{})).reduce((a,o)=>a.concat(o),[]).map(n.matchMedia)}return{mergeOptions:e,optionsAtMedia:t,optionsMediaQueries:r}}function L2e(n){let e=[];function t(i,a){return e=a.filter(({options:o})=>n.optionsAtMedia(o).active!==!1),e.forEach(o=>o.init(i,n)),a.reduce((o,l)=>Object.assign(o,{[l.name]:l}),{})}function r(){e=e.filter(i=>i.destroy())}return{init:t,destroy:r}}function X2(n,e,t){const r=n.ownerDocument,s=r.defaultView,i=I2e(s),a=L2e(i),o=P1(),l=O2e(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:h}=i,{on:f,off:p,emit:m}=l,g=D;let y=!1,v,x=u(M2e,X2.globalOptions),b=u(x),E=[],S,k,C;function A(){const{container:Pe,slides:Se}=b;k=(LM(Pe)?n.querySelector(Pe):Pe)||n.children[0];const O=LM(Se)?k.querySelectorAll(Se):Se;C=[].slice.call(O||k.children)}function T(Pe){const Se=D2e(n,k,C,r,s,Pe,l);if(Pe.loop&&!Se.slideLooper.canLoop()){const Ce=Object.assign({},Pe,{loop:!1});return T(Ce)}return Se}function j(Pe,Se){y||(x=u(x,Pe),b=d(x),E=Se||E,A(),v=T(b),h([x,...E.map(({options:Ce})=>Ce)]).forEach(Ce=>o.add(Ce,"change",D)),b.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(Ne),v.eventHandler.init(Ne),v.resizeHandler.init(Ne),v.slidesHandler.init(Ne),v.options.loop&&v.slideLooper.loop(),k.offsetParent&&C.length&&v.dragHandler.init(Ne),S=a.init(Ne,E)))}function D(Pe,Se){const Ce=ne();R(),j(u({startIndex:Ce},Pe),Se),l.emit("reInit")}function R(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),a.destroy(),o.clear()}function M(){y||(y=!0,o.clear(),R(),l.emit("destroy"),l.clear())}function N(Pe,Se,Ce){!b.active||y||(v.scrollBody.useBaseFriction().useDuration(Se===!0?0:b.duration),v.scrollTo.index(Pe,Ce||0))}function U(Pe){const Se=v.index.add(1).get();N(Se,Pe,-1)}function q(Pe){const Se=v.index.add(-1).get();N(Se,Pe,1)}function I(){return v.index.add(1).get()!==ne()}function B(){return v.index.add(-1).get()!==ne()}function $(){return v.scrollSnapList}function ie(){return v.scrollProgress.get(v.offsetLocation.get())}function ne(){return v.index.get()}function L(){return v.indexPrevious.get()}function te(){return v.slidesInView.get()}function ae(){return v.slidesInView.get(!1)}function de(){return S}function ue(){return v}function le(){return n}function ve(){return k}function _e(){return C}const Ne={canScrollNext:I,canScrollPrev:B,containerNode:ve,internalEngine:ue,destroy:M,off:p,on:f,emit:m,plugins:de,previousScrollSnap:L,reInit:g,rootNode:le,scrollNext:U,scrollPrev:q,scrollProgress:ie,scrollSnapList:$,scrollTo:N,selectedScrollSnap:ne,slideNodes:_e,slidesInView:te,slidesNotInView:ae};return j(e,t),setTimeout(()=>l.emit("init"),0),Ne}X2.globalOptions=void 0;function Y3(n={},e=[]){const t=_.useRef(n),r=_.useRef(e),[s,i]=_.useState(),[a,o]=_.useState(),l=_.useCallback(()=>{s&&s.reInit(t.current,r.current)},[s]);return _.useEffect(()=>{W3(t.current,n)||(t.current=n,l())},[n,l]),_.useEffect(()=>{a2e(r.current,e)||(r.current=e,l())},[e,l]),_.useEffect(()=>{if(i2e()&&a){X2.globalOptions=Y3.globalOptions;const u=X2(a,t.current,r.current);return i(u),()=>u.destroy()}else i(void 0)},[a,i]),[o,s]}Y3.globalOptions=void 0;const SJ=_.createContext(null);function IT(){const n=_.useContext(SJ);if(!n)throw new Error("useCarousel must be used within a <Carousel />");return n}const EJ=_.forwardRef(({orientation:n="horizontal",opts:e,setApi:t,plugins:r,className:s,children:i,...a},o)=>{const[l,u]=Y3({...e,axis:n==="horizontal"?"x":"y"},r),[d,h]=_.useState(!1),[f,p]=_.useState(!1),m=_.useCallback(x=>{x&&(h(x.canScrollPrev()),p(x.canScrollNext()))},[]),g=_.useCallback(()=>{u==null||u.scrollPrev()},[u]),y=_.useCallback(()=>{u==null||u.scrollNext()},[u]),v=_.useCallback(x=>{x.key==="ArrowLeft"?(x.preventDefault(),g()):x.key==="ArrowRight"&&(x.preventDefault(),y())},[g,y]);return _.useEffect(()=>{!u||!t||t(u)},[u,t]),_.useEffect(()=>{if(u)return m(u),u.on("reInit",m),u.on("select",m),()=>{u==null||u.off("select",m)}},[u,m]),c.jsx(SJ.Provider,{value:{carouselRef:l,api:u,opts:e,orientation:n||((e==null?void 0:e.axis)==="y"?"vertical":"horizontal"),scrollPrev:g,scrollNext:y,canScrollPrev:d,canScrollNext:f},children:c.jsx("div",{ref:o,onKeyDownCapture:v,className:ke("relative",s),role:"region","aria-roledescription":"carousel",...a,children:i})})});
704EJ.displayName="Carousel";const kJ=_.forwardRef(({className:n,...e},t)=>{const{carouselRef:r,orientation:s}=IT();return c.jsx("div",{ref:r,className:"overflow-hidden",children:c.jsx("div",{ref:t,className:ke("flex",s==="horizontal"?"-ml-4":"-mt-4 flex-col",n),...e})})});kJ.displayName="CarouselContent";const CJ=_.forwardRef(({className:n,...e},t)=>{const{orientation:r}=IT();return c.jsx("div",{ref:t,role:"group","aria-roledescription":"slide",className:ke("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",n),...e})});CJ.displayName="CarouselItem";const AJ=_.forwardRef(({className:n,variant:e="outline",size:t="icon",...r},s)=>{const{orientation:i,scrollPrev:a,canScrollPrev:o}=IT();return c.jsxs(xe,{ref:s,variant:e,size:t,className:ke("absolute h-8 w-8 rounded-full",i==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",n),disabled:!o,onClick:a,...r,children:[c.jsx(Ji,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Previous slide"})]})});AJ.displayName="CarouselPrevious";const NJ=_.forwardRef(({className:n,variant:e="outline",size:t="icon",...r},s)=>{const{orientation:i,scrollNext:a,canScrollNext:o}=IT();return c.jsxs(xe,{ref:s,variant:e,size:t,className:ke("absolute h-8 w-8 rounded-full",i==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",n),disabled:!o,onClick:a,...r,children:[c.jsx(a1,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Next slide"})]})});NJ.displayName="CarouselNext";function kd({title:n="Heroes of the Faith",description:e="Step into the lives of the great heroes of the Christian faith—explored through their own words, writings, and witness.",canonicalUrl:t,ogImage:r="https://heroesofthefaith.ai/og-image.png",ogType:s="website",jsonLd:i}){const a=n==="Heroes of the Faith"?n:`${n} | Heroes of the Faith`;return c.jsxs(Dhe,{children:[c.jsx("title",{children:a}),c.jsx("meta",{name:"description",content:e}),t&&c.jsx("link",{rel:"canonical",href:t}),c.jsx("meta",{property:"og:title",content:a}),c.jsx("meta",{property:"og:description",content:e}),c.jsx("meta",{property:"og:type",content:s}),c.jsx("meta",{property:"og:image",content:r}),t&&c.jsx("meta",{property:"og:url",content:t}),c.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),c.jsx("meta",{name:"twitter:title",content:a}),c.jsx("meta",{name:"twitter:description",content:e}),c.jsx("meta",{name:"twitter:image",content:r}),i&&c.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})]})}const F2e=[{question:"What is Heroes of the Faith?",answer:"Heroes of the Faith is an interactive digital archive and AI-powered study platform that allows you to explore the lives, writings, and theological perspectives of great Christian figures throughout church history—from the early church fathers to modern missionaries."},{question:"Can I have a conversation with historical Christian figures?",answer:"Yes! Our AI-powered chat feature lets you engage in conversations with historical personas like Augustine, Martin Luther, John Calvin, and many others. These conversations are grounded in their actual writings, sermons, and letters."},{question:"What primary sources are used?",answer:"We draw from authentic historical documents including sermons, letters, confessions, journals, books, and other primary sources written by or about each historical figure. All content is carefully researched and verified."},{question:"Is Heroes of the Faith free to use?",answer:"Yes, Heroes of the Faith offers free access to explore the archive and chat with historical personas. Some premium features may require a subscription for unlimited access."},{question:"Who are some of the heroes featured?",answer:"Our archive includes figures spanning 2,000 years of church history: Apostle Paul, Augustine, Thomas Aquinas, Martin Luther, John Calvin, John Wesley, Charles Spurgeon, Hudson Taylor, Corrie ten Boom, Dietrich Bonhoeffer, and many more."}],B2e="https://delgyrqdrcihvvudekdx.supabase.co";function z2e(n,e){if(!n.startsWith("http")&&!n.startsWith("/"))return n;const t=n.startsWith("http")?n:`${window.location.origin}${n}`,r=new URLSearchParams({url:t});return e&&r.set("w",e.toString()),`${B2e}/functions/v1/optimize-image?${r}`}function X3({src:n,alt:e,className:t,containerClassName:r,fallback:s,priority:i=!1,sizes:a="100vw",aspectRatio:o="auto",width:l,optimize:u=!1}){const[d,h]=_.useState(!1),[f,p]=_.useState(!1),m=_.useRef(null),g=_.useMemo(()=>n?u&&l?z2e(n,l):n:null,[n,u,l]);if(_.useEffect(()=>{var v,x;(v=m.current)!=null&&v.complete&&((x=m.current)==null?void 0:x.naturalHeight)>0&&h(!0)},[g]),_.useEffect(()=>{p(!1),h(!1)},[g]),!g||f)return s?c.jsx(c.Fragment,{children:s}):null;const y={square:"aspect-square",portrait:"aspect-[3/4]",landscape:"aspect-video",auto:""};return c.jsxs("div",{className:ke("relative overflow-hidden",y[o],r),children:[!d&&c.jsx("div",{className:"absolute inset-0 bg-muted animate-pulse"}),c.jsx("img",{ref:m,src:g,alt:e,loading:i?"eager":"lazy",decoding:i?"sync":"async",fetchPriority:i?"high":"auto",sizes:a,onLoad:()=>h(!0),onError:()=>p(!0),className:ke("transition-opacity duration-300",d?"opacity-100":"opacity-0",t)})]})}function $2e({src:n,alt:e,className:t}){return c.jsx("img",{src:n,alt:e,loading:"eager",decoding:"sync",fetchPriority:"high",className:ke("absolute inset-0 w-full h-full object-cover",t)})}const U2e="/assets/hero-athanasius-DlyBM7YQ.jpg",EU=["What we believe has been paid for in blood.","The blood of the martyrs is the seed of the Church.","Here I stand. I can do n
704o other.","One with God is a majority."];function V2e(){const[n,e]=_.useState(0),[t,r]=_.useState([]);_.useEffect(()=>{const i=setInterval(()=>{e(a=>(a+1)%EU.length)},8e3);return()=>clearInterval(i)},[]),_.useEffect(()=>{(async()=>{const{data:a}=await pe.from("personas").select("id, slug, full_name, short_biography, portrait_image_url").eq("is_published",!0).order("created_at",{ascending:!0}).limit(6);a&&r(a)})()},[]);const s=[{"@context":"https://schema.org","@type":"WebSite","@id":"https://heroesofthefaith.ai/#website",url:"https://heroesofthefaith.ai",name:"Heroes of the Faith",description:"Step into the lives and voices of the great heroes of the Christian faith—explored through their own words, writings, and witness.",publisher:{"@id":"https://heroesofthefaith.ai/#organization"}},{"@context":"https://schema.org","@type":"Organization","@id":"https://heroesofthefaith.ai/#organization",name:"Heroes of the Faith",url:"https://heroesofthefaith.ai",logo:{"@type":"ImageObject",url:"https://heroesofthefaith.ai/app-icon-512.png"}},{"@context":"https://schema.org","@type":"FAQPage",mainEntity:F2e.map(i=>({"@type":"Question",name:i.question,acceptedAnswer:{"@type":"Answer",text:i.answer}}))}];return c.jsxs(cn,{children:[c.jsx(kd,{title:"Heroes of the Faith",description:"Step into the lives and voices of the great heroes of the Christian faith—explored through their own words, writings, and witness.",canonicalUrl:"https://heroesofthefaith.ai/",jsonLd:s}),c.jsxs("section",{className:"relative min-h-[85vh] flex items-center justify-center overflow-hidden",children:[c.jsx($2e,{src:U2e,alt:"Heroes of the Faith - Historical Christian figures gathered in a sacred setting"}),c.jsx("div",{className:"absolute inset-0 bg-black/60"}),c.jsx("div",{className:"absolute inset-0 opacity-40",style:{background:`linear-gradient(180deg, 
705              rgba(30, 25, 20, 0.8) 0%, 
706              rgba(40, 35, 25, 0.5) 30%,
707              rgba(35, 30, 20, 0.6) 70%,
708              rgba(20, 18, 15, 0.9) 100%
709            )`}}),c.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(0,0,0,0.5) 100%)"}}),c.jsxs("div",{className:"container mx-auto px-4 text-center relative z-10 pt-48 md:pt-56",children:[c.jsx("h1",{className:"font-display text-5xl md:text-6xl lg:text-7xl font-bold tracking-wider mb-10 text-parchment animate-fade-in uppercase",style:{textShadow:"0 0 40px rgba(201, 165, 90, 0.5), 0 0 80px rgba(201, 165, 90, 0.3), 0 2px 4px rgba(0, 0, 0, 0.5)"},children:"Heroes of the Faith"}),c.jsxs("div",{className:"animate-fade-in mb-10",children:[c.jsx("div",{className:"w-24 h-px bg-gold/50 mx-auto mb-5"}),c.jsx("p",{className:"text-base md:text-lg text-parchment/80 max-w-[55ch] mx-auto leading-relaxed mb-3",children:"Step into the lives of the great heroes of the Christian faith—explored through their own words, writings, and witness."}),c.jsx("p",{className:"text-xs md:text-sm text-parchment/50 tracking-wide",children:"Letters • Sermons • Journals • Confessions"}),c.jsx("div",{className:"w-24 h-px bg-gold/50 mx-auto mt-5"})]}),c.jsx("div",{className:"flex flex-col sm:flex-row gap-4 justify-center animate-fade-in",children:c.jsx(xe,{asChild:!0,size:"lg",className:"bg-gold hover:bg-gold/90 text-iron font-medium px-8 rounded",children:c.jsx(Rt,{to:"/pers
709onas",children:"Discover the Heroes"})})}),c.jsx("div",{className:"mt-16 animate-fade-in",children:c.jsxs("p",{className:"text-sm md:text-base italic text-parchment/40 max-w-md mx-auto transition-opacity duration-1000",children:['"',EU[n],'"']},n)})]})]}),t.length>0&&c.jsx("section",{className:"py-20 bg-background",children:c.jsxs("div",{className:"container mx-auto px-4",children:[c.jsxs("div",{className:"text-center mb-12",children:[c.jsx("h2",{className:"font-serif text-2xl md:text-3xl font-semibold mb-3",children:"Featured Figures"}),c.jsx("p",{className:"text-muted-foreground text-sm",children:"Explore voices from across church history"})]}),c.jsx("div",{className:"max-w-5xl mx-auto px-12",children:c.jsxs(EJ,{opts:{align:"start",loop:!0},className:"w-full",children:[c.jsx(kJ,{className:"-ml-4",children:t.map(i=>c.jsx(CJ,{className:"pl-4 basis-full sm:basis-1/2 md:basis-1/3",children:c.jsxs(Rt,{to:`/persona/${i.slug}`,className:"block group",children:[c.jsxs("div",{className:"relative aspect-[3/4] rounded-lg overflow-hidden mb-4 bg-muted",children:[c.jsx(X3,{src:i.portrait_image_url,alt:i.full_name,aspectRatio:"portrait",sizes:"(max-width: 640px) 100vw, (max-width: 768px) 50vw, 33vw",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",fallback:c.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Image"})}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"}),c.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:c.jsx("h3",{className:"font-serif text-lg font-medium text-parchment group-hover:text-gold transition-colors",children:i.full_name})})]}),c.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 leading-relaxed",children:i.short_biography})]})},i.id))}),c.jsx(AJ,{className:"border-border/50 text-foreground hover:bg-muted"}),c.jsx(NJ,{className:"border-border/50 text-foreground hover:bg-muted"})]})})]})}),c.jsx("section",{className:"py-24",children:c.jsxs("div",{className:"container mx-auto px-4 text-center",children:[c.jsx("h2",{className:"font-serif text-2xl md:text-3xl font-semibold mb-4",children:"Begin Your Study"}),c.jsx("p",{className:"text-muted-foreground mb-8 max-w-[50ch] mx-auto",children:"Explore 30+ historical Christian figures with verified primary sources."}),c.jsx(xe,{asChild:!0,size:"lg",className:"bg-gold hover:bg-gold/90 text-iron font-medium px-8 rounded",children:c.jsx(Rt,{to:"/pers
709onas",children:"Discover the Heroes"})})]})})]})}const Lt=_.forwardRef(({className:n,type:e,...t},r)=>c.jsx("input",{type:e,className:ke("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:r,...t}));Lt.displayName="Input";var H2e="Label",TJ=_.forwardRef((n,e)=>c.jsx(st.label,{...n,ref:e,onMouseDown:t=>{var s;t.target.closest("button, input, select, textarea")||((s=n.onMouseDown)==null||s.call(n,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));TJ.displayName=H2e;var jJ=TJ;const W2e=Sg("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=_.forwardRef(({className:n,...e},t)=>c.jsx(jJ,{ref:t,className:ke(W2e(),n),...e}));yt.displayName=jJ.displayName;const mt=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,className:ke("rounded-lg border bg-card text-card-foreground shadow-sm gradient-card-subtle",n),...e}));mt.displayName="Card";const Ln=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,className:ke("flex flex-col space-y-1.5 p-6",n),...e}));Ln.displayName="CardHeader";const Wn=_.forwardRef(({className:n,...e},t)=>c.jsx("h3",{ref:t,className:ke("text-2xl font-semibold leading-none tracking-tight",n),...e}));Wn.displayName="CardTitle";const Os=_.forwardRef(({className:n,...e},t)=>c.jsx("p",{ref:t,className:ke("text-sm text-muted-foreground",n),...e}));Os.displayName="CardDescription";const kt=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,className:ke("p-6 pt-0",n),...e}));kt.displayName="CardContent";const q2e=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,className:ke("flex items-center p-6 pt-0",n),...e}));q2e.displayName="CardFooter";var LT="Tabs",[G2e,Kqe]=Hr(LT,[A0]),RJ=A0(),[K2e,Z3]=G2e(LT),PJ=_.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:o,activationMode:l="automatic",...u}=n,d=kg(o),[h,f]=Zi({prop:r,onChange:s,defaultProp:i??"",caller:LT});return c.jsx(K2e,{scope:t,baseId:Ja(),value:h,onValueChange:f,orientation:a,dir:d,activationMode:l,children:c.jsx(st.div,{dir:d,"data-orientation":a,...u,ref:e})})});PJ.displayName=LT;var DJ="TabsList",OJ=_.forwardRef((n,e)=>{const{__scopeTabs:t,loop:r=!0,...s}=n,i=Z3(DJ,t),a=RJ(t);return c.jsx(j3,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(st.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});OJ.displayName=DJ;var MJ="TabsTrigger",IJ=_.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,disabled:s=!1,...i}=n,a=Z3(MJ,t),o=RJ(t),l=BJ(a.baseId,r),u=zJ(a.baseId,r),d=r===a.value;return c.jsx(R3,{asChild:!0,...o,focusable:!s,active:d,children:c.jsx(st.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...i,ref:e,onMouseDown:$e(n.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:$e(n.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:$e(n.onFocus,()=>{const h=a.activationMode!=="manual";!d&&!s&&h&&a.onValueChange(r)})})})});IJ.displayName=MJ;var LJ="TabsContent",FJ=_.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,forceMount:s,children:i,...a}=n,o=Z3(LJ,t),l=BJ(o.baseId,r),u=zJ(o.baseId,r),d=r===o.value,h=_.useRef(d);return _.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),c.jsx(ss,{present:s||d,children:({present:f})=>c.jsx(st.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...a,ref:e,style:{...n.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});FJ.displayName=LJ;function BJ(n,e){return`${n}-trigger-${e}`}function zJ(n,e){return`${n}-content-${e}`}var Y2e=PJ,$J=OJ,UJ=IJ,VJ=FJ;const N0=Y2e,Ng=_.forwardRef(({className:n,...e},t)=>c.jsx($J,{ref:t,className:ke("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Ng.displayName=$J.displayName;const Rr=_.forwardRef(({className:n,...e},t)=>c.jsx(UJ,{ref:t,className:ke("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",n),...e}));Rr.displayName=UJ.displayName;const Ml=_.forwardRef(({className:n,...e},t)=>c.jsx(VJ,{ref:t,className:ke("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));Ml.displayName=VJ.displayName;var bn;(function(n){n.assertEqual=s=>{};function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const a of s)i[a]=a;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),a={};for(const o of i)a[o]=s[o];return n.objectValues(a)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},n.find=(s,i)=>{for(const a of s)if(i(a))return a},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>
vendor: 1,174 bytes, line 709
709typeof a=="string"?`'${a}'`:a).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(bn||(bn={}));var kU;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(kU||(kU={}));const vt=bn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hd=n=>{switch(typeof n){case"undefined":return vt.undefined;case"string":return vt.string;case"number":return Number.isNaN(n)?vt.nan:vt.number;case"boolean":return vt.boolean;case"function":return vt.function;case"bigint":return vt.bigint;case"symbol":return vt.symbol;case"object":return Array.isArray(n)?vt.array:n===null?vt.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?vt.promise:typeof Map<"u"&&n instanceof Map?vt.map:typeof Set<"u"&&n instanceof Set?vt.set:typeof Date<"u"&&n instanceof Date?vt.date:vt.object;default:return vt.unknown}},Xe=bn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invali
709d_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class md extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(t(a));else{let o=r,l=0;for(;l<a.path.length;){const u=a.path[l];l===a.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(a))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),r}static assert(e){if(!(e instanceof md))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];t[i]=t[i]||[],t[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}md.create=n=>new md(n);const BM=(n,e)=>{let t;switch(n.code){case Xe.invalid_type:n.received===vt.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case Xe.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,bn.jsonStringifyReplacer)}`;break;case Xe.unrecognized_keys:t=`Unrecognized key(s) in object: ${bn.joinValues(n.keys,", ")}`;break;case Xe.invalid_union:t="Invalid input";break;case Xe.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${bn.joinValues(n.options)}`;break;case Xe.invalid_enum_value:t=`Invalid enum value. Expected ${bn.joinValues(n.options)}, received '${n.received}'`;break;case Xe.invalid_arguments:t="Invalid function arguments";break;case Xe.invalid_return_type:t="Invalid function return type";break;case Xe.invalid_date:t="Invalid date";break;case Xe.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:bn.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case Xe.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case Xe.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case Xe.custom:t="Invalid input";break;case Xe.invalid_intersection_types:t="Intersection results could not be merged";break;case Xe.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case Xe.not_finite:t="Number must be finite";break;default:t=e.defaultError,bn.assertNever(n)}return{message:t}};
vendor: 1,407 bytes, line 709
709let X2e=BM;function Z2e(){return X2e}const J2e=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)o=u(a,{data:e,defaultError:o}).message;return{...s,path:i,message:o}};function ct(n,e){const t=Z2e(),r=J2e({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===BM?void 0:BM].filter(s=>!!s)});n.common.issues.push(r)}class no{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return $t;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,a=await s.value;r.push({key:i,value:a})}return no.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return $t;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}}const $t=Object.freeze({status:"aborted"}),Rb=n=>({status:"dirty",value:n}),Yo=n=>({status:"valid",value:n}
vendor: 5,857 bytes, line 709
709),CU=n=>n.status==="aborted",AU=n=>n.status==="dirty",Vx=n=>n.status==="valid",Z2=n=>typeof Promise<"u"&&n instanceof Promise;var bt;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(bt||(bt={}));class gf{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const NU=(n,e)=>{if(Vx(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new md(n.common.issues);return this._error=t,this._error}}};function sn(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,o)=>{const{message:l}=n;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class yn{get description(){return this._def.description}_getType(e){return Hd(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Hd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new no,ctx:{common:e.parent.common,data:e.data,parsedType:Hd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Z2(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hd(e)},s=this._parseSync({data:e,path:r.path,parent:r});return NU(r,s)}"~validate"(e){var r,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hd(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return Vx(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>Vx(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hd(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Z2(s)?s:Promise.resolve(s));return NU(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const a=e(s),o=()=>i.addIssue({code:Xe.custom,...r(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new qx({schema:this,typeName:Ut.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return tf.create(this,this._def)}nullable(){return Gx.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Uc.create(this)}promise(){return tA.create(this,this._def)}or(e){return Q2.create([this,e],this._def)}and(e){return eA.create(this,e,this._def)}transform(e){return new qx({...sn(this._def),schema:this,typeName:Ut.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new UM({...sn(this._def),innerType:this,defaultValue:t,typeName:Ut.ZodDefault})}brand(){return new wAe({typeName:Ut.ZodBranded,type:this,...sn(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new VM({...sn(this._def),innerType:this,catchValue:t,typeName:Ut.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return J3.create(this,e)}readonly(){return HM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Q2e=/^c[^\s-]{8,}
vendor: 4,290 bytes, line 709
709$/i,eAe=/^[0-9a-z]+$/,tAe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nAe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rAe=/^[a-z0-9_-]{21}$/i,sAe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iAe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,aAe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oAe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let hP;const lAe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cAe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,uAe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,dAe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hAe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fAe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,HJ="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pAe=new RegExp(`^${HJ}$`);function WJ(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function mAe(n){return new RegExp(`^${WJ(n)}$`)}function gAe(n){let e=`${HJ}T${WJ(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function vAe(n,e){return!!((e==="v4"||!e)&&lAe.test(n)||(e==="v6"||!e)&&uAe.test(n))}function yAe(n,e){if(!sAe.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function xAe(n,e){return!!((e==="v4"||!e)&&cAe.test(n)||(e==="v6"||!e)&&dAe.test(n))}class Yu extends yn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==vt.string){const i=this._getOrReturnCtx(e);return ct(i,{code:Xe.invalid_type,expected:vt.string,received:i.parsedType}),$t}const r=new no;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;
vendor: 17,795 bytes, line 709
709(a||o)&&(s=this._getOrReturnCtx(e,s),a?ct(s,{code:Xe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&ct(s,{code:Xe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")aAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"email",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")hP||(hP=new RegExp(oAe,"u")),hP.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"emoji",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"uuid",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"nanoid",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Q2e.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"cuid",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"cuid2",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"ulid",code:Xe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ct(s,{validation:"url",code:Xe.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"regex",code:Xe.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?gAe(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?mAe(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"duration",code:Xe.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?vAe(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"ip",code:Xe.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?yAe(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"jwt",code:Xe.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?xAe(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"cidr",code:Xe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?hAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"base64",code:Xe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?fAe.test(e.data)||(s=this._getOrReturnCtx(e,s),ct(s,{validation:"base64url",code:Xe.invalid_string,message:i.message}),r.dirty()):bn.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:Xe.invalid_string,...bt.errToObj(r)})}_addCheck(e){return new Yu({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...bt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...bt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...bt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...bt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...bt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...bt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...bt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...bt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...bt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...bt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...bt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...bt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...bt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...bt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...bt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...bt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...bt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...bt.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...bt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...bt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...bt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...bt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...bt.errToObj(t)})}nonempty(e){return this.min(1,bt.errToObj(e))}trim(){return new Yu({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yu({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yu({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Yu.create=n=>new Yu({checks:[],typeName:Ut.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...sn(n)});function bAe(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}class Jm extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==vt.number){const i=this._getOrReturnCtx(e);return ct(i,{code:Xe.invalid_type,expected:vt.number,received:i.parsedType}),$t}let r;const s=new no;for(const i of this._def.checks)i.kind==="int"?bn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?bAe(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.not_finite,message:i.message}),s.dirty()):bn.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,bt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,bt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,bt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,bt.toString(t))}setLimit(e,t,r,s){return new Jm({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:bt.toString(s)}]})}_addCheck(e){return new Jm({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:bt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:bt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:bt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:bt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:bt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:bt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:bt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:bt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:bt.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&bn.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Jm.create=n=>new Jm({checks:[],typeName:Ut.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...sn(n)});class Qm extends yn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==vt.bigint)return this._getInvalidInput(e);let r;const s=new no;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ct(r,{code:Xe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):bn.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ct(t,{code:Xe.invalid_type,expected:vt.bigint,received:t.parsedType}),$t}gte(e,t){return this.setLimit("min",e,!0,bt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,bt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,bt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,bt.toString(t))}setLimit(e,t,r,s){return new Qm({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:bt.toString(s)}]})}_addCheck(e){return new Qm({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:bt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:bt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:bt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:bt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:bt.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Qm.create=n=>new Qm({checks:[],typeName:Ut.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...sn(n)});class J2 extends yn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==vt.boolean){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.boolean,received:r.parsedType}),$t}return Yo(e.data)}}J2.create=n=>new J2({typeName:Ut.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...sn(n)});class Hx extends yn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==vt.date){const i=this._getOrReturnCtx(e);return ct(i,{code:Xe.invalid_type,expected:vt.date,received:i.parsedType}),$t}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ct(i,{code:Xe.invalid_date}),$t}const r=new no;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ct(s,{code:Xe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):bn.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Hx({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:bt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:bt.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Hx.create=n=>new Hx({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:Ut.ZodDate,...sn(n)});class TU extends yn{_parse(e){if(this._getType(e)!==vt.symbol){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.symbol,received:r.parsedType}),$t}return Yo(e.data)}}TU.create=n=>new TU({typeName:Ut.ZodSymbol,...sn(n)});class jU extends yn{_parse(e){if(this._getType(e)!==vt.undefined){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.undefined,received:r.parsedType}),$t}return Yo(e.data)}}jU.create=n=>new jU({typeName:Ut.ZodUndefined,...sn(n)});class RU extends yn{_parse(e){if(this._getType(e)!==vt.null){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.null,received:r.parsedType}),$t}return Yo(e.data)}}RU.create=n=>new RU({typeName:Ut.ZodNull,...sn(n)});class PU extends yn{constructor(){super(...arguments),this._any=!0}_parse(e){return Yo(e.data)}}PU.create=n=>new PU({typeName:Ut.ZodAny,...sn(n)});class DU extends yn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Yo(e.data)}}DU.create=n=>new DU({typeName:Ut.ZodUnknown,...sn(n)});class vf extends yn{_parse(e){const t=this._getOrReturnCtx(e);return ct(t,{code:Xe.invalid_type,expected:vt.never,received:t.parsedType}),$t}}vf.create=n=>new vf({typeName:Ut.ZodNever,...sn(n)});class OU extends yn{_parse(e){if(this._getType(e)!==vt.undefined){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.void,received:r.parsedType}),$t}return Yo(e.data)}}OU.create=n=>new OU({typeName:Ut.ZodVoid,...sn(n)});class Uc extends yn{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==vt.array)return ct(t,{code:Xe.invalid_type,expected:vt.array,received:t.parsedType}),$t;if(s.exactLength!==null){const a=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(a||o)&&(ct(t,{code:a?Xe.too_big:Xe.too_small,minimum:o?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(ct(t,{code:Xe.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(ct(t,{code:Xe.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>s.type._parseAsync(new gf(t,a,t.path,o)))).then(a=>no.mergeArray(r,a));const i=[...t.data].map((a,o)=>s.type._parseSync(new gf(t,a,t.path,o)));return no.mergeArray(r,i)}
vendor: 5,088 bytes, line 709
709get element(){return this._def.type}min(e,t){return new Uc({...this._def,minLength:{value:e,message:bt.toString(t)}})}max(e,t){return new Uc({...this._def,maxLength:{value:e,message:bt.toString(t)}})}length(e,t){return new Uc({...this._def,exactLength:{value:e,message:bt.toString(t)}})}nonempty(e){return this.min(1,e)}}Uc.create=(n,e)=>new Uc({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Ut.ZodArray,...sn(e)});function uv(n){if(n instanceof Cr){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=tf.create(uv(r))}return new Cr({...n._def,shape:()=>e})}else return n instanceof Uc?new Uc({...n._def,type:uv(n.element)}):n instanceof tf?tf.create(uv(n.unwrap())):n instanceof Gx?Gx.create(uv(n.unwrap())):n instanceof eg?eg.create(n.items.map(e=>uv(e))):n}class Cr extends yn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=bn.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==vt.object){const u=this._getOrReturnCtx(e);return ct(u,{code:Xe.invalid_type,expected:vt.object,received:u.parsedType}),$t}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof vf&&this._def.unknownKeys==="strip"))for(const u in s.data)a.includes(u)||o.push(u);const l=[];for(const u of a){const d=i[u],h=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new gf(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof vf){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")o.length>0&&(ct(s,{code:Xe.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const h=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new gf(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const h=await d.key,f=await d.value;u.push({key:h,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>no.mergeObjectSync(r,u)):no.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return bt.errToObj,new Cr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,a;const s=((a=(i=this._def).errorMap)==null?void 0:a.call(i,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:bt.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Cr({...this._def,unknownKeys:"strip"})}passthrough(){return new Cr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Cr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Cr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ut.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Cr({...this._def,catchall:e})}pick(e){const t={};for(const r of bn.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new Cr({...this._def,shape:()=>t})}omit(e){const t={};for(const r of bn.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new Cr({...this._def,shape:()=>t})}deepPartial(){return uv(this)}partial(e){const t={};for(const r of bn.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new Cr({...this._def,shape:()=>t})}required(e){const t={};for(const r of bn.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof tf;)i=i._def.innerType;t[r]=i}return new Cr({...this._def,shape:()=>t})}keyof(){return qJ(bn.objectKeys(this.shape))}}Cr.create=(n,e)=>new Cr({shape:()=>n,unknownKeys:"strip",catchall:vf.create(),typeName:Ut.ZodObject,...sn(e)});Cr.strictCreate=(n,e)=>new Cr({shape:()=>n,unknownKeys:"strict",catchall:vf.create(),typeName:Ut.ZodObject,...sn(e)});Cr.lazycreate=(n,e)=>new Cr({shape:n,unknownKeys:"strip",catchall:vf.create(),typeName:Ut.ZodObject,...sn(e)});class Q2 extends yn{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new md(o.ctx.common.issues));return ct(t,{code:Xe.invalid_union,unionErrors:a}),$t}if(t.common.async)return Promise.all(r.map(async i=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(s);{let i;const a=[];for(const l of r){const u={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;
vendor: 5,044 bytes, line 709
709const o=a.map(l=>new md(l));return ct(t,{code:Xe.invalid_union,unionErrors:o}),$t}}get options(){return this._def.options}}Q2.create=(n,e)=>new Q2({options:n,typeName:Ut.ZodUnion,...sn(e)});function zM(n,e){const t=Hd(n),r=Hd(e);if(n===e)return{valid:!0,data:n};if(t===vt.object&&r===vt.object){const s=bn.objectKeys(e),i=bn.objectKeys(n).filter(o=>s.indexOf(o)!==-1),a={...n,...e};for(const o of i){const l=zM(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===vt.array&&r===vt.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const a=n[i],o=e[i],l=zM(a,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===vt.date&&r===vt.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class eA extends yn{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,a)=>{if(CU(i)||CU(a))return $t;const o=zM(i.value,a.value);return o.valid?((AU(i)||AU(a))&&t.dirty(),{status:t.value,value:o.data}):(ct(r,{code:Xe.invalid_intersection_types}),$t)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eA.create=(n,e,t)=>new eA({left:n,right:e,typeName:Ut.ZodIntersection,...sn(t)});class eg extends yn{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==vt.array)return ct(r,{code:Xe.invalid_type,expected:vt.array,received:r.parsedType}),$t;if(r.data.length<this._def.items.length)return ct(r,{code:Xe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$t;!this._def.rest&&r.data.length>this._def.items.length&&(ct(r,{code:Xe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new gf(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>no.mergeArray(t,a)):no.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new eg({...this._def,rest:e})}}eg.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new eg({items:n,typeName:Ut.ZodTuple,rest:null,...sn(e)})};class MU extends yn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==vt.map)return ct(r,{code:Xe.invalid_type,expected:vt.map,received:r.parsedType}),$t;const s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([o,l],u)=>({key:s._parse(new gf(r,o,r.path,[u,"key"])),value:i._parse(new gf(r,l,r.path,[u,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return $t;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return $t;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}}}}MU.create=(n,e,t)=>new MU({valueType:e,keyType:n,typeName:Ut.ZodMap,...sn(t)});class D1 extends yn{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==vt.set)return ct(r,{code:Xe.invalid_type,expected:vt.set,received:r.parsedType}),$t;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ct(r,{code:Xe.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ct(r,{code:Xe.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function a(l){const u=new Set;for(const d of l){if(d.status==="aborted")return $t;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const o=[...r.data.values()].map((l,u)=>i._parse(new gf(r,l,r.path,u)));return r.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new D1({...this._def,minSize:{value:e,message:bt.toString(t)}})}max(e,t){return new D1({...this._def,maxSize:{value:e,message:bt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}D1.create=(n,e)=>new D1({valueType:n,minSize:null,maxSize:null,typeName:Ut.ZodSet,...sn(e)});class IU extends yn{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}IU.create=(n,e)=>new IU({getter:n,typeName:Ut.ZodLazy,...sn(e)});class $M extends yn{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ct(t,{received:t.data,code:Xe.invalid_literal,expected:this._def.value}),$t}
vendor: 5,385 bytes, line 709
709return{status:"valid",value:e.data}}get value(){return this._def.value}}$M.create=(n,e)=>new $M({value:n,typeName:Ut.ZodLiteral,...sn(e)});function qJ(n,e){return new Wx({values:n,typeName:Ut.ZodEnum,...sn(e)})}class Wx extends yn{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return ct(t,{expected:bn.joinValues(r),received:t.parsedType,code:Xe.invalid_type}),$t}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return ct(t,{received:t.data,code:Xe.invalid_enum_value,options:r}),$t}return Yo(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Wx.create(e,{...this._def,...t})}exclude(e,t=this._def){return Wx.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}Wx.create=qJ;class LU extends yn{_parse(e){const t=bn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==vt.string&&r.parsedType!==vt.number){const s=bn.objectValues(t);return ct(r,{expected:bn.joinValues(s),received:r.parsedType,code:Xe.invalid_type}),$t}if(this._cache||(this._cache=new Set(bn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=bn.objectValues(t);return ct(r,{received:r.data,code:Xe.invalid_enum_value,options:s}),$t}return Yo(e.data)}get enum(){return this._def.values}}LU.create=(n,e)=>new LU({values:n,typeName:Ut.ZodNativeEnum,...sn(e)});class tA extends yn{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vt.promise&&t.common.async===!1)return ct(t,{code:Xe.invalid_type,expected:vt.promise,received:t.parsedType}),$t;const r=t.parsedType===vt.promise?t.data:Promise.resolve(t.data);return Yo(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}tA.create=(n,e)=>new tA({type:n,typeName:Ut.ZodPromise,...sn(e)});class qx extends yn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{ct(r,a),a.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return $t;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?$t:l.status==="dirty"||t.value==="dirty"?Rb(l.value):l});{if(t.value==="aborted")return $t;const o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?$t:o.status==="dirty"||t.value==="dirty"?Rb(o.value):o}}if(s.type==="refinement"){const a=o=>{const l=s.refinement(o,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?$t:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?$t:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Vx(a))return $t;const o=s.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Vx(a)?Promise.resolve(s.transform(a.value,i)).then(o=>({status:t.value,value:o})):$t);bn.assertNever(s)}}qx.create=(n,e,t)=>new qx({schema:n,typeName:Ut.ZodEffects,effect:e,...sn(t)});qx.createWithPreprocess=(n,e,t)=>new qx({schema:e,effect:{type:"preprocess",transform:n},typeName:Ut.ZodEffects,...sn(t)});class tf extends yn{_parse(e){return this._getType(e)===vt.undefined?Yo(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tf.create=(n,e)=>new tf({innerType:n,typeName:Ut.ZodOptional,...sn(e)});class Gx extends yn{_parse(e){return this._getType(e)===vt.null?Yo(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gx.create=(n,e)=>new Gx({innerType:n,typeName:Ut.ZodNullable,...sn(e)});class UM extends yn{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===vt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}UM.create=(n,e)=>new UM({innerType:n,typeName:Ut.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...sn(e)});class VM extends yn{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Z2(s)?s.then(i=>
vendor: 2,150 bytes, line 709
709({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new md(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new md(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}VM.create=(n,e)=>new VM({innerType:n,typeName:Ut.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...sn(e)});class FU extends yn{_parse(e){if(this._getType(e)!==vt.nan){const r=this._getOrReturnCtx(e);return ct(r,{code:Xe.invalid_type,expected:vt.nan,received:r.parsedType}),$t}return{status:"valid",value:e.data}}}FU.create=n=>new FU({typeName:Ut.ZodNaN,...sn(n)});class wAe extends yn{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class J3 extends yn{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?$t:i.status==="dirty"?(t.dirty(),Rb(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?$t:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new J3({in:e,out:t,typeName:Ut.ZodPipeline})}}class HM extends yn{_parse(e){const t=this._def.innerType._parse(e),r=s=>(Vx(s)&&(s.value=Object.freeze(s.value)),s);return Z2(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}HM.create=(n,e)=>new HM({innerType:n,typeName:Ut.ZodReadonly,...sn(e)});Cr.lazycreate;var Ut;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",
709n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Ut||(Ut={}));const bp=Yu.create,fP=Jm.create;Qm.create;const _Ae=J2.create;Hx.create;vf.create;Uc.create;const SAe=Cr.create;Cr.strictCreate;Q2.create;eA.create;eg.create;const EAe=$M.create;Wx.create;tA.create;tf.create;Gx.create;const BU={string:n=>Yu.create({...n,coerce:!0}),number:n=>Jm.create({...n,coerce:!0}),boolean:n=>J2.create({...n,coerce:!0}),bigint:n=>Qm.create({...n,coerce:!0}),date:n=>Hx.create({...n,coerce:!0})},zU=bp().email("Please enter a valid email address"),$U=bp().min(6,"Password must be at least 6 characters");function kAe(){const[n]=OS(),[e,t]=_.useState(""),[r,s]=_.useState(""),[i,a]=_.useState(""),[o,l]=_.useState(""),[u,d]=_.useState(!1),[h,f]=_.useState({}),[p,m]=_.useState("signin"),{signIn:g,signUp:y,user:v}=Vt(),x=vr(),{toast:b}=Jl();_.useEffect(()=>{n.get("type")==="recovery"&&m("reset-password")},[n]),_.useEffect(()=>{v&&p!=="reset-password"&&x("/")},[v,x,p]);const E=()=>{const D=zU.safeParse(e);return D.success?(f({}),!0):(f({email:D.error.errors[0].message}),!1)},S=()=>{const D={},R=zU.safeParse(e);R.success||(D.email=R.error.errors[0].message);const M=$U.safeParse(r);return M.success||(D.password=M.error.errors[0].message),f(D),Object.keys(D).length===0},k=()=>{const D={},R=$U.safeParse(r);return R.success||(D.password=R.error.errors[0].message),r!==i&&(D.confirmPassword="Passwords do not match"),f(D),Object.keys(D).length===0},C=async D=>{if(D.preventDefault(),!S())return;d(!0);const{error:R}=await g(e,r);d(!1),R?b({variant:"destructive",title:"Sign in failed",description:R.message==="Invalid login credentials"?"Invalid email or password. Please try again.":R.message}):x("/")},A=async D=>{if(D.preventDefault(),!S())return;d(!0);const{error:R}=await y(e,r,o);if(d(!1),R){let M=R.message;R.message.includes("already registered")&&(M="This email is already registered. Please sign in instead."),b({variant:"destructive",title:"Sign up failed",description:M})}else b({title:"Account created",description:"Welcome to Heroes of the Faith."}),x("/")},T=async D=>{if(D.preventDefault(),!E())return;d(!0);const{error:R}=await pe.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/auth?type=recovery`});d(!1),R?b({variant:"destructive",title:"Request failed",description:R.message}):(b({title:"Check your email",description:"We've sent you a password reset link."}),m("signin"))},j=async D=>{if(D.preventDefault(),!k())return;d(!0);const{error:R}=await pe.auth.updateUser({password:r});d(!1),R?b({variant:"destructive",title:"Password reset failed",description:R.message}):(b({title:"Password updated",description:"Your password has been reset successfully."}),x("/"))};return p==="forgot-password"?c.jsxs("div",{className:"min-h-screen flex items-center justify-center px-4 py-12 bg-background relative",children:[c.jsx(xe,{variant:"ghost",size:"icon",className:"absolute top-4 left-4",onClick:()=>m("signin"),children:c.jsx(Ji,{className:"h-5 w-5"})}),c.jsxs(mt,{className:"w-full max-w-md",children:[c.jsxs(Ln,{className:"text-center",children:[c.jsx("div",{className:"flex justify-center mb-4",children:c.jsx(En,{className:"h-10 w-10 text-accent"})}),c.jsx(Wn,{className:"font-serif text-2xl",children:"Reset Password"}),c.jsx(Os,{children:"Enter your email and we'll send you a reset link"})]}),c.jsx(kt,{children:c.jsxs("form",{onSubmit:T,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"reset-email",children:"Email"}),c.jsx(Lt,{id:"reset-email",type:"email",placeholder:"[email protected]",value:e,onChange:D=>t(D.target.value),required:!0}),h.email&&c.jsx("p",{className:"text-sm text-destructive",children:h.email})]}),c.jsxs(xe,{type:"submit",className:"w-full",disabled:u,children:[u&&c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Send Reset Link"]}),c.jsx(xe,{type:"button",variant:"ghost",className:"w-full",onClick:()=>m("signin"),children:"Back to Sign In"})]})})]})]}):p==="reset-password"?c.jsx("div",{className:"min-h-screen flex items-center justify-center px-4 py-12 bg-background",children:c.jsxs(mt,{className:"w-full max-w-md",children:[c.jsxs(Ln,{className:"text-center",children:[c.jsx("div",{className:"flex justify-center mb-4",children:c.jsx(En,{className:"h-10 w-10 text-accent"})}),c.jsx(Wn,{className:"font-serif text-2xl",children:"Set New Password"}),c.jsx(Os,{children:"Enter your new password below"})]}),c.jsx(kt,{children:c.jsxs("form",{onSubmit:j,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"new-password",children:"New Password"}),c.jsx(Lt,{id:"new-password",type:"password",placeholder:"••••••••",value:r,onChange:D=>s(D.target.value),required:!0}),h.password&&c.jsx("p",{className:"text-sm text-destructive",children:h.password})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"confirm-password",children:"Confirm Password"}),c.jsx(Lt,{id:"confirm-password",type:"password",placeholder:"••••••••",value:i,onChange:D=>a(D.target.value),required:!0}),h.confirmPassword&&c.jsx("p",{className:"text-sm text-destructive",children:h.confirmPassword})]}),c.jsxs(xe,{type:"submit",className:"w-full",disabled:u,children:[u&&c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Reset Password"]})]})})]})}):c.jsxs("div",{className:"min-h-screen flex items-center justify-center px-4 py-12 bg-background relative",children:[c.jsx(xe,{variant:"ghost",size:"icon",className:"absolute top-4 left-4",onClick:()=>x(-1),children:c.jsx(Ji,{className:"h-5 w-5"})}),c.jsxs(mt,{className:"w-full max-w-md",children:[c.jsxs(Ln,{className:"text-center",children:[c.jsx("div",{className:"flex justify-center mb-4",children:c.jsx(En,{className:"h-10 w-10 text-accent"})}),c.jsx(Wn,{className:"font-serif text-2xl",children:"Heroes of the Faith"}),c.jsx(Os,{children:"Access the digital archive of Christian history"})]}),c.jsx(kt,{children:c.jsxs(N0,{defaultValue:"signin",className:"w-full",children:[c.jsxs(Ng,{className:"grid w-full grid-cols-2 mb-6",children:[c.jsx(Rr,{value:"signin",children:"Sign In"}),c.jsx(Rr,{value:"signup",children:"Sign Up"})]}),c.jsx(Ml,{value:"signin",children:c.jsxs("form",{onSubmit:C,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"signin-email",children:"Email"}),c.jsx(Lt,{id:"signin-email",type:"email",placeholder:"[email protected]",value:e,onCh
709ange:D=>t(D.target.value),required:!0}),h.email&&c.jsx("p",{className:"text-sm text-destructive",children:h.email})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(yt,{htmlFor:"signin-password",children:"Password"}),c.jsx(xe,{type:"button",variant:"link",className:"px-0 h-auto text-sm text-muted-foreground hover:text-accent",onClick:()=>m("forgot-password"),children:"Forgot password?"})]}),c.jsx(Lt,{id:"signin-password",type:"password",placeholder:"••••••••",value:r,onChange:D=>s(D.target.value),required:!0}),h.password&&c.jsx("p",{className:"text-sm text-destructive",children:h.password})]}),c.jsxs(xe,{type:"submit",className:"w-full",disabled:u,children:[u&&c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Sign In"]})]})}),c.jsx(Ml,{value:"signup",children:c.jsxs("form",{onSubmit:A,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"signup-name",children:"Display Name (optional)"}),c.jsx(Lt,{id:"signup-name",type:"text",placeholder:"Your name",value:o,onChange:D=>l(D.target.value)})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"signup-email",children:"Email"}),c.jsx(Lt,{id:"signup-email",type:"email",placeholder:"[email protected]",value:e,onChange:D=>t(D.target.value),required:!0}),h.email&&c.jsx("p",{className:"text-sm text-destructive",children:h.email})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"signup-password",children:"Password"}),c.jsx(Lt,{id:"signup-password",type:"password",placeholder:"••••••••",value:r,onChange:D=>s(D.target.value),required:!0}),h.password&&c.jsx("p",{className:"text-sm text-destructive",children:h.password})]}),c.jsxs(xe,{type:"submit",className:"w-full",disabled:u,children:[u&&c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Account"]})]})})]})})]})]})}const CAe=Sg("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"}},defaultVariants:{variant:"default"}});function jt({className:n,variant:e,...t}){return c.jsx("div",{className:ke(CAe({variant:e}),n),...t})}function qt({className:n,...e}){return c.jsx("div",{className:ke("animate-pulse rounded-md bg-muted",n),...e})}function AAe(){return c.jsx(mt,{children:c.jsxs(kt,{className:"p-6 text-center",children:[c.jsx(qt,{className:"w-20 h-20 rounded-full mx-auto mb-4"}),c.jsx(qt,{className:"h-5 w-3/4 mx-auto mb-2"}),c.jsx(qt,{className:"h-4 w-1/2 mx-auto mb-3"}),c.jsx(qt,{className:"h-4 w-full mb-1"}),c.jsx(qt,{className:"h-4 w-5/6 mx-auto"})]})})}function NAe(){const[n,e]=_.useState(""),[t,r]=_.useState([]),{data:s,isLoading:i}=pt({queryKey:["personas"],queryFn:async()=>{const{data:p,error:m}=await pe.from("personas").select("*").eq("is_published",!0).order("full_name");if(m)throw m;return p}}),{data:a}=pt({queryKey:["labels"],queryFn:async()=>{const{data:p,error:m}=await pe.from("labels").select("*").order("label_type").order("name");if(m)throw m;return p}}),{data:o}=pt({queryKey:["persona_labels"],queryFn:async()=>{const{data:p,error:m}=await pe.from("persona_labels").select("persona_id, label_id");if(m)throw m;return p}}),l=p=>{r(m=>m.includes(p)?m.filter(g=>g!==p):[...m,p])},u=s==null?void 0:s.filter(p=>{const m=p.full_name.toLowerCase().includes(n.toLowerCase());if(t.length===0)return m;const g=(o==null?void 0:o.filter(v=>v.persona_id===p.id).map(v=>v.label_id))||[],y=t.every(v=>g.includes(v));return m&&y}),d=a==null?void 0:a.reduce((p,m)=>(p[m.label_type]||(p[m.label_type]=[]),p[m.label_type].push(m),p),{}),h={era:"Era",category:"Category",region:"Region",theme:"Theme"},f={"@context":"https://schema.org","@type":"ItemList",name:"Heroes of the Faith Archive",description:"Browse historical Christian figures including martyrs, reformers, missionaries, and theologians from across church history.",numberOfItems:(u==null?void 0:u.length)||0,itemListElement:(u==null?void 0:u.slice(0,10).map((p,m)=>({"@type":"ListItem",position:m+1,item:{"@type":"Person",name:p.full_name,description:p.short_biography,url:`https://heroesofthefaith.ai/persona/${p.slug}`,...p.portrait_image_url&&{image:p.portrait_image_url.startsWith("http")?p.portrait_image_url:`https://heroesofthefaith.ai${p.portrait_image_url}`}}})))||[]};return c.jsxs(cn,{children:[c.jsx(kd,{title:"Heroes Archive - Browse Christian Figures",description:"Explore 30+ historical Christian heroes: martyrs, reformers, missionaries, and theologians. From Paul the Apostle to Dietrich Bonhoeffer.",canonicalUrl:"https://heroesofthefaith.ai/personas",jsonLd:f}),c.jsxs("div",{className:"container mx-auto px-4 py-12",children:[c.jsxs("div",{className:"text-center mb-12 py-8 px-6 gradient-hero rounded-lg",children:[c.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-semibold mb-4",children:"Browse the Archive"}),c.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto mb-6",children:"Explore historical Christian figures across eras, regions, and theological traditions, ask them questions, or enter a discussion between two heroes."}),c.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[c.jsx(xe,{asChild:!0,variant:"outline",className:"gap-2",children:c.jsxs(Rt,{to:"/explore",children:[c.jsx(_F,{className:"h-4 w-4"}),"Explore Connections"]})}),c.jsx(xe,{asChild:!0,variant:"outline",className:"gap-2",children:c.jsxs(Rt,{to:"/debate",children:[c.jsx(zi,{className:"h-4 w-4"}),"Discussion between Heroes"]})}),c.jsx(xe,{asChild:!0,variant:"outline",className:"gap-2",children:c.jsxs(Rt,{to:"/quiz",children:[c.jsx(Pfe,{className:"h-4 w-4"}),"Test Your Knowledge"]})})]})]}),c.jsx("div",{className:"max-w-md mx-auto mb-8",children:c.jsxs("div",{className:"relative",children:[c.jsx(Eg,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Lt,{placeholder:"Search by name...",value:n,onChange:p=>e(p.target.value),className:"pl-10"})]})}),d&&Object.keys(d).length>0&&c.jsx("div",{className:"mb-10 space-y-4",children:Object.entries(d).map(([p,m])=>c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx("span",{className:"text-sm font-semibold uppercase tracking-widest text-primary mb-2",children:h[p]||p}),c.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:m.map(g=>c.jsx(jt,{variant:t.includes(g.id)?"default":"outline",className:"cursor-pointer transition-all duration-300 hover:shadow-md hover:-translate-y-0.5",onClick:()=>l(g.id),children:g.name},g.id))})]},p))}),i?c.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:Array.from({length:8}).map((p,m)=>c.jsx(AAe,{},m))}):u&&u.length>0?c.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:u.map((p,m)=>c.jsx(Oc.div,{initial:{opacity:0,y:20}
709,animate:{opacity:1,y:0},transition:{duration:.4,delay:m*.05,ease:"easeOut"},children:c.jsx(Rt,{to:`/persona/${p.slug}`,children:c.jsx(mt,{className:"h-full cursor-pointer transition-all duration-300 hover:shadow-xl hover:-translate-y-1",children:c.jsxs(kt,{className:"p-6 text-center",children:[c.jsx("div",{className:"w-20 h-20 rounded-full bg-secondary mx-auto mb-4 flex items-center justify-center overflow-hidden",children:c.jsx(X3,{src:p.portrait_image_url,alt:p.full_name,aspectRatio:"square",sizes:"80px",className:"w-full h-full object-cover scale-[1.22]",fallback:c.jsx(Js,{className:"w-8 h-8 text-muted-foreground"})})}),c.jsx("h3",{className:"font-serif text-lg font-semibold mb-1",children:p.full_name}),(p.birth_year||p.death_year)&&c.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:[p.birth_year||"?"," – ",p.death_year||"?"]}),c.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:p.short_biography})]})})})},p.id))}):c.jsx("div",{className:"text-center py-16",children:c.jsx("p",{className:"text-muted-foreground",children:(s==null?void 0:s.length)===0?"No personas have been published yet. Check back soon.":"No personas match your search criteria."})})]})]})}var TAe="Separator",UU="horizontal",jAe=["horizontal","vertical"],GJ=_.forwardRef((n,e)=>{const{decorative:t,orientation:r=UU,...s}=n,i=RAe(r)?r:UU,o=t?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return c.jsx(st.div,{"data-orientation":i,...o,...s,ref:e})});GJ.displayName=TAe;function RAe(n){return jAe.includes(n)}var KJ=GJ;const nf=_.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},s)=>c.jsx(KJ,{ref:s,decorative:t,orientation:e,className:ke("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));nf.displayName=KJ.displayName;const YJ=_.forwardRef(({...n},e)=>c.jsx("nav",{ref:e,"aria-label":"breadcrumb",...n}));YJ.displayName="Breadcrumb";const XJ=_.forwardRef(({className:n,...e},t)=>c.jsx("ol",{ref:t,className:ke("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",n),...e}));XJ.displayName="BreadcrumbList";const rC=_.forwardRef(({className:n,...e},t)=>c.jsx("li",{ref:t,className:ke("inline-flex items-center gap-1.5",n),...e}));rC.displayName="BreadcrumbItem";const WM=_.forwardRef(({asChild:n,className:e,...t},r)=>{const s=n?Nf:"a";return c.jsx(s,{ref:r,className:ke("transition-colors hover:text-foreground",e),...t})});WM.displayName="BreadcrumbLink";const ZJ=_.forwardRef(({className:n,...e},t)=>c.jsx("span",{ref:t,role:"link","aria-disabled":"true","aria-current":"page",className:ke("font-normal text-foreground",n),...e}));ZJ.displayName="BreadcrumbPage";const qM=({children:n,className:e,...t})=>c.jsx("li",{role:"presentation","aria-hidden":"true",className:ke("[&>svg]:size-3.5",e),...t,children:n??c.jsx(cd,{})});qM.displayName="BreadcrumbSeparator";function PAe(){return c.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-5xl",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-6 text-muted-foreground",children:[c.jsx(Ji,{className:"h-4 w-4"}),c.jsx(qt,{className:"h-4 w-28"})]}),c.jsxs("div",{className:"flex flex-col md:flex-row gap-8 mb-12",children:[c.jsx("div",{className:"flex-shrink-0",children:c.jsx(qt,{className:"w-48 h-48 md:w-56 md:h-56 rounded-lg mx-auto md:mx-0"})}),c.jsxs("div",{className:"flex-1",children:[c.jsx(qt,{className:"h-10 w-64 mb-2"}),c.jsx(qt,{className:"h-6 w-32 mb-4"}),c.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[c.jsx(qt,{className:"h-6 w-20 rounded-full"}),c.jsx(qt,{className:"h-6 w-24 rounded-full"}),c.jsx(qt,{className:"h-6 w-16 rounded-full"})]}),c.jsx(qt,{className:"h-4 w-full mb-2"}),c.jsx(qt,{className:"h-4 w-5/6 mb-2"}),c.jsx(qt,{className:"h-4 w-4/6 mb-6"}),c.jsx(qt,{className:"h-10 w-40"})]})]}),c.jsx(nf,{className:"mb-12"}),c.jsxs("section",{className:"mb-12",children:[c.jsx(qt,{className:"h-8 w-32 mb-6"}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(qt,{className:"h-4 w-full"}),c.jsx(qt,{className:"h-4 w-full"}),c.jsx(qt,{className:"h-4 w-5/6"}),c.jsx(qt,{className:"h-4 w-full"}),c.jsx(qt,{className:"h-4 w-4/6"})]})]}),c.jsxs("section",{className:"mb-12",children:[c.jsx(qt,{className:"h-8 w-40 mb-6"}),c.jsx("div",{className:"space-y-6",children:[1,2].map(n=>c.jsx(mt,{className:"border-l-4 border-l-muted",children:c.jsxs(kt,{className:"pt-6",children:[c.jsx(qt,{className:"h-5 w-full mb-2"}),c.jsx(qt,{className:"h-5 w-5/6 mb-4"}),c.jsx(qt,{className:"h-4 w-48"})]})}
709,n))})]}),c.jsxs("section",{className:"mb-12",children:[c.jsx(qt,{className:"h-8 w-48 mb-6"}),c.jsx("div",{className:"grid gap-4",children:[1,2].map(n=>c.jsxs(mt,{children:[c.jsx(Ln,{className:"pb-2",children:c.jsx(qt,{className:"h-6 w-40"})}),c.jsxs(kt,{children:[c.jsx(qt,{className:"h-4 w-full mb-2"}),c.jsx(qt,{className:"h-4 w-4/5"})]})]},n))})]})]})}function DAe({name:n,description:e,birthYear:t,deathYear:r,imageUrl:s,slug:i}){const a=`https://heroesofthefaith.ai/persona/${i}`,o=s!=null&&s.startsWith("http")?s:s?`https://heroesofthefaith.ai${s}`:"https://heroesofthefaith.ai/og-image.png",l={"@context":"https://schema.org","@type":"Person","@id":a,name:n,description:e,image:o,url:a,...t&&{birthDate:t.toString()},...r&&{deathDate:r.toString()},sameAs:[],mainEntityOfPage:{"@type":"WebPage","@id":a}},u={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://heroesofthefaith.ai/"},{"@type":"ListItem",position:2,name:"Heroes Archive",item:"https://heroesofthefaith.ai/personas"},{"@type":"ListItem",position:3,name:n,item:a}]},d=e.length>155?e.substring(0,152)+"...":e;return c.jsx(kd,{title:n,description:d,canonicalUrl:a,ogImage:o,ogType:"profile",jsonLd:[l,u]})}const as=1080,tl=1350,ja={background:"#2A2420",parchmentOverlay:"#E8E1D3",gold:"#C6A75E",cream:"#F5F0E6",muted:"#A89F8F"};async function OAe(n){try{const e=document.createElement("canvas");e.width=as,e.height=tl;const t=e.getContext("2d");if(!t)return null;const r=t.createLinearGradient(0,0,0,tl);r.addColorStop(0,"#3A3028"),r.addColorStop(.5,"#2A2420"),r.addColorStop(1,"#1E1A16"),t.fillStyle=r,t.fillRect(0,0,as,tl);const s=t.createRadialGradient(as/2,tl/2,tl*.3,as/2,tl/2,tl*.8);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"rgba(0,0,0,0.4)"),t.fillStyle=s,t.fillRect(0,0,as,tl),t.strokeStyle=ja.gold,t.lineWidth=2,t.beginPath(),t.moveTo(100,80),t.lineTo(as-100,80),t.stroke();let i=140;if(n.quote){t.fillStyle=ja.cream,t.font='italic 42px "Crimson Pro", Georgia, serif',t.textAlign="center",t.font='80px "Crimson Pro", Georgia, serif',t.fillStyle=ja.gold,t.fillText('"',as/2,i),i+=40,t.font='italic 42px "Crimson Pro", Georgia, serif',t.fillStyle=ja.cream;const u=as-160,d=VU(t,n.quote,u),h=56,f=d.slice(0,4);d.length>4&&(f[3]=f[3].slice(0,-3)+"...");for(const p of f)t.fillText(p,as/2,i),i+=h;t.font='80px "Crimson Pro", Georgia, serif',t.fillStyle=ja.gold,t.fillText('"',as/2,i+20),i+=80}else i=200;const a=n.quote?420:500,o=(as-a)/2,l=n.quote?i:280;if(t.strokeStyle=ja.gold,t.lineWidth=3,t.strokeRect(o-8,l-8,a+16,a+16),n.portraitUrl)try{const u=await MAe(n.portraitUrl);t.save(),IAe(t,o,l,a,a,4),t.clip();const d=u.width/u.height,h=1;let f=a,p=a,m=o,g=l;d>h?(f=a*d,m=o-(f-a)/2):(p=a/d,g=l-(p-a)/2),t.drawImage(u,m,g,f,p),t.restore(),t.fillStyle="rgba(30, 26, 22, 0.1)",t.fillRect(o,l,a,a)}catch{t.fillStyle="#3A3028",t.fillRect(o,l,a,a),t.fillStyle=ja.muted,t.font='120px "Crimson Pro", Georgia, serif',t.textAlign="center",t.fillText(n.heroName[0],as/2,l+a/2+40)}else t.fillStyle="#3A3028",t.fillRect(o,l,a,a),t.fillStyle=ja.muted,t.font='120px "Crimson Pro", Georgia, serif',t.textAlign="center",t.fillText(n.heroName[0],as/2,l+a/2+40);if(i=l+a+60,t.fillStyle=ja.cream,t.font='600 52px "Crimson Pro", Georgia, serif',t.textAlign="center",t.fillText(n.heroName,as/2,i),i+=50,n.heroYears&&(t.fillStyle=ja.muted,t.font='32px "Source Serif 4", Georgia, serif',t.fillText(n.heroYears,as/2,i),i+=40),!n.quote&&n.descriptor){t.fillStyle=ja.muted,t.font='italic 28px "Crimson Pro", Georgia, serif';const u=VU(t,n.descriptor,as-200);for(let d=0;d<Math.min(u.length,2);d++)t.fillText(u[d],as/2,i+30+d*38)}return t.strokeStyle=ja.gold,t.lineWidth=1,t.beginPath(),t.moveTo(300,tl-120),t.lineTo(as-300,tl-120),t.stroke(),t.fillStyle=ja.muted,t.font='24px "Source Serif 4", Georgia, serif',t.textAlign="center",t.fillText("heroesofthefaith.ai",as/2,tl-70),new Promise(u=>{e.toBlob(d=>u(d),"image/png",.95)})}catch(e){return console.error("Failed to generate share card:",e),null}}function MAe(n){return new Promise((e,t)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>e(r),r.onerror=t,r.src=n})}function VU(n,e,t){const r=e.split(" "),s=[];let i="";for(const a of r){const o=i?`${i} ${a}`:a;n.measureText(o).width>t&&i?(s.push(i),i=a):i=o}return i&&s.push(i),s}function IAe(n,e,t,r,s,i){n.beginPath(),n.moveTo(e+i,t),n.lineTo(e+r-i,t),n.quadraticCurveTo(e+r,t,e+r,t+i),n.lineTo(e+r,t+s-i),n.quadraticCurveTo(e+r,t+s,e+r-i,t+s),n.lineTo(e+i,t+s),n.quadraticCurveTo(e,t+s,e,t+s-i),n.lineTo(e,t+i),n.quadraticCurveTo(e,t,e+i,t),n.closePath()}function HU(n){return n.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}
vendor: 6,026 bytes, lines 709-713
709var FT="Dialog",[JJ,QJ]=Hr(FT),[LAe,ec]=JJ(FT),eQ=n=>{const{__scopeDialog:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:a=!0}=n,o=_.useRef(null),l=_.useRef(null),[u,d]=Zi({prop:r,defaultProp:s??!1,onChange:i,caller:FT});return c.jsx(LAe,{scope:e,triggerRef:o,contentRef:l,contentId:Ja(),titleId:Ja(),descriptionId:Ja(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(h=>!h),[d]),modal:a,children:t})};eQ.displayName=FT;var tQ="DialogTrigger",nQ=_.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=ec(tQ,t),i=Ct(e,s.triggerRef);return c.jsx(st.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":t5(s.open),...r,ref:i,onClick:$e(n.onClick,s.onOpenToggle)})});nQ.displayName=tQ;var Q3="DialogPortal",[FAe,rQ]=JJ(Q3,{forceMount:void 0}),sQ=n=>{const{__scopeDialog:e,forceMount:t,children:r,container:s}=n,i=ec(Q3,e);return c.jsx(FAe,{scope:e,forceMount:t,children:_.Children.map(r,a=>c.jsx(ss,{present:t||i.open,children:c.jsx(m0,{asChild:!0,container:s,children:a})}))})};sQ.displayName=Q3;var nA="DialogOverlay",iQ=_.forwardRef((n,e)=>{const t=rQ(nA,n.__scopeDialog),{forceMount:r=t.forceMount,...s}=n,i=ec(nA,n.__scopeDialog);return i.modal?c.jsx(ss,{present:r||i.open,children:c.jsx(zAe,{...s,ref:e})}):null});iQ.displayName=nA;var BAe=df("DialogOverlay.RemoveScroll"),zAe=_.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=ec(nA,t);return c.jsx(HS,{as:BAe,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(st.div,{"data-state":t5(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),tg="DialogContent",aQ=_.forwardRef((n,e)=>{const t=rQ(tg,n.__scopeDialog),{forceMount:r=t.forceMount,...s}=n,i=ec(tg,n.__scopeDialog);return c.jsx(ss,{present:r||i.open,children:i.modal?c.jsx($Ae,{...s,ref:e}):c.jsx(UAe,{...s,ref:e})})});aQ.displayName=tg;var $Ae=_.forwardRef((n,e)=>{const t=ec(tg,n.__scopeDialog),r=_.useRef(null),s=Ct(e,t.contentRef,r);return _.useEffect(()=>{const i=r.current;if(i)return AT(i)},[]),c.jsx(oQ,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(n.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:$e(n.onPointerDownOutside,i=>{const a=i.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&i.preventDefault()}),onFocusOutside:$e(n.onFocusOutside,i=>i.preventDefault())})}),UAe=_.forwardRef((n,e)=>{const t=ec(tg,n.__scopeDialog),r=_.useRef(!1),s=_.useRef(!1);return c.jsx(oQ,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,o;(a=n.onCloseAutoFocus)==null||a.call(n,i),i.defaultPrevented||(r.current||(o=t.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,u;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((u=t.triggerRef.current)==null?void 0:u.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),oQ=_.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...a}=n,o=ec(tg,t),l=_.useRef(null),u=Ct(e,l);return CT(),c.jsxs(c.Fragment,{children:[c.jsx(US,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(_g,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":t5(o.open),...a,ref:u,onDismiss:()=>o.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(HAe,{titleId:o.titleId}),c.jsx(qAe,{contentRef:l,descriptionId:o.descriptionId})]})]})}),e5="DialogTitle",lQ=_.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=ec(e5,t);return c.jsx(st.h2,{id:s.titleId,...r,ref:e})});lQ.displayName=e5;var cQ="DialogDescription",uQ=_.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=ec(cQ,t);return c.jsx(st.p,{id:s.descriptionId,...r,ref:e})});uQ.displayName=cQ;var dQ="DialogClose",hQ=_.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=ec(dQ,t);return c.jsx(st.button,{type:"button",...r,ref:e,onClick:$e(n.onClick,()=>s.onOpenChange(!1))})});hQ.displayName=dQ;function t5(n){return n?"open":"closed"}var fQ="DialogTitleWarning",[VAe,pQ]=Fhe(fQ,{contentName:tg,titleName:e5,docsSlug:"dialog"}),HAe=({titleId:n})=>{const e=pQ(fQ),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
710
711If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
712
713For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return _.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},WAe="DialogDescriptionWarning",qAe=({contentRef:n,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pQ(WAe).contentName}}.`;return _.useEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,n,e]),null},n5=eQ,mQ=nQ,r5=sQ,KS=iQ,YS=aQ,XS=lQ,ZS=uQ,BT=hQ;const ai=n5,GAe=mQ,KAe=r5,gQ=_.forwardRef(({className:n,...e},t)=>c.jsx(KS,{ref:t,className:ke("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",n),...e}));gQ.displayName=KS.displayName;const Ls=_.forwardRef(({className:n,children:e,...t},r)=>c.jsxs(KAe,{children:[c.jsx(gQ,{}),c.jsxs(YS,{ref:r,className:ke("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:rou
713nded-lg",n),...t,children:[e,c.jsxs(BT,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none p-2 -m-2",children:[c.jsx(Ho,{className:"h-5 w-5"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ls.displayName=YS.displayName;const Fs=({className:n,...e})=>c.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Fs.displayName="DialogHeader";const Tg=({className:n,...e})=>c.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});Tg.displayName="DialogFooter";const Bs=_.forwardRef(({className:n,...e},t)=>c.jsx(XS,{ref:t,className:ke("text-lg font-semibold leading-none tracking-tight",n),...e}));Bs.displayName=XS.displayName;const Df=_.forwardRef(({className:n,...e},t)=>c.jsx(ZS,{ref:t,className:ke("text-sm text-muted-foreground",n),...e}));Df.displayName=ZS.displayName;function YAe({heroName:n,heroYears:e,portraitUrl:t,quote:r,descriptor:s,personaId:i}){var C;const[a,o]=_.useState(!1),[l,u]=_.useState(!1),[d,h]=_.useState(!1),[f,p]=_.useState(""),[m,g]=_.useState(""),[y,v]=_.useState(null),[x,b]=_.useState(null);_.useEffect(()=>()=>{y&&URL.revokeObjectURL(y)},[y]);const E=async()=>{o(!0);const A=`https://heroesofthefaith.ai/persona/${i}`,T=r?`"${r}"
714
715— ${n}`:`Discover ${n} on Heroes of the Faith.`,j=`${T}
716
717${A}`;p(A),g(j);try{const D=HU(n),R=await OAe({heroName:n,heroYears:e,quote:r||void 0,portraitUrl:t||void 0,descriptor:s||n});if(R){const M=URL.createObjectURL(R);b(R),v(N=>(N&&URL.revokeObjectURL(N),M))}else b(null),v(M=>(M&&URL.revokeObjectURL(M),null));if(navigator.share&&R)try{const M=new File([R],`${D}-share.png`,{type:"image/png"});if(navigator.canShare&&navigator.canShare({files:[M]})){await navigator.share({title:n,text:`${T}
718
719${A}`,files:[M]}),u(!0),setTimeout(()=>u(!1),2e3),o(!1);return}}catch{}if(navigator.share)try{await navigator.share({title:n,text:T,url:A}),u(!0),setTimeout(()=>u(!1),2e3),o(!1);return}
719catch(M){if(M.name==="AbortError"){o(!1);return}}h(!0)}catch(D){console.error("Share failed:",D),h(!0)}finally{o(!1)}},S=async()=>{var j;if(!x)return;const A=HU(n),T=new File([x],`${A}-share.png`,{type:"image/png"});if(navigator.share&&((j=navigator.canShare)!=null&&j.call(navigator,{files:[T]})))try{await navigator.share({title:n,text:m,files:[T]}),h(!1);return}catch(D){if(D.name==="AbortError")return}if(y){const D=document.createElement("a");D.href=y,D.download=`${A}-share.png`,document.body.appendChild(D),D.click(),document.body.removeChild(D),Ye.success("Image downloaded! Share it on your favorite platform.")}},k=typeof navigator<"u"&&navigator.share&&((C=navigator.canShare)==null?void 0:C.call(navigator,{files:[new File([],"test.png",{type:"image/png"})]}));return c.jsxs(c.Fragment,{children:[c.jsxs(xe,{variant:"outline",size:"sm",onClick:E,disabled:a,className:"gap-2 border-primary/40 bg-primary/10 hover:bg-primary/20 text-primary hover:text-primary transition-all",children:[a?c.jsx(et,{className:"h-4 w-4 animate-spin"}):l?c.jsx(Go,{className:"h-4 w-4"}):c.jsx(k2,{className:"h-4 w-4"}),"Share"]}),c.jsx(ai,{open:d,onOpenChange:h,children:c.jsxs(Ls,{className:"sm:max-w-md",children:[c.jsxs(Fs,{children:[c.jsxs(Bs,{className:"font-serif",children:["Share ",n]}),c.jsx(Df,{children:"Share this image on social media."})]}),c.jsxs("div",{className:"space-y-4",children:[y?c.jsx("div",{className:"overflow-hidden rounded-md border border-border bg-muted/30",children:c.jsx("img",{src:y,alt:`Share card for ${n}`,className:"h-auto w-full",loading:"lazy"})}):null,x?c.jsxs(xe,{onClick:S,className:"w-full gap-2",children:[k?c.jsx(k2,{className:"h-4 w-4"}):c.jsx(yF,{className:"h-4 w-4"}),k?"Share":"Download Image"]}):null]})]})})]})}function XAe({personaId:n,personaName:e,birthYear:t,deathYear:r}){const{data:s,isLoading:i}=pt({queryKey:["persona-contemporaries",n],queryFn:async()=>{if(!t||!r)return[];const{data:a,error:o}=await pe.from("personas").select("id, slug, full_name, portrait_image_url, birth_year, death_year").eq("is_published",!0).neq("id",n);if(o)throw o;return a.filter(u=>{if(!u.birth_year||!u.death_year)return!1;const d=Math.max(t,u.birth_year);return Math.min(r,u.death_year)>d}).map(u=>{const d=Math.max(t,u.birth_year),h=Math.min(r,u.death_year);return{...u,overlapYears:h-d}}).sort((u,d)=>d.overlapYears-u.overlapYears).slice(0,6)},enabled:!!n&&!!t&&!!r});return!t||!r?null:i?c.jsxs("section",{className:"mb-12",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold mb-6 flex items-center gap-2",children:[c.jsx(Ku,{className:"h-5 w-5 text-accent"}),"Contemporaries & Connections"]}),c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[...Array(6)].map((a,o)=>c.jsx(mt,{children:c.jsxs(kt,{className:"pt-4 flex flex-col items-center",children:[c.jsx(qt,{className:"w-16 h-16 rounded-full mb-3"}),c.jsx(qt,{className:"h-4 w-24 mb-1"}),c.jsx(qt,{className:"h-3 w-16"})]})},o))})]}):!s||s.length===0?c.jsxs("section",{className:"mb-12",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold mb-6 flex items-center gap-2",children:[c.jsx(Ku,{className:"h-5 w-5 text-accent"}),"Contemporaries & Connections"]}),c.jsx(mt,{className:"border-dashed",children:c.jsxs(kt,{className:"pt-6 text-center text-muted-foreground",children:[c.jsx(Ku,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No contemporaries found in the archive."})]})})]}):c.jsxs("section",{className:"mb-12",children:[c.jsxs("div",{className:"flex items-center justify-between mb-6",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold flex items-center gap-2",children:[c.jsx(Ku,{className:"h-5 w-5 text-accent"}),"Contemporaries & Connections"]}),c.jsx(xe,{asChild:!0,variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:c.jsxs(Rt,{to:"/explore",children:[c.jsx(_F,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"View Full Network"})]})})]}),c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"text-center mb-6",children:c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Figures whose lives overlapped with ",c.jsx("span",{className:"font-medium text-foreground",children:e.split(" ")[0]})]})}),c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:s.map((a,o)=>c.jsx(Rt,{to:`/persona/${a.slug}`,className:"group",children:c.jsx(mt,{className:"h-full transition-all duration-200 hover:shadow-lg hover:border-accent/50 hover:-translate-y-1",children:c.jsxs(kt,{className:"pt-4 flex flex-col items-center text-center",children:[c.jsxs("div",{className:"relative mb-3",children:[c.jsx("div",{className:"w-16 h-16 rounded-full bg-secondary overflow-hidden border-2 border-background shadow-md group-hover:border-accent/50 transition-colors",children:a.portrait_image_url?c.jsx("img",{src:a.portrait_image_url,alt:a.full_name,className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx(Js,{className:"w-8 h-8 text-muted-foreground"})})}),c.jsx("div",{className:"absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-accent/80 text-accent-foreground text-[10px] font-bold flex items-center justify-center shadow-sm",title:`${a.overlapYears} years overlap`,children:a.overlapYears>99?"99+":a.overlapYears})]}),c.jsx("h3",{className:"font-serif font-medium text-sm leading-tight mb-1 group-hover:text-accent transition-colors",children:a.full_name}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.birth_year,"–",a.death_year]})]})})},a.id))}),c.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[c.jsx("div",{className:"w-4 h-4 rounded-full bg-accent/80"}),c.jsx("span",{children:"Number indicates years of overlapping lifespans"})]})]})]})}function ZAe({book:n,open:e,onOpenChange:t}){const r=vr(),{user:s}=Vt();_.useState(!1);const i=()=>{n&&(t(!1),r(`/reader/${n.id}`))},a=()=>{n!=null&&n.external_url&&window.open(n.external_url,"_blank")};return n?c.jsx(ai,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-lg",children:[c.jsx(Fs,{children:c.jsx(Bs,{className:"font-serif text-xl",children:n.title})}),c.jsxs("div",{className:"space-y-4",children:[n.cover_url&&c.jsx("div",{className:"flex justify-center",children:c.jsx("img",{src:n.cover_url,alt:n.title,className:"h-48 w-auto rounded-md shadow-lg object-cover"})}),n.author&&c.jsxs("p",{className:"text-center text-muted-foreground",children:["by ",n.author]}),n.description&&c.jsx("p",{className:"text-sm text-muted-foreground line-clamp-4",children:n.description}),c.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[(n.file_path||n.external_url)&&c.jsxs(xe,{onClick:i,className:"gap-2 w-full",children:[c.jsx(En,{className:"h-4 w-4"}),s?"Read Now":"Sign in to Read"]}),n.external_url&&c.jsxs(xe,{variant:"outline",onClick:a,className:"gap-2 w-full",children:[c.jsx(iT,{className:"h-4 w-4"}),"Open Original Source"]})]})]})]})}):null}const JAe={book:"Book",sermon:"Sermon",letter:"Letter",journal:"Journal",speech:"Speech"},QAe={era:"badge-era",category:"badge-category",region:"badge-region",theme:"badge-theme"};function eNe(){var p;const{slug:n}=Xc(),[e,t]=_.useState(null),[r,s]=_.useState(!1),{data:i,isLoading:a}=pt({queryKey:["persona",n],queryFn:async()=>{const{data:m,error:g}=await pe.from("personas").select("*").eq("slug",n).eq("is_published",!0).maybeSingle();if(g)throw g;return m},enabled:!!n}),{data:o}=pt({queryKey:["persona-profile-labels",i==null?void 0:i.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("persona_labels").select("label_id, labels(id, name, label_type)").eq("persona_id",i.id);if(g)throw g;return m.map(y=>y.labels)},enabled:!!(i!=null&&i.id)}),{data:l}=pt({queryKey:["persona-profile-quotes",i==null?void 0:i.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("persona_quotes").select("*").eq("persona_id",i.id).order("verified",{ascending:!1}).order("created_at",{ascending:!0}).limit(5);if(g)throw g;return m},enabled:!!(i!=null&&i.id)}),{data:u}=pt({queryKey:["persona-profile-writings",i==null?void 0:i.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("persona_writings").select("*").eq("persona_id",i.id).order("title");if(g)throw g;return m},enabled:!!(i!=null&&i.id)}),{data:d}=pt({queryKey:["persona-profile-positions",i==null?void 0:i.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("persona_theological_positions").select("*").eq("persona_id",i.id).order("position_key");if(g)throw g;return m},enabled:!!(i!=null&&i.id)}),{data:h}=pt({queryKey:["persona-profile-books",i==null?void 0:i.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("books").select("id, title, author, cover_url, file_path, external_url, format, description").eq("persona_id",i.id).eq("is_public",!0).order("title");if(g)throw g;return m},enabled:!!(i!=null&&i.id)}),f=o==null?void 0:o.reduce((m,g)=>(m[g.label_type]||(m[g.label_type]=[]),m[g.label_type].push(g),m),{});return a?c.jsx(cn,{children:c.jsx(PAe,{})}):i?c.jsxs(cn,{children:[c.jsx(DAe,{name:i.full_name,description:i.short_biography,birthYear:i.birth_year,deathYear:i.death_year,imageUrl:i.portrait_image_url,slug:i.slug}),c.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-5xl",children:[c.jsx(YJ,{className:"mb-6",children:c.jsxs(XJ,{children:[c.jsx(rC,{
719children:c.jsx(WM,{asChild:!0,children:c.jsxs(Rt,{to:"/",className:"flex items-center gap-1",children:[c.jsx(oT,{className:"h-3.5 w-3.5"}),"Home"]})})}),c.jsx(qM,{}),c.jsx(rC,{children:c.jsx(WM,{asChild:!0,children:c.jsx(Rt,{to:"/personas",children:"Heroes"})})}),c.jsx(qM,{}),c.jsx(rC,{children:c.jsx(ZJ,{children:i.full_name})})]})}),c.jsxs("div",{className:"flex flex-col md:flex-row gap-8 mb-12",children:[c.jsx("div",{className:"flex-shrink-0",children:c.jsx("div",{className:"w-48 h-48 md:w-56 md:h-56 rounded-lg bg-secondary flex items-center justify-center overflow-hidden shadow-lg mx-auto md:mx-0",children:c.jsx(X3,{src:i.portrait_image_url,alt:i.full_name,priority:!0,aspectRatio:"square",sizes:"(max-width: 768px) 192px, 224px",width:448,optimize:!0,className:"w-full h-full object-cover scale-[1.15]",fallback:c.jsx(Js,{className:"w-20 h-20 text-muted-foreground"})})})}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex items-center gap-4 mb-2 flex-wrap",children:[c.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-semibold",children:i.full_name}),c.jsx(YAe,{heroName:i.full_name,heroYears:`${i.birth_year||"?"} – ${i.death_year||"?"}`,portraitUrl:i.portrait_image_url,quote:(p=l==null?void 0:l[0])==null?void 0:p.quote_text,descriptor:i.short_biography.slice(0,100),personaId:i.slug})]}),(i.birth_year||i.death_year)&&c.jsxs("p",{className:"text-lg text-muted-foreground mb-4",children:[i.birth_year||"?"," – ",i.death_year||"?"]}),f&&Object.keys(f).length>0&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:["era","category","region","theme"].map(m=>{const g=f[m];return g?g.map(y=>c.jsx(jt,{className:QAe[y.label_type],children:y.name},y.id)):null})}),c.jsx("p",{className:"text-muted-foreground leading-relaxed mb-6",children:i.short_biography}),c.jsxs("div",{className:"flex flex-wrap gap-3",children:[c.jsx(Rt,{to:`/chat/${i.slug}`,children:c.jsxs(xe,{className:"gap-2",children:[c.jsx(l1,{className:"h-4 w-4"}),"Chat with ",i.full_name.split(" ")[0]]})}),c.jsx(Rt,{to:`/debate?personaA=${i.id}`,children:c.jsxs(xe,{variant:"outline",className:"gap-2",children:[c.jsx(zi,{className:"h-4 w-4"}),"Have ",i.full_name.split(" ")[0]," debate someone else"]})})]})]})]}),c.jsx(nf,{className:"mb-12"}),i.long_biography&&c.jsxs("section",{className:"mb-12",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-6",children:"Biography"}),c.jsx("div",{className:"prose-archive max-w-none",children:i.long_biography.split(`
720
721`).map((m,g)=>c.jsx("p",{className:"text-foreground/90 leading-relaxed mb-4",children:m},g))})]}),c.jsxs("section",{className:"mb-12",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold mb-6 flex items-center gap-2",children:[c.jsx(ud,{className:"h-5 w-5 text-accent"}),"From the Writings"]}),l&&l.length>0?c.jsx("div",{className:"space-y-6",children:l.map(m=>c.jsx(mt,{className:"border-l-4 border-l-accent/50",children:c.jsxs(kt,{className:"pt-6",children:[c.jsxs("blockquote",{className:"text-lg italic text-foreground/90 mb-4 leading-relaxed",children:['"',m.quote_text,'"']}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"font-medium",children:["— ",m.source_title]}),m.approximate_date&&c.jsxs("span",{children:["(",m.approximate_date,")"]}),c.jsx(jt,{variant:"outline",className:"ml-2",children:JAe[m.source_type]})]}),m.context_notes&&c.jsx("p",{className:"text-sm text-muted-foreground mt-3 italic",children:m.context_notes})]})},m.id))}):c.jsx(mt,{className:"border-dashed",children:c.jsxs(kt,{className:"pt-6 text-center text-muted-foreground",children:[c.jsx(ud,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No quotes yet for this persona."})]})})]}),c.jsxs("section",{className:"mb-12",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold mb-6 flex items-center gap-2",children:[c.jsx(NO,{className:"h-5 w-5 text-accent"}),"Theological Positions"]}),d&&d.length>0?c.jsx("div",{className:"grid gap-4",children:d.map(m=>c.jsxs(mt,{children:[c.jsx(Ln,{className:"pb-2",children:c.jsx(Wn,{className:"text-lg font-serif",children:m.position_key})}
721),c.jsxs(kt,{children:[c.jsx("p",{className:"text-foreground/90 leading-relaxed mb-3",children:m.position_value}),m.scripture_references&&m.scripture_references.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:m.scripture_references.map((g,y)=>c.jsx(jt,{variant:"secondary",className:"text-xs",children:g},y))})]})]},m.id))}):c.jsx(mt,{className:"border-dashed",children:c.jsxs(kt,{className:"pt-6 text-center text-muted-foreground",children:[c.jsx(NO,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No theological positions added yet."})]})})]}),c.jsxs("section",{className:"mb-12",children:[c.jsxs("h2",{className:"font-serif text-2xl font-semibold mb-6 flex items-center gap-2",children:[c.jsx(En,{className:"h-5 w-5 text-accent"}),"Key Writings"]}),h&&h.length>0&&c.jsxs("div",{className:"mb-6",children:[c.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Available to Read"}),c.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:h.map(m=>c.jsx(mt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>{t(m),s(!0)},children:c.jsx(kt,{className:"p-4",children:c.jsxs("div",{className:"flex gap-3",children:[m.cover_url?c.jsx("img",{src:m.cover_url,alt:m.title,className:"w-16 h-24 object-cover rounded shadow-sm flex-shrink-0 group-hover:shadow-md transition-shadow"}):c.jsx("div",{className:"w-16 h-24 bg-muted rounded flex items-center justify-center flex-shrink-0",children:c.jsx(En,{className:"h-6 w-6 text-muted-foreground"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h3",{className:"font-medium line-clamp-2 group-hover:text-primary transition-colors",children:m.title}),m.author&&c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:m.author}),c.jsx(jt,{variant:"outline",className:"text-xs mt-2 uppercase",children:m.format})]})]})})},m.id))})]}),u&&u.length>0?c.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:u.map(m=>c.jsx(mt,{className:"hover:shadow-md transition-shadow",children:c.jsx(kt,{className:"pt-6",children:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-medium mb-1",children:m.title}),m.document_type&&c.jsx(jt,{variant:"outline",className:"text-xs",children:m.document_type})]}),m.external_link&&c.jsx("a",{href:m.external_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 flex-shrink-0",children:c.jsx(iT,{className:"h-4 w-4"})})]})})},m.id))}):!(h!=null&&h.length)&&c.jsx(mt,{className:"border-dashed",children:c.jsxs(kt,{className:"pt-6 text-center text-muted-foreground",children:[c.jsx(En,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No key writings added yet."})]})})]}),c.jsx(XAe,{personaId:i.id,personaName:i.full_name,birthYear:i.birth_year,deathYear:i.death_year}),c.jsx(ZAe,{book:e,open:r,onOpenChange:s}),c.jsxs("div",{className:"text-center py-8 bg-secondary/30 rounded-lg",children:[c.jsxs("h3",{className:"font-serif text-xl font-semibold mb-2",children:["Engage with ",i.full_name.split(" ")[0],"'s Thought"]}),c.jsx("p",{className:"text-muted-foreground mb-4",children:"Ask questions, explore theology, or discuss Scripture through the lens of this historical figure."}),c.jsx(Rt,{to:`/chat/${i.id}`,children:c.jsxs(xe,{size:"lg",className:"gap-2",children:[c.jsx(l1,{className:"h-4 w-4"}),"Start a Conversation"]})})]})]})]}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-12 text-center",children:[c.jsx("h1",{className:"font-serif text-2xl font-semibold mb-4",children:"Persona Not Found"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"This historical figure doesn't exist or hasn't been published yet."}
721),c.jsx(Rt,{to:"/personas",children:c.jsx(xe,{variant:"outline",children:"Back to Archive"})})]})})}const sC=[{name:"Apostolic",start:0,end:100,color:"hsl(var(--accent) / 0.15)"},{name:"Early Church",start:100,end:325,color:"hsl(var(--accent) / 0.1)"},{name:"Patristic",start:325,end:600,color:"hsl(var(--accent) / 0.15)"},{name:"Medieval",start:600,end:1400,color:"hsl(var(--accent) / 0.1)"},{name:"Reformation",start:1400,end:1600,color:"hsl(var(--accent) / 0.15)"},{name:"Post-Reformation",start:1600,end:1800,color:"hsl(var(--accent) / 0.1)"},{name:"Modern",start:1800,end:2100,color:"hsl(var(--accent) / 0.15)"}];function pP(n){return sC.find(e=>n>=e.start&&n<e.end)}function tNe(){var g,y;const n=vr(),[e,t]=_.useState(null),[r,s]=_.useState(""),[i,a]=_.useState(1),{data:o,isLoading:l}=pt({queryKey:["explore-personas"],queryFn:async()=>{const{data:v,error:x}=await pe.from("personas").select("id, slug, full_name, short_biography, portrait_image_url, birth_year, death_year").eq("is_published",!0).order("birth_year");if(x)throw x;return v}}),u=_.useMemo(()=>{if(!o)return[];const v=[];for(let x=0;x<o.length;x++)for(let b=x+1;b<o.length;b++){const E=o[x],S=o[b];if(!E.birth_year||!E.death_year||!S.birth_year||!S.death_year)continue;const k=Math.max(E.birth_year,S.birth_year),C=Math.min(E.death_year,S.death_year);C>k&&v.push({from:E.id,to:S.id,overlapYears:C-k})}return v},[o]),d=_.useMemo(()=>{if(!o)return new Map;const v=new Map,x=2e3,b={};return o.forEach(E=>{if(!E.birth_year)return;const S=pP(E.birth_year),k=(S==null?void 0:S.name)||"Unknown";b[k]||(b[k]=[]),b[k].push(E)}),o.forEach(E=>{if(!E.birth_year){v.set(E.id,{x:50,y:50,era:"Unknown"});return}const S=2+E.birth_year/x*96,k=pP(E.birth_year),C=(k==null?void 0:k.name)||"Unknown",A=b[C]||[],T=A.findIndex(N=>N.id===E.id),j=A.length,D=18+T/Math.max(j-1,1)*65,R=Math.sin(E.birth_year*.05+T)*8,M=Math.max(15,Math.min(88,D+R));v.set(E.id,{x:S,y:M,era:C})}),v},[o]),h=_.useMemo(()=>{if(!o)return[];if(!r.trim())return o;const v=r.toLowerCase();return o.filter(x=>x.full_name.toLowerCase().includes(v)||x.short_biography.toLowerCase().includes(v))},[o,r]),f=_.useMemo(()=>e?u.filter(v=>v.from===e.id||v.to===e.id):[],[e,u]),p=_.useCallback(v=>{t(x=>(x==null?void 0:x.id)===v.id?null:v)},[]),m=_.useCallback(v=>e?f.some(x=>x.from===v||x.to===v):!1,[e,f]);return l?c.jsx(cn,{children:c.jsx("div",{className:"h-[calc(100vh-4rem)] flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx(_F,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground animate-pulse"}),c.jsx("p",{className:"text-muted-foreground",children:"Loading the network..."})]})})}):c.jsxs(cn,{children:[c.jsx(kd,{title:"Explore Connections",description:"Explore the network of historical Christian figures, their contemporaries, and connections across centuries of church history.",canonicalUrl:"https://heroesofthefaith.ai/explore"}),c.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col overflow-hidden",children:[c.jsx("div",{className:"flex-shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:c.jsx("div",{className:"container mx-auto px-4 py-3",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(Rt,{to:"/pers
721onas",children:c.jsxs(xe,{variant:"ghost",size:"sm",children:[c.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Back to Archive"]})}),c.jsx("div",{className:"hidden sm:block",children:c.jsx("h1",{className:"font-serif text-xl font-semibold",children:"Explore Connections"})})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"relative",children:[c.jsx(Eg,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Lt,{type:"text",placeholder:"Search figures...",value:r,onChange:v=>s(v.target.value),className:"pl-9 w-48 sm:w-64"}),r&&c.jsx("button",{onClick:()=>s(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(Ho,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-1 border rounded-md p-1",children:[c.jsx(xe,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(v=>Math.max(.5,v-.25)),children:c.jsx(hpe,{className:"h-4 w-4"})}),c.jsxs("span",{className:"text-xs text-muted-foreground w-12 text-center",children:[Math.round(i*100),"%"]}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(v=>Math.min(2,v+.25)),children:c.jsx(dpe,{className:"h-4 w-4"})}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>a(1),children:c.jsx(Yfe,{className:"h-4 w-4"})})]})]})]})})}),c.jsxs("div",{className:"flex-1 relative overflow-hidden bg-gradient-to-br from-background via-background to-muted/20",children:[c.jsx("div",{className:"absolute inset-0 flex pointer-events-none",style:{transform:`scale(${i})`,transformOrigin:"center center"},children:sC.map((v,x)=>{const E=(v.end-v.start)/2e3*100,S=v.start/2e3*100;return c.jsxs("div",{className:"absolute top-0 bottom-0 border-r border-border/30",style:{left:`${S}%`,width:`${E}%`,backgroundColor:v.color},children:[c.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 whitespace-nowrap",children:c.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:v.name})}),c.jsx("div",{className:"absolute bottom-2 left-0 text-[10px] text-muted-foreground/50",children:v.start>0&&v.start})]},v.name)})}),c.jsx("div",{className:"absolute inset-x-0 top-0 h-8 bg-background/80 backdrop-blur-sm border-b flex items-end justify-between px-4 text-[10px] text-muted-foreground pointer-events-none z-10",children:sC.map(v=>{const b=v.start/2e3*100,E=(v.end-v.start)/2e3*100;return c.jsxs("div",{className:"absolute flex flex-col items-center pb-1",style:{left:`${b+E/2}%`,transform:"translateX(-50%)"},children:[c.jsx("span",{className:"font-semibold text-foreground/80 text-[11px] hidden sm:block",children:v.name}),c.jsxs("span",{className:"text-muted-foreground",children:[v.start,"–",v.end]})]},v.name)})}),c.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{transform:`scale(${i})`,transformOrigin:"center center"},children:u.map((v,x)=>{const b=d.get(v.from),E=d.get(v.to);if(!b||!E)return null;const S=e&&(v.from===e.id||v.to===e.id);if(e&&!S)return null;const k=S?.6:.1,C=S?2:1;return c.jsx("line",{x1:`${b.x}%`,y1:`${b.y}%`,x2:`${E.x}%`,y2:`${E.y}%`,stroke:"hsl(var(--accent))",strokeWidth:C,opacity:k,className:"transition-all duration-300"},x)})}),c.jsx("div",{className:"absolute inset-0 overflow-auto",style:{transform:`scale(${i})`,transformOrigin:"center center"},children:(g=r?h:o)==null?void 0:g.map(v=>{const x=d.get(v.id);if(!x)return null;const b=(e==null?void 0:e.id)===v.id,E=m(v.id),S=!e||b||E;return c.jsx("button",{onClick:()=>p(v),className:`
722                    absolute transform -translate-x-1/2 -translate-y-1/2
723                    transition-all duration-300 ease-out
724                    focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
725                    ${S?"opacity-100 scale-100":"opacity-30 scale-75"}
726                    ${b?"z-20":"z-10"}
727                  `,style:{left:`${x.x}%`,top:`${x.y}%`},title:`${v.full_name} (${v.birth_year||"?"}–${v.death_year||"?"})`,children:c.jsxs("div",{className:`
728                    relative group
729                    ${b?"scale-125":"hover:scale-110"}
730                    transition-transform duration-200
731                  `,children:[c.jsx("div",{className:`
732                      w-12 h-12 sm:w-14 sm:h-14 rounded-full overflow-hidden
733                      border-2 shadow-lg
734                      ${b?"border-accent ring-4 ring-accent/30":"border-background hover:border-accent/50"}
735                      bg-secondary
736                    `,children:v.portrait_image_url?c.jsx("img",{src:v.portrait_image_url,alt:v.full_name,className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx(Js,{className:"w-6 h-6 text-muted-foreground"})})}),c.jsxs("div",{className:`
737                      absolute left-1/2 -translate-x-1/2 top-full mt-1
738                      bg-popover text-popover-foreground text-xs
739                      px-2 py-1 rounded shadow-md whitespace-nowrap
740                      border
741                      ${b?"opacity-100":"opacity-0 group-hover:opacity-100"}
742                      transition-opacity duration-200
743                      pointer-events-none
744                    `,children:[c.jsx("span",{className:"font-medium",children:v.full_name}),c.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",v.birth_year||"?","–",v.death_year||"?",")"]})]})]})},v.id)})}),e&&c.jsx(mt,{className:"absolute bottom-4 right-4 w-80 shadow-xl animate-fade-in",children:c.jsxs(kt,{className:"pt-4",children:[c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"w-16 h-16 rounded-lg bg-secondary overflow-hidden flex-shrink-0",children:e.portrait_image_url?c.jsx("img",{src:e.portrait_image_url,alt:e.full_name,className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx(Js,{className:"w-8 h-8 text-muted-foreground"})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h3",{className:"font-serif font-semibold truncate",children:e.full_name}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.birth_year||"?","–",e.death_year||"?"]}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.birth_year&&c.jsx(jt,{variant:"outline",className:"text-[10px]",children:((y=pP(e.birth_year))==null?void 0:y.name)||"Unknown Era"}),c.jsxs(jt,{variant:"secondary",className:"text-[10px]",children:[f.length," connections"]})]})]}),c.jsx("button",{onClick:()=>t(null),className:"text-muted-foreground hover:text-foreground",children:c.jsx(Ho,{className:"h-4 w-4"})})]}),c.jsx("p",{className:"text-sm text-muted-foreground mt-3 line-clamp-2",children:e.short_biography}),c.jsxs("div",{className:"flex gap-2 mt-4",children:[c.jsx(xe,{size:"sm",className:"flex-1",onClick:()=>n(`/persona/${e.slug}`),children:"View Profile"}),c.jsx(xe,{size:"sm",variant:"outline",onClick:()=>n(`/chat/${e.slug}`),children:c.jsx(l1,{className:"h-4 w-4"})})]})]})})]}),c.jsx("div",{className:"flex-shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:c.jsx("div",{className:"container mx-auto px-4 py-2",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs",children:[c.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:sC.map(v=>c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:v.color.replace("/ 0.15","/ 0.6").replace("/ 0.1","/ 0.5")}}),c.jsx("span",{className:"text-muted-foreground",children:v.name})]},v.name))}),c.jsx("div",{className:"hidden sm:block h-4 w-px bg-border"}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent"}),c.jsx("span",{className:"text-muted-foreground",children:"Click to see connections"})]}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:"w-4 h-0.5 bg-accent/60"}),c.jsx("span",{className:"text-muted-foreground",children:"Overlapping lifespans"})]})]})]})})})]})]})}const Ca=_.forwardRef(({className:n,...e},t)=>c.jsx("textarea",{className:ke("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
744ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:t,...e}));Ca.displayName="Textarea";function Ft(n){const e=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&e==="[object Date]"?new n.constructor(+n):typeof n=="number"||e==="[object Number]"||typeof n=="string"||e==="[object String]"?new Date(n):new Date(NaN)}function Aa(n,e){return n instanceof Date?new n.constructor(e):new Date(e)}function Li(n,e){const t=Ft(n);return isNaN(e)?Aa(n,NaN):(e&&t.setDate(t.getDate()+e),t)}function Xl(n,e){const t=Ft(n);if(isNaN(e))return Aa(n,NaN);if(!e)return t;const r=t.getDate(),s=Aa(n,t.getTime());s.setMonth(t.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(t.setFullYear(s.getFullYear(),s.getMonth(),r),t)}const s5=6048e5,nNe=864e5,lk=43200,WU=1440;let rNe={};function T0(){return rNe}function Wo(n,e){var o,l,u,d;const t=T0(),r=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Ft(n),i=s.getDay(),a=(i<r?7:0)+i-r;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function ng(n){return Wo(n,{weekStartsOn:1})}function vQ(n){const e=Ft(n),t=e.getFullYear(),r=Aa(n,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const s=ng(r),i=Aa(n,0);i.setFullYear(t,0,4),i.setHours(0,0,0,0);const a=ng(i);return e.getTime()>=s.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}function Kx(n){const e=Ft(n);return e.setHours(0,0,0,0),e}function Yx(n){const e=Ft(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function Mc(n,e){const t=Kx(n),r=Kx(e),s=+t-Yx(t),i=+r-Yx(r);return Math.round((s-i)/nNe)}function sNe(n){const e=vQ(n),t=Aa(n,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),ng(t)}function GM(n,e){const t=e*7;return Li(n,t)}function iNe(n,e){return Xl(n,e*12)}function aNe(n){let e;return n.forEach(function(t){const r=Ft(t);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function oNe(n){let e;return n.forEach(t=>{const r=Ft(t);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function iC(n,e){const t=Ft(n),r=Ft(e),s=t.getTime()-r.getTime();return s<0?-1:s>0?1:s}function JS(n){return Aa(n,Date.now())}function Si(n,e){const t=Kx(n),r=Kx(e);return+t==+r}function i5(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function lNe(n){if(!i5(n)&&typeof n!="number")return!1;const e=Ft(n);return!isNaN(Number(e))}function Xx(n,e){const t=Ft(n),r=Ft(e),s=t.getFullYear()-r.getFullYear(),i=t.getMonth()-r.getMonth();return s*12+i}function cNe(n,e,t){const r=Wo(n,t),s=Wo(e,t),i=+r-Yx(r),a=+s-Yx(s);return Math.round((i-a)/s5)}function uNe(n){return e=>{const r=(n?Math[n]:Math.trunc)(e);return r===0?0:r}}function dNe(n,e){return+Ft(n)-+Ft(e)}function hNe(n){const e=Ft(n);return e.setHours(23,59,59,999),e}function QS(n){const e=Ft(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function fNe(n){const e=Ft(n);return+hNe(e)==+QS(e)}function pNe(n,e){const t=Ft(n),r=Ft(e),s=iC(t,r),i=Math.abs(Xx(t,r));let a;if(i<1)a=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-s*i);let o=iC(t,r)===-s;fNe(Ft(n))&&i===1&&iC(n,r)===1&&(o=!1),a=s*(i-Number(o))}return a===0?0:a}function mNe(n,e,t){const r=dNe(n,e)/1e3;return uNe(t==null?void 0:t.roundingMethod)(r)}function Gi(n){const e=Ft(n);return e.setDate(1),e.setHours(0,0,0,0),e}function yQ(n){const e=Ft(n),t=Aa(n,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}function a5(n,e){var o,l,u,d;const t=T0(),r=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Ft(n),i=s.getDay(),a=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function xQ(n){return a5(n,{weekStartsOn:1}
vendor: 4,284 bytes, line 744
744)}const gNe={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"}},vNe=(n,e,t)=>{let r;const s=gNe[n];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r};function mP(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const yNe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xNe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},bNe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wNe={date:mP({formats:yNe,defaultWidth:"full"}),time:mP({formats:xNe,defaultWidth:"full"}),dateTime:mP({formats:bNe,defaultWidth:"full"})},_Ne={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},SNe=(n,e,t,r)=>_Ne[n];function rb(n){return(e,t)=>{const r=t!=null&&t.context?String(t.context):"standalone";let s;if(r==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,o=t!=null&&t.width?String(t.width):a;s=n.formattingValues[o]||n.formattingValues[a]}else{const a=n.defaultWidth,o=t!=null&&t.width?String(t.width):n.defaultWidth;s=n.values[o]||n.values[a]}const i=n.argumentCallback?n.argumentCallback(e):e;return s[i]}}const ENe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},kNe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},CNe={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"]},ANe={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"]},NNe={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"}},TNe={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"}},jNe=(n,e)=>{const t=Number(n),r=t%100;if(r>20||r<10)switch(r%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},RNe={ordinalNumber:jNe,era:rb({values:ENe,defaultWidth:"wide"}),quarter:rb({values:kNe,defaultWidth:"wide",argumentCallback:n=>n-1}),month:rb({values:CNe,defaultWidth:"wide"}),day:rb({values:ANe,defaultWidth:"wide"}),dayPeriod:rb({values:NNe,defaultWidth:"wide",formattingValues:TNe,defaultFormattingWidth:"wide"})};
vendor: 9,507 bytes, line 744
744function sb(n){return(e,t={})=>{const r=t.width,s=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],o=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?DNe(o,h=>h.test(a)):PNe(o,h=>h.test(a));let u;u=n.valueCallback?n.valueCallback(l):l,u=t.valueCallback?t.valueCallback(u):u;const d=e.slice(a.length);return{value:u,rest:d}}}function PNe(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function DNe(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function ONe(n){return(e,t={})=>{const r=e.match(n.matchPattern);if(!r)return null;const s=r[0],i=e.match(n.parsePattern);if(!i)return null;let a=n.valueCallback?n.valueCallback(i[0]):i[0];a=t.valueCallback?t.valueCallback(a):a;const o=e.slice(s.length);return{value:a,rest:o}}}const MNe=/^(\d+)(th|st|nd|rd)?/i,INe=/\d+/i,LNe={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},FNe={any:[/^b/i,/^(a|c)/i]},BNe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zNe={any:[/1/i,/2/i,/3/i,/4/i]},$Ne={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},UNe={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]},VNe={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},HNe={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]},WNe={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},qNe={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}},GNe={ordinalNumber:ONe({matchPattern:MNe,parsePattern:INe,valueCallback:n=>parseInt(n,10)}),era:sb({matchPatterns:LNe,defaultMatchWidth:"wide",parsePatterns:FNe,defaultParseWidth:"any"}),quarter:sb({matchPatterns:BNe,defaultMatchWidth:"wide",parsePatterns:zNe,defaultParseWidth:"any",valueCallback:n=>n+1}),month:sb({matchPatterns:$Ne,defaultMatchWidth:"wide",parsePatterns:UNe,defaultParseWidth:"any"}),day:sb({matchPatterns:VNe,defaultMatchWidth:"wide",parsePatterns:HNe,defaultParseWidth:"any"}),dayPeriod:sb({matchPatterns:WNe,defaultMatchWidth:"any",parsePatterns:qNe,defaultParseWidth:"any"})},o5={code:"en-US",formatDistance:vNe,formatLong:wNe,formatRelative:SNe,localize:RNe,match:GNe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function KNe(n){const e=Ft(n);return Mc(e,yQ(e))+1}function bQ(n){const e=Ft(n),t=+ng(e)-+sNe(e);return Math.round(t/s5)+1}function wQ(n,e){var d,h,f,p;const t=Ft(n),r=t.getFullYear(),s=T0(),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,a=Aa(n,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const o=Wo(a,e),l=Aa(n,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const u=Wo(l,e);return t.getTime()>=o.getTime()?r+1:t.getTime()>=u.getTime()?r:r-1}function YNe(n,e){var o,l,u,d;const t=T0(),r=(e==null?void 0:e.firstWeekContainsDate)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)??t.firstWeekContainsDate??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=wQ(n,e),i=Aa(n,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Wo(i,e)}function _Q(n,e){const t=Ft(n),r=+Wo(t,e)-+YNe(t,e);return Math.round(r/s5)+1}function On(n,e){const t=n<0?"-":"",r=Math.abs(n).toString().padStart(e,"0");return t+r}const Rd={y(n,e){const t=n.getFullYear(),r=t>0?t:1-t;return On(e==="yy"?r%100:r,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):On(t+1,2)},d(n,e){return On(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(n,e){return On(n.getHours()%12||12,e.length)},H(n,e){return On(n.getHours(),e.length)},m(n,e){return On(n.getMinutes(),e.length)},s(n,e){return On(n.getSeconds(),e.length)},S(n,e){const t=e.length,r=n.getMilliseconds(),s=Math.trunc(r*Math.pow(10,t-3));return On(s,e.length)}},Zg={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},qU={G:function(n,e,t){const r=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(r,{width:"abbreviated"});case"GGGGG":return t.era(r,{width:"narrow"});case"GGGG":default:return t.era(r,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const r=n.getFullYear(),s=r>0?r:1-r;return t.ordinalNumber(s,{unit:"year"})}return Rd.y(n,e)},Y:function(n,e,t,r){const s=wQ(n,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return On(a,2)}return e==="Yo"?t.ordinalNumber(i,{unit:"year"}):On(i,e.length)},R:function(n,e){const t=vQ(n);return On(t,e.length)},u:function(n,e){const t=n.getFullYear();return On(t,e.length)},Q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return On(r,2);case"Qo":return t.ordinalNumber(r,{unit:"quarter"});case"QQQ":return t.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return On(r,2);case"qo":return t.ordinalNumber(r,{unit:"quarter"});case"qqq":return t.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,e,t){const r=n.getMonth();switch(e){case"M":case"MM":return Rd.M(n,e);case"Mo":return t.ordinalNumber(r+1,{unit:"month"});case"MMM":return t.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(r,{width:"wide",context:"formatting"})}},L:function(n,e,t){const r=n.getMonth();switch(e){case"L":return String(r+1);case"LL":return On(r+1,2);case"Lo":return t.ordinalNumber(r+1,{unit:"month"});case"LLL":return t.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(r,{width:"wide",context:"standalone"})}},w:function(n,e,t,r){const s=_Q(n,r);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):On(s,e.length)},I:function(n,e,t){const r=bQ(n);return e==="Io"?t.ordinalNumber(r,{unit:"week"}):On(r,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):Rd.d(n,e)},D:function(n,e,t){const r=KNe(n);return e==="Do"?t.ordinalNumber(r,{unit:"dayOfYear"}):On(r,e.length)},E:function(n,e,t){const r=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(r,{width:"short",context:"formatting"});case"EEEE":default:return t.day(r,{width:"wide",context:"formatting"})}},e:function(n,e,t,r){const s=n.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return On(i,2);case"eo":return t.ordinalNumber(i,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});case"eeee":default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(n,e,t,r){const s=n.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return On(i,e.length);case"co":return t.ordinalNumber(i,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});case"cccc":default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(n,e,t){const r=n.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return On(s,e.length);case"io":return t.ordinalNumber(s,{unit:"day"});case"iii":return t.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(r,{width:"short",context:"formatting"});case"iiii":default:return t.day(r,{width:"wide",context:"formatting"})}},a:function(n,e,t){const s=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,e,t){const r=n.getHours();let s;switch(r===12?s=Zg.noon:r===0?s=Zg.midnight:s=r/12>
vendor: 4,583 bytes, line 744
744=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,e,t){const r=n.getHours();let s;switch(r>=17?s=Zg.evening:r>=12?s=Zg.afternoon:r>=4?s=Zg.morning:s=Zg.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let r=n.getHours()%12;return r===0&&(r=12),t.ordinalNumber(r,{unit:"hour"})}return Rd.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):Rd.H(n,e)},K:function(n,e,t){const r=n.getHours()%12;return e==="Ko"?t.ordinalNumber(r,{unit:"hour"}):On(r,e.length)},k:function(n,e,t){let r=n.getHours();return r===0&&(r=24),e==="ko"?t.ordinalNumber(r,{unit:"hour"}):On(r,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):Rd.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):Rd.s(n,e)},S:function(n,e){return Rd.S(n,e)},X:function(n,e,t){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return KU(r);case"XXXX":case"XX":return np(r);case"XXXXX":case"XXX":default:return np(r,":")}},x:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"x":return KU(r);case"xxxx":case"xx":return np(r);case"xxxxx":case"xxx":default:return np(r,":")}},O:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+GU(r,":");case"OOOO":default:return"GMT"+np(r,":")}},z:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+GU(r,":");case"zzzz":default:return"GMT"+np(r,":")}},t:function(n,e,t){const r=Math.trunc(n.getTime()/1e3);return On(r,e.length)},T:function(n,e,t){const r=n.getTime();return On(r,e.length)}};function GU(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),s=Math.trunc(r/60),i=r%60;return i===0?t+String(s):t+String(s)+e+On(i,2)}function KU(n,e){return n%60===0?(n>0?"-":"+")+On(Math.abs(n)/60,2):np(n,e)}function np(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),s=On(Math.trunc(r/60),2),i=On(r%60,2);return t+s+e+i}const YU=(n,e)=>{switch(n){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"})}},SQ=(n,e)=>{switch(n){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"})}},XNe=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],r=t[1],s=t[2];if(!s)return YU(n,e);let i;switch(r){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}}",YU(r,e)).replace("{{time}}",SQ(s,e))},ZNe={p:SQ,P:XNe},JNe=/^D+$/,QNe=/^Y+$/,eTe=["D","DD","YY","YYYY"];function tTe(n){return JNe.test(n)}function nTe(n){return QNe.test(n)}function rTe(n,e,t){const r=sTe(n,e,t);if(console.warn(r),eTe.includes(n))throw new RangeError(r)}function sTe(n,e,t){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${r} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const iTe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aTe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,oTe=/^'([^]*?)'?$/,lTe=/''/g,cTe=/[a-zA-Z]/;function hr(n,e,t){var d,h,f,p,m,g,y,v;const r=T0(),s=(t==null?void 0:t.locale)??r.locale??o5,i=(t==null?void 0:t.firstWeekContainsDate)??((h=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,a=(t==null?void 0:t.weekStartsOn)??((g=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((v=(y=r.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??0,o=Ft(n);if(!lNe(o))throw new RangeError("Invalid time value");let l=e.match(aTe).map(x=>{const b=x[0];if(b==="p"||b==="P"){const E=ZNe[b];return E(x,s.formatLong)}return x}).join("").match(iTe).map(x=>
744{if(x==="''")return{isToken:!1,value:"'"};const b=x[0];if(b==="'")return{isToken:!1,value:uTe(x)};if(qU[b])return{isToken:!0,value:x};if(b.match(cTe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:x}});s.localize.preprocessor&&(l=s.localize.preprocessor(o,l));const u={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return l.map(x=>{if(!x.isToken)return x.value;const b=x.value;(!(t!=null&&t.useAdditionalWeekYearTokens)&&nTe(b)||!(t!=null&&t.useAdditionalDayOfYearTokens)&&tTe(b))&&rTe(b,e,String(n));const E=qU[b[0]];return E(o,b,s.localize,u)}).join("")}function uTe(n){const e=n.match(oTe);return e?e[1].replace(lTe,"'"):n}function dTe(n,e,t){const r=T0(),s=(t==null?void 0:t.locale)??r.locale??o5,i=2520,a=iC(n,e);if(isNaN(a))throw new RangeError("Invalid time value");const o=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:a});let l,u;a>0?(l=Ft(e),u=Ft(n)):(l=Ft(n),u=Ft(e));const d=mNe(u,l),h=(Yx(u)-Yx(l))/1e3,f=Math.round((d-h)/60);let p;if(f<2)return t!=null&&t.includeSeconds?d<5?s.formatDistance("lessThanXSeconds",5,o):d<10?s.formatDistance("lessThanXSeconds",10,o):d<20?s.formatDistance("lessThanXSeconds",20,o):d<40?s.formatDistance("halfAMinute",0,o):d<60?s.formatDistance("lessThanXMinutes",1,o):s.formatDistance("xMinutes",1,o):f===0?s.formatDistance("lessThanXMinutes",1,o):s.formatDistance("xMinutes",f,o);if(f<45)return s.formatDistance("xMinutes",f,o);if(f<90)return s.formatDistance("aboutXHours",1,o);if(f<WU){const m=Math.round(f/60);return s.formatDistance("aboutXHours",m,o)}else{if(f<i)return s.formatDistance("xDays",1,o);if(f<lk){const m=Math.round(f/WU);return s.formatDistance("xDays",m,o)}else if(f<lk*2)return p=Math.round(f/lk),s.formatDistance("aboutXMonths",p,o)}if(p=pNe(u,l),p<12){const m=Math.round(f/lk);return s.formatDistance("xMonths",m,o)}else{const m=p%12,g=Math.trunc(p/12);return m<3?s.formatDistance("aboutXYears",g,o):m<9?s.formatDistance("overXYears",g,o):s.formatDistance("almostXYears",g+1,o)}}function EQ(n,e){return dTe(n,JS(n),e)}function hTe(n){const e=Ft(n),t=e.getFullYear(),r=e.getMonth(),s=Aa(n,0);return s.setFullYear(t,r+1,0),s.setHours(0,0,0,0),s.getDate()}function fTe(n){return Math.trunc(+Ft(n)/1e3)}function pTe(n){const e=Ft(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(0,0,0,0),e}function mTe(n,e){return cNe(pTe(n),Gi(n),e)+1}function KM(n,e){const t=Ft(n),r=Ft(e);return t.getTime()>r.getTime()}function kQ(n,e){const t=Ft(n),r=Ft(e);return+t<+r}function gTe(n,e,t){const r=Wo(n,t),s=Wo(e,t);return+r==+s}function zT(n,e){const t=Ft(n),r=Ft(e);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()}function vTe(n,e){const t=Ft(n),r=Ft(e);return t.getFullYear()===r.getFullYear()}function yTe(n){return zT(n,JS(n))}function xTe(n,e){return gTe(n,JS(n),e)}function bTe(n){return Si(n,JS(n))}function aC(n,e){return Li(n,-e)}function wTe(n){return Si(n,aC(JS(n),1))}function gP(n,e){const t=Ft(n),r=t.getFullYear(),s=t.getDate(),i=Aa(n,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const a=hTe(i);return t.setMonth(e,Math.min(s,a)),t}function XU(n,e){const t=Ft(n);return isNaN(+t)?Aa(n,NaN):(t.setFullYear(e),t)}function _Te({isCollapsed:n,onToggle:e}){const{user:t}=Vt(),{personaId:r}=Xc(),{data:s,isLoading:i}=pt({queryKey:["user-conversations",t==null?void 0:t.id],queryFn:async()=>{const{data:o,error:l}=await pe.from("conversations").select(`
745          id,
746          updated_at,
747          title,
748          conversation_personas(
749            persona_id,
750            personas(id, full_name, portrait_image_url)
751          )
752        `).eq("user_id",t.id).eq("conversation_type","single_chat").order("updated_at",{ascending:!1});if(l)throw l;return o},enabled:!!t}),a=s==null?void 0:s.reduce((o,l)=>{var d;const u=(d=l.conversation_personas[0])==null?void 0:d.personas;return u&&(o[u.id]||(o[u.id]={persona:u,conversations:[]}),o[u.id].conversations.push(l)),o},{});return n?c.jsxs("div",{className:"w-12 border-r bg-card flex flex-col items-center py-3",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:e,className:"mb-4",children:c.jsx(BG,{className:"h-4 w-4"})}),s==null?void 0:s.slice(0,5).map(o=>{var u;const l=(u=o.conversation_personas[0])==null?void 0:u.personas;return l?c.jsx(Rt,{to:`/chat/${l.id}`,className:"w-8 h-8 rounded-full bg-secondary flex items-center justify-center overflow-hidden mb-2 hover:ring-2 ring-primary transition-all",children:l.portrait_image_url?c.jsx("img",{src:l.portrait_image_url,alt:l.full_name,className:"w-full h-full object-cover"}):c.jsx(Js,{className:"w-4 h-4 text-muted-foreground"})},o.id):null})]}):c.jsxs("div",{className:"w-64 border-r bg-card flex flex-col",children:[c.jsxs("div",{className:"p-3 border-b flex items-center justify-between",children:[c.jsx("h2",{className:"font-semibold text-sm",children:"Conversations"}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:e,children:c.jsx(Jfe,{className:"h-4 w-4"})})]}),c.jsx(Or,{className:"flex-1",children:c.jsx("div",{className:"p-2",children:i?c.jsx("div",{className:"text-sm text-muted-foreground p-3 text-center",children:"Loading..."}):s!=null&&s.length?Object.values(a||{}).map(({persona:o,conversations:l})=>c.jsx("div",{className:"mb-4",children:c.jsxs(Rt,{to:`/chat/${o.id}`,className:ke("flex items-center gap-2 p-2 rounded-lg hover:bg-muted/50 transition-colors",r===o.id&&"bg-muted"),children:[c.jsx("div",{className:"w-8 h-8 rounded-full bg-secondary flex-shrink-0 flex items-center justify-center overflow-hidden",children:o.portrait_image_url?c.jsx("img",{src:o.portrait_image_url,alt:o.full_name,className:"w-full h-full object-cover"}):c.jsx(Js,{className:"w-4 h-4 text-muted-foreground"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-medium text-sm truncate",children:o.full_name}),c.jsx("p",{className:"text-xs text-muted-foreground",children:EQ(new Date(l[0].updated_at),{addSuffix:!0})})]})]})},o.id)):c.jsxs("div",{className:"text-sm text-muted-foreground p-3 text-center",children:[c.jsx(Tf,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No conversations yet"}),c.jsx("p",{className:"text-xs mt-1",children:"Start chatting with a historical figure"})]})})}),c.jsx("div",{className:"p-3 border-t",children:c.jsx(Rt,{to:"/pers
752onas",children:c.jsxs(xe,{variant:"outline",size:"sm",className:"w-full",children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"New Conversation"]})})})]})}const STe="https://delgyrqdrcihvvudekdx.supabase.co/functions/v1/chat-with-persona";function ETe(){const{personaSlug:n}=Xc(),e=vr();$n();const{user:t}=Vt(),[r,s]=_.useState([]),[i,a]=_.useState(""),[o,l]=_.useState(!1),[u,d]=_.useState(null),[h,f]=_.useState(!0),[p,m]=_.useState(!1),g=_.useRef(null),y=_.useRef(null),{data:v,isLoading:x}=pt({queryKey:["chat-persona",n],queryFn:async()=>{const{data:A,error:T}=await pe.from("personas").select("*").eq("slug",n).eq("is_published",!0).maybeSingle();if(T)throw T;return A},enabled:!!n}),b=v==null?void 0:v.id;_.useEffect(()=>{if(!t||!b){f(!1);return}(async()=>{try{const{data:T,error:j}=await pe.from("conversations").select(`
753            id,
754            conversation_personas!inner(persona_id)
755          `).eq("user_id",t.id).eq("conversation_type","single_chat").eq("conversation_personas.persona_id",b).order("updated_at",{ascending:!1}).limit(1).maybeSingle();if(j)throw j;if(T){d(T.id);const{data:D,error:R}=await pe.from("messages").select("id, role, content").eq("conversation_id",T.id).order("created_at",{ascending:!0});if(R)throw R;D&&s(D.map(M=>({id:M.id,role:M.role==="user"?"user":"assistant",content:M.content})))}}catch(T){console.error("Error loading conversation:",T)}finally{f(!1)}})()},[t,b]);const E=_.useCallback(async(A,T,j)=>{const{data:D,error:R}=await pe.from("messages").insert({conversation_id:j,role:A,content:T,persona_id:A==="persona"?b:null}).select("id").single();return R?(console.error("Error saving message:",R),null):D.id},[b]),S=_.useCallback(async()=>{if(!t||!b)return null;const{data:A,error:T}=await pe.from("conversations").insert({user_id:t.id,conversation_type:"single_chat",title:null}).select("id").single();if(T)return console.error("Error creating conversation:",T),null;const{error:j}=await pe.from("conversation_personas").insert({conversation_id:A.id,persona_id:b,role:"primary"});return j?(console.error("Error linking persona:",j),null):A.id},[t,b]);_.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);const k=async()=>{var R,M,N,U,q,I;if(!i.trim()||o||!b||!t)return;const A={role:"user",content:i.trim()},T=[...r,A];s(T),a(""),l(!0);let j="",D=u;try{if(!D){if(D=await S(),!D){Ye.error("Failed to create conversation"),l(!1);return}d(D)}await E("user",A.content,D),await pe.from("conversations").update({updated_at:new Date().toISOString()}).eq("id",D);const{data:{session:B}}=await pe.auth.getSession();if(!(B!=null&&B.access_token)){Ye.error("Please sign in to continue."),l(!1);return}const $=await fetch(STe,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B.access_token}`},body:JSON.stringify({personaId:b,messages:T.map(te=>({role:te.role,content:te.content}))})});if(!$.ok){const te=await $.json();$.status===429?Ye.error("Rate limit exceeded. Please wait a moment and try again."):$.status===402?Ye.error("AI credits exhausted. Please add credits to continue."):Ye.error(te.error||"Failed to get response"),l(!1);return}if(!$.body)throw new Error("No response body");const ie=$.body.getReader(),ne=new TextDecoder;let L="";for(s(te=>[...te,{role:"assistant",content:""}]);;){const{done:te,value:ae}=await ie.read();if(te)break;L+=ne.decode(ae,{stream:!0});let de;for(;(de=L.indexOf(`
756`))!==-1;){let ue=L.slice(0,de);if(L=L.slice(de+1),ue.endsWith("\r")&&(ue=ue.slice(0,-1)),ue.startsWith(":")||ue.trim()===""||!ue.startsWith("data: "))continue;const le=ue.slice(6).trim();if(le==="[DONE]")break;try{const _e=(N=(M=(R=JSON.parse(le).choices)==null?void 0:R[0])==null?void 0:M.delta)==null?void 0:N.content;_e&&(j+=_e,s(Ne=>{const Pe=[...Ne];return Pe[Pe.length-1]={role:"assistant",content:j},Pe}))}catch{L=ue+`
757`+L;break}}}if(L.trim())for(let te of L.split(`
758`)){if(!te||(te.endsWith("\r")&&(te=te.slice(0,-1)),te.startsWith(":")||te.trim()==="")||!te.startsWith("data: "))continue;const ae=te.slice(6).trim();if(ae!=="[DONE]")try{const ue=(I=(q=(U=JSON.parse(ae).choices)==null?void 0:U[0])==null?void 0:q.delta)==null?void 0:I.content;ue&&(j+=ue,s(le=>{const ve=[...le];return ve[ve.length-1]={role:"assistant",content:j},ve}))}catch{}}j&&D&&await E("persona",j,D)}catch(B){console.error("Chat error:",B),Ye.error("Failed to send message. Please try again."),s($=>{var ie,ne;return((ie=$[$.length-1])==null?void 0:ie.role)==="assistant"&&!((ne=$[$.length-1])!=null&&ne.content)?$.slice(0,-1):$})}finally{l(!1)}},C=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),k())};return x||h?c.jsx(cn,{children:c.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):t?v?c.jsx(cn,{children:c.jsxs("div",{className:"flex h-[calc(100vh-4rem)]",children:[c.jsx(_Te,{isCollapsed:p,onToggle:()=>m(!p)}),c.jsxs("div",{className:"flex flex-col flex-1",children:[c.jsx("div",{className:"border-b bg-card px-4 py-3",children:c.jsxs("div",{className:"container mx-auto flex items-center gap-4",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>e(`/persona/${n}`),children:c.jsx(Ji,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-secondary flex items-center justify-center overflow-hidden",children:v.portrait_image_url?c.jsx("img",{src:v.portrait_image_url,alt:v.full_name,className:"w-full h-full object-cover"}):c.jsx(Js,{className:"w-5 h-5 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif font-semibold",children:v.full_name}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.birth_year||"?"," – ",v.death_year||"?"]})]})]})]})}),c.jsx(Or,{ref:g,className:"flex-1 px-4 py-6",children:c.jsx("div",{className:"container mx-auto max-w-3xl space-y-6",children:r.length===0?c.jsxs("div",{className:"text-center py-12",children:[c.jsx("div",{className:"w-20 h-20 rounded-full bg-secondary mx-auto mb-4 flex items-center justify-center overflow-hidden",children:v.portrait_image_url?c.jsx("img",{src:v.portrait_image_url,alt:v.full_name,className:"w-full h-full object-cover"}):c.jsx(Js,{className:"w-10 h-10 text-muted-foreground"})}),c.jsxs("h2",{className:"font-serif text-xl font-semibold mb-2",children:["Speak with ",v.full_name]}),c.jsxs("p",{className:"text-muted-foreground max-w-md mx-auto",children:["Ask questions about theology, Scripture, life, or ministry. ",v.full_name.split(" ")[0]," will respond drawing from their historical writings and known positions."]})]}):r.map((A,T)=>c.jsxs("div",{className:`flex gap-3 ${A.role==="user"?"justify-end":"justify-start"}`,children:[A.role==="assistant"&&c.jsx("div",{className:"w-8 h-8 rounded-full bg-secondary flex-shrink-0 flex items-center justify-center overflow-hidden",children:v.portrait_image_url?c.jsx("img",{src:v.portrait_image_url,alt:v.full_name,className:"w-full h-full object-cover"}):c.jsx(Js,{className:"w-4 h-4 text-muted-foreground"})}),c.jsx(mt,{className:`max-w-[80%] px-4 py-3 ${A.role==="user"?"bg-primary text-primary-foreground":"bg-card"}`,children:c.jsx("div",{className:"prose-archive text-sm whitespace-pre-wrap",children:A.content||c.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[c.jsx(et,{className:"h-3 w-3 animate-spin"}),"Thinking..."]})})}),A.role==="user"&&c.jsx("div",{className:"w-8 h-8 rounded-full bg-primary flex-shrink-0 flex items-center justify-center",children:c.jsx(Js,{className:"w-4 h-4 text-primary-foreground"})})]},T))})}),c.jsx("div",{className:"border-t bg-card px-4 py-4",children:c.jsxs("div",{className:"container mx-auto max-w-3xl",children:[c.jsxs("div",{className:"flex gap-3",children:[c.jsx(Ca,{ref:y,value:i,onChange:A=>a(A.target.value),onKeyDown:C,placeholder:`Ask ${v.full_name.split(" ")[0]} a question...`,className:"min-h-[44px] max-h-32 resize-none",rows:1,disabled:o}),c.jsx(xe,{onClick:k,disabled:!i.trim()||o,size:"icon",className:"h-11 w-11 flex-shrink-0",children:o?c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(TS,{className:"h-4 w-4"})})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"Responses are AI-generated based on historical writings. Not a substitute for Scripture."})]})})]})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-12 text-center",children:[c.jsx(o1,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"font-serif text-2xl font-semibold mb-2",children:"Persona Not Found"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"This historical figure doesn't exist or hasn't been published yet."}
vendor: 3,839 bytes, line 758
758),c.jsx(Rt,{to:"/personas",children:c.jsx(xe,{variant:"outline",children:"Browse the Archive"})})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-12 text-center",children:[c.jsx(o1,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"font-serif text-2xl font-semibold mb-2",children:"Sign In Required"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"Please sign in to chat with historical figures and save your conversations."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[c.jsx(Rt,{to:"/auth",children:c.jsx(xe,{className:"w-full sm:w-auto",children:"Sign In"})}),c.jsx(Rt,{to:"/auth?tab=signup",children:c.jsx(xe,{variant:"outline",className:"w-full sm:w-auto",children:"Free Sign Up"})})]})]})})}function eE(n){const e=_.useRef({value:n,previous:n});return _.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var l5="Radio",[kTe,CQ]=Hr(l5),[CTe,ATe]=kTe(l5),AQ=_.forwardRef((n,e)=>{const{__scopeRadio:t,name:r,checked:s=!1,required:i,disabled:a,value:o="on",onCheck:l,form:u,...d}=n,[h,f]=_.useState(null),p=Ct(e,y=>f(y)),m=_.useRef(!1),g=h?u||!!h.closest("form"):!0;return c.jsxs(CTe,{scope:t,checked:s,disabled:a,children:[c.jsx(st.button,{type:"button",role:"radio","aria-checked":s,"data-state":RQ(s),"data-disabled":a?"":void 0,disabled:a,value:o,...d,ref:p,onClick:$e(n.onClick,y=>{s||l==null||l(),g&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})}),g&&c.jsx(jQ,{control:h,bubbles:!m.current,name:r,value:o,checked:s,required:i,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});AQ.displayName=l5;var NQ="RadioIndicator",TQ=_.forwardRef((n,e)=>{const{__scopeRadio:t,forceMount:r,...s}=n,i=ATe(NQ,t);return c.jsx(ss,{present:r||i.checked,children:c.jsx(st.span,{"data-state":RQ(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})})});TQ.displayName=NQ;var NTe="RadioBubbleInput",jQ=_.forwardRef(({__scopeRadio:n,control:e,checked:t,bubbles:r=!0,...s},i)=>{const a=_.useRef(null),o=Ct(a,i),l=eE(t),u=PS(e);return _.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(h,"checked").set;if(l!==t&&p){const m=new Event("click",{bubbles:r});p.call(d,t),d.dispatchEvent(m)}},[l,t,r]),c.jsx(st.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:o,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});jQ.displayName=NTe;function RQ(n){return n?"checked":"unchecked"}var TTe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$T="RadioGroup",[jTe,Yqe]=Hr($T,[A0,CQ]),PQ=A0(),DQ=CQ(),[RTe,PTe]=jTe($T),OQ=_.forwardRef((n,e)=>{const{__scopeRadioGroup:t,name:r,defaultValue:s,value:i,required:a=!1,disabled:o=!1,orientation:l,dir:u,loop:d=!0,onValueChange:h,...f}=n,p=PQ(t),m=kg(u),[g,y]=Zi({prop:i,defaultProp:s??null,onChange:h,caller:$T});return c.jsx(RTe,{scope:t,name:r,required:a,disabled:o,value:g,onValueChange:y,children:c.jsx(j3,{asChild:!0,...p,orientation:l,dir:m,loop:d,children:c.jsx(st.div,{role:"radiogroup","aria-required":a,"aria-orientation":l,"data-disabled":o?"":void 0,dir:m,...f,ref:e})})})});OQ.displayName=$T;var MQ="RadioGroupItem",IQ=_.forwardRef((n,e)=>{const{__scopeRadioGroup:t,disabled:r,...s}=n,i=PTe(MQ,t),a=i.disabled||r,o=PQ(t),l=DQ(t),u=_.useRef(null),d=Ct(e,u),h=i.value===s.value,f=_.useRef(!1);return _.useEffect(()=>{const p=g=>{TTe.includes(g.key)&&(f.current=!0)},m=()=>f.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",m)}},[]),c.jsx(R3,{asChild:!0,...o,focusable:!a,active:h,children:c.jsx(AQ,{disabled:a,required:i.required,
758checked:h,...l,...s,name:i.name,ref:d,onCheck:()=>i.onValueChange(s.value),onKeyDown:$e(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:$e(s.onFocus,()=>{var p;f.current&&((p=u.current)==null||p.click())})})})});IQ.displayName=MQ;var DTe="RadioGroupIndicator",LQ=_.forwardRef((n,e)=>{const{__scopeRadioGroup:t,...r}=n,s=DQ(t);return c.jsx(TQ,{...s,...r,ref:e})});LQ.displayName=DTe;var FQ=OQ,BQ=IQ,OTe=LQ;const rA=_.forwardRef(({className:n,...e},t)=>c.jsx(FQ,{className:ke("grid gap-2",n),...e,ref:t}));rA.displayName=FQ.displayName;const gu=_.forwardRef(({className:n,...e},t)=>c.jsx(BQ,{ref:t,className:ke("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:c.jsx(OTe,{className:"flex items-center justify-center",children:c.jsx(jG,{className:"h-2.5 w-2.5 fill-current text-current"})})}));gu.displayName=BQ.displayName;var zQ={exports:{}},$Q={};/**
759 * @license React
760 * use-sync-external-store-shim.production.js
761 *
762 * Copyright (c) Meta Platforms, Inc. and affiliates.
763 *
764 * This source code is licensed under the MIT license found in the
765 * LICENSE file in the root directory of this source tree.
766 */var Zx=_;function MTe(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ITe=typeof Object.is=="function"?Object.is:MTe,LTe=Zx.useState,FTe=Zx.useEffect,BTe=Zx.useLayoutEffect,zTe=Zx.useDebugValue;function $Te(n,e){var t=e(),r=LTe({inst:{value:t,getSnapshot:e}}),s=r[0].inst,i=r[1];return BTe(function(){s.value=t,s.getSnapshot=e,vP(s)&&i({inst:s})},[n,t,e]),FTe(function(){return vP(s)&&i({inst:s}),n(function(){vP(s)&&i({inst:s})})},[n]),zTe(t),t}function vP(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ITe(n,t)}catch{return!0}}function UTe(n,e){return e()}var VTe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?UTe:$Te;$Q.useSyncExternalStore=Zx.useSyncExternalStore!==void 0?Zx.useSyncExternalStore:VTe;zQ.exports=$Q;var UT=zQ.exports;function HTe(){return UT.useSyncExternalStore(WTe,()=>!0,()=>!1)}function WTe(){return()=>{}}var c5="Avatar",[qTe,Xqe]=Hr(c5),[GTe,UQ]=qTe(c5),VQ=_.forwardRef((n,e)=>{const{__scopeAvatar:t,...r}=n,[s,i]=_.useState("idle");return c.jsx(GTe,{scope:t,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:c.jsx(st.span,{...r,ref:e})})});VQ.displayName=c5;var HQ="AvatarImage",WQ=_.forwardRef((n,e)=>{const{__scopeAvatar:t,src:r,onLoadingStatusChange:s=()=>{},...i}=n,a=UQ(HQ,t),o=KTe(r,i),l=Pr(u=>{s(u),a.onImageLoadingStatusChange(u)});return Dr(()=>{o!=="idle"&&l(o)},[o,l]),o==="loaded"?c.jsx(st.img,{...i,ref:e,src:r}):null});WQ.displayName=HQ;var qQ="AvatarFallback",GQ=_.forwardRef((n,e)=>{const{__scopeAvatar:t,delayMs:r,...s}=n,i=UQ(qQ,t),[a,o]=_.useState(r===void 0);return _.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>o(!0),r);return()=>window.clearTimeout(l)}},[r]),a&&i.imageLoadingStatus!=="loaded"?c.jsx(st.span,{...s,ref:e}):null});GQ.displayName=qQ;function ZU(n,e){return n?e?(n.src!==e&&(n.src=e),n.complete&&n.naturalWidth>0?"loaded":"loading"):"error":"idle"}function KTe(n,{referrerPolicy:e,crossOrigin:t}){const r=HTe(),s=_.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[a,o]=_.useState(()=>ZU(i,n));return Dr(()=>{o(ZU(i,n))},[i,n]),Dr(()=>{const l=h=>()=>{o(h)};if(!i)return;const u=l("loaded"),d=l("error");return i.addEventListener("load",u),i.addEventListener("error",d),e&&(i.referrerPolicy=e),typeof t=="string"&&(i.crossOrigin=t),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,t,e]),a}var KQ=VQ,YQ=WQ,XQ=GQ;const Ui=_.forwardRef(({className:n,...e},t)=>c.jsx(KQ,{ref:t,className:ke("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",n),...e}));Ui.displayName=KQ.displayName;const Vi=_.forwardRef(({className:n,...e},t)=>c.jsx(YQ,{ref:t,className:ke("aspect-square h-full w-full",n),...e}));Vi.displayName=YQ.displayName;const Hi=_.forwardRef(({className:n,...e},t)=>c.jsx(XQ,{ref:t,className:ke("flex h-full w-full items-center justify-center rounded-full bg-muted",n),...e}));Hi.displayName=XQ.displayName;const ck={monthly:{price_id:"price_1SmuXVCxIOQiB0i8S0QIk1rC",product_id:"prod_TkPMYTqpV0ZPaD",amount:499,label:"$4.99/month",description:"Monthly Pro Access"},lifetime:{price_id:"price_1Smuk5CxIOQiB0i8tOoc9cy1",product_id:"prod_TkPZWThymLN3B4",amount:2900,label:"$29 one-time",description:"Lifetime Pro Access"},promo_code:"fffamily",coupon_id:"wKQKuJfE"};function ZQ({open:n,onOpenChange:e,feature:t}){const{session:r}=Vt(),{checkSubscription:s}=wT(),{toast:i}=Jl(),[a,o]=_.useState(""),[l,u]=_.useState(!1),[d,h]=_.useState(null),f=async(g,y)=>{if(!(r!=null&&r.access_token)){i({title:"Sign in required",description:"Please sign in to upgrade to Pro.",variant:"destructive"});return}h(y);try{const{data:v,error:x}=await pe.functions.invoke("create-checkout",{headers:{Authorization:`Bearer ${r.access_token}`},body:{price_id:g}});if(x)throw x;v!=null&&v.url&&window.open(v.url,"_blank")}catch(v){console.error("Checkout error:",v),i({title:"Checkout failed",description:"Please try again later.",variant:"destructive"})}finally{h(null)}},p=async()=>
766{if(a.trim()){if(!(r!=null&&r.access_token)){i({title:"Sign in required",description:"Please sign in to apply a promo code.",variant:"destructive"});return}u(!0);try{const{data:g,error:y}=await pe.functions.invoke("apply-promo-code",{headers:{Authorization:`Bearer ${r.access_token}`},body:{promo_code:a.trim()}});if(y)throw y;g!=null&&g.success?(i({title:"Welcome to Pro!",description:g.message}),await s(),e(!1)):i({title:"Invalid code",description:(g==null?void 0:g.error)||"This promo code is not valid.",variant:"destructive"})}catch(g){console.error("Promo error:",g),i({title:"Error",description:"Failed to apply promo code. Please try again.",variant:"destructive"})}finally{u(!1)}}},m=[{icon:Tf,text:"Theological Debates between historical figures"},{icon:En,text:"Scripture Study with AI commentary"},{icon:jS,text:"Unlimited conversations with all personas"},{icon:TO,text:"Priority access to new features"}];return c.jsx(ai,{open:n,onOpenChange:e,children:c.jsxs(Ls,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[c.jsxs(Fs,{className:"text-center",children:[c.jsx("div",{className:"mx-auto mb-2",children:c.jsx(TO,{className:"h-10 w-10 text-primary"})}),c.jsx(Bs,{className:"text-2xl font-serif",children:"Unlock the Full Archive"}),c.jsx(Df,{children:t?`${t} is a Pro feature. Upgrade to access this and more.`:"Get unlimited access to debates, scripture study, and all Pro features."})]}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsx("div",{className:"space-y-2",children:m.map((g,y)=>c.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[c.jsx(Go,{className:"h-4 w-4 text-primary shrink-0"}),c.jsx("span",{children:g.text})]},y))}),c.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[c.jsxs(mt,{className:"relative border-2 hover:border-primary/50 transition-colors",children:[c.jsx(Ln,{className:"pb-2",children:c.jsx(Wn,{className:"text-lg",children:"Monthly"})}),c.jsxs(kt,{className:"space-y-3",children:[c.jsx("div",{className:"text-3xl font-bold",children:ck.monthly.label}),c.jsxs(xe,{className:"w-full",variant:"outline",disabled:d!==null,onClick:()=>f(ck.monthly.price_id,"monthly"),children:[d==="monthly"?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Subscribe"]})]})]}),c.jsxs(mt,{className:"relative border-2 border-primary",children:[c.jsx(jt,{className:"absolute -top-2 left-1/2 -translate-x-1/2",children:"Best Value"}),c.jsx(Ln,{className:"pb-2",children:c.jsx(Wn,{className:"text-lg",children:"Lifetime"})}),c.jsxs(kt,{className:"space-y-3",children:[c.jsx("div",{className:"text-3xl font-bold",children:ck.lifetime.label}),c.jsxs(xe,{className:"w-full",disabled:d!==null,onClick:()=>f(ck.lifetime.price_id,"lifetime"),children:[d==="lifetime"?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):null,"Buy Now"]})]})]})]}),c.jsxs("div",{className:"pt-2 border-t",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Have a promo code?"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Lt,{placeholder:"Enter code",value:a,onChange:g=>o(g.target.value),onKeyDown:g=>g.key==="Enter"&&p()}),c.jsx(xe,{variant:"secondary",onClick:p,disabled:l||!a.trim(),children:l?c.jsx(et,{className:"h-4 w-4 animate-spin"}):"Apply"})]})]})]})]})})}function YTe(){const n=vr(),[e]=OS(),t=$n(),{user:r}=Vt(),{isPro:s,isLoading:i}=wT(),[a,o]=_.useState(!1),l=e.get("personaA"),[u,d]=_.useState(l),[h,f]=_.useState(null),[p,m]=_.useState(""),[g,y]=_.useState("user_guided"),[v,x]=_.useState(!1),{data:b,isLoading:E}=pt({queryKey:["personas-for-debate"],queryFn:async()=>{const{data:T,error:j}=await pe.from("personas").select("id, full_name, short_biography, portrait_image_url, birth_year, death_year").eq("is_published",!0).order("full_name");if(j)throw j;return T},staleTime:1e3*60*5});_.useEffect(()=>{if(u&&b){const T=b.find(j=>j.id===u);T&&t.setQueryData(["persona",u],T)}},[u,b,t]),_.useEffect(()=>{if(h&&b){const T=b.find(j=>j.id===h);T&&t.setQueryData(["persona",h],T)}},[h,b,t]);const S=()=>{!u||!h||!p.trim()||(x(!0),n(`/debate/${u}/${h}?topic=${encodeURIComponent(p)}&mode=${g}`))};if(!r)return c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center relative",children:[c.jsx(xe,{variant:"ghost",size:"icon",className:"absolute top-0 left-4",onClick:()=>n(-1),children:c.jsx(Ji,{className:"h-5 w-5"})}),c.jsx(zi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Sign in Required"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"Please sign in to access the debate room."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[c.jsx(xe,{onClick:()=>n("/auth"),children:"Sign In"}),c.jsx(xe,{variant:"outline",onClick:()=>n("/auth?tab=signup"),children:"Free Sign Up"})]})]})});if(r&&!i&&!s)return c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center relative",children:[c.jsx(xe,{variant:"ghost",size:"icon",className:"absolute top-0 left-4",onClick:()=>n(-1),children:c.jsx(Ji,{className:"h-5 w-5"})}),c.jsx(zi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Pro Feature"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"Theological debates are a Pro feature. Upgrade to start watching historical figures debate."}),c.jsx(xe,{onClick:()=>o(!0),children:"Upgrade to Pro"}),c.jsx(ZQ,{open:a,onOpenChange:o,feature:"Theological Debates"})]})});const k=b==null?void 0:b.find(T=>T.id===u),C=b==null?void 0:b.find(T=>T.id===h),A=u&&h&&u!==h&&p.trim();return c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx(zi,{className:"h-12 w-12 mx-auto mb-4 text-primary"}),c.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Theological Debate Room"}),c.jsx("p",{className:"text-muted-foreground",children:"Watch two historical Christian figures engage in thoughtful theological discourse"})]}),c.jsxs("div",{className:"grid gap-6",children:[c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsxs(Wn,{className:"flex items-center gap-2",children:[c.jsx(Ku,{className:"h-5 w-5"}),"Select Debaters"]}),c.jsx(Os,{children:"Choose two personas to engage in debate"})]}),c.jsxs(kt,{children:[c.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[c.jsxs("div",{children:[c.jsx(yt,{className:"mb-3 block font-medium",children:"First Debater"}),c.jsx("div",{className:"grid gap-2 max-h-64 overflow-y-auto pr-2",children:E?c.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading personas..."}):b==null?void 0:b.map(T=>c.jsxs("button",{onClick:()=>d(T.id),disabled:T.id===h,className:ke("flex items-center gap-3 p-3 rounded-lg border text-left transition-colors",u===T.id?"border-primary bg-primary/5":"border-border hover:border-primary/50",T.id===h&&"opacity-50 cursor-not-allowed"),children:[c.jsxs(Ui,{className:"h-10 w-10",children:[c.jsx(Vi,{src:T.portrait_image_url||void 0}),c.jsx(Hi,{children:T.full_name.charAt(0)})]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:T.full_name}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[T.birth_year,"–",T.death_year]})]})]},T.id))})]}),c.jsxs("div",{children:[c.jsx(yt,{className:"mb-3 block font-medium",children:"Second Debater"}),c.jsx("div",{className:"grid gap-2 max-h-64 overflow-y-auto pr-2",children:E?c.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading personas..."}):b==null?void 0:b.map(T=>c.jsxs("button",{onClick:()=>f(T.id),disabled:T.id===u,className:ke("flex items-center gap-3 p-3 rounded-lg border text-left transition-colors",h===T.id?"border-primary bg-primary/5":"border-border hover:border-primary/50",T.id===u&&"opacity-50 cursor-not-allowed"),children:[c.jsxs(Ui,{className:"h-10 w-10",children:[c.jsx(Vi,{src:T.portrait_image_url||void 0}),c.jsx(Hi,{children:T.full_name.charAt(0)})]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:T.full_name}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[T.birth_year,"–",T.death_year]})]})]},T.id))})]})]}),(k||C)&&c.jsx("div",{className:"mt-6 p-4 bg-muted/50 rounded-lg",children:c.jsxs("div",{className:"flex items-center justify-center gap-4",children:[k?c.jsxs("div",{className:"text-center",children:[c.jsxs(Ui,{className:"h-16 w-16 mx-auto mb-2",children:[c.jsx(Vi,{src:k.portrait_image_url||void 0}),c.jsx(Hi,{children:k.full_name.charAt(0)})]}),c.jsx("div",{className:"font-medium text-sm",children:k.full_name})]}):c.jsx("div",{className:"h-16 w-16 rounded-full bg-muted border-2 border-dashed border-muted-foreground
766/30"}),c.jsx(zi,{className:"h-8 w-8 text-primary"}),C?c.jsxs("div",{className:"text-center",children:[c.jsxs(Ui,{className:"h-16 w-16 mx-auto mb-2",children:[c.jsx(Vi,{src:C.portrait_image_url||void 0}),c.jsx(Hi,{children:C.full_name.charAt(0)})]}),c.jsx("div",{className:"font-medium text-sm",children:C.full_name})]}):c.jsx("div",{className:"h-16 w-16 rounded-full bg-muted border-2 border-dashed border-muted-foreground/30"})]})})]})]}),c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Debate Topic"}),c.jsx(Os,{children:"What should they discuss?"})]}),c.jsx(kt,{children:c.jsx(Lt,{placeholder:"e.g., The nature of predestination, Infant baptism, The role of tradition...",value:p,onChange:T=>m(T.target.value),className:"text-lg"})})]}),c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Debate Mode"}),c.jsx(Os,{children:"Choose how the debate will be conducted"})]}),c.jsx(kt,{children:c.jsx(rA,{value:g,onValueChange:T=>y(T),children:c.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[c.jsxs("label",{className:ke("flex items-start gap-4 p-4 rounded-lg border cursor-pointer transition-colors",g==="user_guided"?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[c.jsx(gu,{value:"user_guided",className:"mt-1"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2 font-medium mb-1",children:[c.jsx(Tf,{className:"h-4 w-4"}),"User-Guided"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"You ask questions and moderate. Both personas respond to your prompts sequentially."})]})]}),c.jsxs("label",{className:ke("flex items-start gap-4 p-4 rounded-lg border cursor-pointer transition-colors",g==="autonomous"?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[c.jsx(gu,{value:"autonomous",className:"mt-1"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2 font-medium mb-1",children:[c.jsx(upe,{className:"h-4 w-4"}),"Autonomous Debate"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Watch them debate independently with opening statements, rebuttals, and conclusions."})]})]})]})})})]}),c.jsx(xe,{size:"lg",className:"w-full",disabled:!A||v,onClick:S,children:v?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"h-5 w-5 mr-2 animate-spin"}),"Starting Debate..."]}):c.jsxs(c.Fragment,{children:[c.jsx(zi,{className:"h-5 w-5 mr-2"}),"Begin Debate"]})})]})]})})}function JQ({currentDebateId:n,isCollapsed:e,onToggle:t}){const r=vr(),{user:s}=Vt(),{data:i,isLoading:a}=pt({queryKey:["debate-history",s==null?void 0:s.id],queryFn:async()=>{if(!s)return[];const{data:o,error:l}=await pe.from("conversations").select("id, title, updated_at").eq("user_id",s.id).eq("conversation_type","debate").order("updated_at",{ascending:!1});if(l)throw l;const u=[];for(const d of o||[]){const{data:h}=await pe.from("conversation_personas").select("persona_id, role").eq("conversation_id",d.id);if(h&&h.length>=2){const f=h.map(m=>m.persona_id),{data:p}=await pe.from("personas").select("id, full_name, portrait_image_url").in("id",f);u.push({id:d.id,title:d.title,updated_at:d.updated_at,personas:p||[]})}}return u},enabled:!!s});return e?c.jsxs("div",{className:"w-12 border-r border-border flex flex-col items-center py-4",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:t,children:c.jsx(cd,{className:"h-4 w-4"})}),c.jsx("div",{className:"mt-4",children:c.jsx(zi,{className:"h-5 w-5 text-muted-foreground"})})]}):c.jsxs("div",{className:"w-72 border-r border-border flex flex-col",children:[c.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[c.jsx("h2",{className:"font-semibold text-sm",children:"Past Debates"}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:t,children:c.jsx(CS,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"p-2",children:c.jsxs(xe,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>r("/debate"),children:[c.jsx(ka,{className:"h-4 w-4"}),"New Debate"]})}),c.jsx(Or,{className:"flex-1",children:c.jsx("div",{className:"p-2 space-y-1",children:a?c.jsx("div",{className:"flex items-center justify-center py-8",children:c.jsx(et,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):i&&i.length>0?i.map(o=>{var l,u;return c.jsxs("button",{onClick:()=>r(`/debate/history/${o.id}`),className:ke("w-full p-3 rounded-lg text-left transition-colors",n===o.id?"bg-primary/10 border border-primary/20":"hover:bg-muted"),children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.personas.slice(0,2).map((d,h)=>c.jsxs(Ui,{className:ke("h-6 w-6",h===1&&"-ml-3"),children:[c.jsx(Vi,{src:d.portrait_image_url||void 0}),c.jsx(Hi,{className:"text-xs",children:d.full_name.charAt(0)})]},d.id)),c.jsx(zi,{className:"h-3 w-3 text-muted-foreground mx-1"})]}),c.jsx("div",{className:"text-sm font-medium truncate",children:o.title||`${(l=o.personas[0])==null?void 0:l.full_name}
766 vs ${(u=o.personas[1])==null?void 0:u.full_name}`}),c.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(o.updated_at).toLocaleDateString()})]},o.id)}):c.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:"No past debates yet"})})})]})}function XTe(n){const e=n.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,50),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}function QQ({conversationId:n,debateTitle:e}){const[t,r]=_.useState(!1),[s,i]=_.useState(!1),[a,o]=_.useState(null),[l,u]=_.useState(!1),{toast:d}=Jl(),h=async()=>{i(!0);try{const{data:m,error:g}=await pe.from("conversations").select("share_slug, is_public").eq("id",n).single();if(g)throw g;if(m!=null&&m.is_public&&(m!=null&&m.share_slug)){const b=`${window.location.origin}/debate/share/${m.share_slug}`;o(b);return}const y=XTe(e||"debate"),{error:v}=await pe.from("conversations").update({share_slug:y,is_public:!0}).eq("id",n);if(v)throw v;const x=`${window.location.origin}/debate/share/${y}`;o(x),d({title:"Debate shared!",description:"Anyone with the link can now view this debate."})}catch(m){console.error("Share error:",m),d({title:"Failed to share",description:"Could not generate share link. Please try again.",variant:"destructive"})}finally{i(!1)}},f=async()=>{if(a)try{await navigator.clipboard.writeText(a),u(!0),setTimeout(()=>u(!1),2e3),d({title:"Copied!",description:"Link copied to clipboard."})}catch{d({title:"Copy failed",description:"Please copy the link manually.",variant:"destructive"})}},p=m=>{r(m),m&&!a&&h(),m||u(!1)};return c.jsxs(ai,{open:t,onOpenChange:p,children:[c.jsx(GAe,{asChild:!0,children:c.jsxs(xe,{variant:"outline",size:"sm",children:[c.jsx(k2,{className:"h-4 w-4 mr-2"}),"Share"]})}),c.jsxs(Ls,{className:"sm:max-w-md",children:[c.jsxs(Fs,{children:[c.jsxs(Bs,{className:"flex items-center gap-2",children:[c.jsx(MG,{className:"h-5 w-5"}),"Share Debate"]}),c.jsx(Df,{children:"Anyone with this link can view the debate (read-only)."})]}),c.jsx("div",{className:"flex flex-col gap-4 pt-4",children:s?c.jsxs("div",{className:"flex items-center justify-center py-6",children:[c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"}),c.jsx("span",{className:"ml-2 text-muted-foreground",children:"Generating link..."})]}):a?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Lt,{value:a,readOnly:!0,className:"flex-1 text-sm"}),c.jsx(xe,{size:"sm",onClick:f,variant:l?"default":"outline",children:l?c.jsx(Go,{className:"h-4 w-4"}):c.jsx(vF,{className:"h-4 w-4"})})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"This debate is now publicly viewable. The link will remain active."})]}):null})]})]})}function ZTe(){const{personaAId:n,personaBId:e}=Xc(),[t]=OS(),r=vr(),{user:s}=Vt(),{toast:i}=Jl(),a=t.get("topic")||"",o=t.get("mode")||"user_guided",[l,u]=_.useState([]),[d,h]=_.useState(""),[f,p]=_.useState(!1),[m,g]=_.useState(null),[y,v]=_.useState(!1),[x,b]=_.useState(0),[E,S]=_.useState(null),[k,C]=_.useState(!1),A=_.useRef(null),T=_.useRef(null),{data:j,isLoading:D}=pt({queryKey:["persona",n],queryFn:async()=>{const{data:L,error:te}=await pe.from("personas").select("id, full_name, short_biography, portrait_image_url").eq("id",n).single();if(te)throw te;return L},enabled:!!n,staleTime:1e3*60*5}),{data:R,isLoading:M}=pt({queryKey:["persona",e],queryFn:async()=>{const{data:L,error:te}=await pe.from("personas").select("id, full_name, short_biography, portrait_image_url").eq("id",e).single();if(te)throw te;return L},enabled:!!e,staleTime:1e3*60*5}),N=D||M;_.useEffect(()=>{var L;(L=A.current)==null||L.scrollIntoView({behavior:"smooth"})},[l]);const U=_.useCallback(async()=>{if(!s||!n||!e||!j||!R)return null;const L=`${j.full_name} vs ${R.full_name}: ${a.slice(0,50)}${a.length>50?"...":""}`,{data:te,error:ae}=await pe.from("conversations").insert({user_id:s.id,conversation_type:"debate",title:L}).select().single();return ae?(console.error("Error creating debate:",ae),null):(await pe.from("conversation_personas").insert([{conversation_id:te.id,persona_id:n,role:"debater_a"},{conversation_id:te.id,persona_id:e,role:"debater_b"}]),S(te.id),te.id)},[s,n,e,j,R,a]),q=_.useCallback(async(L,te,ae,de)=>{await pe.from("messages").insert({conversation_id:L,content:te,role:ae,persona_id:de||null}),await pe.from("conversations").update({updated_at:new Date().toISOString()}).eq("id",L)},[]),I=_.useCallback(async(L,te,ae)=>{var ve,_e,Ne,Pe;if(!n||!e)return;const de=L===n?j:R;if(!de)return;p(!0),g(L);const ue=`msg-${Date.now()}`,le=L===n?"persona_a":"persona_b";u(Se=>[...Se,{id:ue,role:le,content:"",personaId:L,personaName:de.full_name}]);
766try{T.current=new AbortController;const{data:{session:Se}}=await pe.auth.getSession();if(!(Se!=null&&Se.access_token)){i({title:"Authentication Required",description:"Please sign in to continue.",variant:"destructive"}),p(!1),g(null);return}const Ce=await fetch("https://delgyrqdrcihvvudekdx.supabase.co/functions/v1/debate-with-personas",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Se.access_token}`},body:JSON.stringify({personaAId:n,personaBId:e,topic:a,mode:o,messages:te,currentSpeaker:L}),signal:T.current.signal});if(!Ce.ok){const H=await Ce.json();throw new Error(H.error||"Failed to get response")}const O=(ve=Ce.body)==null?void 0:ve.getReader(),X=new TextDecoder;let ee="";if(O)for(;;){const{done:H,value:se}=await O.read();if(H)break;const Q=X.decode(se,{stream:!0}).split(`
767`);for(const Y of Q)if(Y.startsWith("data: ")){const ce=Y.slice(6).trim();if(ce==="[DONE]")continue;try{const ge=(Pe=(Ne=(_e=JSON.parse(ce).choices)==null?void 0:_e[0])==null?void 0:Ne.delta)==null?void 0:Pe.content;ge&&(ee+=ge,u(Ee=>Ee.map(Le=>Le.id===ue?{...Le,content:ee}:Le)))}catch{}}}const V=ae||E;return V&&ee&&await q(V,ee,"persona",L),b(H=>H+1),ee}catch(Se){if(Se.name==="AbortError")return;console.error("Stream error:",Se),i({title:"Error",description:Se instanceof Error?Se.message:"Failed to get response",variant:"destructive"})}finally{p(!1),g(null)}},[n,e,j,R,a,o,i,E,q]),B=_.useCallback(async()=>{if(y||!s||!j||!R)return;const L=await U();if(!L){i({title:"Error",description:"Failed to create debate. Please try again.",variant:"destructive"});return}v(!0);const te=`Debate Topic: "${a}"
768
769${j==null?void 0:j.full_name} and ${R==null?void 0:R.full_name} will now discuss this topic.`;u([{id:"system-start",role:"system",content:te}]),await q(L,te,"user"),await I(n,[{role:"user",content:`Please share your opening statement on the topic: "${a}"`}],L)},[y,s,j,R,n,a,U,i,q,I]),$=_.useRef(!1);_.useEffect(()=>{!$.current&&s&&j&&R&&!y&&!f&&($.current=!0,B())},[s,j,R,y,f,B]);const ie=_.useCallback(async()=>{if(!y||!n||!e)return;const L=l.filter(ue=>ue.role!=="system").map(ue=>({role:ue.role==="user"?"user":"assistant",content:ue.role==="persona_a"||ue.role==="persona_b"?`[${ue.personaName}]: ${ue.content}`:ue.content})),te=[...l].reverse().find(ue=>ue.role==="persona_a"||ue.role==="persona_b"),ae=(te==null?void 0:te.role)==="persona_a"?e:n,de=x===1?"Please share your opening statement in response.":x<4?"Please respond to what was just said. Offer your rebuttal or agreement.":"Please share your concluding thoughts on this debate.";await I(ae,[...L,{role:"user",content:de}])},[y,n,e,l,x,I]),ne=async()=>{if(!d.trim()||f)return;const L=d.trim();h(""),u(ue=>[...ue,{id:`user-${Date.now()}`,role:"user",content:L}]),E&&await q(E,L,"user");const te=l.filter(ue=>ue.role!=="system").map(ue=>({role:ue.role==="user"?"user":"assistant",content:ue.role==="persona_a"||ue.role==="persona_b"?`[${ue.personaName}]: ${ue.content}`:ue.content})),ae=await I(n,[...te,{role:"user",content:L}]),de=[...te,{role:"user",content:L},{role:"assistant",content:`[${j==null?void 0:j.full_name}]: ${ae||""}`}];await I(e,[...de,{role:"user",content:"Please share your perspective on this as well."}])};return s?N||!j||!R?c.jsx(cn,{children:c.jsx("div",{className:"flex h-[calc(100vh-8rem)]",children:c.jsxs("div",{className:"flex-1 flex flex-col px-4 py-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b",children:[c.jsx("div",{className:"h-9 w-20 bg-muted animate-pulse rounded"}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"h-8 w-8 bg-muted animate-pulse rounded-full"}),c.jsx("div",{className:"h-4 w-24 bg-muted animate-pulse rounded hidden sm:block"})]}),c.jsx(zi,{className:"h-5 w-5 text-muted"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"h-4 w-24 bg-muted animate-pulse rounded hidden sm:block"}),c.jsx("div",{className:"h-8 w-8 bg-muted animate-pulse rounded-full"})]})]}),c.jsx("div",{className:"h-4 w-20 bg-muted animate-pulse rounded"})]}),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center space-y-4",children:[c.jsx("div",{className:"h-12 w-12 bg-muted animate-pulse rounded-full mx-auto"}),c.jsx("div",{className:"h-6 w-32 bg-muted animate-pulse rounded mx-auto"}),c.jsx("div",{className:"h-4 w-48 bg-muted animate-pulse rounded mx-auto"})]})})]})})}):c.jsx(cn,{children:c.jsxs("div",{className:"flex h-[calc(100vh-8rem)]",children:[c.jsx(JQ,{currentDebateId:E,isCollapsed:k,onToggle:()=>C(!k)}),c.jsxs("div",{className:"flex-1 flex flex-col px-4 py-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b",children:[c.jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>r("/debate"),children:[c.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Back"]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:j.portrait_image_url||void 0}),c.jsx(Hi,{children:j.full_name.charAt(0)})]}),c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:j.full_name})]}),c.jsx(zi,{className:"h-5 w-5 text-primary"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:R.full_name}),c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:R.portrait_image_url||void 0}),c.jsx(Hi,{children:R.full_name.charAt(0)})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground hidden sm:inline",children:o==="autonomous"?"Autonomous":"Guided"}),E&&c.jsx(QQ,{conversationId:E,debateTitle:`${j.full_name} vs ${R.full_name}`})]})]}),c.jsx(Or,{className:"flex-1 pr-4",children:c.jsxs("div",{className:"space-y-4 pb-4",children:[y?l.map(L=>c.jsx("div",{className:ke("flex gap-3",L.role==="user"&&"justify-end",L.role==="system"&&"justify-center"),children:L.role==="system"?c.jsx(mt,{className:"px-4 py-2 bg-muted/50 max-w-lg text-center",children:c.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:L.content})}):L.role==="user"?c.jsx(mt,{className:"px-4 py-3 bg-primary text-primary-foreground max-w-lg",children:c.jsx("p",{className:"whitespace-pre-wrap",children:L.content})}):c.jsxs(c.Fragment,{children:[c.jsxs(Ui,{className:"h-10 w-10 flex-shrink-0",children:[c.jsx(Vi,{src:L.role==="persona_a"?j.portrait_image_url||void 0:R.portrait_image_url||void 0}),c.jsx(Hi,{children:L.role==="persona_a"?j.full_name.charAt(0):R.full_name.charAt(0)})]}),c.jsxs(mt,{className:ke("px-4 py-3 max-w-2xl",L.role==="persona_a"?"bg-blue-500/10 border-blue-500/20":"bg-
769amber-500/10 border-amber-500/20"),children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:L.personaName}),c.jsx("p",{className:"whitespace-pre-wrap",children:L.content||c.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[c.jsx(et,{className:"h-4 w-4 animate-spin"}),"Thinking..."]})})]})]})},L.id)):c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsxs("div",{className:"text-center",children:[c.jsx(et,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),c.jsxs("p",{className:"text-muted-foreground",children:['Starting debate on "',a,'"...']})]})}),c.jsx("div",{ref:A})]})}),y&&c.jsx("div",{className:"pt-4 border-t",children:o==="autonomous"?c.jsx("div",{className:"flex gap-2 justify-center",children:c.jsx(xe,{onClick:ie,disabled:f||x>=6,size:"lg",children:f?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}),m===n?j.full_name:R.full_name," is speaking..."]}):x>=6?"Debate Complete":c.jsxs(c.Fragment,{children:[c.jsx(Qfe,{className:"h-4 w-4 mr-2"}),"Continue Debate (",x,"/6 turns)"]})})}):c.jsxs("form",{onSubmit:L=>{L.preventDefault(),ne()},className:"flex gap-2",children:[c.jsx(Lt,{value:d,onChange:L=>h(L.target.value),placeholder:"Ask a question or guide the discussion...",disabled:f,className:"flex-1"}),c.jsx(xe,{type:"submit",disabled:f||!d.trim(),children:f?c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(TS,{className:"h-4 w-4"})})]})})]})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(zi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Sign in Required"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"Please sign in to access the debate room."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[c.jsx(xe,{onClick:()=>r("/auth"),children:"Sign In"}),c.jsx(xe,{variant:"outline",onClick:()=>r("/auth?tab=signup"),children:"Free Sign Up"})]})]})})}function JTe(){var U;const{conversationId:n}=Xc(),e=vr(),{user:t}=Vt(),{toast:r}=Jl(),s=$n(),[i,a]=_.useState(!1),[o,l]=_.useState([]),[u,d]=_.useState(""),[h,f]=_.useState(!1),[p,m]=_.useState(null),g=_.useRef(null),y=_.useRef(null),{data:v,isLoading:x}=pt({queryKey:["debate-conversation",n],queryFn:async()=>{const{data:q,error:I}=await pe.from("conversations").select("*").eq("id",n).single();if(I)throw I;return q},enabled:!!n&&!!t}),{data:b}=pt({queryKey:["debate-personas",n],queryFn:async()=>{const{data:q,error:I}=await pe.from("conversation_personas").select("persona_id, role").eq("conversation_id",n);if(I)throw I;const B=(q==null?void 0:q.map(te=>te.persona_id))||[],{data:$,error:ie}=await pe.from("personas").select("*").in("id",B);if(ie)throw ie;const ne=q==null?void 0:q.find(te=>te.role==="debater_a"),L=q==null?void 0:q.find(te=>te.role==="debater_b");return{personaA:$==null?void 0:$.find(te=>te.id===(ne==null?void 0:ne.persona_id)),personaB:$==null?void 0:$.find(te=>te.id===(L==null?void 0:L.persona_id)),personaAId:ne==null?void 0:ne.persona_id,personaBId:L==null?void 0:L.persona_id}},enabled:!!n&&!!t}),{data:E,isLoading:S}=pt({queryKey:["debate-messages",n],queryFn:async()=>{const{data:q,error:I}=await pe.from("messages").select("*").eq("conversation_id",n).order("created_at",{ascending:!0});if(I)throw I;return q},enabled:!!n&&!!t}),k=b==null?void 0:b.personaA,C=b==null?void 0:b.personaB,A=b==null?void 0:b.personaAId,T=b==null?void 0:b.personaBId,j=((U=v==null?void 0:v.title)==null?void 0:U.split(": ").slice(1).join(": "))||"";_.useEffect(()=>{if(!E||!k||!C)return;const q=E.map((I,B)=>{if(I.role==="user"&&!I.persona_id)return B===0&&I.content.includes("Debate Topic:")?{id:I.id,role:"system",content:I.content}:{id:I.id,role:"user",content:I.content};const $=I.persona_id===k.id;return{id:I.id,role:$?"persona_a":"persona_b",content:I.content,personaId:I.persona_id||void 0,personaName:$?k.full_name:C.full_name}});l(q)},[E,k,C]),_.useEffect(()=>{var q;(q=g.current)==null||q.scrollIntoView({behavior:"smooth"})},[o]);const D=_.useCallback(async(q,I,B)=>{n&&(await pe.from("messages").insert({conversation_id:n,content:q,role:I,persona_id:B||null}),await pe.from("conversations").update({updated_at:new Date().toISOString()}).eq("id",n))},[n]),R=_.useCallback(async(q,I)=>{var ne,L,te,ae;if(!A||!T||!k||!C)return;const B=q===A?k:C;f(!0),m(q);const $=`msg-${Date.now()}`,ie=q===A?"persona_a":"persona_b";l(de=>[...de,{id:$,role:ie,content:"",personaId:q,personaName:B.full_name}]);
769try{y.current=new AbortController;const{data:{session:de}}=await pe.auth.getSession();if(!(de!=null&&de.access_token)){r({title:"Authentication Required",description:"Please sign in to continue.",variant:"destructive"}),f(!1),m(null);return}const ue=await fetch("https://delgyrqdrcihvvudekdx.supabase.co/functions/v1/debate-with-personas",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${de.access_token}`},body:JSON.stringify({personaAId:A,personaBId:T,topic:j,mode:"user_guided",messages:I,currentSpeaker:q}),signal:y.current.signal});if(!ue.ok){const Ne=await ue.json();throw new Error(Ne.error||"Failed to get response")}const le=(ne=ue.body)==null?void 0:ne.getReader(),ve=new TextDecoder;let _e="";if(le)for(;;){const{done:Ne,value:Pe}=await le.read();if(Ne)break;const Ce=ve.decode(Pe,{stream:!0}).split(`
770`);for(const O of Ce)if(O.startsWith("data: ")){const X=O.slice(6).trim();if(X==="[DONE]")continue;try{const V=(ae=(te=(L=JSON.parse(X).choices)==null?void 0:L[0])==null?void 0:te.delta)==null?void 0:ae.content;V&&(_e+=V,l(H=>H.map(se=>se.id===$?{...se,content:_e}:se)))}catch{}}}return _e&&(await D(_e,"persona",q),s.invalidateQueries({queryKey:["debate-history"]})),_e}catch(de){if(de.name==="AbortError")return;console.error("Stream error:",de),r({title:"Error",description:de instanceof Error?de.message:"Failed to get response",variant:"destructive"})}finally{f(!1),m(null)}},[A,T,k,C,j,r,D,s]),M=async()=>{if(!u.trim()||h||!A||!T||!k||!C)return;const q=u.trim();d(""),l(ie=>[...ie,{id:`user-${Date.now()}`,role:"user",content:q}]),await D(q,"user");const I=o.filter(ie=>ie.role!=="system").map(ie=>({role:ie.role==="user"?"user":"assistant",content:ie.role==="persona_a"||ie.role==="persona_b"?`[${ie.personaName}]: ${ie.content}`:ie.content})),B=await R(A,[...I,{role:"user",content:q}]),$=[...I,{role:"user",content:q},{role:"assistant",content:`[${k.full_name}]: ${B||""}`}];await R(T,[...$,{role:"user",content:"Please share your perspective on this as well."}])};return t?x||S||!k||!C?c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(et,{className:"h-8 w-8 animate-spin mx-auto mb-4"}),c.jsx("p",{children:"Loading debate..."})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"flex h-[calc(100vh-8rem)]",children:[c.jsx(JQ,{currentDebateId:n||null,isCollapsed:i,onToggle:()=>a(!i)}),c.jsxs("div",{className:"flex-1 flex flex-col px-4 py-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b",children:[c.jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>e("/debate"),children:[c.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Back"]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:k.portrait_image_url||void 0}),c.jsx(Hi,{children:k.full_name.charAt(0)})]}),c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:k.full_name})]}),c.jsx(zi,{className:"h-5 w-5 text-primary"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:C.full_name}),c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:C.portrait_image_url||void 0}),c.jsx(Hi,{children:C.full_name.charAt(0)})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground hidden sm:inline",children:new Date((v==null?void 0:v.created_at)||"").toLocaleDateString()}),n&&c.jsx(QQ,{conversationId:n,debateTitle:(v==null?void 0:v.title)||void 0})]})]}),c.jsx(Or,{className:"flex-1 pr-4",children:c.jsxs("div",{className:"space-y-4 pb-4",children:[o.map(q=>c.jsx("div",{className:ke("flex gap-3",q.role==="user"&&"justify-end",q.role==="system"&&"justify-center"),children:q.role==="system"?c.jsx(mt,{className:"px-4 py-2 bg-muted/50 max-w-lg text-center",children:c.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q.content})}):q.role==="user"?c.jsx(mt,{className:"px-4 py-3 bg-primary text-primary-foreground max-w-lg",children:c.jsx("p",{className:"whitespace-pre-wrap",children:q.content})}):c.jsxs(c.Fragment,{children:[c.jsxs(Ui,{className:"h-10 w-10 flex-shrink-0",children:[c.jsx(Vi,{src:q.role==="persona_a"?k.portrait_image_url||void 0:C.portrait_image_url||void 0}),c.jsx(Hi,{children:q.role==="persona_a"?k.full_name.charAt(0):C.full_name.charAt(0)})]}),c.jsxs(mt,{className:ke("px-4 py-3 max-w-2xl",q.role==="persona_a"?"bg-blue-500/10 border-blue-500/20":"bg-
770amber-500/10 border-amber-500/20"),children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:q.personaName}),c.jsx("p",{className:"whitespace-pre-wrap",children:q.content||c.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[c.jsx(et,{className:"h-4 w-4 animate-spin"}),"Thinking..."]})})]})]})},q.id)),c.jsx("div",{ref:g})]})}),c.jsx("div",{className:"pt-4 border-t",children:c.jsxs("form",{onSubmit:q=>{q.preventDefault(),M()},className:"flex gap-2",children:[c.jsx(Lt,{value:u,onChange:q=>d(q.target.value),placeholder:"Continue the debate with a new question...",disabled:h,className:"flex-1"}),c.jsx(xe,{type:"submit",disabled:h||!u.trim(),children:h?c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(TS,{className:"h-4 w-4"})})]})})]})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx("p",{children:"Please sign in to view past debates."}),c.jsx(xe,{onClick:()=>e("/auth"),className:"mt-4",children:"Sign In"})]})})}function QTe(){const{shareSlug:n}=Xc(),{toast:e}=Jl(),[t,r]=_.useState(!1),{data:s,isLoading:i,error:a}=pt({queryKey:["shared-debate",n],queryFn:async()=>{const{data:m,error:g}=await pe.from("public_debates_view").select("id, title, conversation_type, share_slug, is_public, created_at, updated_at").eq("share_slug",n).single();if(g)throw g;return m},enabled:!!n}),{data:o}=pt({queryKey:["shared-debate-personas",s==null?void 0:s.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("conversation_personas").select("persona_id, role").eq("conversation_id",s.id);if(g)throw g;const y=(m==null?void 0:m.map(S=>S.persona_id))||[],{data:v,error:x}=await pe.from("personas").select("id, full_name, portrait_image_url").in("id",y);if(x)throw x;const b=m==null?void 0:m.find(S=>S.role==="debater_a"),E=m==null?void 0:m.find(S=>S.role==="debater_b");return{personaA:v==null?void 0:v.find(S=>S.id===(b==null?void 0:b.persona_id)),personaB:v==null?void 0:v.find(S=>S.id===(E==null?void 0:E.persona_id))}},enabled:!!(s!=null&&s.id)}),{data:l,isLoading:u}=pt({queryKey:["shared-debate-messages",s==null?void 0:s.id],queryFn:async()=>{const{data:m,error:g}=await pe.from("messages").select("*").eq("conversation_id",s.id).order("created_at",{ascending:!0});if(g)throw g;return m},enabled:!!(s!=null&&s.id)}),d=o==null?void 0:o.personaA,h=o==null?void 0:o.personaB,f=(l==null?void 0:l.map((m,g)=>{if(m.role==="user"&&!m.persona_id)return g===0&&m.content.includes("Debate Topic:")?{id:m.id,role:"system",content:m.content}:{id:m.id,role:"user",content:m.content};const y=m.persona_id===(d==null?void 0:d.id);return{id:m.id,role:y?"persona_a":"persona_b",content:m.content,personaId:m.persona_id||void 0,personaName:y?d==null?void 0:d.full_name:h==null?void 0:h.full_name}}))||[],p=async()=>{const m=f.map(y=>y.role==="system"?`--- ${y.content} ---`:y.role==="user"?`[User]: ${y.content}`:`[${y.personaName}]: ${y.content}`).join(`
771
772`),g=`${(s==null?void 0:s.title)||"Debate Transcript"}
773
774${m}`;try{await navigator.clipboard.writeText(g),r(!0),setTimeout(()=>r(!1),2e3),e({title:"Copied!",description:"Transcript copied to clipboard."})}catch{e({title:"Copy failed",description:"Please try again.",variant:"destructive"})}};return i||u?c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(et,{className:"h-8 w-8 animate-spin mx-auto mb-4"}),c.jsx("p",{children:"Loading debate..."})]})}):a||!s?c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(zi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Debate Not Found"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"This debate link may be invalid or the debate is no longer shared."}),c.jsx(xe,{asChild:!0,children:c.jsx(Rt,{to:"/debate",children:"View All Debates"})})]})}):!d||!h?c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(et,{className:"h-8 w-8 animate-spin mx-auto mb-4"}),c.jsx("p",{children:"Loading participants..."})]})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-4xl",children:[c.jsxs("div",{className:"flex items-center justify-between mb-6 pb-4 border-b",children:[c.jsx(xe,{variant:"ghost",size:"sm",asChild:!0,children:c.jsxs(Rt,{to:"/debate",children:[c.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Debates"]})}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:d.portrait_image_url||void 0}),c.jsx(Hi,{children:d.full_name.charAt(0)})]}),c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:d.full_name})]}),c.jsx(zi,{className:"h-5 w-5 text-primary"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:h.full_name}),c.jsxs(Ui,{className:"h-8 w-8",children:[c.jsx(Vi,{src:h.portrait_image_url||void 0}),c.jsx(Hi,{children:h.full_name.charAt(0)})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground hidden sm:inline",children:new Date(s.created_at).toLocaleDateString()}),c.jsxs(xe,{variant:"outline",size:"sm",onClick:p,children:[t?c.jsx(Go,{className:"h-4 w-4 mr-2"}):c.jsx(vF,{className:"h-4 w-4 mr-2"}),t?"Copied":"Copy"]})]})]}),c.jsx("h1",{className:"text-xl font-bold mb-6 text-center",children:s.title}),c.jsx(Or,{className:"h-[calc(100vh-20rem)]",children:c.jsx("div",{className:"space-y-4 pb-4",children:f.map(m=>c.jsx("div",{className:ke("flex gap-3",m.role==="user"&&"justify-end",m.role==="system"&&"justify-center"),children:m.role==="system"?c.jsx(mt,{className:"px-4 py-2 bg-muted/50 max-w-lg text-center",children:c.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:m.content})}):m.role==="user"?c.jsx(mt,{className:"px-4 py-3 bg-primary text-primary-foreground max-w-lg",children:c.jsx("p",{className:"whitespace-pre-wrap",children:m.content})}):c.jsxs(c.Fragment,{children:[c.jsxs(Ui,{className:"h-10 w-10 flex-shrink-0",children:[c.jsx(Vi,{src:m.role==="persona_a"?d.portrait_image_url||void 0:h.portrait_image_url||void 0}),c.jsx(Hi,{children:m.role==="persona_a"?d.full_name.charAt(0):h.full_name.charAt(0)})]}),c.jsxs(mt,{className:ke("px-4 py-3 max-w-2xl",m.role==="persona_a"?"bg-blue-500/10 border-blue-500/20":"bg-
774amber-500/10 border-amber-500/20"),children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:m.personaName}),c.jsx("p",{className:"whitespace-pre-wrap",children:m.content})]})]})},m.id))})}),c.jsxs("div",{className:"pt-4 border-t text-center text-sm text-muted-foreground",children:[c.jsx("p",{children:"This is a read-only view of a shared debate."}),c.jsx(xe,{variant:"link",asChild:!0,className:"mt-1",children:c.jsx(Rt,{to:"/debate",children:"Start your own debate →"})})]})]})})}function eje({className:n}){return c.jsxs("div",{className:n,children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-3",children:[c.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(En,{className:"h-4 w-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:"Bible Text Pane"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a book and chapter from the dropdowns. Click on individual verses to select them for commentary and notes."})]})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(Zfe,{className:"h-4 w-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:"Verse Selection"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Click a verse to select it. Hold Shift and click to select a range. Selected verses highlight in gold and drive the commentary."})]})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(Tf,{className:"h-4 w-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:"Commentary Pane"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"View historical commentaries from figures like Matthew Henry and John Calvin, or switch to AI commentary from our historical personas."})]})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(jS,{className:"h-4 w-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:"AI Personas"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose from our historical personas to hear how Augustine, Spurgeon, or others might have commented on the passage."})]})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(Gm,{className:"h-4 w-4 text-primary"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-sm",children:"Notes Pane"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Write personal notes on selected verses. Add tags to organize them. All notes are saved to your account and searchable in the Notes Archive."})]})]})]}),c.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:c.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Tip: Drag the panel dividers to resize sections to your preference."})})]})}function tje(){return c.jsx(cn,{children:c.jsx("div",{className:"container mx-auto px-4 py-12",children:c.jsxs("div",{className:"max-w-3xl mx-auto",children:[c.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-semibold mb-8 text-center",children:"About This Archive"}),c.jsxs("div",{className:"prose-archive space-y-6",children:[c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Our Mission"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Heroes of the Faith is an interactive digital archive dedicated to preserving and presenting the writings, theological positions, and lived wisdom of Christian figures throughout church history. Our mission is to make these historical voices accessible for serious study, grounded in primary sources and historical fidelity."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Historical Fidelity"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Each persona in this archive is constructed from documented historical sources. We prioritize accuracy over creativity, ensuring that theological positions, quoted writings, and biographical information reflect what these figures actually wrote and believed. When a persona speaks on a topic not covered in their historical writings, they will acknowledge this limitation rather than speculate."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Primary Sources"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:`The "From the Writings" sections present direct quotations from each figure's own works—sermons, books, letters, and journals. These quotations are verified and properly attributed, allowing you to engage with their actual words rather than 
774interpretations.`})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Study Features"}),c.jsxs("ul",{className:"space-y-3 text-muted-foreground",children:[c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Single Persona Conversations:"})," Engage with one historical figure in dialogue. Ask questions about Scripture, theology, or their life experiences."]}),c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Multi-Persona Debates:"})," Observe two figures engage on theological topics where they historically disagreed, with structured opening statements, rebuttals, and conclusions."]}),c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Essay and Sermon Feedback:"})," Submit your own writing for critique from the perspective of a historical theologian or a panel of two reviewers."]})]})]}),c.jsxs("section",{id:"instructions",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Study Workspace Instructions"}),c.jsxs(mt,{children:[c.jsx(Ln,{className:"pb-2",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:c.jsx(En,{className:"h-5 w-5 text-primary"})}),c.jsx(Wn,{className:"font-serif text-lg",children:"How to Use the Study Workspace"})]})}),c.jsx(kt,{children:c.jsx(eje,{})})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Limitations"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"This archive uses AI to generate persona responses, but these responses are constrained by documented historical data. The system will never fabricate quotes or claim positions not supported by historical evidence. When engaging with topics beyond a persona's documented writings, responses will be explicitly framed as reasoned application rather than authoritative statement."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Classification System"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Personas are organized using a flexible label system rather than rigid folders. Each figure may have multiple labels across categories:"}),c.jsxs("ul",{className:"mt-4 space-y-2 text-muted-foreground",children:[c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Era:"})," Early Church, Medieval, Reformation, Modern, Contemporary"]}),c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Category:"})," Missionaries, Theologians, Reformers, Women of the Faith, Early Church Fathers, Social Reformers, Scientists of the Faith"]}),c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Region:"})," Africa, Asia, Europe, Americas, Middle East"]}),c.jsxs("li",{children:[c.jsx("strong",{className:"text-foreground",children:"Theme:"})," Missions, Suffering, Justification, Prayer, Holiness, Social Justice, Science and Faith, Scripture Authority"]})]})]})]})]})})})}function nje(){return c.jsxs(cn,{children:[c.jsx(kd,{title:"Privacy Policy | Every Language Bible",description:"Privacy Policy for Every Language Bible App - Learn how we protect your privacy with our privacy-first approach."}),c.jsxs("div",{className:"container mx-auto px-4 py-12 max-w-4xl",children:[c.jsx("h1",{className:"font-serif text-4xl font-bold mb-4 pb-4 border-b-4 border-primary",children:"Privacy Policy"}),c.jsxs("div",{className:"text-muted-foreground mb-8",children:[c.jsx("strong",{children:"Effective Date:"})," January 13, 2026",c.jsx("br",{}),c.jsx("strong",{children:"Last Updated:"})," January 13, 2026"]}),c.jsxs("div",{className:"prose prose-lg dark:prose-invert max-w-none space-y-8",children:[c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Introduction"}),c.jsx("p",{children:'Every Language Bible ("we," "our," or "us") is committed to protecting your privacy. This Privacy Policy explains how our mobile application collects, uses, and safeguards your information.'}
774),c.jsxs("p",{children:[c.jsx("strong",{children:"Our Commitment:"}),' Your privacy and security are our highest priorities, especially given our mission to serve believers in regions where faith can be dangerous. We designed this app with a "privacy-first" approach - all your data stays on your device.']})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Information We Collect"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Information Stored Locally on Your Device:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsxs("li",{children:[c.jsx("strong",{children:"Reading Progress:"})," Chapters read, bookmarks, current reading position"]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Learning Progress:"})," Completed lessons, discipleship track progress, notes"]}),c.jsxs("li",{children:[c.jsx("strong",{children:"User Preferences:"})," Language settings, theme preferences, audio settings"]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Analytics Data (Optional):"})," Usage statistics, session duration, feature usage"]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Security Settings:"})," Passcode hash, biometric authentication preferences, stealth mode settings"]})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Information We Do NOT Collect:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"❌ Personal identification information (name, email, phone number)"}),c.jsx("li",{children:"❌ Location data"}),c.jsx("li",{children:"❌ Device identifiers"}),c.jsx("li",{children:"❌ Contacts or photos"}),c.jsx("li",{children:"❌ Browsing history"}),c.jsx("li",{children:"❌ Any data is NOT transmitted to our servers or third parties"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"How We Use Your Information"}),c.jsxs("p",{children:["All information collected is stored ",c.jsx("strong",{children:"locally on your device only"})," and is used to:"]}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Save your reading progress"}),c.jsx("li",{children:"Provide personalized recommendations"}),c.jsx("li",{children:"Track your learning journey"}),c.jsx("li",{children:"Improve your experience with the app"}),c.jsx("li",{children:"Enable security features (passcode protection, stealth mode)"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Data Storage and Security"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Local Storage:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"All your data is stored on your device using secure, encrypted storage"}),c.jsx("li",{children:"No cloud synchronization or backups to external servers"}),c.jsx("li",{children:"Data persists until you delete the app or manually clear it"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Security Measures:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Biometric authentication (Face ID/Touch ID) support"}),c.jsx("li",{children:"Passcode protection with secure hashing"}),c.jsx("li",{children:"Stealth mode (calculator disguise) for hostile environments"}),c.jsx("li",{children:"No data transmission to external servers"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"API Communication:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsxs("li",{children:["Our app connects to our server ",c.jsx("strong",{children:"only"})," to download Bible content, audio files, and discipleship materials"]}),c.jsx("li",{children:"These connections use industry-standard HTTPS encryption"}),c.jsx("li",{children:"No personal or usage data is sent to our servers"}),c.jsx("li",{children:"All API calls are anonymous"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Your Privacy Rights"}),c.jsx("p",{children:"You have the following rights regarding your data:"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Access:"}),c.jsx("p",{children:"View all data stored by the app in Settings → Analytics & Privacy"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Export:"}),c.jsx("p",{children:"Export your reading history and progress data as JSON via Settings → Analytics & Privacy → Export Data"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Delete:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Clear all app data: Settings → Reset All Data"}),c.jsx("li",{children:"Delete specific data: Settings → Analytics & Privacy → Clear Analytics"}),c.jsx("li",{children:"Uninstall the app to remove all data permanently"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Control:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Disable analytics: Settings → Analytics & Privacy → Disable Analytics"}),c.jsx("li",{children:"Choose what to track: Settings → Analytics & Privacy → Tracking Preferences"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Children's Privacy"}),c.jsx("p",{children:"Our app is designed to be safe for all ages. We do not knowingly collect any personal information from anyone, including children under 13."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Biometric Data"}),c.jsx("p",{children:"If you enable Face ID or Touch ID:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Your biometric data is NEVER accessed by our app"}),c.jsx("li",{children:'We only receive a "success" or "failure" result from iOS'}),c.jsx("li",{children:"Biometric data never leaves your device"}),c.jsx("li",{children:"We don't store or transmit any biometric information"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Third-Party Services"}),c.jsxs("p",{children:["We do ",c.jsx("strong",{children:"NOT"})," use:"]}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"❌ Analytics services (Google Analytics, Firebase, etc.)"}
774),c.jsx("li",{children:"❌ Advertising networks"}),c.jsx("li",{children:"❌ Social media integrations"}),c.jsx("li",{children:"❌ Crash reporting services"}),c.jsx("li",{children:"❌ Any third-party tracking"})]}),c.jsx("p",{className:"mt-4",children:"Our app operates completely independently with zero third-party integrations."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Data Retention"}),c.jsx("p",{children:"Your data is retained:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"On your device until you delete the app"}),c.jsx("li",{children:"Until you manually clear it via Settings"}),c.jsx("li",{children:"We don't have access to delete your data as it's not on our servers"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"International Users"}),c.jsx("p",{children:"Our app is available worldwide. Since all data is stored locally on your device, there are no cross-border data transfers or GDPR concerns."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Changes to This Privacy Policy"}),c.jsx("p",{children:"We may update this Privacy Policy from time to time. Changes will be communicated through:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"In-app notification"}),c.jsx("li",{children:'Updated "Last Modified" date at the top of this policy'})]}),c.jsx("p",{className:"mt-4",children:"Continued use of the app after changes constitutes acceptance of the updated policy."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Your Consent"}),c.jsx("p",{children:"By using our app, you consent to this Privacy Policy."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Content Licensing"}),c.jsx("p",{children:"The Bible translations available in this app are provided under their respective licenses. We do not claim ownership of the Scripture content. Audio recordings are used with appropriate permissions."})]}),c.jsxs("section",{className:"bg-muted/50 p-6 rounded-lg mt-10",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Contact Us"}),c.jsx("p",{children:"If you have questions about this Privacy Policy, please contact us:"}),c.jsxs("p",{className:"mt-4",children:[c.jsx("strong",{children:"Email:"})," [email protected]",c.jsx("br",{}),c.jsx("strong",{children:"Website:"})," ",c.jsx("a",{href:"https://everylanguage.com",className:"text-primary hover:underline",children:"https://everylanguage.com"})]})]}),c.jsxs("section",{className:"bg-primary/10 p-6 rounded-lg border-l-4 border-primary mt-8",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Summary for App Store"}),c.jsxs("p",{className:"mb-4",children:[c.jsx("strong",{children:"What data do we collect?"}),c.jsx("br",{}),"Reading progress, preferences, and optional analytics - all stored locally on your device"]}),c.jsxs("p",{className:"mb-4",children:[c.jsx("strong",{children:"Do we share data?"}),c.jsx("br",{}),"NO. We never share, sell, or transmit your data to anyone."]}),c.jsxs("p",{className:"mb-4",children:[c.jsx("strong",{children:"Can users delete their data?"}),c.jsx("br",{}),"YES. Users can delete all data at any time through Settings."]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Do we use third-party analytics or ads?"}),c.jsx("br",{}),"NO. Zero third-party integrations."]})]}),c.jsxs("footer",{className:"text-center mt-12 pt-8 border-t border-border text-muted-foreground text-sm",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"This privacy policy was created:"})," January 13, 2026"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"For app version:"})," 1.0.0"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Organization:"})," Every Language"]}),c.jsx("p",{className:"mt-4",children:"© 2026 Every Language. All rights reserved."}),c.jsx("p",{children:c.jsx("a",{href:"https://everylanguage.com",className:"text-primary hover:underline",children:"everylanguage.com"})})]})]})]})]})}function rje(){return c.jsxs(cn,{children:[c.jsx(kd,{title:"Terms of Service | Every Language Bible",description:"Terms of Service for Every Language Bible App - Read our terms and conditions for using the app."}),c.jsxs("div",{className:"container mx-auto px-4 py-12 max-w-4xl",children:[c.jsx("h1",{className:"font-serif text-4xl font-bold mb-4 pb-4 border-b-4 border-primary",children:"Terms of Service"}),c.jsxs("div",{className:"text-muted-foreground mb-8",children:[c.jsx("strong",{children:"Effective Date:"})," January 13, 2026",c.jsx("br",{}),c.jsx("strong",{children:"Last Updated:"})," January 13, 2026"]}),c.jsxs("div",{className:"prose prose-lg dark:prose-invert max-w-none space-y-8",children:[c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"1. Acceptance of Terms"}),c.jsx("p",{children:'By downloading, installing, or using the Every Language Bible app ("the App"), you agree to be bound by these Terms of Service ("Terms"). If you do not agree to these Terms, please do not use the App.'})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"2. Description of Service"}),c.jsx("p",{children:"Every Language Bible provides:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Access to Bible translations in 150+ languages"}),c.jsx("li",{children:"Audio narration with text synchronization"}),c.jsx("li",{children:"Discipleship training materials"}),c.jsx("li",{children:"Church planting resources"}),c.jsx("li",{children:"Security features including stealth mode and biometric protection"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"3. License to Use"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Grant of License"}),c.jsx("p",{children:"We grant you a limited, non-exclusive, non-transferable, revocable license to:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Download and install the App on your personal devices"}),c.jsx("li",{children:"Access and use the App for personal, non-commercial use"}),c.jsx("li",{children:"Download Bible content for offline use"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Restrictions"}),c.jsx("p",{children:"You may NOT:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Sell, rent, lease, or sublicense the App"}
774),c.jsx("li",{children:"Reverse engineer, decompile, or disassemble the App"}),c.jsx("li",{children:"Remove any copyright or proprietary notices"}),c.jsx("li",{children:"Use the App for any illegal purpose"}),c.jsx("li",{children:"Attempt to gain unauthorized access to any part of the App"}),c.jsx("li",{children:"Redistribute Bible content outside the App (unless permitted by the specific translation's license)"}),c.jsx("li",{children:"Use the App to violate any local, state, national, or international law"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"4. User Responsibilities"}),c.jsx("p",{children:"You are responsible for:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Maintaining the security of your device and passcode"}),c.jsx("li",{children:"All activity that occurs under your usage of the App"}),c.jsx("li",{children:"Compliance with all applicable laws in your jurisdiction"}),c.jsx("li",{children:"Understanding and respecting the licensing terms of specific Bible translations"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"5. Content Ownership and Licensing"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Bible Translations"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"The Bible translations provided in the App are owned by their respective publishers and rights holders"}),c.jsx("li",{children:"Each translation is provided under its specific license terms"}),c.jsx("li",{children:"You agree to respect the licensing terms of each translation"}),c.jsx("li",{children:"We do not claim ownership of any Scripture text"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"App Content"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"The App's code, design, and original materials are owned by Every Language"}),c.jsx("li",{children:"Audio recordings are used with appropriate permissions"}),c.jsx("li",{children:"User-generated content (notes, highlights, bookmarks) remains your property"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"6. Privacy and Data"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsxs("li",{children:["Your use of the App is subject to our ",c.jsx(Rt,{to:"/privacy",className:"text-primary hover:underline",children:"Privacy Policy"})]}),c.jsx("li",{children:"We do not collect, store, or transmit your personal data to our servers"}),c.jsx("li",{children:"All your data is stored locally on your device"}),c.jsx("li",{children:"You are responsible for backing up your data"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"7. Security Features"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Stealth Mode"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:'The calculator disguise feature ("stealth mode") is provided as-is'}),c.jsx("li",{children:"We make no guarantees about the effectiveness of this security feature"}),c.jsx("li",{children:"You are solely responsible for your safety"}),c.jsx("li",{children:"Use this feature at your own risk"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Biometric Authentication"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Biometric features rely on your device's native capabilities"}),c.jsx("li",{children:"We are not responsible for the security of your device's biometric system"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"8. Availability and Updates"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Service Availability"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"We strive to maintain App availability but make no guarantees"}),c.jsx("li",{children:"The App may be temporarily unavailable for maintenance or updates"}),c.jsx("li",{children:"We reserve the right to modify or discontinue the App at any time"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Updates"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Updates may be provided periodically"}),c.jsx("li",{children:"Some updates may be required for continued use"}),c.jsx("li",{children:"New features may be added or removed in updates"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"9. Disclaimers and Limitations"}
774),c.jsxs("div",{className:"bg-amber-100 dark:bg-amber-950/50 p-6 rounded-lg border-l-4 border-amber-500 mt-4",children:[c.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Disclaimer of Warranties"}),c.jsx("p",{className:"mb-4",children:'THE APP IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO:'}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[c.jsx("li",{children:"Merchantability"}),c.jsx("li",{children:"Fitness for a particular purpose"}),c.jsx("li",{children:"Non-infringement"}),c.jsx("li",{children:"Accuracy or reliability of content"}),c.jsx("li",{children:"Uninterrupted or error-free operation"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2",children:"Limitation of Liability"}),c.jsx("p",{className:"mb-4",children:"TO THE MAXIMUM EXTENT PERMITTED BY LAW, WE SHALL NOT BE LIABLE FOR:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[c.jsx("li",{children:"Any indirect, incidental, special, consequential, or punitive damages"}),c.jsx("li",{children:"Loss of profits, data, or use"}),c.jsx("li",{children:"Personal injury or property damage"}),c.jsx("li",{children:"Any harm resulting from use of stealth mode or security features"})]}),c.jsx("p",{className:"mt-4 font-semibold",children:"YOUR SOLE REMEDY FOR DISSATISFACTION WITH THE APP IS TO STOP USING IT."})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"10. Indemnification"}),c.jsx("p",{children:"You agree to indemnify and hold harmless Every Language, its officers, directors, employees, and agents from any claims, losses, damages, liabilities, including legal fees, arising out of:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Your use or misuse of the App"}),c.jsx("li",{children:"Your violation of these Terms"}),c.jsx("li",{children:"Your violation of any law or rights of a third party"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"11. Geographic Restrictions"}),c.jsx("p",{children:"The App is available worldwide. However:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"You are responsible for compliance with local laws in your jurisdiction"}),c.jsx("li",{children:"Some countries may prohibit religious content or apps"}),c.jsx("li",{children:"You use the App at your own risk in jurisdictions where it may be prohibited"}),c.jsx("li",{children:"We disclaim all liability related to use in jurisdictions where the App may be restricted"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"12. Termination"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"By You"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"You may stop using the App at any time"}),c.jsx("li",{children:"Uninstalling the App terminates your use"}),c.jsx("li",{children:"Termination does not affect accrued rights and obligations"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"By Us"}),c.jsx("p",{children:"We may terminate or suspend your access if you:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Violate these Terms"}),c.jsx("li",{children:"Use the App for illegal purposes"}),c.jsx("li",{children:"Attempt to harm the App or other users"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"13. Copyright and Intellectual Property"}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Copyright Infringement"}),c.jsxs("p",{children:["If you believe any content in the App infringes your copyright, contact us at:",c.jsx("br",{}),c.jsx("strong",{children:"[email protected]"})]}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Trademarks"}),c.jsx("p",{children:'"Every Language Bible" and associated logos are trademarks of Every Language. You may not use our trademarks without written permission.'})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"14. Export Compliance"}),c.jsx("p",{children:"The App uses standard encryption. By using the App, you represent that:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"You are not located in a country subject to U.S. embargo"}),c.jsx("li",{children:"You are not on any U.S. government list of prohibited parties"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"15. Modifications to Terms"}),c.jsx("p",{children:"We reserve the right to modify these Terms at any time. Changes will be effective when posted in the App. Continued use after changes constitutes acceptance of modified Terms."}),c.jsx("p",{className:"mt-4",children:"We will notify you of material changes through:"}),c.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"In-app notification"}),c.jsx("li",{children:'Updated "Last Modified" date'})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"16. Severability"}),c.jsx("p",{children:"If any provision of these Terms is found to be unenforceable, the remaining provisions will remain in full effect."})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"17. Entire Agreement"}),c.jsxs("p",{children:["These Terms, together with our ",c.jsx(Rt,{to:"/privacy",className:"text-primary hover:underline",children:"Privacy Policy"}),", constitute the entire agreement between you and us regarding the App."]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"18. Governing Law"}),c.jsx("p",{children:"These Terms shall be governed by the laws of the United States, without regard to conflict of law provisions."}),c.jsx("h3",{className:"font-semibold text-lg mt-6 mb-2 text-muted-foreground",children:"Dispute Resolution"}),c.jsx("p",{children:"Any disputes shall be resolved through:"}),c.jsxs("ol",{className:"list-decimal pl-6 space-y-2 mt-2",children:[c.jsx("li",{children:"Good faith negotiation"}),c.jsx("li",{children:"Mediation (if negotiation fails)"}),c.jsx("li",{children:"Binding arbitration (if mediation fails)"})]})]}),c.jsxs("section",{className:"bg-muted/50 p-6 rounded-lg mt-10",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Contact Information"}),c.jsx("p",{children:"For questions about these Terms, contact us:"}),c.jsxs("p",{className:"mt-4",children:[c.jsx("strong",{children:"Email:"})," [email protected]",c.jsx("br",{}),c.jsx("strong",{children:"Website:"})," ",c.jsx("a",{href:"https://everylanguage.com",className:"text-primary hover:underline",children:"https://everylanguage.com"})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mt-8 mb-4",children:"Acknowledgment"}),c.jsx("p",{className:"font-semibold",children:"BY USING THE APP, YOU ACKNOWLEDGE THAT YOU HAVE READ THESE TERMS, UNDERSTAND THEM, AND AGREE TO BE BOUND BY THEM."})]}
774),c.jsxs("section",{className:"bg-amber-100 dark:bg-amber-950/50 p-6 rounded-lg border-l-4 border-amber-500 mt-8",children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Quick Summary"}),c.jsx("p",{className:"italic mb-4",children:"(Not Legally Binding - See Full Terms Above)"}),c.jsxs("p",{children:["✓ Use the App for personal Bible reading and learning",c.jsx("br",{}),"✓ Download content for offline use",c.jsx("br",{}),"✓ All your data stays on your device",c.jsx("br",{}),"✗ Don't redistribute Bible content",c.jsx("br",{}),"✗ Don't use the App illegally",c.jsx("br",{}),"✗ Don't try to hack or reverse engineer",c.jsx("br",{}),"✗ We're not liable for security features",c.jsx("br",{}),'✗ App provided "as is" with no guarantees']})]}),c.jsxs("footer",{className:"text-center mt-12 pt-8 border-t border-border text-muted-foreground text-sm",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"Document Version:"})," 1.0"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"For App Version:"})," 1.0.0"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Organization:"})," Every Language"]}),c.jsx("p",{className:"mt-4",children:"© 2026 Every Language. All rights reserved."}),c.jsx("p",{children:c.jsx("a",{href:"https://everylanguage.com",className:"text-primary hover:underline",children:"everylanguage.com"})})]})]})]})]})}function sje(){return c.jsxs(cn,{children:[c.jsx(kd,{title:"Support",description:"Get help and support for Heroes of the Faith. Contact us with questions, feedback, or technical issues.",canonicalUrl:"https://heroesofthefaith.ai/support"}),c.jsx("div",{className:"container mx-auto px-4 py-12",children:c.jsxs("div",{className:"max-w-3xl mx-auto",children:[c.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-semibold mb-8 text-center",children:"Support"}),c.jsxs("div",{className:"prose-archive space-y-6",children:[c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"How Can We Help?"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"Whether you have questions about using the archive, need technical assistance, or want to provide feedback, we're here to help. Please don't hesitate to reach out."})]}),c.jsx("section",{children:c.jsx(mt,{className:"border-primary/20",children:c.jsx(kt,{className:"pt-6",children:c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:c.jsx(Kfe,{className:"h-6 w-6 text-primary"})}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-serif text-xl font-semibold mb-2",children:"Email Support"}),c.jsx("p",{className:"text-muted-foreground mb-3",children:"For general inquiries, technical issues, or feedback, email us at:"}),c.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:text-primary/80 font-medium text-lg transition-colors",children:"[email protected]"})]})]})})})}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Common Topics"}),c.jsxs("div",{className:"grid gap-4",children:[c.jsx(mt,{children:c.jsx(kt,{className:"pt-6",children:c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center shrink-0",children:c.jsx(l1,{className:"h-5 w-5 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold mb-1",children:"Account & Subscription"}),c.jsx("p",{className:"text-muted-foreground text-sm",children:"Questions about your account, billing, or subscription status."})]})]})})}),c.jsx(mt,{children:c.jsx(kt,{className:"pt-6",children:c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center shrink-0",children:c.jsx(En,{className:"h-5 w-5 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold mb-1",children:"Using the Archive"}),c.jsxs("p",{className:"text-muted-foreground text-sm",children:["Help with conversations, debates, the library, or study features. Check out our"," ",c.jsx(Rt,{to:"/about#instructions",className:"text-primary hover:underline",children:"Study Workspace Instructions"})," ","for detailed guidance."]})]})]})})})]})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Response Time"}),c.jsx("p",{className:"text-muted-foreground leading-relaxed",children:'We aim to respond to all inquiries within 24-48 hours. For urgent matters, please include "URGENT" in your email subject line.'})]}),c.jsxs("section",{children:[c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-4",children:"Legal"}),c.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["Please review our"," ",c.jsx(Rt,{to:"/privacy",className:"text-primary hover:underline",children:"Privacy Policy"})," ","and"," ",c.jsx(Rt,{to:"/terms",className:"text-primary hover:underline",children:"Terms of Service"})," ","for information about how we handle your data and the terms of using our service."]})]})]})]})})]})}var u5="Progress",d5=100,[ije,Zqe]=Hr(u5),[aje,oje]=ije(u5),eee=_.forwardRef((n,e)=>{const{__scopeProgress:t,value:r=null,max:s,getValueLabel:i=lje,...a}=n;(s||s===0)&&!JU(s)&&console.error(cje(`${s}`,"Progress"));const o=JU(s)?s:d5;r!==null&&!QU(r,o)&&console.error(uje(`${r}`,"Progress"));const l=QU(r,o)?r:null,u=sA(l)?i(l,o):void 0;return c.jsx(aje,{scope:t,value:l,max:o,children:c.jsx(st.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":sA(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":ree(l,o),"data-value":l??void 0,"data-max":o,...a,ref:e})})});eee.displayName=u5;var tee="ProgressIndicator",nee=_.forwardRef((n,e)=>{const{__scopeProgress:t,...r}=n,s=oje(tee,t);return c.jsx(st.div,{"data-state":ree(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});nee.displayName=tee;function lje(n,e){return`${Math.round(n/e*100)}%`}function ree(n,e){return n==null?"indeterminate":n===e?"complete":"loading"}function sA(n){return typeof n=="number"}function JU(n){return sA(n)&&!isNaN(n)&&n>0}function QU(n,e){return sA(n)&&!isNaN(n)&&n<=e&&n>=0}function cje(n,e){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${d5}\`.`}function uje(n,e){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${e}\`. The \`value\` prop must be:
775  - a positive number
776  - less than the value passed to \`max\` (or ${d5} if no \`max\` prop is set)
777  - \`null\` or \`undefined\` if the progress is indeterminate.
778
779Defaulting to \`null\`.`}
779var see=eee,dje=nee;const yf=_.forwardRef(({className:n,value:e,...t},r)=>c.jsx(see,{ref:r,className:ke("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...t,children:c.jsx(dje,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));yf.displayName=see.displayName;const eV=[{id:"mixed",label:"Mixed Challenge",icon:pw,description:"A variety of question types"},{id:"quote",label:"Who Said It?",icon:ud,description:"Match quotes to heroes"},{id:"theology",label:"Theological Positions",icon:En,description:"Test your doctrine knowledge"},{id:"timeline",label:"Historical Timeline",icon:kS,description:"Know your eras and dates"}];function hje(){const n=vr(),{user:e}=Vt(),{toast:t}=Jl(),[r,s]=_.useState("setup"),[i,a]=_.useState("mixed"),[o,l]=_.useState([]),[u,d]=_.useState(0),[h,f]=_.useState(null),[p,m]=_.useState(!1),[g,y]=_.useState(0),[v,x]=_.useState(!1),[b,E]=_.useState(null),[S,k]=_.useState(0),[C,A]=_.useState(0),[T,j]=_.useState(null);_.useEffect(()=>{e&&D()},[e]);const D=async()=>{if(!e)return;const{data:ie}=await pe.from("quiz_sessions").select("total_questions, correct_answers").eq("user_id",e.id).not("completed_at","is",null);if(ie&&ie.length>0){const ne=ie.length,L=ie.map(de=>de.correct_answers/de.total_questions*100),te=Math.max(...L),ae=L.reduce((de,ue)=>de+ue,0)/L.length;j({totalQuizzes:ne,bestScore:te,avgScore:ae})}},R=async()=>{x(!0);try{const{data:ie,error:ne}=await pe.functions.invoke("generate-quiz",{body:{quizType:i,count:10}});if(ne)throw ne;if(!ie.questions||ie.questions.length===0)throw new Error("No questions generated");if(l(ie.questions),d(0),y(0),k(0),A(0),f(null),m(!1),e){const{data:L}=await pe.from("quiz_sessions").insert({user_id:e.id,quiz_type:i,total_questions:ie.questions.length}).select().single();L&&E(L.id)}s("playing")}catch(ie){console.error("Failed to start quiz:",ie),t({title:"Error",description:"Failed to generate quiz. Please try again.",variant:"destructive"})}finally{x(!1)}},M=async ie=>{if(p)return;f(ie),m(!0);const ne=ie===o[u].correct_answer;ne?(y(L=>L+1),k(L=>L+1),A(L=>Math.max(L,S+1))):k(0),e&&b&&await pe.from("quiz_answers").insert({session_id:b,question_id:o[u].id,user_answer:ie,is_correct:ne})},N=async()=>{u<o.length-1?(d(ie=>ie+1),f(null),m(!1)):(e&&b&&await pe.from("quiz_sessions").update({correct_answers:g,completed_at:new Date().toISOString()}).eq("id",b),s("result"),D())},U=()=>{s("setup"),l([]),E(null)},q=async()=>{var ae;const ie=Math.round(g/o.length*100),ne=((ae=eV.find(de=>de.id===i))==null?void 0:ae.label)||"Mixed Challenge",L=`I scored ${g}/${o.length} (${ie}%) on the ${ne} quiz! Test your knowledge of Christian history:`,te=`${window.location.origin}/quiz`;try{navigator.share?await navigator.share({title:"Heroes of the Faith Quiz",text:L,url:te}):(await navigator.clipboard.writeText(`${L} ${te}`),t({title:"Copied to clipboard!",description:"Share your results with friends."}))}catch(de){de.name!=="AbortError"&&(await navigator.clipboard.writeText(`${L} ${te}`),t({title:"Copied to clipboard!",description:"Share your results with friends."}))}},I=o[u],B=o.length>0?(u+1)/o.length*100:0,$=ie=>{switch(ie){case"quote":return ud;case"theology":return En;case"timeline":return kS;case"connection":return Ku;default:return pw}};return e?c.jsxs(cn,{children:[c.jsx(kd,{title:"Quiz - Test Your Knowledge",description:"Test your knowledge of Christian history with interactive quizzes about martyrs, reformers, theologians, and more.",canonicalUrl:"https://heroesofthefaith.ai/quiz"}),c.jsx("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:c.jsxs(y3,{mode:"wait",children:[r==="setup"&&c.jsxs(Oc.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx(pw,{className:"h-12 w-12 mx-auto mb-4 text-primary"}),c.jsx("h1",{className:"font-serif text-3xl font-bold mb-2",children:"Heroes Quiz"}),c.jsx("p",{className:"text-muted-foreground",children:"Test your knowledge of Christian history"})]}),T&&c.jsx(mt,{className:"mb-6",children:c.jsx(kt,{className:"pt-6",children:c.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-2xl font-bold text-primary",children:T.totalQuizzes}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Qu
779izzes Taken"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-2xl font-bold text-primary",children:[Math.round(T.bestScore),"%"]}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Best Score"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-2xl font-bold text-primary",children:[Math.round(T.avgScore),"%"]}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Average"})]})]})})}),c.jsx("div",{className:"grid gap-3 mb-8",children:eV.map(ie=>c.jsxs("button",{onClick:()=>a(ie.id),className:ke("flex items-center gap-4 p-4 rounded-lg border text-left transition-all",i===ie.id?"border-primary bg-primary/5 ring-1 ring-primary":"border-border hover:border-primary/50"),children:[c.jsx(ie.icon,{className:ke("h-8 w-8",i===ie.id?"text-primary":"text-muted-foreground")}),c.jsxs("div",{children:[c.jsx("div",{className:"font-medium",children:ie.label}),c.jsx("div",{className:"text-sm text-muted-foreground",children:ie.description})]})]},ie.id))}),c.jsx(xe,{size:"lg",className:"w-full",onClick:R,disabled:v,children:v?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"h-5 w-5 mr-2 animate-spin"}),"Generating Quiz..."]}):c.jsxs(c.Fragment,{children:["Start Quiz",c.jsx(a1,{className:"h-5 w-5 ml-2"})]})})]},"setup"),r==="playing"&&I&&c.jsxs(Oc.div,{initial:{opacity:0,x:50},animate:{opacity:1,x:0},exit:{opacity:0,x:-50},children:[c.jsxs("div",{className:"mb-6",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(jt,{variant:"outline",children:["Question ",u+1," of ",o.length]}),S>1&&c.jsxs(jt,{variant:"secondary",className:"bg-amber-500/10 text-amber-600",children:["🔥 ",S," streak"]})]}),c.jsxs("div",{className:"text-sm text-muted-foreground",children:["Score: ",g,"/",u+(p?1:0)]})]}),c.jsx(yf,{value:B,className:"h-2"})]}),c.jsxs(mt,{className:"mb-6",children:[c.jsxs(Ln,{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[(()=>{const ie=$(I.category);return c.jsx(ie,{className:"h-4 w-4 text-muted-foreground"})})(),c.jsx(jt,{variant:"outline",className:"capitalize",children:I.category}),c.jsx(jt,{variant:"secondary",className:"capitalize",children:I.difficulty})]}),c.jsx(Wn,{className:"text-xl leading-relaxed",children:I.question_text})]}),c.jsx(kt,{children:c.jsx("div",{className:"grid gap-3",children:I.options.map((ie,ne)=>{const L=ie===I.correct_answer,te=ie===h;return c.jsx("button",{onClick:()=>M(ie),disabled:p,className:ke("p-4 rounded-lg border text-left transition-all",!p&&"hover:border-primary hover:bg-primary/5",p&&L&&"border-green-500 bg-green-500/10",p&&te&&!L&&"border-red-500 bg-red-500/10",!p&&te&&"border-primary bg-primary/5"),children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{children:ie}),p&&L&&c.jsx(TG,{className:"h-5 w-5 text-green-500"}),p&&te&&!L&&c.jsx(sT,{className:"h-5 w-5 text-red-500"})]})},ne)})})})]}),p&&c.jsx(Oc.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:c.jsx(xe,{size:"lg",className:"w-full",onClick:N,children:u<o.length-1?c.jsxs(c.Fragment,{children:["Next Question",c.jsx(a1,{className:"h-5 w-5 ml-2"})]}):c.jsxs(c.Fragment,{children:["See Results",c.jsx(L$,{className:"h-5 w-5 ml-2"})]})})})]},`question-${u}`),r==="result"&&c.jsx(Oc.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:c.jsx(mt,{className:"text-center",children:c.jsxs(kt,{className:"pt-8 pb-8",children:[c.jsx(L$,{className:ke("h-16 w-16 mx-auto mb-4",g>=o.length*.8?"text-amber-500":g>=o.length*.6?"text-primary":"text-muted-foreground")}),c.jsx("h2",{className:"font-serif text-2xl font-bold mb-2",children:"Quiz Complete!"}),c.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:[g," / ",o.length]}),c.jsxs("div",{className:"text-muted-foreground mb-6",children:[Math.round(g/o.length*100),"% correct"]}),C>1&&c.jsx("div",{className:"mb-6",children:c.jsxs(jt,{variant:"secondary",className:"text-lg py-1 px-3",children:["🔥 Best Streak: ",C]})}),c.jsx("div",{className:"text-sm text-muted-foreground mb-8",children:g>=o.length*.9?"Outstanding! You're a true scholar!":g>=o.length*.7?"Great job! Keep studying!":g>=o.length*.5?"Good effort! Room to grow.":"Keep learning! Every hero's story is worth knowing."}),c.jsxs(xe,{size:"lg",variant:"secondary",className:"w-full mb-4",onClick:q,children:[c.jsx(k2,{className:"h-5 w-5 mr-2"}),"Share How You Did on Christian History"]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs(xe,{size:"lg",className:"flex-1",onClick:U,children:[c.jsx(tpe,{className:"h-5 w-5 mr-2"}),"Try Again"]}),c.jsxs(xe,{size:"lg",variant:"outline",className:"flex-1",onClick:()=>n("/personas"),children:[c.jsx(En,{className:"h-5 w-5 mr-2"}),"Study Heroes"]})]})]})})},"result")]})})]}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[c.jsx(pw,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),c.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Sign in Required"}),c.jsx("p",{className:"text-muted-foreground mb-6",children:"Sign in to take quizzes and track y
779our progress."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[c.jsx(xe,{onClick:()=>n("/auth"),children:"Sign In"}),c.jsx(xe,{variant:"outline",onClick:()=>n("/auth?tab=signup"),children:"Free Sign Up"})]})]})})}const fje=()=>{const n=Ql();return _.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",n.pathname)},[n.pathname]),c.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),c.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),c.jsx(Rt,{to:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},pje=[{href:"/admin",label:"Dashboard",icon:oT},{href:"/admin/personas",label:"Personas",icon:Ku},{href:"/admin/labels",label:"Labels",icon:HG},{href:"/admin/library",label:"Library",icon:En},{href:"/admin/books",label:"Books",icon:ud}];function rg({children:n}){const{isAdmin:e,isLoading:t,error:r,refetch:s,user:i}=N3(),{signOut:a}=Vt(),o=Ql();return t?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i?r?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsxs("div",{className:"text-center max-w-md px-6",children:[c.jsx("h1",{className:"font-serif text-2xl font-semibold mb-2",children:"Admin Check Failed"}),c.jsx("p",{className:"text-muted-foreground mb-4",children:"We couldn’t verify your admin privileges (network error). Please retry."}),c.jsxs("div",{className:"flex items-center justify-center gap-2",children:[c.jsx(xe,{variant:"outline",onClick:()=>s(),children:"Retry"}),c.jsx(xe,{variant:"ghost",onClick:()=>a(),children:"Sign Out"})]})]})}):e?c.jsxs("div",{className:"min-h-screen flex bg-background",children:[c.jsxs("aside",{className:"w-64 border-r bg-card flex flex-col",children:[c.jsx("div",{className:"p-6 border-b",children:c.jsxs(Rt,{to:"/",className:"flex items-center gap-2",children:[c.jsx(En,{className:"h-5 w-5 text-accent"}),c.jsx("span",{className:"font-serif text-lg font-semibold",children:"Heroes Admin"})]})}),c.jsx("nav",{className:"flex-1 p-4 space-y-1",children:pje.map(l=>{const u=l.icon,d=o.pathname===l.href||l.href!=="/admin"&&o.pathname.startsWith(l.href);return c.jsxs(Rt,{to:l.href,className:ke("flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",d?"bg-secondary text-foreground font-medium":"text-muted-foreground hover:bg-secondary/50 hover:text-foreground"),children:[c.jsx(u,{className:"h-4 w-4"}),l.label]},l.href)})}),c.jsx("div",{className:"p-4 border-t",children:c.jsxs(xe,{variant:"ghost",className:"w-full justify-start gap-3 text-muted-foreground",onClick:()=>a(),children:[c.jsx(IG,{className:"h-4 w-4"}),"Sign Out"]})})]}),c.jsx("main",{className:"flex-1 overflow-y-auto",children:c.jsx("div",{className:"p-8",children:n})})]}):c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"font-serif text-2xl font-semibold mb-2",children:"Access Denied"}),c.jsx("p",{className:"text-muted-foreground mb-4",children:"You do not have admin privileges to access this area."}),c.jsx(Rt,{to:"/",children:c.jsx(xe,{variant:"outline",children:"Return to Home"})})]})}):c.jsx(yT,{to:"/auth",replace:!0})}function mje(){const{data:n}=pt({queryKey:["admin-stats"],queryFn:async()=>{var l,u,d;const[t,r,s,i]=await Promise.all([pe.from("personas").select("id, is_published"),pe.from("labels").select("id"),pe.from("conversations").select("id"),pe.from("persona_quotes").select("id")]),a=t.data||[],o=a.filter(h=>h.is_published).length;return{totalPersonas:a.length,publishedPersonas:o,draftPersonas:a.length-o,totalLabels:((l=r.data)==null?void 0:l.length)||0,totalConversations:((u=s.data)==null?void 0:u.length)||0,totalQuotes:((d=i.data)==null?void 0:d.length)||0}}}),e=[{title:"Total Personas",value:(n==null?void 0:n.totalPersonas)??
7790,subtitle:`${(n==null?void 0:n.publishedPersonas)??0} published, ${(n==null?void 0:n.draftPersonas)??0} drafts`,icon:Ku},{title:"Labels",value:(n==null?void 0:n.totalLabels)??0,subtitle:"Era, category, region, theme",icon:HG},{title:"Conversations",value:(n==null?void 0:n.totalConversations)??0,subtitle:"User chat sessions",icon:Tf},{title:"Quotes",value:(n==null?void 0:n.totalQuotes)??0,subtitle:"Primary source quotes",icon:En}];return c.jsx(rg,{children:c.jsxs("div",{className:"space-y-8",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif text-3xl font-semibold",children:"Dashboard"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your Heroes of the Faith archive"})]}),c.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-6",children:e.map(t=>{const r=t.icon;return c.jsxs(mt,{children:[c.jsxs(Ln,{className:"flex flex-row items-center justify-between pb-2",children:[c.jsx(Wn,{className:"text-sm font-medium text-muted-foreground",children:t.title}),c.jsx(r,{className:"h-4 w-4 text-muted-foreground"})]}),c.jsxs(kt,{children:[c.jsx("div",{className:"text-2xl font-semibold font-serif",children:t.value}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.subtitle})]})]},t.title)})})]})})}const Of=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:t,className:ke("w-full caption-bottom text-sm",n),...e})}));Of.displayName="Table";const Mf=_.forwardRef(({className:n,...e},t)=>c.jsx("thead",{ref:t,className:ke("[&_tr]:border-b",n),...e}));Mf.displayName="TableHeader";const If=_.forwardRef(({className:n,...e},t)=>c.jsx("tbody",{ref:t,className:ke("[&_tr:last-child]:border-0",n),...e}));If.displayName="TableBody";const gje=_.forwardRef(({className:n,...e},t)=>c.jsx("tfoot",{ref:t,className:ke("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...e}));gje.displayName="TableFooter";const Qs=_.forwardRef(({className:n,...e},t)=>c.jsx("tr",{ref:t,className:ke("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",n),...e}));Qs.displayName="TableRow";const gn=_.forwardRef(({className:n,...e},t)=>c.jsx("th",{ref:t,className:ke("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...e}));gn.displayName="TableHead";const ln=_.forwardRef(({className:n,...e},t)=>c.jsx("td",{ref:t,className:ke("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...e}));ln.displayName="TableCell";const vje=_.forwardRef(({className:n,...e},t)=>c.jsx("caption",{ref:t,className:ke("mt-4 text-sm text-muted-foreground",n),...e}));vje.displayName="TableCaption";var iee="AlertDialog",[yje,Jqe]=Hr(iee,[QJ]),Cd=QJ(),aee=n=>{const{__scopeAlertDialog:e,...t}=n,r=Cd(e);return c.jsx(n5,{...r,...t,modal:!0})};aee.displayName=iee;var xje="AlertDialogTrigger",bje=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,s=Cd(t);return c.jsx(mQ,{...s,...r,ref:e})});bje.displayName=xje;var wje="AlertDialogPortal",oee=n=>{const{__scopeAlertDialog:e,...t}=n,r=Cd(e);return c.jsx(r5,{...r,...t})};oee.displayName=wje;var _je="AlertDialogOverlay",lee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,s=Cd(t);return c.jsx(KS,{...s,...r,ref:e})});lee.displayName=_je;var uy="AlertDialogContent",[Sje,Eje]=yje(uy),kje=rG("AlertDialogContent"),cee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,children:r,...s}=n,i=Cd(t),a=_.useRef(null),o=Ct(e,a),l=_.useRef(null);return c.jsx(VAe,{contentName:uy,titleName:uee,docsSlug:"alert-dialog",children:c.jsx(Sje,{scope:t,cancelRef:l,children:c.jsxs(YS,{role:"alertdialog",...i,...s,ref:o,onOpenAutoFocus:$e(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[c.jsx(kje,{children:r}),c.jsx(Aje,{contentRef:a})]})})})});cee.displayName=uy;var uee="AlertDialogTitle",dee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,s=Cd(t);return c.jsx(XS,{...s,...r,ref:e})});dee.displayName=uee;var hee="AlertDialogDescription",fee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,s=Cd(t);return c.jsx(ZS,{...s,...r,ref:e})});fee.displayName=hee;var Cje="AlertDialogAction",pee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,s=Cd(t);return c.jsx(BT,{...s,...r,ref:e})});pee.displayName=Cje;var mee="AlertDialogCancel",gee=_.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,{cancelRef:s}=Eje(mee,t),i=Cd(t),a=Ct(e,s);return c.jsx(BT,{...i,...r,ref:a})});gee.displayName=mee;var Aje=({contentRef:n})=>{const e=`\`${uy}\` requires a description for the component to be accessible for screen reader users.
780
781You can add a description to the \`${uy}\` by passing a \`${hee}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
782
783Alternatively, 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 \`${uy}\`. 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.
784
785For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{var r;document.getElementById((r=n.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,n]),null},Nje=aee,Tje=oee,vee=lee,yee=cee,xee=pee,bee=gee,wee=dee,_ee=fee;const tE=Nje,jje=Tje,See=_.forwardRef(({className:n,...e},t)=>c.jsx(vee,{className:ke("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",n),...e,ref:t}));See.displayName=vee.displayName;const j0=_.forwardRef(({className:n,...e},t)=>c.jsxs(jje,{children:[c.jsx(See,{}),c.jsx(yee,{ref:t,className:ke("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",n),...e})]}));j0.displayName=yee.displayName;const R0=({className:n,...e})=>c.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",n),...e});R0.displayName="AlertDialogHeader";const P0=({className:n,...e})=>c.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});P0.displayName="AlertDialogFooter";const D0=_.forwardRef(({className:n,...e},t)=>c.jsx(wee,{ref:t,className:ke("text-lg font-semibold",n),...e}));D0.displayName=wee.displayName;const O0=_.forwardRef(({className:n,...e},t)=>c.jsx(_ee,{ref:t,className:ke("text-sm text-muted-foreground",n),...e}));O0.displayName=_ee.displayName;const M0=_.forwardRef(({className:n,...e},t)=>c.jsx(xee,{ref:t,className:ke(C1(),n),...e}));M0.displayName=xee.displayName;const I0=_.forwardRef(({className:n,...e},t)=>c.jsx(bee,{ref:t,className:ke(C1({variant:"outline"}),"mt-2 sm:mt-0",n),...e}));I0.displayName=bee.displayName;var VT="Checkbox",[Rje,Qqe]=Hr(VT),[Pje,h5]=Rje(VT);function Dje(n){const{__scopeCheckbox:e,checked:t,children:r,defaultChecked:s,disabled:i,form:a,name:o,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:h}=n,[f,p]=Zi({prop:t,defaultProp:s??!1,onChange:l,caller:VT}),[m,g]=_.useState(null),[y,v]=_.useState(null),x=_.useRef(!1),b=m?!!a||!!m.closest("form"):!0,E={checked:f,disabled:i,setChecked:p,control:m,setControl:g,name:o,form:a,value:d,hasConsumerStoppedPropagationRef:x,required:u,defaultChecked:rf(s)?!1:s,isFormControl:b,bubbleInput:y,setBubbleInput:v};return c.jsx(Pje,{scope:e,...E,children:Oje(h)?h(E):r})}var Eee="CheckboxTrigger",kee=_.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:t,...r},s)=>{const{control:i,value:a,disabled:o,checked:l,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=h5(Eee,n),g=Ct(s,d),y=_.useRef(l);return _.useEffect(()=>{const v=i==null?void 0:i.form;if(v){const x=()=>h(y.current);return v.addEventListener("reset",x),()=>v.removeEventListener("reset",x)}},[i,h]),c.jsx(st.button,{type:"button",role:"checkbox","aria-checked":rf(l)?"mixed":l,"aria-required":u,"data-state":jee(l),"data-disabled":o?"":void 0,disabled:o,value:a,...r,ref:g,onKeyDown:$e(e,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:$e(t,v=>{h(x=>rf(x)?!0:!x),m&&p&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})})});kee.displayName=Eee;var f5=_.forwardRef((n,e)=>{const{__scopeCheckbox:t,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:l,onCheckedChange:u,form:d,...h}=n;return c.jsx(Dje,{__scopeCheckbox:t,checked:s,defaultChecked:i,disabled:o,required:a,onCheckedChange:u,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:f})=>c.jsxs(c.Fragment,{children:[c.jsx(kee,{...h,ref:e,__scopeCheckbox:t}),f&&c.jsx(Tee,{__scopeCheckbox:t})]})})});f5.displayName=VT;var Cee="CheckboxIndicator",Aee=_.forwardRef((n,e)=>{const{__scopeCheckbox:t,forceMount:r,...s}=n,i=h5(Cee,t);return c.jsx(ss,{present:r||rf(i.checked)||i.checked===!0,children:c.jsx(st.span,{"data-state":jee(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...n.style}})})});Aee.displayName=Cee;var Nee="CheckboxBubbleInput",Tee=_.forwardRef(({__scopeCheckbox:n,...e},t)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:a,required:o,disabled:l,name:u,value:d,form:h,bubbleInput:f,setBubbleInput:p}=h5(Nee,n),m=Ct(t,p),g=eE(i),y=PS(r);_.useEffect(()=>{const x=f;if(!x)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set,k=!s.current;if(g!==i&&S){const C=new Event("click",{bubbles:k});x.indeterminate=rf(i),S.call(x,rf(i)?!1:i),x.dispatchEvent(C)}},[f,g,i,s]);const v=_.useRef(rf(i)?!1:i);return c.jsx(st.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??v.current,required:o,disabled:l,name:u,value:d,form:h,...e,tabIndex:-1,ref:m,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Tee.displayName=Nee;function Oje(n){return typeof n=="function"}function rf(n){return n==="indeterminate"}function jee(n){return rf(n)?"indeterminate":n?"checked":"unchecked"}const iA=_.forwardRef(({className:n,...e},t)=>c.jsx(f5,{ref:t,className:ke("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:c.jsx(Aee,{className:ke("flex items-center justify-center text-current"),children:c.jsx(Go,{className:"h-4 w-4"})})}));iA.displayName=f5.displayName;function Mje({open:n,onOpenChange:e,onComplete:t}){const[r,s]=_.useState(""),[i,a]=_.useState(!1),[o,l]=_.useState([]),[u,d]=_.useState(!1),[h,f]=_.useState(!0),[p,m]=_.useState([]),g=C=>C.split(`
786`).map(A=>A.trim()).filter(A=>A.length>0),y=C=>C.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim(),v=(C,A)=>{const T=C.toLowerCase().trim().replace(/[-_]/g," "),j=p.find(N=>N.label_type===A&&(N.name.toLowerCase()===T||N.slug.replace(/-/g," ")===T));if(j)return j;const D=p.find(N=>N.label_type===A&&(N.name.toLowerCase().includes(T)||T.includes(N.name.toLowerCase())));if(D)return D;const M={reformer:"reformer","reformed theologian":"reformed","reformed theology":"reformed",calvinism:"reformed",calvinist:"reformed","puritan theologian":"puritan",puritanism:"puritan","mission work":"missions","missionary work":"missions",evangelism:"evangelist","bible translation work":"bible translation",translator:"bible translation","church fathers":"church father",patristic:"church father",mart
786yred:"martyr","united kingdom":"england",britain:"england",british:"england",american:"north america",usa:"north america","united states":"north america"}[T];if(M)return p.find(N=>N.label_type===A&&N.slug===M)},x=async(C,A)=>{l(T=>T.map((j,D)=>D===A?{...j,status:"researching"}:j));try{const{data:T,error:j}=await pe.functions.invoke("research-persona",{body:{name:C}});if(j)throw new Error(j.message||"Research failed");const D=T;l($=>$.map((ie,ne)=>ne===A?{...ie,status:"saving"}:ie));const R=y(D.full_name),{data:M,error:N}=await pe.from("personas").insert({full_name:D.full_name,slug:R,birth_year:D.birth_year,death_year:D.death_year,short_biography:D.short_biography,long_biography:D.long_biography,portrait_image_url:null,is_published:u}).select("id").single();if(N)throw new Error(`Failed to create persona: ${N.message}`);const U=M.id;let q=0;await pe.from("persona_personality").insert({persona_id:U,tone_slider:D.personality.tone_slider,firmness_slider:D.personality.firmness_slider,pastoral_vs_academic:D.personality.pastoral_vs_academic});const I=[];if(D.labels.era){const $=v(D.labels.era,"era");$&&I.push($.id)}if(D.labels.region){const $=v(D.labels.region,"region");$&&I.push($.id)}for(const $ of D.labels.categories){const ie=v($,"category");ie&&I.push(ie.id)}for(const $ of D.labels.themes){const ie=v($,"theme");ie&&I.push(ie.id)}if(I.length>0){const $=I.map(ie=>({persona_id:U,label_id:ie}));await pe.from("persona_labels").insert($),q=I.length}if(D.quotes.length>0){const $=D.quotes.map(ie=>({persona_id:U,quote_text:ie.text,source_title:ie.source_title,source_type:ie.source_type,approximate_date:ie.approximate_date,verified:!1}));await pe.from("persona_quotes").insert($)}if(D.theological_positions.length>0){const $=D.theological_positions.map(ie=>({persona_id:U,position_key:ie.topic,position_value:ie.stance,scripture_references:ie.scripture_references}));await pe.from("persona_theological_positions").insert($)}if(D.writings.length>0){const $=D.writings.map(ie=>({persona_id:U,title:ie.title,document_type:ie.document_type,external_link:ie.external_link}));await pe.from("persona_writings").insert($)}let B=!1;if(h){l($=>$.map((ie,ne)=>ne===A?{...ie,status:"generating_portrait"}:ie));try{const{data:$,error:ie}=await pe.functions.invoke("generate-persona-portrait",{body:{personaName:D.full_name,personaId:U,birthYear:D.birth_year,deathYear:D.death_year}});!ie&&($!=null&&$.success)?B=!0:console.warn(`Portrait generation failed for ${D.full_name}:`,ie)}catch($){console.warn(`Portrait generation error for ${D.full_name}:`,$)}}l($=>$.map((ie,ne)=>ne===A?{...ie,status:"complete",personaId:U,message:`Created ${D.full_name}`,details:{quotes:D.quotes.length,positions:D.theological_positions.length,writings:D.writings.length,labels:q,hasPortrait:B}}:ie))}catch(T){console.error(`Error processing ${C}:`,T),l(j=>j.map((D,R)=>R===A?{...D,status:"error",message:T instanceof Error?T.message:"Unknown error"}:D))}},b=async()=>{const C=g(r);if(C.length===0){Ye.error("Please enter at least one persona name");return}a(!0);const{data:A}=await pe.from("labels").select("id, name, slug, label_type");m(A||[]);const T=C.map(D=>({name:D,status:"pending"}));l(T);for(let D=0;D<C.length;D++)await x(C[D],D);a(!1);const j=o.filter(D=>D.status==="complete").length;j>0&&(Ye.success(`Imported ${j} persona${j!==1?"s":""}`),t())},E=()=>{i||(s(""),l([]),e(!1))},S=o.length>0?o.filter(C=>C.status==="complete"||C.status==="error").length/o.length*100:0,k=C=>{switch(C){case"pending":return c.jsx(RG,{className:"h-4 w-4 text-muted-foreground"});case"researching":return c.jsx(Eg,{className:"h-4 w-4 text-blue-500 animate-pulse"});case"saving":return c.jsx(NS,{className:"h-4 w-4 text-amber-500 animate-pulse"});case"generating_portrait":return c.jsx(OG,{className:"h-4 w-4 text-purple-500 animate-pulse"});case"complete":return c.jsx(TG,{className:"h-4 w-4 text-green-500"});case"error":return c.jsx(sT,{className:"h-4 w-4 text-destructive"})}};return c.jsx(ai,{open:n,onOpenChange:E,children:c.jsxs(Ls,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[c.jsxs(Fs,{children:[c.jsx(Bs,{children:"Bulk Import Personas"}),c.jsx(Df,{children:"Paste persona names (one per line). AI will research each person and auto-populate biographical info, quotes, theological positions, writings, and labels."})]}),c.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden flex flex-col",children:[!i&&o.length===0&&
786c.jsxs(c.Fragment,{children:[c.jsx(Ca,{placeholder:`Charles Spurgeon
787Amy Carmichael
788Dietrich Bonhoeffer
789Augustine of Hippo`,value:r,onChange:C=>s(C.target.value),className:"min-h-[200px] font-mono text-sm"}),c.jsxs("div",{className:"space-y-3 border rounded-lg p-4 bg-muted/30",children:[c.jsx("p",{className:"text-sm font-medium",children:"Import Options"}),c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(iA,{id:"generate-portraits",checked:h,onCheckedChange:C=>f(C===!0)}),c.jsx(yt,{htmlFor:"generate-portraits",className:"text-sm",children:"Generate AI portraits (Renaissance oil painting style)"})]}),c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(iA,{id:"auto-publish",checked:u,onCheckedChange:C=>d(C===!0)}),c.jsx(yt,{htmlFor:"auto-publish",className:"text-sm",children:"Auto-publish personas after import"})]})]}),c.jsx("div",{className:"text-sm text-muted-foreground",children:c.jsxs("p",{children:[c.jsx("strong",{children:g(r).length})," persona",g(r).length!==1?"s":""," will be imported"]})}),c.jsx(xe,{onClick:b,disabled:g(r).length===0,className:"w-full",children:"Start Import"})]}),(i||o.length>0)&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between text-sm",children:[c.jsxs("span",{children:["Processing ",o.filter(C=>C.status!=="pending").length," of"," ",o.length]}),c.jsxs("span",{children:[Math.round(S),"%"]})]}),c.jsx(yf,{value:S,className:"h-2"})]}),c.jsx(Or,{className:"flex-1 min-h-0 border rounded-lg",children:c.jsx("div",{className:"p-2 space-y-1",children:o.map((C,A)=>c.jsxs("div",{className:"flex items-start gap-3 p-2 rounded-md hover:bg-muted/50",children:[c.jsx("div",{className:"mt-0.5",children:k(C.status)}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-medium text-sm truncate",children:C.name}),C.message&&c.jsx("p",{className:`text-xs truncate ${C.status==="error"?"text-destructive":"text-muted-foreground"}`,children:C.message}),C.details&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:[C.details.quotes," quotes, ",C.details.positions," positions,"," ",C.details.writings," writings, ",C.details.labels," labels",C.details.hasPortrait&&" • portrait ✓"]})]})]},A))})}),!i&&c.jsxs("div",{className:"flex gap-2",children:[c.jsx(xe,{variant:"outline",onClick:E,className:"flex-1",children:"Close"}),c.jsx(xe,{onClick:()=>{l([]),s("")},className:"flex-1",children:"Import More"})]}),i&&c.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[c.jsx(et,{className:"h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-sm",children:"Processing... Please wait"})]})]})]})]})})}function Ije({personaId:n,open:e,onOpenChange:t}){const[r,s]=_.useState(!1),i=$n(),{data:a,isLoading:o}=pt({queryKey:["persona-preview",n],queryFn:async()=>{if(!n)return null;const{data:f,error:p}=await pe.from("personas").select("*").eq("id",n).single();if(p)throw p;return f},enabled:!!n&&e}),{data:l}=pt({queryKey:["persona-labels-preview",n],queryFn:async()=>{if(!n)return[];const{data:f,error:p}=await pe.from("persona_labels").select("label_id, labels(name, label_type)").eq("persona_id",n);if(p)throw p;return f},enabled:!!n&&e}),{data:u}=pt({queryKey:["persona-quotes-preview",n],queryFn:async()=>{if(!n)return[];const{data:f,error:p}=await pe.from("persona_quotes").select("*").eq("persona_id",n).limit(3);if(p)throw p;return f},enabled:!!n&&e}),{data:d}=pt({queryKey:["persona-writings-preview",n],queryFn:async()=>{if(!n)return[];const{data:f,error:p}=await pe.from("persona_writings").select("*").eq("persona_id",n).limit(5);if(p)throw p;return f},enabled:!!n&&e}),h=async()=>{if(!(!a||!n)){s(!0);try{const{data:f,error:p}=await pe.functions.invoke("generate-persona-portrait",{body:{personaName:a.full_name,personaId:n,birthYear:a.birth_year,deathYear:a.death_year}});if(p)throw p;if(f!=null&&f.error)throw new Error(f.error);Ye.success("Portrait regenerated successfully!"),i.invalidateQueries({queryKey:["persona-preview",n]}),i.invalidateQueries({queryKey:["admin-personas"]})}catch(f){console.error("Error regenerating portrait:",f),Ye.error(f instanceof Error?f.message:"Failed to regenerate portrait")}finally{s(!1)}}};return c.jsx(ai,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl max-h-[85vh]",children:[c.jsx(Fs,{children:c.jsx(Bs,{className:"font-serif text-2xl",children:o?c.jsx(qt,{className:"h-8 w-48"}):a==null?void 0:a.full_name})}),c.jsx(Or,{className:"max-h-[calc(85vh-100px)] pr-4",children:o?c.jsxs("div",{className:"space-y-4",children:[c.jsx(qt,{className:"h-32 w-32 rounded-lg"}),c.jsx(qt,{className:"h-4 w-full"}),c.jsx(qt,{className:"h-4 w-3/4"})]}):a?c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[a.portrait_image_url?c.jsx("div",{className:"w-32 h-32 rounded-lg overflow-hidden bg-secondary flex-shrink-0",children:c.jsx("img",{src:a.portrait_image_url,alt:a.full_name,className:"w-full h-full object-cover scale-[1.15]"})}):c.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center text-muted-foreground",children:"No portrait"}),c.jsxs(xe,{variant:"outline",size:"sm",onClick:h,disabled:r,className:"w-32",children:[r?c.jsx(et,{className:"h-3 w-3 mr-1 animate-spin"}):c.jsx(AS,{className:"h-3 w-3 mr-1"}),r?"Generating...":"Regenerate"]})]}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[c.jsx(kS,{className:"h-4 w-4"}),c.jsxs("span",{children:[a.birth_year||"?"," – ",a.death_year||"?"]})]}),c.jsx(jt,{variant:a.is_published?"default":"secondary",children:a.is_published?"Published":"Draft"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Slug: ",c.jsx("code",{className:"bg-muted px-1 rounded",children:a.slug})]})]})]}),l&&l.length>0&&c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-medium mb-2",children:"Labels"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(f=>{var p;return c.jsx(jt,{variant:"outline",className:"text-xs",children:(p=f.labels)==null?void 0:p.name},f.label_id)})})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-medium mb-2",children:"Short Biography"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:a.short_biography})]}),a.long_biography&&c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-medium mb-2",children:"Long Biography"}),c.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap line-clamp-6",children:a.long_biography})]}),u&&u.length>0&&c.jsxs("div",{children:[c.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[c.jsx(ud,{className:"h-4 w-4"}),"Quotes (",u.length,")"]}),c.jsx("div",{className:"space-y-2",children:u.map(f=>c.jsxs("blockquote",{className:"border-l-2 border-primary/30 pl-3 text-sm text-muted-foreground italic",children:['"',f.quote_text,'"',c.jsxs("footer",{className:"text-xs mt-1 not-italic",children:["— ",f.source_title]})]},f.id))})]}),d&&d.length>0&&c.jsxs("div",{children:[c.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[c.jsx(En,{className:"h-4 w-4"}),"Writings (",d.length,")"]}),c.jsx("ul",{className:"space-y-1",children:d.map(f=>c.jsxs("li",{className:"text-sm text-muted-foreground",children:["• ",f.title,f.document_type&&c.jsxs("span",{className:"text-xs ml-1",children:["(",f.document_type,")"]})]},f.id))})]})]}):c.jsx("p",{className:"text-muted-foreground",children:"Persona not found"})})]})})}function Lje(){const[n,e]=_.useState(""),[t,r]=_.useState(null),[s,i]=_.useState(!1),[a,o]=_.useState(null),l=$n(),{data:u,isLoading:d}=pt({queryKey:["admin-personas"],queryFn:async()=>{const{data:m,error:g}=await pe.from("personas").select("*").order("full_name");if(g)throw g;return m}}),h=kn({mutationFn:async({id:m,is_published:g})=>{const{error:y}=await pe.from("personas").update({is_published:g}).eq("id",m);if(y)throw y},onSuccess:()=>
789{l.invalidateQueries({queryKey:["admin-personas"]}),Ye.success("Persona updated")},onError:()=>{Ye.error("Failed to update persona")}}),f=kn({mutationFn:async m=>{const{error:g}=await pe.from("personas").delete().eq("id",m);if(g)throw g},onSuccess:()=>{l.invalidateQueries({queryKey:["admin-personas"]}),Ye.success("Persona deleted"),r(null)},onError:()=>{Ye.error("Failed to delete persona")}}),p=u==null?void 0:u.filter(m=>m.full_name.toLowerCase().includes(n.toLowerCase()));return c.jsxs(rg,{children:[c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif text-3xl font-semibold",children:"Personas"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage historical figures in the archive"})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(xe,{variant:"outline",onClick:()=>i(!0),children:[c.jsx(S2,{className:"h-4 w-4 mr-2"}),"Bulk Import"]}),c.jsx(Rt,{to:"/admin/personas/new",children:c.jsxs(xe,{children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"Add Persona"]})})]})]}),c.jsx("div",{className:"flex items-center gap-4",children:c.jsxs("div",{className:"relative flex-1 max-w-sm",children:[c.jsx(Eg,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Lt,{placeholder:"Search personas...",value:n,onChange:m=>e(m.target.value),className:"pl-10"})]})}),c.jsx("div",{className:"border rounded-md",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{children:"Name"}),c.jsx(gn,{children:"Years"}),c.jsx(gn,{children:"Status"}),c.jsx(gn,{children:"Created"}),c.jsx(gn,{className:"w-[70px]"})]})}),c.jsx(If,{children:d?c.jsx(Qs,{children:c.jsx(ln,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"Loading personas..."})}):p&&p.length>0?p.map(m=>c.jsxs(Qs,{children:[c.jsx(ln,{children:c.jsxs("div",{children:[c.jsx("button",{onClick:()=>o(m.id),className:"font-medium text-left hover:text-primary hover:underline transition-colors",children:m.full_name}),c.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:m.short_biography})]})}),c.jsxs(ln,{className:"text-muted-foreground",children:[m.birth_year||"?"," – ",m.death_year||"?"]}),c.jsx(ln,{children:c.jsx(jt,{variant:m.is_published?"default":"secondary",children:m.is_published?"Published":"Draft"})}),c.jsx(ln,{className:"text-muted-foreground text-sm",children:new Date(m.created_at).toLocaleDateString()}),c.jsx(ln,{children:c.jsxs(B3,{children:[c.jsx(z3,{asChild:!0,children:c.jsx(xe,{variant:"ghost",size:"icon",children:c.jsx(Mfe,{className:"h-4 w-4"})})}),c.jsxs(PT,{align:"end",children:[c.jsx(Do,{asChild:!0,children:c.jsxs(Rt,{to:`/admin/personas/${m.id}`,children:[c.jsx(zG,{className:"h-4 w-4 mr-2"}),"Edit"]})}),c.jsx(Do,{onClick:()=>h.mutate({id:m.id,is_published:!m.is_published}),children:m.is_published?c.jsxs(c.Fragment,{children:[c.jsx(Ife,{className:"h-4 w-4 mr-2"}),"Unpublish"]}):c.jsxs(c.Fragment,{children:[c.jsx(aT,{className:"h-4 w-4 mr-2"}),"Publish"]})}),c.jsxs(Do,{className:"text-destructive",onClick:()=>r(m.id),children:[c.jsx(ao,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},m.id)):c.jsx(Qs,{children:c.jsx(ln,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:(u==null?void 0:u.length)===0?"No personas yet. Create your first one.":"No personas match your search."})})})]})})]}),c.jsx(tE,{open:!!t,onOpenChange:()=>r(null),children:c.jsxs(j0,{children:[c.jsxs(R0,{children:[c.jsx(D0,{children:"Delete Persona"}),c.jsx(O0,{children:"This will permanently delete this persona and all associated data including quotes, writings, and conversation history. This action cannot be undone."})]}),c.jsxs(P0,{children:[c.jsx(I0,{children:"Cancel"}),c.jsx(M0,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>t&&f.mutate(t),children:"Delete"})]})]})}),c.jsx(Mje,{open:s,onOpenChange:i,onComplete:()=>l.invalidateQueries({queryKey:["admin-personas"]})}),c.jsx(Ije,{personaId:a,open:!!a,onOpenChange:m=>!m&&o(null)})]})}var nE=n=>n.type==="checkbox",wp=n=>n instanceof Date,Fi=n=>n==null;const Ree=n=>typeof n=="object";var Ur=n=>!Fi(n)&&!Array.isArray(n)&&Ree(n)&&!wp(n),Pee=n=>Ur(n)&&n.target?nE(n.target)?n.target.checked:n.target.value:n,Fje=n=>n.substring(0,n.search(/\.\d+(\.|$)/))||n,Dee=(n,e)=>n.has(Fje(e)),Bje=n=>{const e=n.constructor&&n.constructor.prototype;return Ur(e)&&e.hasOwnProperty("isPrototypeOf")},p5=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function us(n){let e;const t=Array.isArray(n),r=typeof FileList<"u"?n instanceof FileList:!1;if(n instanceof Date)e=new Date(n);else if(!(p5&&(n instanceof Blob||r))&&(t||Ur(n)))if(e=t?[]:{},!t&&!Bje(n))e=n;else for(const s in n)n.hasOwnProperty(s)&&(e[s]=us(n[s]));else return n;return e}var HT=n=>/^\w*$/.test(n),Fr=n=>n===void 0,m5=n=>
789Array.isArray(n)?n.filter(Boolean):[],g5=n=>m5(n.replace(/["|']|\]/g,"").split(/\.|\[/)),it=(n,e,t)=>{if(!e||!Ur(n))return t;const r=(HT(e)?[e]:g5(e)).reduce((s,i)=>Fi(s)?s:s[i],n);return Fr(r)||r===n?Fr(n[e])?t:n[e]:r},Ha=n=>typeof n=="boolean",Pn=(n,e,t)=>{let r=-1;const s=HT(e)?[e]:g5(e),i=s.length,a=i-1;for(;++r<i;){const o=s[r];let l=t;if(r!==a){const u=n[o];l=Ur(u)||Array.isArray(u)?u:isNaN(+s[r+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;n[o]=l,n=n[o]}};const aA={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Il={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},eu={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},v5=Oe.createContext(null);v5.displayName="HookFormContext";const WT=()=>Oe.useContext(v5),zje=n=>{const{children:e,...t}=n;return Oe.createElement(v5.Provider,{value:t},e)};var Oee=(n,e,t,r=!0)=>{const s={defaultValues:e._defaultValues};for(const i in n)Object.defineProperty(s,i,{get:()=>{const a=i;return e._proxyFormState[a]!==Il.all&&(e._proxyFormState[a]=!r||Il.all),t&&(t[a]=!0),n[a]}});return s};const y5=typeof window<"u"?Oe.useLayoutEffect:Oe.useEffect;function $je(n){const e=WT(),{control:t=e.control,disabled:r,name:s,exact:i}=n||{},[a,o]=Oe.useState(t._formState),l=Oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return y5(()=>t._subscribe({name:s,formState:l.current,exact:i,callback:u=>{!r&&o({...t._formState,...u})}}),[s,r,i]),Oe.useEffect(()=>{l.current.isValid&&t._setValid(!0)},[t]),Oe.useMemo(()=>Oee(a,t,l.current,!1),[a,t])}var Ic=n=>typeof n=="string",Mee=(n,e,t,r,s)=>Ic(n)?(r&&e.watch.add(n),it(t,n,s)):Array.isArray(n)?n.map(i=>(r&&e.watch.add(i),it(t,i))):(r&&(e.watchAll=!0),t),YM=n=>Fi(n)||!Ree(n);function Vu(n,e,t=new WeakSet){if(YM(n)||YM(e))return n===e;if(wp(n)&&wp(e))return n.getTime()===e.getTime();const r=Object.keys(n),s=Object.keys(e);if(r.length!==s.length)return!1;if(t.has(n)||t.has(e))return!0;t.add(n),t.add(e);for(const i of r){const a=n[i];if(!s.includes(i))return!1;if(i!=="ref"){const o=e[i];if(wp(a)&&wp(o)||Ur(a)&&Ur(o)||Array.isArray(a)&&Array.isArray(o)?!Vu(a,o,t):a!==o)return!1}}return!0}function Uje(n){const e=WT(),{control:t=e.control,name:r,defaultValue:s,disabled:i,exact:a,compute:o}=n||{},l=Oe.useRef(s),u=Oe.useRef(o),d=Oe.useRef(void 0);u.current=o;const h=Oe.useMemo(()=>t._getWatch(r,l.current),[t,r]),[f,p]=Oe.useState(u.current?u.current(h):h);return y5(()=>t._subscribe({name:r,formState:{values:!0},exact:a,callback:m=>{if(!i){const g=Mee(r,t._names,m.values||t._formValues,!1,l.current);if(u.current){const y=u.current(g);Vu(y,d.current)||(p(y),d.current=y)}else p(g)}}}),[t,i,r,a]),Oe.useEffect(()=>t._removeUnmounted()),f}function Vje(n){const e=WT(),{name:t,disabled:r,control:s=e.control,shouldUnregister:i,defaultValue:a}=n,o=Dee(s._names.array,t),l=Oe.useMemo(()=>it(s._formValues,t,it(s._defaultValues,t,a)),[s,t,a]),u=Uje({control:s,name:t,defaultValue:l,exact:!0}),d=$je({control:s,name:t,exact:!0}),h=Oe.useRef(n),f=Oe.useRef(s.register(t,{...n.rules,value:u,...Ha(n.disabled)?{disabled:n.disabled}:{}}));h.current=n;const p=Oe.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!it(d.errors,t)},isDirty:{enumerable:!0,get:()=>!!it(d.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!it(d.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!it(d.validatingFields,t)},error:{enumerable:!0,get:()=>it(d.errors,t)}}),[d,t]),m=Oe.useCallback(x=>f.current.onChange({target:{value:Pee(x),name:t},type:aA.CHANGE}),[t]),g=Oe.useCallback(()=>f.current.onBlur({target:{value:it(s._formValues,t),name:t},type:aA.BLUR}),[t,s._formValues]),y=Oe.useCallback(x=>{const b=it(s._fields,t);b&&x&&(b._f.ref={focus:()=>x.focus&&x.focus(),select:()=>x.select&&x.select(),setCustomValidity:E=>x.setCustomValidity(E),reportValidity:()=>x.reportValidity()})},[s._fields,t]),v=Oe.useMemo(()=>({name:t,value:u,...Ha(r)||d.disabled?{disabled:d.disabled||r}:{},onChange:m,onBlur:g,ref:y}),[t,r,d.disabled,m,g,y,u]);return Oe.useEffect(()=>{const x=s._options.shouldUnregister||i;s.register(t,{...h.current.rules,...Ha(h.current.disabled)?{disabled:h.current.disabled}:{}});const b=(E,S)=>{const k=it(s._fields,E);k&&k._f&&(k._f.mount=S)};if(b(t,!0),x){const E=us(it(s._options.defaultValues,t));Pn(s._defaultValues,t,E),Fr(it(s._formValues,t))&&Pn(s._formValues,t,E)}return!o&&s.register(t),()=>{(o?x&&!s._state.action:x)?s.unregister(t):b(t,!1)}},[t,s,o,i]),Oe.useEffect(()=>{s._setDisabledField({disabled:r,name:t})},[r,t,s]),Oe.useMemo(()=>({field:v,formState:d,fieldState:p}),[v,d,p])}const Hje=n=>n.render(Vje(n));var Iee=(n,e,t,r,s)=>e?{...t[n],types:{...t[n]&&t[n].types?t[n].types:{},[r]:s||!0}}:{},Sw=n=>Array.isArray(n)?n:[n],tV=()=>{let n=[];return{get observers(){return n},next:s=>{for(const i of n)i.next&&i.next(s)},subscribe:s=>(n.push(s),{unsubscribe:()=>{n=n.filter(i=>i!==s)}}),unsubscribe:()=>{n=[]}}},ha=n=>
vendor: 10,842 bytes, line 789
789Ur(n)&&!Object.keys(n).length,x5=n=>n.type==="file",Ll=n=>typeof n=="function",oA=n=>{if(!p5)return!1;const e=n?n.ownerDocument:0;return n instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Lee=n=>n.type==="select-multiple",b5=n=>n.type==="radio",Wje=n=>b5(n)||nE(n),yP=n=>oA(n)&&n.isConnected;function qje(n,e){const t=e.slice(0,-1).length;let r=0;for(;r<t;)n=Fr(n)?r++:n[e[r++]];return n}function Gje(n){for(const e in n)if(n.hasOwnProperty(e)&&!Fr(n[e]))return!1;return!0}function Kr(n,e){const t=Array.isArray(e)?e:HT(e)?[e]:g5(e),r=t.length===1?n:qje(n,t),s=t.length-1,i=t[s];return r&&delete r[i],s!==0&&(Ur(r)&&ha(r)||Array.isArray(r)&&Gje(r))&&Kr(n,t.slice(0,-1)),n}var Fee=n=>{for(const e in n)if(Ll(n[e]))return!0;return!1};function lA(n,e={}){const t=Array.isArray(n);if(Ur(n)||t)for(const r in n)Array.isArray(n[r])||Ur(n[r])&&!Fee(n[r])?(e[r]=Array.isArray(n[r])?[]:{},lA(n[r],e[r])):Fi(n[r])||(e[r]=!0);return e}function Bee(n,e,t){const r=Array.isArray(n);if(Ur(n)||r)for(const s in n)Array.isArray(n[s])||Ur(n[s])&&!Fee(n[s])?Fr(e)||YM(t[s])?t[s]=Array.isArray(n[s])?lA(n[s],[]):{...lA(n[s])}:Bee(n[s],Fi(e)?{}:e[s],t[s]):t[s]=!Vu(n[s],e[s]);return t}var ib=(n,e)=>Bee(n,e,lA(e));const nV={value:!1,isValid:!1},rV={value:!0,isValid:!0};var zee=n=>{if(Array.isArray(n)){if(n.length>1){const e=n.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return n[0].checked&&!n[0].disabled?n[0].attributes&&!Fr(n[0].attributes.value)?Fr(n[0].value)||n[0].value===""?rV:{value:n[0].value,isValid:!0}:rV:nV}return nV},$ee=(n,{valueAsNumber:e,valueAsDate:t,setValueAs:r})=>Fr(n)?n:e?n===""?NaN:n&&+n:t&&Ic(n)?new Date(n):r?r(n):n;const sV={isValid:!1,value:null};var Uee=n=>Array.isArray(n)?n.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,sV):sV;function iV(n){const e=n.ref;return x5(e)?e.files:b5(e)?Uee(n.refs).value:Lee(e)?[...e.selectedOptions].map(({value:t})=>t):nE(e)?zee(n.refs).value:$ee(Fr(e.value)?n.ref.value:e.value,n)}var Kje=(n,e,t,r)=>{const s={};for(const i of n){const a=it(e,i);a&&Pn(s,i,a._f)}return{criteriaMode:t,names:[...n],fields:s,shouldUseNativeValidation:r}},cA=n=>n instanceof RegExp,ab=n=>Fr(n)?n:cA(n)?n.source:Ur(n)?cA(n.value)?n.value.source:n.value:n,aV=n=>({isOnSubmit:!n||n===Il.onSubmit,isOnBlur:n===Il.onBlur,isOnChange:n===Il.onChange,isOnAll:n===Il.all,isOnTouch:n===Il.onTouched});const oV="AsyncFunction";var Yje=n=>!!n&&!!n.validate&&!!(Ll(n.validate)&&n.validate.constructor.name===oV||Ur(n.validate)&&Object.values(n.validate).find(e=>e.constructor.name===oV)),Xje=n=>n.mount&&(n.required||n.min||n.max||n.maxLength||n.minLength||n.pattern||n.validate),lV=(n,e,t)=>!t&&(e.watchAll||e.watch.has(n)||[...e.watch].some(r=>n.startsWith(r)&&/^\.\w+/.test(n.slice(r.length))));const Ew=(n,e,t,r)=>{for(const s of t||Object.keys(n)){const i=it(n,s);if(i){const{_f:a,...o}=i;if(a){if(a.refs&&a.refs[0]&&e(a.refs[0],s)&&!r)return!0;if(a.ref&&e(a.ref,a.name)&&!r)return!0;if(Ew(o,e))break}else if(Ur(o)&&Ew(o,e))break}}};function cV(n,e,t){const r=it(n,t);if(r||HT(t))return{error:r,name:t};const s=t.split(".");for(;s.length;){const i=s.join("."),a=it(e,i),o=it(n,i);if(a&&!Array.isArray(a)&&t!==i)return{name:t};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};s.pop()}return{name:t}}var Zje=(n,e,t,r)=>{t(n);const{name:s,...i}=n;return ha(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(a=>e[a]===(!r||Il.all))},Jje=(n,e,t)=>!n||!e||n===e||Sw(n).some(r=>r&&(t?r===e:r.startsWith(e)||e.startsWith(r))),Qje=(n,e,t,r,s)=>s.isOnAll?!1:!t&&s.isOnTouch?!(e||n):(t?r.isOnBlur:s.isOnBlur)?!n:(t?r.isOnChange:s.isOnChange)?n:!0,eRe=(n,e)=>!m5(it(n,e)).length&&Kr(n,e),tRe=(n,e,t)=>{const r=Sw(it(n,t));return Pn(r,"root",e[t]),Pn(n,t,r),n},oC=n=>Ic(n);function uV(n,e,t="validate"){if(oC(n)||Array.isArray(n)&&n.every(oC)||Ha(n)&&!n)return{type:t,message:oC(n)?n:"",ref:e}}var Jg=n=>Ur(n)&&!cA(n)?n:{value:n,message:""},dV=async(n,e,t,r,s,i)=>{const{ref:a,refs:o,required:l,maxLength:u,minLength:d,min:h,max:f,pattern:p,validate:m,name:g,valueAsNumber:y,mount:v}=n._f,x=it(t,g);if(!v||e.has(g))return{};const b=o?o[0]:a,E=R=>{s&&b.reportValidity&&(b.setCustomValidity(Ha(R)?"":R||""),b.reportValidity())},S={},k=b5(a),C=nE(a),A=k||C,T=(y||x5(a))&&Fr(a.value)&&Fr(x)||oA(a)&&a.value===""||x===""||Array.isArray(x)&&!x.length,j=Iee.bind(null,g,r,S),D=(R,M,N,U=eu.maxLength,q=eu.minLength)=>{const I=R?M:N;S[g]={type:R?U:q,message:I,ref:a,...j(R?U:q,I)}};if(i?!Array.isArray(x)||!x.length:l&&(!A&&(T||Fi(x))||Ha(x)&&!x||C&&!zee(o).isValid||k&&!Uee(o).isValid)){const{value:R,message:M}=oC(l)?{value:!!l,message:l}:Jg(l);if(R&&(S[g]={type:eu.required,message:M,ref:b,...j(eu.required,M)},!r))return E(M),S}if(!T&&(!Fi(h)||!Fi(f))){let R,M;const N=Jg(f),U=Jg(h);if(!Fi(x)&&!isNaN(x)){const q=a.valueAsNumber||x&&+x;Fi(N.value)||(R=q>N.value),Fi(U.value)||(M=q<U.value)}else{const q=a.valueAsDate||new Date(x),I=ie=>new Date(new Date().toDateString()+" "+ie),B=a.type=="time",$=a.type=="week";Ic(N.value)&&x&&(R=B?I(x)>I(N.value):$?x>N.value:q>new Date(N.value)),Ic(U.value)&&x&&(M=B?I(x)<I(U.value):$?x<U.value:q<new Date(U.value))}if((R||M)&&(D(!!R,N.message,U.message,eu.max,eu.min),!r))return E(S[g].message),S}if((u||d)&&!T&&(Ic(x)||i&&Array.isArray(x))){const R=Jg(u),M=Jg(d),N=!Fi(R.value)&&x.length>+R.value,U=!Fi(M.value)&&x.length<+M.value;if((N||U)&&(D(N,R.message,M.message),!r))return E(S[g].message),S}if(p&&!T&&Ic(x)){const{value:R,message:M}=Jg(p);if(cA(R)&&!x.match(R)&&(S[g]={type:eu.pattern,message:M,ref:a,...j(eu.pattern,M)},!r))return E(M),S}if(m){if(Ll(m)){const R=await m(x,t),M=uV(R,b);if(M&&(S[g]={...M,...j(eu.validate,M.message)},!r))return E(M.message),S}else if(Ur(m)){let R={};for(const M in m){if(!ha(R)&&!r)break;const N=uV(await m[M](x,t),b,M);N&&(R={...N,...j(M,N.message)},E(N.message),r&&(S[g]=R))}if(!ha(R)&&(S[g]={ref:b,...R},!r))return S}}return E(!0),S};const nRe={mode:Il.onSubmit,reValidateMode:Il.onChange,shouldFocusError:!0};function rRe(n={}){let e={...nRe,...n},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ll(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},s=Ur(e.defaultValues)||Ur(e.values)?us(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:us(s),a={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let h={...d};const f={array:tV(),state:tV()},p=e.criteriaMode===Il.all,m=z=>Q=>{clearTimeout(u),u=setTimeout(z,Q)},g=async z=>{if(!e.disabled&&(d.isValid||h.isValid||z)){const Q=e.resolver?ha((await C()).errors):await T(r,!0);Q!==t.isValid&&f.state.next({isValid:Q})}},y=(z,Q)=>{!e.disabled&&(d.isValidating||d.validatingFields||h.isValidating||h.validatingFields)&&((z||Array.from(o.mount)).forEach(Y=>{Y&&(Q?Pn(t.validatingFields,Y,Q):Kr(t.validatingFields,Y))}),f.state.next({validatingFields:t.validatingFields,isValidating:!ha(t.validatingFields)}))},v=(z,Q=[],Y,ce,he=!0,ge=!0)=>{if(ce&&Y&&!e.disabled){if(a.action=!0,ge&&Array.isArray(it(r,z))){const Ee=Y(it(r,z),ce.argA,ce.argB);he&&Pn(r,z,Ee)}if(ge&&Array.isArray(it(t.errors,z))){const Ee=Y(it(t.errors,z),ce.argA,ce.argB);he&&Pn(t.errors,z,Ee),eRe(t.errors,z)}if((d.touchedFields||h.touchedFields)&&ge&&Array.isArray(it(t.touchedFields,z))){const Ee=Y(it(t.touchedFields,z),ce.argA,ce.argB);he&&Pn(t.touchedFields,z,Ee)}(d.dirtyFields||h.dirtyFields)&&(t.dirtyFields=ib(s,i)),f.state.next({name:z,isDirty:D(z,Q),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else Pn(i,z,Q)},x=(z,Q)=>{Pn(t.errors,z,Q),f.state.next({errors:t.errors})},b=z=>{t.errors=z,f.state.next({errors:t.errors,isValid:!1})},E=(z,Q,Y,ce)=>{const he=it(r,z);if(he){const ge=it(i,z,Fr(Y)?it(s,z):Y);Fr(ge)||ce&&ce.defaultChecked||Q?Pn(i,z,Q?ge:iV(he._f)):N(z,ge),a.mount&&g()}},S=(z,Q,Y,ce,he)=>{let ge=!1,Ee=!1;const Le={name:z};if(!e.disabled){if(!Y||ce){(d.isDirty||h.isDirty)&&(Ee=t.isDirty,t.isDirty=Le.isDirty=D(),ge=Ee!==Le.isDirty);const qe=Vu(it(s,z),Q);Ee=!!it(t.dirtyFields,z),qe?Kr(t.dirtyFields,z):Pn(t.dirtyFields,z,!0),Le.dirtyFields=t.dirtyFields,ge=ge||(d.dirtyFields||h.dirtyFields)&&Ee!==!qe}if(Y){const qe=it(t.touchedFields,z);qe||(Pn(t.touchedFields,z,Y),Le.touchedFields=t.touchedFields,ge=ge||(d.touchedFields||h.touchedFields)&&qe!==Y)}ge&&he&&f.state.next(Le)}return ge?Le:{}},k=(z,Q,Y,ce)=>{const he=it(t.errors,z),ge=(d.isValid||h.isValid)&&Ha(Q)&&t.isValid!==Q;if(e.delayError&&Y?(l=m(()=>x(z,Y)),l(e.delayError)):(clearTimeout(u),l=null,Y?Pn(t.errors,z,Y):Kr(t.errors,z)),(Y?!Vu(he,Y):he)||!ha(ce)||ge){const Ee={...ce,...ge&&Ha(Q)?{isValid:Q}:{},errors:t.errors,name:z};t={...t,...Ee},f.state.next(Ee)}},C=async z=>{y(z,!0);const Q=await e.resolver(i,e.context,Kje(z||o.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return y(z),Q},A=async z=>{const{errors:Q}=await C(z);if(z)for(const Y of z){const ce=it(Q,Y);ce?Pn(t.errors,Y,ce):Kr(t.errors,Y)}else t.errors=Q;return Q},T=async(z,Q,Y={valid:!0})=>{for(const ce in z){const he=z[ce];if(he){const{_f:ge,...Ee}=he;if(ge){const Le=o.array.has(ge.name),qe=he._f&&Yje(he._f);qe&&d.validatingFields&&y([ce],!0);const lt=await dV(he,o.disabled,i,p,e.shouldUseNativeValidation&&!Q,Le);if(qe&&d.validatingFields&&y([ce]),lt[ge.name]&&(Y.valid=!1,Q))break;!Q&&(it(lt,ge.name)?Le?tRe(t.errors,lt,ge.name):Pn(t.errors,ge.name,lt[ge.name]):Kr(t.errors,ge.name))}!ha(Ee)&&await T(Ee,Q,Y)}}return Y.valid},j=()=>{for(const z of o.unMount){const Q=it(r,z);Q&&(Q._f.refs?Q._f.refs.every(Y=>!yP(Y)):!yP(Q._f.ref))&&le(z)}o.unMount=new Set},D=(z,Q)=>!e.disabled&&(z&&Q&&Pn(i,z,Q),!Vu(ie(),s)),R=(z,Q,Y)=>Mee(z,o,{...a.mount?i:Fr(Q)?s:Ic(z)?{[z]:Q}:Q},Y,Q),M=z=>m5(it(a.mount?i:s,z,e.shouldUnregister?it(s,z,[]):[])),N=(z,Q,Y={})=>{const ce=it(r,z);let he=Q;if(ce){const ge=ce._f;ge&&(!ge.disabled&&Pn(i,z,$ee(Q,ge)),he=oA(ge.ref)&&Fi(Q)?"":Q,Lee(ge.ref)?[...ge.ref.options].forEach(Ee=>Ee.selected=he.includes(Ee.value)):ge.refs?nE(ge.ref)?ge.refs.forEach(Ee=>{(!Ee.defaultChecked||!Ee.disabled)&&(Array.isArray(he)?Ee.checked=!!he.find(Le=>Le===Ee.value):Ee.checked=he===Ee.value||!!he)}):ge.refs.forEach(Ee=>Ee.checked=Ee.value===he):x5(ge.ref)?ge.ref.value="":(ge.ref.value=he,ge.ref.type||f.state.next({name:z,values:us(i)})))}(Y.shouldDirty||Y.shouldTouch)&&S(z,he,Y.shouldTouch,Y.shouldDirty,!0),Y.shouldValidate&&$(z)},U=(z,Q,Y)=>{for(const ce in Q){if(!Q.hasOwnProperty(ce))return;const he=Q[ce],ge=z+"."+ce,Ee=it(r,ge);(o.array.has(z)||Ur(he)||Ee&&!Ee._f)&&!wp(he)?U(ge,he,Y):N(ge,he,Y)}},q=(z,Q,Y={})=>{const ce=it(r,z),he=o.array.has(z),ge=us(Q);
vendor: 4,460 bytes, line 789
789Pn(i,z,ge),he?(f.array.next({name:z,values:us(i)}),(d.isDirty||d.dirtyFields||h.isDirty||h.dirtyFields)&&Y.shouldDirty&&f.state.next({name:z,dirtyFields:ib(s,i),isDirty:D(z,ge)})):ce&&!ce._f&&!Fi(ge)?U(z,ge,Y):N(z,ge,Y),lV(z,o)&&f.state.next({...t,name:z}),f.state.next({name:a.mount?z:void 0,values:us(i)})},I=async z=>{a.mount=!0;const Q=z.target;let Y=Q.name,ce=!0;const he=it(r,Y),ge=qe=>{ce=Number.isNaN(qe)||wp(qe)&&isNaN(qe.getTime())||Vu(qe,it(i,Y,qe))},Ee=aV(e.mode),Le=aV(e.reValidateMode);if(he){let qe,lt;const rt=Q.type?iV(he._f):Pee(z),Pt=z.type===aA.BLUR||z.type===aA.FOCUS_OUT,en=!Xje(he._f)&&!e.resolver&&!it(t.errors,Y)&&!he._f.deps||Qje(Pt,it(t.touchedFields,Y),t.isSubmitted,Le,Ee),gt=lV(Y,o,Pt);Pn(i,Y,rt),Pt?(he._f.onBlur&&he._f.onBlur(z),l&&l(0)):he._f.onChange&&he._f.onChange(z);const Wt=S(Y,rt,Pt),wn=!ha(Wt)||gt;if(!Pt&&f.state.next({name:Y,type:z.type,values:us(i)}),en)return(d.isValid||h.isValid)&&(e.mode==="onBlur"?Pt&&g():Pt||g()),wn&&f.state.next({name:Y,...gt?{}:Wt});if(!Pt&&gt&&f.state.next({...t}),e.resolver){const{errors:J}=await C([Y]);if(ge(rt),ce){const Me=cV(t.errors,r,Y),Be=cV(J,r,Me.name||Y);qe=Be.error,Y=Be.name,lt=ha(J)}}else y([Y],!0),qe=(await dV(he,o.disabled,i,p,e.shouldUseNativeValidation))[Y],y([Y]),ge(rt),ce&&(qe?lt=!1:(d.isValid||h.isValid)&&(lt=await T(r,!0)));ce&&(he._f.deps&&$(he._f.deps),k(Y,lt,qe,Wt))}},B=(z,Q)=>{if(it(t.errors,Q)&&z.focus)return z.focus(),1},$=async(z,Q={})=>{let Y,ce;const he=Sw(z);if(e.resolver){const ge=await A(Fr(z)?z:he);Y=ha(ge),ce=z?!he.some(Ee=>it(ge,Ee)):Y}else z?(ce=(await Promise.all(he.map(async ge=>{const Ee=it(r,ge);return await T(Ee&&Ee._f?{[ge]:Ee}:Ee)}))).every(Boolean),!(!ce&&!t.isValid)&&g()):ce=Y=await T(r);return f.state.next({...!Ic(z)||(d.isValid||h.isValid)&&Y!==t.isValid?{}:{name:z},...e.resolver||!z?{isValid:Y}:{},errors:t.errors}),Q.shouldFocus&&!ce&&Ew(r,B,z?he:o.mount),ce},ie=z=>{const Q={...a.mount?i:s};return Fr(z)?Q:Ic(z)?it(Q,z):z.map(Y=>it(Q,Y))},ne=(z,Q)=>({invalid:!!it((Q||t).errors,z),isDirty:!!it((Q||t).dirtyFields,z),error:it((Q||t).errors,z),isValidating:!!it(t.validatingFields,z),isTouched:!!it((Q||t).touchedFields,z)}),L=z=>{z&&Sw(z).forEach(Q=>Kr(t.errors,Q)),f.state.next({errors:z?t.errors:{}})},te=(z,Q,Y)=>{const ce=(it(r,z,{_f:{}})._f||{}).ref,he=it(t.errors,z)||{},{ref:ge,message:Ee,type:Le,...qe}=he;Pn(t.errors,z,{...qe,...Q,ref:ce}),f.state.next({name:z,errors:t.errors,isValid:!1}),Y&&Y.shouldFocus&&ce&&ce.focus&&ce.focus()},ae=(z,Q)=>Ll(z)?f.state.subscribe({next:Y=>"values"in Y&&z(R(void 0,Q),Y)}):R(z,Q,!0),de=z=>f.state.subscribe({next:Q=>{Jje(z.name,Q.name,z.exact)&&Zje(Q,z.formState||d,V,z.reRenderRoot)&&z.callback({values:{...i},...t,...Q,defaultValues:s})}}).unsubscribe,ue=z=>(a.mount=!0,h={...h,...z.formState},de({...z,formState:h})),le=(z,Q={})=>{for(const Y of z?Sw(z):o.mount)o.mount.delete(Y),o.array.delete(Y),Q.keepValue||(Kr(r,Y),Kr(i,Y)),!Q.keepError&&Kr(t.errors,Y),!Q.keepDirty&&Kr(t.dirtyFields,Y),!Q.keepTouched&&Kr(t.touchedFields,Y),!Q.keepIsValidating&&Kr(t.validatingFields,Y),!e.shouldUnregister&&!Q.keepDefaultValue&&Kr(s,Y);f.state.next({values:us(i)}),f.state.next({...t,...Q.keepDirty?{isDirty:D()}:{}}),!Q.keepIsValid&&g()},ve=({disabled:z,name:Q})=>{(Ha(z)&&a.mount||z||o.disabled.has(Q))&&(z?o.disabled.add(Q):o.disabled.delete(Q))},_e=(z,Q={})=>{let Y=it(r,z);const ce=Ha(Q.disabled)||Ha(e.disabled);return Pn(r,z,{...Y||{},_f:{...Y&&Y._f?Y._f:{ref:{name:z}},name:z,mount:!0,...Q}}),o.mount.add(z),Y?ve({disabled:Ha(Q.disabled)?Q.disabled:e.disabled,name:z}):E(z,!0,Q.value),{...ce?{disabled:Q.disabled||e.disabled}:{},...e.progressive?{required:!!Q.required,min:ab(Q.min),max:ab(Q.max),minLength:ab(Q.minLength),maxLength:ab(Q.maxLength),pattern:ab(Q.pattern)}:{},name:z,onChange:I,onBlur:I,ref:he=>{if(he){_e(z,Q),Y=it(r,z);const ge=Fr(he.value)&&he.querySelectorAll&&he.querySelectorAll("input,select,textarea")[0]||he,Ee=Wje(ge),Le=Y._f.refs||[];if(Ee?Le.find(qe=>qe===ge):ge===Y._f.ref)return;Pn(r,z,{_f:{...Y._f,...Ee?{refs:[...Le.filter(yP),ge,...Array.isArray(it(s,z))?[{}]:[]],ref:{type:ge.type,name:z}}:{ref:ge}}}),E(z,!1,void 0,ge)}else Y=it(r,z,{}),Y._f&&(Y._f.mount=!1),(e.shouldUnregister||Q.shouldUnregister)&&!(Dee(o.array,z)&&a.action)&&o.unMount.add(z)}}},Ne=()=>e.shouldFocusError&&Ew(r,B,o.mount),Pe=z=>{Ha(z)&&(f.state.next({disabled:z}),Ew(r,(Q,Y)=>{const ce=it(r,Y);ce&&(Q.disabled=ce._f.disabled||z,Array.isArray(ce._f.refs)&&ce._f.refs.forEac
vendor: 4,108 bytes, line 789
789h(he=>{he.disabled=ce._f.disabled||z}))},0,!1))},Se=(z,Q)=>async Y=>{let ce;Y&&(Y.preventDefault&&Y.preventDefault(),Y.persist&&Y.persist());let he=us(i);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:ge,values:Ee}=await C();t.errors=ge,he=us(Ee)}else await T(r);if(o.disabled.size)for(const ge of o.disabled)Kr(he,ge);if(Kr(t.errors,"root"),ha(t.errors)){f.state.next({errors:{}});try{await z(he,Y)}catch(ge){ce=ge}}else Q&&await Q({...t.errors},Y),Ne(),setTimeout(Ne);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ha(t.errors)&&!ce,submitCount:t.submitCount+1,errors:t.errors}),ce)throw ce},Ce=(z,Q={})=>{it(r,z)&&(Fr(Q.defaultValue)?q(z,us(it(s,z))):(q(z,Q.defaultValue),Pn(s,z,us(Q.defaultValue))),Q.keepTouched||Kr(t.touchedFields,z),Q.keepDirty||(Kr(t.dirtyFields,z),t.isDirty=Q.defaultValue?D(z,us(it(s,z))):D()),Q.keepError||(Kr(t.errors,z),d.isValid&&g()),f.state.next({...t}))},O=(z,Q={})=>{const Y=z?us(z):s,ce=us(Y),he=ha(z),ge=he?s:ce;if(Q.keepDefaultValues||(s=Y),!Q.keepValues){if(Q.keepDirtyValues){const Ee=new Set([...o.mount,...Object.keys(ib(s,i))]);for(const Le of Array.from(Ee))it(t.dirtyFields,Le)?Pn(ge,Le,it(i,Le)):q(Le,it(ge,Le))}else{if(p5&&Fr(z))for(const Ee of o.mount){const Le=it(r,Ee);if(Le&&Le._f){const qe=Array.isArray(Le._f.refs)?Le._f.refs[0]:Le._f.ref;if(oA(qe)){const lt=qe.closest("form");if(lt){lt.reset();break}}}}if(Q.keepFieldsRef)for(const Ee of o.mount)q(Ee,it(ge,Ee));else r={}}i=e.shouldUnregister?Q.keepDefaultValues?us(s):{}:us(ge),f.array.next({values:{...ge}}),f.state.next({values:{...ge}})}o={mount:Q.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!Q.keepIsValid||!!Q.keepDirtyValues,a.watch=!!e.shouldUnregister,f.state.next({submitCount:Q.keepSubmitCount?t.submitCount:0,isDirty:he?!1:Q.keepDirty?t.isDirty:!!(Q.keepDefaultValues&&!Vu(z,s)),isSubmitted:Q.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:he?{}:Q.keepDirtyValues?Q.keepDefaultValues&&i?ib(s,i):t.dirtyFields:Q.keepDefaultValues&&z?ib(s,z):Q.keepDirty?t.dirtyFields:{},touchedFields:Q.keepTouched?t.touchedFields:{},errors:Q.keepErrors?t.errors:{},isSubmitSuccessful:Q.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},X=(z,Q)=>O(Ll(z)?z(i):z,Q),ee=(z,Q={})=>{const Y=it(r,z),ce=Y&&Y._f;if(ce){const he=ce.refs?ce.refs[0]:ce.ref;he.focus&&(he.focus(),Q.shouldSelect&&Ll(he.select)&&he.select())}},V=z=>{t={...t,...z}},se={control:{register:_e,unregister:le,getFieldState:ne,handleSubmit:Se,setError:te,_subscribe:de,_runSchema:C,_focusError:Ne,_getWatch:R,_getDirty:D,_setValid:g,_setFieldArray:v,_setDisabledField:ve,_setErrors:b,_getFieldArray:M,_reset:O,_resetDefaultValues:()=>Ll(e.defaultValues)&&e.defaultValues().then(z=>{X(z,e.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:j,_disableForm:Pe,_subjects:f,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return a},set _state(z){a=z},get _defaultValues(){return s},get _names(){return o},set _names(z){o=z},get _formState(){return t},get _options(){return e},set _options(z){e={...e,...z}}},subscribe:ue,trigger:$,register:_e,handleSubmit:Se,watch:ae,setValue:q,getValues:ie,reset:X,resetField:Ce,clearErrors:L,unregister:le,setError:te,setFocus:ee,getFieldState:ne};return{...se,formControl:se}}function sRe(n={}){const e=Oe.useRef(void 0),t=Oe.useRef(void 0),[r,s]=Oe.useState({isDirty:!1,isValidating:!1,isLoading:Ll(n.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1,isReady:!1,defaultValues:Ll(n.defaultValues)?void 0:n.defaultValues});if(!e.current)if(n.formControl)e.current={...n.formControl,formState:r},n.defaultValues&&!Ll(n.defaultValues)&&n.formControl.reset(n.defaultValues,n.resetOptions);else{const{formControl:a,...o}=rRe(n);e.current={...o,formState:r}}const i=e.current.control;return i._options=n,y5(()=>{const a=i._subscribe({formState:i._proxyFormState,callback:()=>s({...i._formState}
789),reRenderRoot:!0});return s(o=>({...o,isReady:!0})),i._formState.isReady=!0,a},[i]),Oe.useEffect(()=>i._disableForm(n.disabled),[i,n.disabled]),Oe.useEffect(()=>{n.mode&&(i._options.mode=n.mode),n.reValidateMode&&(i._options.reValidateMode=n.reValidateMode)},[i,n.mode,n.reValidateMode]),Oe.useEffect(()=>{n.errors&&(i._setErrors(n.errors),i._focusError())},[i,n.errors]),Oe.useEffect(()=>{n.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,n.shouldUnregister]),Oe.useEffect(()=>{if(i._proxyFormState.isDirty){const a=i._getDirty();a!==r.isDirty&&i._subjects.state.next({isDirty:a})}},[i,r.isDirty]),Oe.useEffect(()=>{n.values&&!Vu(n.values,t.current)?(i._reset(n.values,{keepFieldsRef:!0,...i._options.resetOptions}),t.current=n.values,s(a=>({...a}))):i._resetDefaultValues()},[i,n.values]),Oe.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=Oee(r,i),e.current}const hV=(n,e,t)=>{if(n&&"reportValidity"in n){const r=it(t,e);n.setCustomValidity(r&&r.message||""),n.reportValidity()}},Vee=(n,e)=>{for(const t in e.fields){const r=e.fields[t];r&&r.ref&&"reportValidity"in r.ref?hV(r.ref,t,n):r.refs&&r.refs.forEach(s=>hV(s,t,n))}},iRe=(n,e)=>{e.shouldUseNativeValidation&&Vee(n,e);const t={};for(const r in n){const s=it(e.fields,r),i=Object.assign(n[r]||{},{ref:s&&s.ref});if(aRe(e.names||Object.keys(n),r)){const a=Object.assign({},it(t,r));Pn(a,"root",i),Pn(t,r,a)}else Pn(t,r,i)}return t},aRe=(n,e)=>n.some(t=>t.startsWith(e+"."));var oRe=function(n,e){for(var t={};n.length;){var r=n[0],s=r.code,i=r.message,a=r.path.join(".");if(!t[a])if("unionErrors"in r){var o=r.unionErrors[0].errors[0];t[a]={message:o.message,type:o.code}}else t[a]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(h){return n.push(h)})}),e){var l=t[a].types,u=l&&l[r.code];t[a]=Iee(a,e,t,s,u?[].concat(u,r.message):r.message)}n.shift()}return t},lRe=function(n,e,t){return t===void 0&&(t={}),function(r,s,i){try{return Promise.resolve(function(a,o){try{var l=Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return i.shouldUseNativeValidation&&Vee({},i),{errors:{},values:t.raw?r:u}})}catch(u){return o(u)}return l&&l.then?l.then(void 0,o):l}(0,function(a){if(function(o){return Array.isArray(o==null?void 0:o.errors)}(a))return{values:{},errors:iRe(oRe(a.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}},qT="Switch",[cRe,e9e]=Hr(qT),[uRe,dRe]=cRe(qT),Hee=_.forwardRef((n,e)=>{const{__scopeSwitch:t,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:l="on",onCheckedChange:u,form:d,...h}=n,[f,p]=_.useState(null),m=Ct(e,b=>p(b)),g=_.useRef(!1),y=f?d||!!f.closest("form"):!0,[v,x]=Zi({prop:s,defaultProp:i??!1,onChange:u,caller:qT});return c.jsxs(uRe,{scope:t,checked:v,disabled:o,children:[c.jsx(st.button,{type:"button",role:"switch","aria-checked":v,"aria-required":a,"data-state":Kee(v),"data-disabled":o?"":void 0,disabled:o,value:l,...h,ref:m,onClick:$e(n.onClick,b=>{x(E=>!E),y&&(g.current=b.isPropagationStopped(),g.current||b.stopPropagation())})}),y&&c.jsx(Gee,{control:f,bubbles:!g.current,name:r,value:l,checked:v,required:a,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});Hee.displayName=qT;var Wee="SwitchThumb",qee=_.forwardRef((n,e)=>{const{__scopeSwitch:t,...r}=n,s=dRe(Wee,t);return c.jsx(st.span,{"data-state":Kee(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});qee.displayName=Wee;var hRe="SwitchBubbleInput",Gee=_.forwardRef(({__scopeSwitch:n,control:e,checked:t,bubbles:r=!0,...s},i)=>{const a=_.useRef(null),o=Ct(a,i),l=eE(t),u=PS(e);return _.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(h,"checked").set;if(l!==t&&p){const m=new Event("click",{bubbles:r});p.call(d,t),d.dispatchEvent(m)}},[l,t,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:o,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Gee.displayName=hRe;function Kee(n){return n?"checked":"unchecked"}var Yee=Hee,fRe=qee;const w5=_.forwardRef(({className:n,...e},t)=>c.jsx(Yee,{className:ke("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",n),...e,ref:t,children:c.jsx(fRe,{className:ke("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")})}
789));w5.displayName=Yee.displayName;const pRe=zje,Xee=_.createContext({}),nc=({...n})=>c.jsx(Xee.Provider,{value:{name:n.name},children:c.jsx(Hje,{...n})}),GT=()=>{const n=_.useContext(Xee),e=_.useContext(Zee),{getFieldState:t,formState:r}=WT(),s=t(n.name,r);if(!n)throw new Error("useFormField should be used within <FormField>");const{id:i}=e;return{id:i,name:n.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},Zee=_.createContext({}),sl=_.forwardRef(({className:n,...e},t)=>{const r=_.useId();return c.jsx(Zee.Provider,{value:{id:r},children:c.jsx("div",{ref:t,className:ke("space-y-2",n),...e})})});sl.displayName="FormItem";const il=_.forwardRef(({className:n,...e},t)=>{const{error:r,formItemId:s}=GT();return c.jsx(yt,{ref:t,className:ke(r&&"text-destructive",n),htmlFor:s,...e})});il.displayName="FormLabel";const al=_.forwardRef(({...n},e)=>{const{error:t,formItemId:r,formDescriptionId:s,formMessageId:i}=GT();return c.jsx(Nf,{ref:e,id:r,"aria-describedby":t?`${s} ${i}`:`${s}`,"aria-invalid":!!t,...n})});al.displayName="FormControl";const lC=_.forwardRef(({className:n,...e},t)=>{const{formDescriptionId:r}=GT();return c.jsx("p",{ref:t,id:r,className:ke("text-sm text-muted-foreground",n),...e})});lC.displayName="FormDescription";const rp=_.forwardRef(({className:n,children:e,...t},r)=>{const{error:s,formMessageId:i}=GT(),a=s?String(s==null?void 0:s.message):e;return a?c.jsx("p",{ref:r,id:i,className:ke("text-sm font-medium text-destructive",n),...t,children:a}):null});rp.displayName="FormMessage";var Jee=["PageUp","PageDown"],Qee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ete={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},L0="Slider",[XM,mRe,gRe]=SS(L0),[tte,t9e]=Hr(L0,[gRe]),[vRe,KT]=tte(L0),nte=_.forwardRef((n,e)=>{const{name:t,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:h=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...g}=n,y=_.useRef(new Set),v=_.useRef(0),b=a==="horizontal"?yRe:xRe,[E=[],S]=Zi({prop:d,defaultProp:u,onChange:D=>{var M;(M=[...y.current][v.current])==null||M.focus(),h(D)}}),k=_.useRef(E);function C(D){const R=ERe(E,D);j(D,R)}function A(D){j(D,v.current)}function T(){const D=k.current[v.current];E[v.current]!==D&&f(E)}function j(D,R,{commit:M}={commit:!1}){const N=NRe(i),U=TRe(Math.round((D-r)/i)*i+r,N),q=T1(U,[r,s]);S((I=[])=>{const B=_Re(I,q,R);if(ARe(B,l*i)){v.current=B.indexOf(q);const $=String(B)!==String(I);return $&&M&&f(B),$?B:I}else return I})}return c.jsx(vRe,{scope:n.__scopeSlider,name:t,disabled:o,min:r,max:s,valueIndexToChangeRef:v,thumbs:y.current,values:E,orientation:a,form:m,children:c.jsx(XM.Provider,{scope:n.__scopeSlider,children:c.jsx(XM.Slot,{scope:n.__scopeSlider,children:c.jsx(b,{"aria-disabled":o,"data-disabled":o?"":void 0,...g,ref:e,onPointerDown:$e(g.onPointerDown,()=>{o||(k.current=E)}),min:r,max:s,inverted:p,onSlideStart:o?void 0:C,onSlideMove:o?void 0:A,onSlideEnd:o?void 0:T,onHomeKeyDown:()=>!o&&j(r,0,{commit:!0}),onEndKeyDown:()=>!o&&j(s,E.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:R})=>{if(!o){const U=Jee.includes(D.key)||D.shiftKey&&Qee.includes(D.key)?10:1,q=v.current,I=E[q],B=i*U*R;j(I+B,q,{commit:!0})}}})})})})});nte.displayName=L0;var[rte,ste]=tte(L0,{startEdge:"left",endEdge:"right",size:"width",direction:1}),yRe=_.forwardRef((n,e)=>{const{min:t,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:l,onStepKeyDown:u,...d}=n,[h,f]=_.useState(null),p=Ct(e,b=>f(b)),m=_.useRef(void 0),g=kg(s),y=g==="ltr",v=y&&!i||!y&&i;function x(b){const E=m.current||h.getBoundingClientRect(),S=[0,E.width],C=_5(S,v?[t,r]:[r,t]);return m.current=E,C(b-E.left)}return c.jsx(rte,{scope:n.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:c.jsx(ite,{dir:g,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const E=x(b.clientX);a==null||a(E)},onSlideMove:b=>{const E=x(b.clientX);o==null||o(E)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:b=>{const S=ete[v?"from-left":"from-right"].includes(b.key);u==null||u({event:b,direction:S?-1:1})}})})}),xRe=_.forwardRef((n,e)=>{const{min:t,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onStepKeyDown:l,...u}=n,d=_.useRef(null),h=Ct(e,d),f=_.useRef(void 0),p=!s;function m(g){const y=f.current||d.current.getBoundingClientRect(),v=[0,y.height],b=_5(v,p?[r,t]:[t,r]);return f.current=y,b(g-y.top)}return c.jsx(rte,{scope:n.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:c.jsx(ite,{"data-orientation":"vertical",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const y=m(g.clientY);i==null||i(y)},onSlideMove:g=>{const y=m(g.clientY);a==null||a(y)},onSlideEnd:()=>{f.current=void 0,o==null||o()},onStepKeyDown:g=>{const v=ete[p?"from-bottom":"from-top"].includes(g.key);l==null||l({event:g,direction:v?-1:1})}})})}),ite=_.forwardRef((n,e)=>{const{__scopeSlider:t,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:l,...u}=n,d=KT(L0,t);return c.jsx(st.span,{...u,ref:e,onKeyDown:$e(n.onKeyDown,h=>{h.key==="Home"?(a(h),h.preventDefault()):h.key==="End"?(o(h),h.preventDefault()):Jee.concat(Qee).includes(h.key)&&(l(h),h.preventDefault())}),onPointerDown:$e(n.onPointerDown,h=>{const f=h.target;f.setPointerCapture(h.pointerId),h.preventDefault(),d.thumbs.has(f)?f.focus():r(h)}),onPointerMove:$e(n.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&s(h)}),onPointerUp:$e(n.onPointerUp,h=>{const f=h.target;f.hasPointerCapture(h.pointerId)&&(f.releasePointerCapture(h.pointerId),i(h))})})}),ate="SliderTrack",ote=_.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,s=KT(ate,t);return c.jsx(st.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});ote.displayName=ate;var ZM="SliderRange",lte=_.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,s=KT(ZM,t),i=ste(ZM,t),a=_.useRef(null),o=Ct(e,a),l=s.values.length,u=s.values.map(f=>dte(f,s.min,s.max)),d=l>1?Math.min(...u):0,h=100-Math.max(...u);return c.jsx(st.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:o,style:{...n.style,[i.startEdge]:d+"%",[i.endEdge]:h+"%"}})});lte.displayName=ZM;var JM="SliderThumb",cte=_.forwardRef((n,e)=>{const t=mRe(n.__scopeSlider),[r,s]=_.useState(null),i=Ct(e,o=>s(o)),a=_.useMemo(()=>r?t().findIndex(o=>o.ref.current===r):-1,[t,r]);return c.jsx(bRe,{...n,ref:i,index:a})}),bRe=_.forwardRef((n,e)=>{const{__scopeSlider:t,index:r,name:s,...i}=n,a=KT(JM,t),o=ste(JM,t),[l,u]=_.useState(null),d=Ct(e,x=>u(x)),h=l?a.form||!!l.closest("form"):!0,f=PS(l),p=a.values[r],m=p===void 0?0:dte(p,a.min,a.max),g=SRe(r,a.values.length),y=f==null?void 0:f[o.size],v=y?kRe(y,m,o.direction):0;return _.useEffect(()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}},[l,a.thumbs]),c.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${m}% + ${v}
789px)`},children:[c.jsx(XM.ItemSlot,{scope:n.__scopeSlider,children:c.jsx(st.span,{role:"slider","aria-label":n["aria-label"]||g,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:n.style,onFocus:$e(n.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),h&&c.jsx(ute,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},r)]})});cte.displayName=JM;var wRe="RadioBubbleInput",ute=_.forwardRef(({__scopeSlider:n,value:e,...t},r)=>{const s=_.useRef(null),i=Ct(s,r),a=eE(e);return _.useEffect(()=>{const o=s.current;if(!o)return;const l=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&d){const h=new Event("input",{bubbles:!0});d.call(o,e),o.dispatchEvent(h)}},[a,e]),c.jsx(st.input,{style:{display:"none"},...t,ref:i,defaultValue:e})});ute.displayName=wRe;function _Re(n=[],e,t){const r=[...n];return r[t]=e,r.sort((s,i)=>s-i)}function dte(n,e,t){const i=100/(t-e)*(n-e);return T1(i,[0,100])}function SRe(n,e){return e>2?`Value ${n+1} of ${e}`:e===2?["Minimum","Maximum"][n]:void 0}function ERe(n,e){if(n.length===1)return 0;const t=n.map(s=>Math.abs(s-e)),r=Math.min(...t);return t.indexOf(r)}function kRe(n,e,t){const r=n/2,i=_5([0,50],[0,r]);return(r-i(e)*t)*t}function CRe(n){return n.slice(0,-1).map((e,t)=>n[t+1]-e)}function ARe(n,e){if(e>0){const t=CRe(n);return Math.min(...t)>=e}return!0}function _5(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function NRe(n){return(String(n).split(".")[1]||"").length}function TRe(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}var hte=nte,jRe=ote,RRe=lte,PRe=cte;const kw=_.forwardRef(({className:n,...e},t)=>c.jsxs(hte,{ref:t,className:ke("relative flex w-full touch-none select-none items-center",n),...e,children:[c.jsx(jRe,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:c.jsx(RRe,{className:"absolute h-full bg-primary"})}),c.jsx(PRe,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background 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"})]}));kw.displayName=hte.displayName;const fV={era:"Era",category:"Category",region:"Region",theme:"Theme"},DRe={era:"badge-era",category:"badge-category",region:"badge-region",theme:"badge-theme"};function ORe({personaId:n}){const e=$n(),{data:t,isLoading:r}=pt({queryKey:["labels"],queryFn:async()=>{const{data:u,error:d}=await pe.from("labels").select("*").order("label_type").order("name");if(d)throw d;return u}}),{data:s,isLoading:i}=pt({queryKey:["persona-labels",n],queryFn:async()=>{const{data:u,error:d}=await pe.from("persona_labels").select("label_id").eq("persona_id",n);if(d)throw d;return u.map(h=>h.label_id)}}),a=kn({mutationFn:async({labelId:u,checked:d})=>{if(d){const{error:h}=await pe.from("persona_labels").insert({persona_id:n,label_id:u});if(h)throw h}else{const{error:h}=await pe.from("persona_labels").delete().eq("persona_id",n).eq("label_id",u);if(h)throw h}},onSuccess:()=>{e.invalidateQueries({queryKey:["persona-labels",n]})},onError:()=>{Ye.error("Failed to update labels")}}),o=t==null?void 0:t.reduce((u,d)=>(u[d.label_type]||(u[d.label_type]=[]),u[d.label_type].push(d),u),{});return r||i?c.jsx(mt,{children:c.jsx(kt,{className:"flex items-center justify-center py-8",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Labels"}),c.jsx(Os,{children:"Categorize this persona by era, region, category, and theological themes"})]}),c.jsx(kt,{className:"space-y-6",children:o&&Object.keys(o).length>0?Object.keys(fV).map(u=>{const d=o[u];return!d||d.length===0?null:c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium mb-3",children:fV[u]}),c.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(h=>{const f=(s==null?void 0:s.includes(h.id))??!1;return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(iA,{id:`label-${h.id}`,checked:f,onCheckedChange:p=>a.mutate({labelId:h.id,checked:p})}),c.jsx("label",{htmlFor:`label-${h.id}`,className:"cursor-pointer",children:c.jsx(jt,{className:DRe[h.label_type],children:h.name})})]}
vendor: 4,730 bytes, line 789
789,h.id)})})]},u)}):c.jsx("p",{className:"text-muted-foreground text-sm",children:"No labels have been created yet. Create labels in the Labels section first."})})]})}var MRe=[" ","Enter","ArrowUp","ArrowDown"],IRe=[" ","Enter"],sg="Select",[YT,XT,LRe]=SS(sg),[F0,n9e]=Hr(sg,[LRe,jf]),ZT=jf(),[FRe,Lf]=F0(sg),[BRe,zRe]=F0(sg),fte=n=>{const{__scopeSelect:e,children:t,open:r,defaultOpen:s,onOpenChange:i,value:a,defaultValue:o,onValueChange:l,dir:u,name:d,autoComplete:h,disabled:f,required:p,form:m}=n,g=ZT(e),[y,v]=_.useState(null),[x,b]=_.useState(null),[E,S]=_.useState(!1),k=kg(u),[C,A]=Zi({prop:r,defaultProp:s??!1,onChange:i,caller:sg}),[T,j]=Zi({prop:a,defaultProp:o,onChange:l,caller:sg}),D=_.useRef(null),R=y?m||!!y.closest("form"):!0,[M,N]=_.useState(new Set),U=Array.from(M).map(q=>q.props.value).join(";");return c.jsx(dT,{...g,children:c.jsxs(FRe,{required:p,scope:e,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:E,onValueNodeHasChildrenChange:S,contentId:Ja(),value:T,onValueChange:j,open:C,onOpenChange:A,dir:k,triggerPointerDownPosRef:D,disabled:f,children:[c.jsx(YT.Provider,{scope:e,children:c.jsx(BRe,{scope:n.__scopeSelect,onNativeOptionAdd:_.useCallback(q=>{N(I=>new Set(I).add(q))},[]),onNativeOptionRemove:_.useCallback(q=>{N(I=>{const B=new Set(I);return B.delete(q),B})},[]),children:t})}),R?c.jsxs(Lte,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:h,value:T,onChange:q=>j(q.target.value),disabled:f,form:m,children:[T===void 0?c.jsx("option",{value:""}):null,Array.from(M)]},U):null]})})};fte.displayName=sg;var pte="SelectTrigger",mte=_.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:r=!1,...s}=n,i=ZT(t),a=Lf(pte,t),o=a.disabled||r,l=Ct(e,a.onTriggerChange),u=XT(t),d=_.useRef("touch"),[h,f,p]=Bte(g=>{const y=u().filter(b=>!b.disabled),v=y.find(b=>b.value===a.value),x=zte(y,g,v);x!==void 0&&a.onValueChange(x.value)}),m=g=>{o||(a.onOpenChange(!0),p()),g&&(a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return c.jsx(DS,{asChild:!0,...i,children:c.jsx(st.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":Fte(a.value)?"":void 0,...s,ref:l,onClick:$e(s.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&m(g)}),onPointerDown:$e(s.onPointerDown,g=>{d.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:$e(s.onKeyDown,g=>{const y=h.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(y&&g.key===" ")&&MRe.includes(g.key)&&(m(),g.preventDefault())})})})});mte.displayName=pte;var gte="SelectValue",vte=_.forwardRef((n,e)=>{const{__scopeSelect:t,className:r,style:s,children:i,placeholder:a="",...o}=n,l=Lf(gte,t),{onValueNodeHasChildrenChange:u}=l,d=i!==void 0,h=Ct(e,l.onValueNodeChange);return Dr(()=>{u(d)},[u,d]),c.jsx(st.span,{...o,ref:h,style:{pointerEvents:"none"},children:Fte(l.value)?c.jsx(c.Fragment,{children:a}):i})});vte.displayName=gte;var $Re="SelectIcon",yte=_.forwardRef((n,e)=>{const{__scopeSelect:t,children:r,...s}=n;return c.jsx(st.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});yte.displayName=$Re;var URe="SelectPortal",xte=n=>c.jsx(m0,{asChild:!0,...n});xte.displayName=URe;var ig="SelectContent",bte=_.forwardRef((n,e)=>{const t=Lf(ig,n.__scopeSelect),[r,s]=_.useState();if(Dr(()=>{s(new DocumentFragment)},[]),!t.open){const i=r;return i?wg.createPortal(c.jsx(wte,{scope:n.__scopeSelect,children:c.jsx(YT.Slot,{scope:n.__scopeSelect,children:c.jsx("div",{children:n.children})})}),i):null}return c.jsx(_te,{...n,ref:e})});bte.displayName=ig;var ul=10,[wte,Ff]=F0(ig),VRe="SelectContentImpl",HRe=df("SelectContent.RemoveScroll"),_te=_.forwardRef((n,e)=>{const{__scopeSelect:t,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:a,side:o,sideOffset:l,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y,...v}=n,x=Lf(ig,t),[b,E]=_.useState(null),[S,k]=_.useState(null),C=Ct(e,le=>E(le)),[A,T]=_.useState(null),[j,D]=_.useState(null),R=XT(t),[M,N]=_.useState(!1),U=_.useRef(!1);_.useEffect(()=>{if(b)return AT(b)},[b]),CT();const q=_.useCallback(le=>{const[ve,..._e]=R().map(Se=>Se.ref.current),[Ne]=_e.slice(-1),Pe=document.activeElement;for(const Se of le)if(Se===Pe||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ve&&S&&(S.scrollTop=0),Se===Ne&&S&&(S.scrollTop=S.scrollHeight),Se==null||Se.focu
vendor: 13,674 bytes, line 789
789s(),document.activeElement!==Pe))return},[R,S]),I=_.useCallback(()=>q([A,b]),[q,A,b]);_.useEffect(()=>{M&&I()},[M,I]);const{onOpenChange:B,triggerPointerDownPosRef:$}=x;_.useEffect(()=>{if(b){let le={x:0,y:0};const ve=Ne=>{var Pe,Se;le={x:Math.abs(Math.round(Ne.pageX)-(((Pe=$.current)==null?void 0:Pe.x)??0)),y:Math.abs(Math.round(Ne.pageY)-(((Se=$.current)==null?void 0:Se.y)??0))}},_e=Ne=>{le.x<=10&&le.y<=10?Ne.preventDefault():b.contains(Ne.target)||B(!1),document.removeEventListener("pointermove",ve),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",ve),document.addEventListener("pointerup",_e,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",_e,{capture:!0})}}},[b,B,$]),_.useEffect(()=>{const le=()=>B(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[B]);const[ie,ne]=Bte(le=>{const ve=R().filter(Pe=>!Pe.disabled),_e=ve.find(Pe=>Pe.ref.current===document.activeElement),Ne=zte(ve,le,_e);Ne&&setTimeout(()=>Ne.ref.current.focus())}),L=_.useCallback((le,ve,_e)=>{const Ne=!U.current&&!_e;(x.value!==void 0&&x.value===ve||Ne)&&(T(le),Ne&&(U.current=!0))},[x.value]),te=_.useCallback(()=>b==null?void 0:b.focus(),[b]),ae=_.useCallback((le,ve,_e)=>{const Ne=!U.current&&!_e;(x.value!==void 0&&x.value===ve||Ne)&&D(le)},[x.value]),de=r==="popper"?QM:Ste,ue=de===QM?{side:o,sideOffset:l,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:y}:{};return c.jsx(wte,{scope:t,content:b,viewport:S,onViewportChange:k,itemRefCallback:L,selectedItem:A,onItemLeave:te,itemTextRefCallback:ae,focusSelectedItem:I,selectedItemText:j,position:r,isPositioned:M,searchRef:ie,children:c.jsx(HS,{as:HRe,allowPinchZoom:!0,children:c.jsx(US,{asChild:!0,trapped:x.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:$e(s,le=>{var ve;(ve=x.trigger)==null||ve.focus({preventScroll:!0}),le.preventDefault()}),children:c.jsx(_g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:c.jsx(de,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:le=>le.preventDefault(),...v,...ue,onPlaced:()=>N(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:$e(v.onKeyDown,le=>{const ve=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!ve&&le.key.length===1&&ne(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let Ne=R().filter(Pe=>!Pe.disabled).map(Pe=>Pe.ref.current);if(["ArrowUp","End"].includes(le.key)&&(Ne=Ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const Pe=le.target,Se=Ne.indexOf(Pe);Ne=Ne.slice(Se+1)}setTimeout(()=>q(Ne)),le.preventDefault()}})})})})})})});_te.displayName=VRe;var WRe="SelectItemAlignedPosition",Ste=_.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:r,...s}=n,i=Lf(ig,t),a=Ff(ig,t),[o,l]=_.useState(null),[u,d]=_.useState(null),h=Ct(e,C=>d(C)),f=XT(t),p=_.useRef(!1),m=_.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:x}=a,b=_.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&u&&g&&y&&v){const C=i.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),T=i.valueNode.getBoundingClientRect(),j=v.getBoundingClientRect();if(i.dir!=="rtl"){const Pe=j.left-A.left,Se=T.left-Pe,Ce=C.left-Se,O=C.width+Ce,X=Math.max(O,A.width),ee=window.innerWidth-ul,V=T1(Se,[ul,Math.max(ul,ee-X)]);o.style.minWidth=O+"px",o.style.left=V+"px"}else{const Pe=A.right-j.right,Se=window.innerWidth-T.right-Pe,Ce=window.innerWidth-C.right-Se,O=C.width+Ce,X=Math.max(O,A.width),ee=window.innerWidth-ul,V=T1(Se,[ul,Math.max(ul,ee-X)]);o.style.minWidth=O+"px",o.style.right=V+"px"}const D=f(),R=window.innerHeight-ul*2,M=g.scrollHeight,N=window.getComputedStyle(u),U=parseInt(N.borderTopWidth,10),q=parseInt(N.paddingTop,10),I=parseInt(N.borderBottomWidth,10),B=parseInt(N.paddingBottom,10),$=U+q+M+B+I,ie=Math.min(y.offsetHeight*5,$),ne=window.getComputedStyle(g),L=parseInt(ne.paddingTop,10),te=parseInt(ne.paddingBottom,10),ae=C.top+C.height/2-ul,de=R-ae,ue=y.offsetHeight/2,le=y.offsetTop+ue,ve=U+q+le,_e=$-ve;if(ve<=ae){const Pe=D.length>0&&y===D[D.length-1].ref.current;o.style.bottom="0px";const Se=u.clientHeight-g.offsetTop-g.offsetHeight,Ce=Math.max(de,ue+(Pe?te:0)+Se+I),O=ve+Ce;o.style.height=O+"px"}else{const Pe=D.length>0&&y===D[0].ref.current;o.style.top="0px";const Ce=Math.max(ae,U+g.offsetTop+(Pe?L:0)+ue)+_e;o.style.height=Ce+"px",g.scrollTop=ve-ae+g.offsetTop}o.style.margin=`${ul}px 0`,o.style.minHeight=ie+"px",o.style.maxHeight=R+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,o,u,g,y,v,i.dir,r]);Dr(()=>b(),[b]);const[E,S]=_.useState();Dr(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const k=_.useCallback(C=>{C&&m.current===!0&&(b(),x==null||x(),m.current=!1)},[b,x]);return c.jsx(GRe,{scope:t,contentWrapper:o,shouldExpandOnScrollRef:p,onScrollButtonChange:k,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:c.jsx(st.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ste.displayName=WRe;var qRe="SelectPopperPosition",QM=_.forwardRef((n,e)=>{const{__scopeSelect:t,align:r="start",collisionPadding:s=ul,...i}=n,a=ZT(t);return c.jsx(hT,{...a,...i,ref:e,align:r,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)"}})});QM.displayName=qRe;var[GRe,S5]=F0(ig,{}),eI="SelectViewport",Ete=_.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:r,...s}=n,i=Ff(eI,t),a=S5(eI,t),o=Ct(e,i.onViewportChange),l=_.useRef(0);return c.jsxs(c.Fragment,{children:[c.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:r}),c.jsx(YT.Slot,{scope:t,children:c.jsx(st.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:$e(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=a;if(f!=null&&f.current&&h){const p=Math.abs(l.current-d.scrollTop);if(p>0){const m=window.innerHeight-ul*2,g=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),v=Math.max(g,y);if(v<m){const x=v+p,b=Math.min(m,x),E=x-b;h.style.height=b+"px",h.style.bottom==="0px"&&(d.scrollTop=E>0?E:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});Ete.displayName=eI;var kte="SelectGroup",[KRe,YRe]=F0(kte),XRe=_.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,s=Ja();return c.jsx(KRe,{scope:t,id:s,children:c.jsx(st.div,{role:"group","aria-labelledby":s,...r,ref:e})})});XRe.displayName=kte;var Cte="SelectLabel",Ate=_.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,s=YRe(Cte,t);return c.jsx(st.div,{id:s.id,...r,ref:e})});Ate.displayName=Cte;var uA="SelectItem",[ZRe,Nte]=F0(uA),Tte=_.forwardRef((n,e)=>{const{__scopeSelect:t,value:r,disabled:s=!1,textValue:i,...a}=n,o=Lf(uA,t),l=Ff(uA,t),u=o.value===r,[d,h]=_.useState(i??""),[f,p]=_.useState(!1),m=Ct(e,x=>{var b;return(b=l.itemRefCallback)==null?void 0:b.call(l,x,r,s)}),g=Ja(),y=_.useRef("touch"),v=()=>{s||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")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 c.jsx(ZRe,{scope:t,value:r,disabled:s,textId:g,isSelected:u,onItemTextChange:_.useCallback(x=>{h(b=>b||((x==null?void 0:x.textContent)??"").trim())},[]),children:c.jsx(YT.ItemSlot,{scope:t,value:r,disabled:s,textValue:d,children:c.jsx(st.div,{role:"option","aria-labelledby":g,"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,...a,ref:m,onFocus:$e(a.onFocus,()=>p(!0)),onBlur:$e(a.onBlur,()=>p(!1)),onClick:$e(a.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:$e(a.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:$e(a.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:$e(a.onPointerMove,x=>{var b;y.current=x.pointerType,s?(b=l.onItemLeave)==null||b.call(l):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$e(a.onPointerLeave,x=>{var b;x.currentTarget===document.activeElement&&((b=l.onItemLeave)==null||b.call(l))}),onKeyDown:$e(a.onKeyDown,x=>{var E;((E=l.searchRef)==null?void 0:E.current)!==""&&x.key===" "||(IRe.includes(x.key)&&v(),x.key===" "&&x.preventDefault())})})})})});Tte.displayName=uA;var Pb="SelectItemText",jte=_.forwardRef((n,e)=>{const{__scopeSelect:t,className:r,style:s,...i}=n,a=Lf(Pb,t),o=Ff(Pb,t),l=Nte(Pb,t),u=zRe(Pb,t),[d,h]=_.useState(null),f=Ct(e,v=>h(v),l.onItemTextChange,v=>{var x;return(x=o.itemTextRefCallback)==null?void 0:x.call(o,v,l.value,l.disabled)}),p=d==null?void 0:d.textContent,m=_.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=u;return Dr(()=>(g(m),()=>y(m)),[g,y,m]),c.jsxs(c.Fragment,{children:[c.jsx(st.span,{id:l.textId,...i,ref:f}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?wg.createPortal(i.children,a.valueNode):null]})});jte.displayName=Pb;var Rte="SelectItemIndicator",Pte=_.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n;return Nte(Rte,t).isSelected?c.jsx(st.span,{"aria-hidden":!0,...r,ref:e}):null});Pte.displayName=Rte;var tI="SelectScrollUpButton",Dte=_.forwardRef((n,e)=>{const t=Ff(tI,n.__scopeSelect),r=S5(tI,n.__scopeSelect),[s,i]=_.useState(!1),a=Ct(e,r.onScrollButtonChange);return Dr(()=>{if(t.viewport&&t.isPositioned){let o=function(){const u=l.scrollTop>0;i(u)};const l=t.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[t.viewport,t.isPositioned]),s?c.jsx(Mte,{...n,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=t;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});Dte.displayName=tI;var nI="SelectScrollDownButton",Ote=_.forwardRef((n,e)=>{const t=Ff(nI,n.__scopeSelect),r=S5(nI,n.__scopeSelect),[s,i]=_.useState(!1),a=Ct(e,r.onScrollButtonChange);return Dr(()=>{if(t.viewport&&t.isPositioned){let o=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;i(d)};const l=t.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[t.viewport,t.isPositioned]),s?c.jsx(Mte,{...n,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=t;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});Ote.displayName=nI;var Mte=_.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:r,...s}=n,i=Ff("SelectScrollButton",t),a=_.useRef(null),o=XT(t),l=_.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return _.useEffect(()=>()=>l(),[l]),Dr(()=>{var d;const u=o().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),c.jsx(st.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:$e(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:$e(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:$e(s.onPointerLeave,()=>{l()})})}),JRe="SelectSeparator",Ite=_.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n;return c.jsx(st.div,{"aria-hidden":!0,...r,ref:e})});Ite.displayName=JRe;var rI="SelectArrow",QRe=_.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,s=ZT(t),i=Lf(rI,t),a=Ff(rI,t);return i.open&&a.position==="popper"?c.jsx(fT,{...s,...r,ref:e}):null});QRe.displayName=rI;var ePe="SelectBubbleInput",Lte=_.forwardRef(({__scopeSelect:n,value:e,...t},r)=>{const s=_.useRef(null),i=Ct(r,s),a=eE(e);return _.useEffect(()=>{const o=s.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&d){const h=new Event("change",{bubbles:!0});d.call(o,e),o.dispatchEvent(h)}},[a,e]),c.jsx(st.select,{...t,style:{...oG,...t.style},ref:i,defaultValue:e})});Lte.displayName=ePe;function Fte(n){return n===""||n===void 0}function Bte(n){const e=Pr(n),t=_.useRef(""),r=_.useRef(0),s=_.useCallback(a=>{const o=t.current+a;e(o),function l(u){t.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(o)},[e]),i=_.useCallback(()=>{t.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[t,s,i]}function zte(n,e,t){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let a=tPe(n,Math.max(i,0));s.length===1&&(a=a.filter(u=>u!==t));const l=a.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==t?l:void 0}function tPe(n,e){return n.map((t,r)=>n[(e+r)%n.length])}var nPe=fte,$te=mte,rPe=vte,sPe=yte,iPe=xte,Ute=bte,aPe=Ete,Vte=Ate,Hte=Tte,oPe=jte,lPe=Pte,Wte=Dte,qte=Ote,Gte=Ite;
789const ki=nPe,Ci=rPe,ti=_.forwardRef(({className:n,children:e,...t},r)=>c.jsxs($te,{ref:r,className:ke("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",n),...t,children:[e,c.jsx(sPe,{asChild:!0,children:c.jsx(_2,{className:"h-4 w-4 opacity-50"})})]}));ti.displayName=$te.displayName;const Kte=_.forwardRef(({className:n,...e},t)=>c.jsx(Wte,{ref:t,className:ke("flex cursor-default items-center justify-center py-1",n),...e,children:c.jsx(Rfe,{className:"h-4 w-4"})}));Kte.displayName=Wte.displayName;const Yte=_.forwardRef(({className:n,...e},t)=>c.jsx(qte,{ref:t,className:ke("flex cursor-default items-center justify-center py-1",n),...e,children:c.jsx(_2,{className:"h-4 w-4"})}));Yte.displayName=qte.displayName;const ni=_.forwardRef(({className:n,children:e,position:t="popper",...r},s)=>c.jsx(iPe,{children:c.jsxs(Ute,{ref:s,className:ke("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",t==="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",n),position:t,...r,children:[c.jsx(Kte,{}),c.jsx(aPe,{className:ke("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),c.jsx(Yte,{})]})}));ni.displayName=Ute.displayName;const cPe=_.forwardRef(({className:n,...e},t)=>c.jsx(Vte,{ref:t,className:ke("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...e}));cPe.displayName=Vte.displayName;const xn=_.forwardRef(({className:n,children:e,...t},r)=>c.jsxs(Hte,{ref:r,className:ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",n),...t,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(lPe,{children:c.jsx(Go,{className:"h-4 w-4"})})}),c.jsx(oPe,{children:e})]}));xn.displayName=Hte.displayName;const uPe=_.forwardRef(({className:n,...e},t)=>c.jsx(Gte,{ref:t,className:ke("-mx-1 my-1 h-px bg-muted",n),...e}));uPe.displayName=Gte.displayName;const pV={book:"Book",sermon:"Sermon",letter:"Letter",journal:"Journal",speech:"Speech"};function dPe({personaId:n}){const[e,t]=_.useState(!1),[r,s]=_.useState(null),[i,a]=_.useState({quote_text:"",source_title:"",source_type:"book",approximate_date:"",context_notes:""}),o=$n(),{data:l,isLoading:u}=pt({queryKey:["persona-quotes",n],queryFn:async()=>{const{data:g,error:y}=await pe.from("persona_quotes").select("*").eq("persona_id",n).order("created_at",{ascending:!1});if(y)throw y;return g}}),d=kn({mutationFn:async g=>{const y={persona_id:n,quote_text:g.quote_text,source_title:g.source_title,source_type:g.source_type,approximate_date:g.approximate_date||null,context_notes:g.context_notes||null};if(r){const{error:v}=await pe.from("persona_quotes").update(y).eq("id",r.id);if(v)throw v}else{const{error:v}=await pe.from("persona_quotes").insert(y);if(v)throw v}},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-quotes",n]}),Ye.success(r?"Quote updated":"Quote added"),m()},onError:()=>{Ye.error("Failed to save quote")}}),h=kn({mutationFn:async g=>{const{error:y}=await pe.from("persona_quotes").delete().eq("id",g);if(y)throw y},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-quotes",n]}),Ye.success("Quote deleted")},onError:()=>{Ye.error("Failed to delete quote")}}),f=()=>{s(null),a({quote_text:"",source_title:"",source_type:"book",approximate_date:"",context_notes:""}),t(!0)},p=g=>{s(g),a({quote_text:g.quote_text,source_title:g.source_title,source_type:g.source_type,approximate_date:g.approximate_date||"",context_notes:g.context_notes||""}),t(!0)},m=()=>{t(!1),s(null)};return u?c.jsx(mt,{children:c.jsx(kt,{className:"flex items-center justify-center py-8",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):c.jsxs(mt,{children:[c.jsxs(Ln,{className:"flex flex-row items-center justify-between",children:[c.jsxs("div",{children:[c.jsx(Wn,{children:"Primary Source Quotes"}),c.jsx(Os,{children:"Verified quotes from the persona's writings and speeches"})]}),c.jsxs(xe,{onClick:f,children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"Add Quote"]})]}),c.jsx(kt,{children:l&&l.length>0?c.jsx("div",{className:"border rounded-md",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{className:"w-1/2",children:"Quote"}),c.jsx(gn,{children:"Source"}),c.jsx(gn,{children:"Type"}),c.jsx(gn,{className:"w-[70px]"})]})}),c.jsx(If,{children:l.map(g=>c.jsxs(Qs,{className:"cursor-pointer",onClick:()=>p(g),children:[c.jsx(ln,{children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(ud,{className:"h-4 w-4 mt-0.5 text-muted-foreground flex-shrink-0"}),c.jsx("p",{className:"text-sm line-clamp-2 italic",children:g.quote_text})]})}),c.jsxs(ln,{className:"text-sm",children:[g.source_title,g.approximate_date&&c.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",g.approximate_date,")"]})]}),c.jsx(ln,{children:c.jsx(jt,{variant:"secondary",children:pV[g.source_type]})}),c.jsx(ln,{children:c.jsx(xe,{variant:"ghost",size:"icon",onClick:y=>{y.stopPropagation(),h.mutate(g.id)},children:c.jsx(ao,{className:"h-4 w-4 text-destructive"})})})]},g.id))})]})}):c.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[c.jsx(ud,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No quotes yet. Add verified quotes from primary sources."})]})}),c.jsx(ai,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(Fs,{children:c.jsx(Bs,{children:r?"Edit Quote":"Add Quote"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"quote-text",children:"Quote Text"}),c.jsx(Ca,{id:"quote-text",placeholder:"Enter the exact quote...",rows:4,value:i.quote_text,onChange:g=>a(y=>({...y,quote_text:g.target.value}))})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"source-title",children:"Source Title"}),c.jsx(Lt,{id:"source-title",placeholder:"e.g., Lectures to My Students",value:i.source_title,onChange:g=>a(y=>({...y,source_title:g.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"source-type",children:"Source Type"}),c.jsxs(ki,{value:i.source_type,onValueChange:g=>a(y=>({...y,source_type:g})),children:[c.jsx(ti,{id:"source-type",children:c.jsx(Ci,{})}),c.jsx(ni,{children:Object.entries(pV).map(([g,y])=>c.jsx(xn,{value:g,children:y},g))})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"approximate-date",children:"Approximate Date (optional)"}),c.jsx(Lt,{id:"approximate-date",placeholder:"e.g., 1887 or circa 1850s",value:i.approximate_date,onChange:g=>a(y=>({...y,approximate_date:g.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"context-notes",children:"Context Notes (optional)"}),c.jsx(Ca,{id:"context-notes",placeholder:"Add any helpful context about this quote...",rows:2,value:i.context_notes,onChange:g=>a(y=>({...y,context_notes:g.target.value}))})]})]}),c.jsxs(Tg,{children:[c.jsx(xe,{variant:"outline",onClick:m,children:"Cancel"}),c.jsxs(xe,{onClick:()=>d.mutate(i),disabled:!i.quote_text.trim()||!i.source_title.trim()||d.isPending,children:[d.isPending?c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}):null,r?"Update":"Add"," Quote"]})]})]})})]})}const mV=[{value:"book",label:"Book"},{value:"sermon",label:"Sermon"},{value:"essay",label:"Essay"},{value:"letter",label:"Letter"},{value:"commentary",label:"Commentary"},{value:"treatise",label:"Treatise"},{value:"other",label:"Other"}];function hPe({personaId:n}){const[e,t]=_.useState(!1),[r,s]=_.useState(null),[i,a]=_.useState({title:"",document_type:"book",external_link:""}),o=$n(),{data:l,isLoading:u}=pt({queryKey:["persona-writings",n],queryFn:async()=>{const{data:g,error:y}=await pe.from("persona_writings").select("*").eq("persona_id",n).order("title");if(y)throw y;return g}}),d=kn({mutationFn:async g=>{const y={persona_id:n,title:g.title,document_type:g.document_type,external_link:g.external_link||null};if(r){const{error:v}=await pe.from("persona_writings").update(y).eq("id",r.id);if(v)throw v}else{const{error:v}=await pe.from("persona_writings").insert(y);if(v)throw v}},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-writings",n]}),Ye.success(r?"Writing updated":"Writing added"),m()},onError:()=>{Ye.error("Failed to save writing")}}),h=kn({mutationFn:async g=>{const{error:y}=await pe.from("persona_writings").delete().eq("id",g);if(y)throw y},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-writings",n]}),Ye.success("Writing deleted")},onError:()=>{Ye.error("Failed to delete writing")}}),f=()=>{s(null),a({title:"",document_type:"book",external_link:""}),t(!0)},p=g=>{s(g),a({title:g.title,document_type:g.document_type||"book",external_link:g.external_link||""}),t(!0)},m=()=>{t(!1),s(null)};return u?c.jsx(mt,{children:c.jsx(kt,{className:"flex items-center justify-center py-8",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):c.jsxs(mt,{children:[c.jsxs(Ln,{className:"flex flex-row items-center justify-between",children:[c.jsxs("div",{children:[c.jsx(Wn,{children:"Key Writings"}),c.jsx(Os,{children:"Notable works and documents authored by this persona"})]}),c.jsxs(xe,{onClick:f,children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"Add Writing"]})]}),c.jsx(kt,{children:l&&l.length>0?c.jsx("div",{className:"border rounded-md",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{children:"Title"}),c.jsx(gn,{children:"Type"}),c.jsx(gn,{children:"Link"}),c.jsx(gn,{className:"w-[70px]"})]})}),c.jsx(If,{children:l.map(g=>{var y;return c.jsxs(Qs,{className:"cursor-pointer",onClick:()=>p(g),children:[c.jsx(ln,{className:"font-medium",children:g.title}),c.jsx(ln,{children:c.jsx(jt,{variant:"secondary",children:((y=mV.find(v=>v.value===g.document_type))==null?void 0:y.label)||g.document_type})}),c.jsx(ln,{children:g.external_link?c.jsxs("a",{href:g.external_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",onClick:v=>v.stopPropagation(),children:[c.jsx(iT,{className:"h-3 w-3"}),"Link"]}):c.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),c.jsx(ln,{children:c.jsx(xe,{variant:"ghost",size:"icon",onClick:v=>{v.stopPropagation(),h.mutate(g.id)},children:c.jsx(ao,{className:"h-4 w-4 text-destructive"})})})]},g.id)})})]})}):c.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[c.jsx(En,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No writings yet. Add the persona's key works."})]})}),c.jsx(ai,{open:e,onOpenChange:t,children:c.jsxs(Ls,{children:[c.jsx(Fs,{children:c.jsx(Bs,{children:r?"Edit Writing":"Add Writing"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"writing-title",children:"Title"}),c.jsx(Lt,{id:"writing-title",placeholder:"e.g., Institutes of the Christian Religion",value:i.title,onChange:g=>a(y=>({...y,title:g.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"document-type",children:"Document Type"}),c.jsxs(ki,{value:i.document_type,onValueChange:g=>a(y=>({...y,document_type:g})),children:[c.jsx(ti,{id:"document-type",children:c.jsx(Ci,{})}),c.jsx(ni,{children:mV.map(g=>c.jsx(xn,{value:g.value,children:g.label},g.value))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"external-link",children:"Exter
789nal Link (optional)"}),c.jsx(Lt,{id:"external-link",placeholder:"https://...",value:i.external_link,onChange:g=>a(y=>({...y,external_link:g.target.value}))})]})]}),c.jsxs(Tg,{children:[c.jsx(xe,{variant:"outline",onClick:m,children:"Cancel"}),c.jsxs(xe,{onClick:()=>d.mutate(i),disabled:!i.title.trim()||d.isPending,children:[d.isPending?c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}):null,r?"Update":"Add"," Writing"]})]})]})})]})}function fPe({personaId:n}){const[e,t]=_.useState(!1),[r,s]=_.useState(null),[i,a]=_.useState({position_key:"",position_value:"",scripture_references:""}),o=$n(),{data:l,isLoading:u}=pt({queryKey:["persona-positions",n],queryFn:async()=>{const{data:y,error:v}=await pe.from("persona_theological_positions").select("*").eq("persona_id",n).order("position_key");if(v)throw v;return y}}),d=kn({mutationFn:async y=>{const v=y.scripture_references.split(",").map(b=>b.trim()).filter(Boolean),x={persona_id:n,position_key:y.position_key,position_value:y.position_value,scripture_references:v.length>0?v:null};if(r){const{error:b}=await pe.from("persona_theological_positions").update(x).eq("id",r.id);if(b)throw b}else{const{error:b}=await pe.from("persona_theological_positions").insert(x);if(b)throw b}},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-positions",n]}),Ye.success(r?"Position updated":"Position added"),m()},onError:()=>{Ye.error("Failed to save position")}}),h=kn({mutationFn:async y=>{const{error:v}=await pe.from("persona_theological_positions").delete().eq("id",y);if(v)throw v},onSuccess:()=>{o.invalidateQueries({queryKey:["persona-positions",n]}),Ye.success("Position deleted")},onError:()=>{Ye.error("Failed to delete position")}}),f=()=>{s(null),a({position_key:"",position_value:"",scripture_references:""}),t(!0)},p=y=>{var v;s(y),a({position_key:y.position_key,position_value:y.position_value,scripture_references:((v=y.scripture_references)==null?void 0:v.join(", "))||""}),t(!0)},m=()=>{t(!1),s(null)},g=["Salvation","Predestination","Baptism","Lord's Supper","Church Government","Scripture","Justification","Sanctification","Trinity","Christology","Eschatology","Spiritual Gifts"];return u?c.jsx(mt,{children:c.jsx(kt,{className:"flex items-center justify-center py-8",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):c.jsxs(mt,{children:[c.jsxs(Ln,{className:"flex flex-row items-center justify-between",children:[c.jsxs("div",{children:[c.jsx(Wn,{children:"Theological Positions"}),c.jsx(Os,{children:"Key doctrinal stances and beliefs held by this persona"})]}),c.jsxs(xe,{onClick:f,children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"Add Position"]})]}),c.jsx(kt,{children:l&&l.length>0?c.jsx("div",{className:"border rounded-md",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{className:"w-1/4",children:"Topic"}),c.jsx(gn,{children:"Position"}),c.jsx(gn,{className:"w-1/4",children:"Scripture References"}),c.jsx(gn,{className:"w-[70px]"})]})}),c.jsx(If,{children:l.map(y=>{var v;return c.jsxs(Qs,{className:"cursor-pointer",onClick:()=>p(y),children:[c.jsx(ln,{className:"font-medium",children:y.position_key}),c.jsx(ln,{className:"text-sm",children:y.position_value}),c.jsx(ln,{className:"text-sm text-muted-foreground",children:((v=y.scripture_references)==null?void 0:v.join(", "))||"—"}),c.jsx(ln,{children:c.jsx(xe,{variant:"ghost",size:"icon",onClick:x=>{x.stopPropagation(),h.mutate(y.id)},children:c.jsx(ao,{className:"h-4 w-4 text-destructive"})})})]},y.id)})})]})}):c.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[c.jsx(NO,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c.jsx("p",{children:"No theological positions yet. Add the persona's key doctrinal stances."})]})}),c.jsx(ai,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(Fs,{children:c.jsx(Bs,{children:r?"Edit Position":"Add Theological Position"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"position-key",children:"Topic"}),c.jsx(Lt,{id:"position-key",placeholder:"e.g., Salvation, Baptism, Church Government",value:i.position_key,onChange:y=>a(v=>({...v,position_key:y.target.value}))}),c.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:g.map(y=>c.jsx(xe,{type:"button",variant:"outline",size:"sm",className:"text-xs h-6",onClick:()=>a(v=>({...v,position_key:y})),children:y},y))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"position-value",children:"Position"}),c.jsx(Ca,{id:"position-value",placeholder:"Describe the persona's stance on this topic...",rows:4,value:i.position_value,onChange:y=>a(v=>({...v,position_value:y.target.value}))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"scripture-references",children:"Scripture References (optional)"}),c.jsx(Lt,{id:"scripture-references",placeholder:"e.g., Romans 8:28, Ephesians 2:8-9",value:i.scripture_references,onChange:y=>a(v=>({...v,scripture_references:y.target.value}))}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Separate multiple references with commas"})]})]}),c.jsxs(Tg,{children:[c.jsx(xe,{variant:"outline",onClick:m,children:"Cancel"}),c.jsxs(xe,{onClick:()=>d.mutate(i),disabled:!i.position_key.trim()||!i.position_value.trim()||d.isPending,children:[d.isPending?c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}):null,r?"Update":"Add"," Position"]})]})]})})]})}const pPe=SAe({full_name:bp().min(1,"Name is required").max(100),short_biography:bp().min(1,"Short biography is required").max(500),long_biography:bp().optional(),birth_year:BU.number().nullable().optional(),death_year:BU.number().nullable().optional(),portrait_image_url:bp().url().optional().or(EAe("")),is_published:_Ae().default(!1),tone_slider:fP().min(1).max(10).default(5),firmness_slider:fP().min(1).max(10).default(5),pastoral_vs_academic:fP().min(1).max(10).default(5)});function mPe(){const{id:n}=Xc(),e=vr(),t=$n(),r=!!n&&n!=="new",[s,i]=_.useState(!1),a=sRe({resolver:lRe(pPe),defaultValues:{full_name:"",short_biography:"",long_biography:"",birth_year:null,death_year:null,portrait_image_url:"",is_published:!1,tone_slider:5,firmness_slider:5,pastoral_vs_academic:5}}),{data:o,isLoading:l}=pt({queryKey:["admin-persona",n],queryFn:async()=>
789{if(!r)return null;const{data:h,error:f}=await pe.from("personas").select("*").eq("id",n).single();if(f)throw f;const{data:p}=await pe.from("persona_personality").select("*").eq("persona_id",n).single();return{...h,tone_slider:(p==null?void 0:p.tone_slider)??5,firmness_slider:(p==null?void 0:p.firmness_slider)??5,pastoral_vs_academic:(p==null?void 0:p.pastoral_vs_academic)??5}},enabled:r});_.useEffect(()=>{o&&a.reset({full_name:o.full_name,short_biography:o.short_biography,long_biography:o.long_biography||"",birth_year:o.birth_year,death_year:o.death_year,portrait_image_url:o.portrait_image_url||"",is_published:o.is_published,tone_slider:o.tone_slider,firmness_slider:o.firmness_slider,pastoral_vs_academic:o.pastoral_vs_academic})},[o,a]);const u=kn({mutationFn:async h=>{const f=h.full_name.toLowerCase().replace(/[^a-zA-Z0-9\s-]/g,"").replace(/\s+/g,"-"),p={full_name:h.full_name,short_biography:h.short_biography,long_biography:h.long_biography||null,birth_year:h.birth_year||null,death_year:h.death_year||null,portrait_image_url:h.portrait_image_url||null,is_published:h.is_published,slug:f};let m=n;if(r){const{error:v}=await pe.from("personas").update(p).eq("id",n);if(v)throw v}else{const{data:v,error:x}=await pe.from("personas").insert(p).select("id").single();if(x)throw x;m=v.id}const g={persona_id:m,tone_slider:h.tone_slider,firmness_slider:h.firmness_slider,pastoral_vs_academic:h.pastoral_vs_academic},{error:y}=await pe.from("persona_personality").upsert(g,{onConflict:"persona_id"});if(y)throw y;return m},onSuccess:h=>{t.invalidateQueries({queryKey:["admin-personas"]}),t.invalidateQueries({queryKey:["admin-persona",n]}),Ye.success(r?"Persona updated":"Persona created"),!r&&h&&e(`/admin/personas/${h}`)},onError:h=>{console.error("Save error:",h),Ye.error("Failed to save persona")}}),d=h=>{u.mutate(h)};return r&&l?c.jsx(rg,{children:c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):c.jsx(rg,{children:c.jsx(pRe,{...a,children:c.jsxs("form",{onSubmit:a.handleSubmit(d),className:"space-y-8",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(xe,{type:"button",variant:"ghost",size:"icon",onClick:()=>e("/admin/personas"),children:c.jsx(Ji,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif text-3xl font-semibold",children:r?"Edit Persona":"New Persona"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:r?`Editing ${o==null?void 0:o.full_name}`:"Create a new historical figure"})]})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(nc,{control:a.control,name:"is_published",render:({field:h})=>c.jsxs(sl,{className:"flex items-center gap-2",children:[c.jsx(il,{className:"text-sm text-muted-foreground",children:"Published"}),c.jsx(al,{children:c.jsx(w5,{checked:h.value,onCheckedChange:h.onChange})})]})}),c.jsxs(xe,{type:"submit",disabled:u.isPending,children:[u.isPending?c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}):c.jsx(NS,{className:"h-4 w-4 mr-2"}),"Save"]})]})]}),c.jsxs(N0,{defaultValue:"basic",className:"space-y-6",children:[c.jsxs(Ng,{children:[c.jsx(Rr,{value:"basic",children:"Basic Info"}),c.jsx(Rr,{value:"personality",children:"Personality"}),c.jsx(Rr,{value:"labels",disabled:!r,children:"Labels"}),c.jsx(Rr,{value:"quotes",disabled:!r,children:"Quotes"}),c.jsx(Rr,{value:"writings",disabled:!r,children:"Writings"}),c.jsx(Rr,{value:"positions",disabled:!r,children:"Theological Positions"})]}),c.jsx(Ml,{value:"basic",className:"space-y-6",children:c.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Identity"}),c.jsx(Os,{children:"Basic identifying information"})]}),c.jsxs(kt,{className:"space-y-4",children:[c.jsx(nc,{control:a.control,name:"full_name",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Full Name"}),c.jsx(al,{children:c.jsx(Lt,{placeholder:"e.g., Charles Haddon Spurgeon",...h})}),c.jsx(rp,{})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsx(nc,{control:a.control,name:"birth_year",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Birth Year"}),c.jsx(al,{children:c.jsx(Lt,{type:"number",placeholder:"e.g., 1834",...h,value:h.value??""})}),c.jsx(rp,{})]})}),c.jsx(nc,{control:a.control,name:"death_year",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Death Year"}),c.jsx(al,{children:c.jsx(Lt,{type:"number",placeholder:"e.g., 1892",...h,value:h.value??""})}),c.jsx(rp,{})]})})]}),c.jsx(nc,{control:a.control,name:"portrait_image_url",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Portrait Image URL"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(al,{children:c.jsx(Lt,{placeholder:"https://example.com/image.jpg",...h})}),r&&c.jsx(xe,{type:"button",variant:"outline",size:"icon",disabled:s,onClick:async()=>{i(!0);try{const{data:f,error:p}=await pe.functions.invoke("generate-persona-portrait",{body:{personaName:a.getValues("full_name"),personaId:n,birthYear:a.getValues("birth_year"),deathYear:a.getValues("death_year")}});if(p)throw p;if(f!=null&&f.error)throw new Error(f.error);Ye.success("Portrait regenerated successfully!"),f!=null&&f.portraitUrl&&a.setValue("portrait_image_url",f.portraitUrl),t.invalidateQueries({queryKey:["admin-persona",n]}),t.invalidateQueries({queryKey:["admin-personas"]})}catch(f){console.error("Error regenerating portrait:",f),Ye.error(f instanceof Error?f.message:"Failed to regenerate portrait")}finally{i(!1)}},title:"Regenerate Portrait with AI",children:s?c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(AS,{className:"h-4 w-4"})})]}),c.jsx(lC,{children:"URL to a portrait image. Use the refresh button to generate with AI."}),c.jsx(rp,{}),h.value&&c.jsx("div",{className:"mt-2 w-24 h-24 rounded-lg overflow-hidden bg-secondary",children:c.jsx("img",{src:h.value,alt:"Portrait preview",className:"w-full h-full object-cover"})})]})})]})]}),c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Biography"}),c.jsx(Os,{children:"Description and background"})]}),c.jsxs(kt,{className:"space-y-4",children:[c.jsx(nc,{control:a.control,name:"short_biography",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Short Biography"}),c.jsx(al,{children:c.jsx(Ca,{placeholder:"A brief one-paragraph description...",rows:3,...h})}),c.jsx(lC,{children:"Displayed in cards and previews (max 500 characters)"}),c.jsx(rp,{})]})}),c.jsx(nc,{control:a.control,name:"long_biography",render:({field:h})=>c.jsxs(sl,{children:[c.jsx(il,{children:"Long Biography"}),c.jsx(al,{children:c.jsx(Ca,{placeholder:"A detailed biography covering their life, ministry, and legacy...",rows:8,...h})}),c.jsx(lC,{children:"Full biography for the persona's profile page"}),c.jsx(rp,{})]})})]})]})]})}),c.jsx(Ml,{value:"personality",children:c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsx(Wn,{children:"Personality Settings"}),c.jsx(Os,{children:"Configure how this persona communicates and responds"})]}),c.jsxs(kt,{className:"space-y-8",children:[c.jsx(nc,{control:a.control,name:"tone_slider",render:({field:h})=>c.jsxs(sl,{children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx(il,{children:"Tone"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:h.value<=3?"Gentle & Warm":h.value>=7?"Direct & Challenging":"Balanced"})]}),c.jsx(al,{children:c.jsx(kw,{min:1,max:10,step:1,value:[h.value],onValueChange:f=>h.onChange(f[0])})}),c.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-1",children:[c.jsx("span",{children:"Gentle"}),c.jsx("span",{children:"Direct"})]})]})}),c.jsx(nc,{control:a.control,name:"firmness_slider",render:({field:h})=>c.jsxs(sl,{children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx(il,{children:"Firmness"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:h.value<=3?"Open & Exploratory":h.value>=7?"Firm & Convictional":"Measured"})]}),c.jsx(al,{children:c.jsx(kw,{min:1,max:10,step:1,value:[h.value],onValueChange:f=>h.onChange(f[0])})}),c.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-1",children:[c.jsx("span",{children:"Open"}),c.jsx("span",{children:"Firm"})]})]})}),c.jsx(nc,{control:a.control,name:"pastoral_vs_academic",render:({field:h})=>c.jsxs(sl,{children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx(il,{children:"Style"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:h.value<=3?"Pastoral & Practical":h.value>=7?"Academic & Theological":"Balanced"})]}),c.jsx(al,{children:c.jsx(kw,{min:1,max:10,step:1,value:[h.value],onValueChange:f=>h.onChange(f[0])})}),c.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-1",children:[c.jsx("span",{children:"Pastoral"}),c.jsx("span",{children:"Academic"})]})]})})]})]})}),c.jsx(Ml,{value:"labels",children:r&&c.jsx(ORe,{personaId:n})}),c.jsx(Ml,{value:"quotes",children:r&&c.jsx(dPe,{personaId:n})}),c.jsx(Ml,{value:"writings",children:r&&c.jsx(hPe,{personaId:n})}),c.jsx(Ml,{value:"positions",children:r&&c.jsx(fPe,{personaId:n})})]})]})})})}const gPe={era:"badge-era",category:"badge-category",region:"badge-region",theme:"badge-theme"};function vPe(){const[n,e]=_.useState(!1),[t,r]=_.useState({name:"",label_type:"era"}),s=$n(),{data:i,isLoading:a}=pt({queryKey:["admin-labels"],queryFn:async()=>{const{data:h,error:f}=await pe.from("labels").select("*").order("label_type").order("name");if(f)throw f;return h}}),o=kn({mutationFn:async h=>{const f=h.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),{error:p}=await pe.from("labels").insert({name:h.name,slug:f,label_type:h.label_type});if(p)throw p},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-labels"]}),Ye.success("Label created"),e(!1),r({name:"",label_type:"era"})},onError:()=>{Ye.error("Failed to create label")}}),l=kn({mutationFn:async h=>{const{error:f}=await pe.from("labels").delete().eq("id",h);if(f)throw f},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-labels"]}),Ye.success("Label deleted")},onError:()=>{Ye.error("Failed to delete label")}}),u=i==null?void 0:i.reduce((h,f)=>(h[f.label_type]||(h[f.label_type]=[]),h[f.label_type].push(f),h),{}),d={era:"Era",category:"Category",region:"Region",theme:"Theme"};return c.jsxs(rg,{children:[c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif text-3xl font-semibold",children:"Labels"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Organize personas by era, category, region, and theme"})]}),c.jsxs(xe,{onClick:()=>e(!0),children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"Add Label"]})]}),a?c.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading labels..."}):u&&Object.keys(u).length>0?c.jsx("div",{className:"space-y-8",children:Object.keys(d).map(h=>{const f=u[h];return!f||f.length===0?null:c.jsxs("div",{children:[c.jsx("h2",{className:"font-serif text-xl font-semibold mb-4",children:d[h]}),c.jsx("div",{className:"border rounded-md",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{children:"Name"}),c.jsx(gn,{children:"Slug"}),c.jsx(gn,{className:"w-[70px]"})]})}),c.jsx(If,{children:f.map(p=>c.jsxs(Qs,{children:[c.jsx(ln,{children:c.jsx(jt,{className:gPe[p.label_type],children:p.name})}),c.jsx(ln,{className:"text-muted-foreground font-mono text-sm",children:p.slug}),c.jsx(ln,{children:c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>l.mutate(p.id),children:c.jsx(ao,{className:"h-4 w-4 text-destructive"})})})]}
789,p.id))})]})})]},h)})}):c.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No labels yet. Create your first one to start organizing personas."})]}),c.jsx(ai,{open:n,onOpenChange:e,children:c.jsxs(Ls,{children:[c.jsx(Fs,{children:c.jsx(Bs,{children:"Add Label"})}),c.jsxs("div",{className:"space-y-4 py-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"label-type",children:"Type"}),c.jsxs(ki,{value:t.label_type,onValueChange:h=>r(f=>({...f,label_type:h})),children:[c.jsx(ti,{id:"label-type",children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"era",children:"Era"}),c.jsx(xn,{value:"category",children:"Category"}),c.jsx(xn,{value:"region",children:"Region"}),c.jsx(xn,{value:"theme",children:"Theme"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"label-name",children:"Name"}),c.jsx(Lt,{id:"label-name",placeholder:"e.g., Reformation, North America",value:t.name,onChange:h=>r(f=>({...f,name:h.target.value}))})]})]}),c.jsxs(Tg,{children:[c.jsx(xe,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),c.jsx(xe,{onClick:()=>o.mutate(t),disabled:!t.name.trim()||o.isPending,children:"Create"})]})]})})]})}const gV={document_type:"general",title:"",author:"",year:"",source_notes:"",linked_persona_id:"",linked_commentary_source_id:""},yPe={persona_writing:"Persona Writing",historical_commentary:"Historical Commentary",general:"General Library"},xPe={persona_writing:Ku,historical_commentary:En,general:xF};function bPe(){var M;const{toast:n}=Jl(),{user:e}=Vt(),t=$n(),[r,s]=_.useState(!1),[i,a]=_.useState(null),[o,l]=_.useState(gV),[u,d]=_.useState(!1),[h,f]=_.useState("all"),[p,m]=_.useState(null),{data:g,isLoading:y}=pt({queryKey:["library-documents"],queryFn:async()=>{const{data:N,error:U}=await pe.from("library_documents").select(`
790          *,
791          personas:linked_persona_id(full_name),
792          commentary_sources:linked_commentary_source_id(name)
793        `).order("created_at",{ascending:!1});if(U)throw U;return N}}),{data:v}=pt({queryKey:["admin-personas-list"],queryFn:async()=>{const{data:N,error:U}=await pe.from("personas").select("id, full_name").order("full_name");if(U)throw U;return N}}),{data:x}=pt({queryKey:["commentary-sources"],queryFn:async()=>{const{data:N,error:U}=await pe.from("commentary_sources").select("id, name, slug").order("name");if(U)throw U;return N}}),b=kn({mutationFn:async()=>{if(!i||!e)throw new Error("No file selected or not authenticated");let N="";if(o.document_type==="persona_writing"&&o.linked_persona_id){const I=v==null?void 0:v.find($=>$.id===o.linked_persona_id);N=`persona-writings/${(I==null?void 0:I.full_name.toLowerCase().replace(/\s+/g,"-"))||"unknown"}/${Date.now()}-${i.name}`}else if(o.document_type==="historical_commentary"&&o.linked_commentary_source_id){const I=x==null?void 0:x.find(B=>B.id===o.linked_commentary_source_id);N=`historical-commentaries/${(I==null?void 0:I.slug)||"unknown"}/${Date.now()}-${i.name}`}else N=`general/${Date.now()}-${i.name}`;const{error:U}=await pe.storage.from("library-documents").upload(N,i);if(U)throw U;const{error:q}=await pe.from("library_documents").insert({document_type:o.document_type,title:o.title,author:o.author||null,year:o.year?parseInt(o.year):null,source_notes:o.source_notes||null,file_path:N,file_size_bytes:i.size,linked_persona_id:o.linked_persona_id||null,linked_commentary_source_id:o.linked_commentary_source_id||null,uploaded_by:e.id});if(q)throw q},onSuccess:()=>{n({title:"Document uploaded successfully"}),t.invalidateQueries({queryKey:["library-documents"]}),k()},onError:N=>{n({title:"Upload failed",description:N.message,variant:"destructive"})}}),E=kn({mutationFn:async N=>{const{error:U}=await pe.storage.from("library-documents").remove([N.file_path]);if(U)throw U;const{error:q}=await pe.from("library_documents").delete().eq("id",N.id);if(q)throw q},onSuccess:()=>{n({title:"Document deleted"}),t.invalidateQueries({queryKey:["library-documents"]})},onError:N=>{n({title:"Delete failed",description:N.message,variant:"destructive"})}}),S=kn({mutationFn:async N=>{const{data:U,error:q}=await pe.functions.invoke("extract-pdf-text",{body:{documentId:N}});if(q)throw q;if(U!=null&&U.error)throw new Error(U.error);return U},onSuccess:N=>{var U;n({title:"Text extracted successfully",description:`Extracted ${((U=N.textLength)==null?void 0:U.toLocaleStr
793ing())||0} characters`}),t.invalidateQueries({queryKey:["library-documents"]})},onError:N=>{n({title:"Extraction failed",description:N.message,variant:"destructive"}),t.invalidateQueries({queryKey:["library-documents"]})}}),k=()=>{s(!1),a(null),l(gV)},C=_.useCallback(N=>{N.preventDefault(),d(!0)},[]),A=_.useCallback(N=>{N.preventDefault(),d(!1)},[]),T=_.useCallback(N=>{N.preventDefault(),d(!1);const U=N.dataTransfer.files;U.length>0&&U[0].type==="application/pdf"?(a(U[0]),l(q=>({...q,title:U[0].name.replace(".pdf","")})),s(!0)):n({title:"Invalid file type",description:"Please upload PDF files only",variant:"destructive"})},[n]),j=N=>{var q;const U=(q=N.target.files)==null?void 0:q[0];U&&U.type==="application/pdf"?(a(U),l(I=>({...I,title:U.name.replace(".pdf","")})),s(!0)):U&&n({title:"Invalid file type",description:"Please upload PDF files only",variant:"destructive"})},D=N=>N?N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`:"—",R=g==null?void 0:g.filter(N=>h==="all"?!0:N.document_type===h);return c.jsxs(rg,{children:[c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"font-serif text-3xl font-semibold",children:"Document Library"}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Upload and manage PDFs for personas and historical commentaries"})]}),c.jsx(mt,{className:`border-2 border-dashed transition-colors cursor-pointer ${u?"border-primary bg-primary/5":"border-muted-foreground/25"}`,onDragOver:C,onDragLeave:A,onDrop:T,children:c.jsxs(kt,{className:"flex flex-col items-center justify-center py-12",children:[c.jsx(F$,{className:`h-12 w-12 mb-4 ${u?"text-primary":"text-muted-foreground"}`}),c.jsx("p",{className:"text-lg font-medium mb-1",children:u?"Drop your PDF here":"Drag & drop a PDF"}),c.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"or click to browse (max 50MB)"}),c.jsx("input",{type:"file",accept:".pdf,application/pdf",className:"hidden",id:"file-upload",onChange:j}),c.jsx(xe,{asChild:!0,variant:"outline",children:c.jsxs("label",{htmlFor:"file-upload",className:"cursor-pointer",children:[c.jsx(wi,{className:"h-4 w-4 mr-2"}),"Browse Files"]})})]})}),c.jsxs(mt,{children:[c.jsx(Ln,{children:c.jsx(Wn,{children:"Uploaded Documents"})}),c.jsx(kt,{children:c.jsxs(N0,{value:h,onValueChange:f,children:[c.jsxs(Ng,{className:"mb-4",children:[c.jsx(Rr,{value:"all",children:"All"}),c.jsx(Rr,{value:"persona_writing",children:"Persona Writings"}),c.jsx(Rr,{value:"historical_commentary",children:"Commentaries"}),c.jsx(Rr,{value:"general",children:"General"})]}),c.jsx(Ml,{value:h,children:y?c.jsx("div",{className:"flex justify-center py-8",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):R&&R.length>0?c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{children:"Title"}),c.jsx(gn,{children:"Type"}),c.jsx(gn,{children:"Linked To"}),c.jsx(gn,{children:"Text Status"}),c.jsx(gn,{children:"Size"}),c.jsx(gn,{className:"w-[140px]"})]})}),c.jsx(If,{children:R.map(N=>{var I,B;const U=xPe[N.document_type],q=S.isPending&&S.variables===N.id;return c.jsxs(Qs,{children:[c.jsx(ln,{className:"font-medium",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),c.jsxs("div",{children:[c.jsx("div",{children:N.title}),N.author&&c.jsx("div",{className:"text-xs text-muted-foreground",children:N.author})]})]})}),c.jsx(ln,{children:c.jsxs(jt,{variant:"secondary",className:"gap-1",children:[c.jsx(U,{className:"h-3 w-3"}),yPe[N.document_type]]})}),c.jsx(ln,{className:"text-muted-foreground",children:((I=N.personas)==null?void 0:I.full_name)||((B=N.commentary_sources)==null?void 0:B.name)||"—"}),c.jsx(ln,{children:N.extraction_status==="completed"?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(jt,{variant:"default",className:"gap-1 bg-green-600",children:[c.jsx(Go,{className:"h-3 w-3"}),"Extracted"]}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>m(N),title:"View extracted text",children:c.jsx(aT,{className:"h-3 w-3"})})]}):N.extraction_status==="processing"||q?c.jsxs(jt,{variant:"secondary",className:"gap-1",children:[c.jsx(et,{className:"h-3 w-3 animate-spin"}),"Processing"]}):N.extraction_status==="failed"?c.jsxs(jt,{variant:"destructive",className:"gap-1",title:N.extraction_error||"Extraction failed",children:[c.jsx(sT,{className:"h-3 w-3"}),"Failed"]}):c.jsxs(jt,{variant:"outline",className:"gap-1",children:[c.jsx(RG,{className:"h-3 w-3"}),"Pending"]})}),c.jsx(ln,{className:"text-muted-foreground",children:D(N.file_size_bytes)}),c.jsx(ln,{children:c.jsxs("div",{className:"flex items-center gap-1",children:[N.extraction_status!=="completed"&&N.extraction_status!=="processing"&&c.jsx(xe,{variant:"ghost",size:"icon",className:"text-primary hover:text-primary",onClick:()=>S.mutate(N.id),disabled:q,title:"Extract text from PDF",children:q?
793c.jsx(et,{className:"h-4 w-4 animate-spin"}):c.jsx(jS,{className:"h-4 w-4"})}),c.jsx(xe,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>E.mutate(N),disabled:E.isPending,children:c.jsx(ao,{className:"h-4 w-4"})})]})})]},N.id)})})]}):c.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[c.jsx(xF,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),c.jsx("p",{className:"text-lg font-medium mb-1",children:"No documents yet"}),c.jsx("p",{className:"text-sm",children:"Drag and drop a PDF above to get started"})]})})]})})]})]}),c.jsx(ai,{open:r,onOpenChange:s,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(Fs,{children:c.jsx(Bs,{children:"Upload Document"})}),c.jsxs("div",{className:"space-y-4",children:[i&&c.jsxs("div",{className:"flex items-center gap-3 p-3 bg-secondary rounded-md",children:[c.jsx(wi,{className:"h-8 w-8 text-primary"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-medium truncate",children:i.name}),c.jsx("p",{className:"text-sm text-muted-foreground",children:D(i.size)})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Document Type *"}),c.jsxs(ki,{value:o.document_type,onValueChange:N=>l(U=>({...U,document_type:N,linked_persona_id:"",linked_commentary_source_id:""})),children:[c.jsx(ti,{children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"persona_writing",children:"Persona Writing"}),c.jsx(xn,{value:"historical_commentary",children:"Historical Commentary"}),c.jsx(xn,{value:"general",children:"General Library"})]})]})]}),o.document_type==="persona_writing"&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Link to Persona *"}),c.jsxs(ki,{value:o.linked_persona_id,onValueChange:N=>l(U=>({...U,linked_persona_id:N})),children:[c.jsx(ti,{children:c.jsx(Ci,{placeholder:"Select a persona"})}),c.jsx(ni,{children:v==null?void 0:v.map(N=>c.jsx(xn,{value:N.id,children:N.full_name},N.id))})]})]}),o.document_type==="historical_commentary"&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Link to Commentary Source *"}),c.jsxs(ki,{value:o.linked_commentary_source_id,onValueChange:N=>l(U=>({...U,linked_commentary_source_id:N})),children:[c.jsx(ti,{children:c.jsx(Ci,{placeholder:"Select a source"})}),c.jsx(ni,{children:x==null?void 0:x.map(N=>c.jsx(xn,{value:N.id,children:N.name},N.id))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Title *"}),c.jsx(Lt,{value:o.title,onChange:N=>l(U=>({...U,title:N.target.value})),placeholder:"Document title"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Author"}),c.jsx(Lt,{value:o.author,onChange:N=>l(U=>({...U,author:N.target.value})),placeholder:"Author name"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Year"}),c.jsx(Lt,{type:"number",value:o.year,onChange:N=>l(U=>({...U,year:N.target.value})),placeholder:"Publication year"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Source / License Notes"}),c.jsx(Ca,{value:o.source_notes,onChange:N=>l(U=>({...U,source_notes:N.target.value})),placeholder:"e.g., Public domain, From archive.org",rows:2})]}),o.document_type==="persona_writing"&&!o.linked_persona_id&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400",children:[c.jsx(o1,{className:"h-4 w-4"}),"Please select a persona to link this document to"]}),o.document_type==="historical_commentary"&&!o.linked_commentary_source_id&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400",children:[c.jsx(o1,{className:"h-4 w-4"}),"Please select a commentary source to link this document to"]}),c.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[c.jsx(xe,{variant:"outline",onClick:k,children:"Cancel"}),c.jsx(xe,{onClick:()=>b.mutate(),disabled:b.isPending||!o.title||o.document_type==="persona_writing"&&!o.linked_persona_id||o.document_type==="historical_commentary"&&!o.linked_commentary_source_id,children:b.isPending?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(F$,{className:"h-4 w-4 mr-2"}),"Upload"]})})]})]})]})}),c.jsx(ai,{open:!!p,onOpenChange:()=>m(null),children:c.jsxs(Ls,{className:"max-w-3xl max-h-[80vh]",children:[c.jsx(Fs,{children:c.jsxs(Bs,{className:"flex items-center gap-2",children:[c.jsx(wi,{className:"h-5 w-5"}),"Extracted Text: ",p==null?void 0:p.title]})}),c.jsx("div",{className:"overflow-y-auto max-h-[60vh] border rounded-md p-4 bg-muted/30",children:p!=null&&p.extracted_text?c.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono leading-relaxed",children:p.extracted_text}):c.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No text content available"})}),c.jsxs("div",{className:"flex justify-between items-center pt-2 text-sm text-muted-foreground",children:[c.jsxs("span",{children:[((M=p==null?void 0:p.extracted_text)==null?void 0:M.length.toLocaleStr
793ing())||0," characters"]}),c.jsx(xe,{variant:"outline",onClick:()=>m(null),children:"Close"})]})]})})]})}const xP=768;function wPe(){const[n,e]=_.useState(void 0);return _.useEffect(()=>{const t=window.matchMedia(`(max-width: ${xP-1}px)`),r=()=>{e(window.innerWidth<xP)};return t.addEventListener("change",r),e(window.innerWidth<xP),()=>t.removeEventListener("change",r)},[]),!!n}const rE=n5,_Pe=r5,Xte=_.forwardRef(({className:n,...e},t)=>c.jsx(KS,{className:ke("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",n),...e,ref:t}));Xte.displayName=KS.displayName;const SPe=Sg("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"}}),B0=_.forwardRef(({side:n="right",className:e,children:t,...r},s)=>c.jsxs(_Pe,{children:[c.jsx(Xte,{}),c.jsxs(YS,{ref:s,className:ke(SPe({side:n}),e),...r,children:[t,c.jsxs(BT,{className:"absolute right-4 top-4 roun
793ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[c.jsx(Ho,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));B0.displayName=YS.displayName;const sE=({className:n,...e})=>c.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",n),...e});sE.displayName="SheetHeader";const iE=_.forwardRef(({className:n,...e},t)=>c.jsx(XS,{ref:t,className:ke("text-lg font-semibold text-foreground",n),...e}));iE.displayName=XS.displayName;const EPe=_.forwardRef(({className:n,...e},t)=>c.jsx(ZS,{ref:t,className:ke("text-sm text-muted-foreground",n),...e}));EPe.displayName=ZS.displayName;const kPe="sidebar:state",CPe=60*60*24*7,APe="16rem",NPe="18rem",TPe="3rem",jPe="b",Zte=_.createContext(null);function aE(){const n=_.useContext(Zte);if(!n)throw new Error("useSidebar must be used within a SidebarProvider.");return n}const Jte=_.forwardRef(({defaultOpen:n=!0,open:e,onOpenChange:t,className:r,style:s,children:i,...a},o)=>{const l=wPe(),[u,d]=_.useState(!1),[h,f]=_.useState(n),p=e??h,m=_.useCallback(x=>{const b=typeof x=="function"?x(p):x;t?t(b):f(b),document.cookie=`${kPe}=${b}; path=/; max-age=${CPe}`},[t,p]),g=_.useCallback(()=>l?d(x=>!x):m(x=>!x),[l,m,d]);_.useEffect(()=>{const x=b=>{b.key===jPe&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),g())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[g]);const y=p?"expanded":"collapsed",v=_.useMemo(()=>({state:y,open:p,setOpen:m,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:g}),[y,p,m,l,u,d,g]);return c.jsx(Zte.Provider,{value:v,children:c.jsx(RK,{delayDuration:0,children:c.jsx("div",{style:{"--sidebar-width":APe,"--sidebar-width-icon":TPe,...s},className:ke("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:o,...a,children:i})})})});Jte.displayName="SidebarProvider";const Qte=_.forwardRef(({side:n="left",variant:e="sidebar",collapsible:t="offcanvas",className:r,children:s,...i},a)=>{const{isMobile:o,state:l,openMobile:u,setOpenMobile:d}=aE();return t==="none"?c.jsx("div",{className:ke("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:a,...i,children:s}):o?c.jsx(rE,{open:u,onOpenChange:d,...i,children:c.jsx(B0,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":NPe},side:n,children:c.jsx("div",{className:"flex h-full w-full flex-col",children:s})})}):c.jsxs("div",{ref:a,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?t:"","data-variant":e,"data-side":n,children:[c.jsx("div",{className:ke("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),c.jsx("div",{className:ke("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",n==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:c.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:s})})]})});Qte.displayName="Sidebar";const E5=_.forwardRef(({className:n,onClick:e,...t},r)=>{const{toggleSidebar:s}=aE();return c.jsxs(xe,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:ke("h-7 w-7",n),onClick:i=>{e==null||e(i),s()},...t,children:[c.jsx(BG,{}),c.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});E5.displayName="SidebarTrigger";const RPe=_.forwardRef(({className:n,...e},t)=>{const{toggleSidebar:r}=aE();return c.jsx("button",{ref:t,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:ke("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 hover:after:bg-sidebar-border sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",n),...e})});RPe.displayName="SidebarRail";const ene=_.forwardRef(({className:n,...e},t)=>c.jsx("main",{ref:t,className:ke("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-
793h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",n),...e}));ene.displayName="SidebarInset";const PPe=_.forwardRef(({className:n,...e},t)=>c.jsx(Lt,{ref:t,"data-sidebar":"input",className:ke("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",n),...e}));PPe.displayName="SidebarInput";const tne=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"header",className:ke("flex flex-col gap-2 p-2",n),...e}));tne.displayName="SidebarHeader";const DPe=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"footer",className:ke("flex flex-col gap-2 p-2",n),...e}));DPe.displayName="SidebarFooter";const OPe=_.forwardRef(({className:n,...e},t)=>c.jsx(nf,{ref:t,"data-sidebar":"separator",className:ke("mx-2 w-auto bg-sidebar-border",n),...e}));OPe.displayName="SidebarSeparator";const nne=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"content",className:ke("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",n),...e}));nne.displayName="SidebarContent";const Db=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"group",className:ke("relative flex w-full min-w-0 flex-col p-2",n),...e}));Db.displayName="SidebarGroup";const cC=_.forwardRef(({className:n,asChild:e=!1,...t},r)=>{const s=e?Nf:"div";return c.jsx(s,{ref:r,"data-sidebar":"group-label",className:ke("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",n),...t})});cC.displayName="SidebarGroupLabel";const MPe=_.forwardRef(({className:n,asChild:e=!1,...t},r)=>{const s=e?Nf:"button";return c.jsx(s,{ref:r,"data-sidebar":"group-action",className:ke("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",n),...t})});MPe.displayName="SidebarGroupAction";const Ob=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"group-content",className:ke("w-full text-sm",n),...e}));Ob.displayName="SidebarGroupContent";const Mb=_.forwardRef(({className:n,...e},t)=>c.jsx("ul",{ref:t,"data-sidebar":"menu",className:ke("flex w-full min-w-0 flex-col gap-1",n),...e}));Mb.displayName="SidebarMenu";const ol=_.forwardRef(({className:n,...e},t)=>c.jsx("li",{ref:t,"data-sidebar":"menu-item",className:ke("group/menu-item relative",n),...e}));ol.displayName="SidebarMenuItem";const IPe=Sg("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),ll=_.forwardRef(({asChild:n=!1,isActive:e=!1,variant:t="default",size:r="default",tooltip:s,className:i,...a},o)=>{const l=n?Nf:"button",{isMobile:u,state:d}=aE(),h=c.jsx(l,{ref:o,"data-sidebar":"menu-button","data-size":r,"data-active":e,className:ke(IPe({variant:t,size:r}),i),...a}
793);return s?(typeof s=="string"&&(s={children:s}),c.jsxs(mve,{children:[c.jsx(gve,{asChild:!0,children:h}),c.jsx(PK,{side:"right",align:"center",hidden:d!=="collapsed"||u,...s})]})):h});ll.displayName="SidebarMenuButton";const LPe=_.forwardRef(({className:n,asChild:e=!1,showOnHover:t=!1,...r},s)=>{const i=e?Nf:"button";return c.jsx(i,{ref:s,"data-sidebar":"menu-action",className:ke("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",n),...r})});LPe.displayName="SidebarMenuAction";const FPe=_.forwardRef(({className:n,...e},t)=>c.jsx("div",{ref:t,"data-sidebar":"menu-badge",className:ke("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n),...e}));FPe.displayName="SidebarMenuBadge";const BPe=_.forwardRef(({className:n,showIcon:e=!1,...t},r)=>{const s=_.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return c.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:ke("flex h-8 items-center gap-2 rounded-md px-2",n),...t,children:[e&&c.jsx(qt,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),c.jsx(qt,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});BPe.displayName="SidebarMenuSkeleton";const zPe=_.forwardRef(({className:n,...e},t)=>c.jsx("ul",{ref:t,"data-sidebar":"menu-sub",className:ke("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",n),...e}));zPe.displayName="SidebarMenuSub";const $Pe=_.forwardRef(({...n},e)=>c.jsx("li",{ref:e,...n}));$Pe.displayName="SidebarMenuSubItem";const UPe=_.forwardRef(({asChild:n=!1,size:e="md",isActive:t,className:r,...s},i)=>{const a=n?Nf:"a";return c.jsx(a,{ref:i,"data-sidebar":"menu-sub-button","data-size":e,"data-active":t,className:ke("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...s})});UPe.displayName="SidebarMenuSubButton";function rne(){const{user:n}=Vt();return pt({queryKey:["all-notes-unified",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:e,error:t}=await pe.from("journal_entries").select("*").eq("user_id",n.id).order("created_at",{ascending:!1});if(t)throw t;const{data:r,error:s}=await pe.from("user_notes").select(`
794          *,
795          user_note_tags (id, tag_name),
796          verse_start:bible_verses!verse_start_id (
797            id,
798            book_id,
799            chapter_number,
800            verse_number,
801            bible_books (book_name)
802          )
803        `).eq("user_id",n.id).order("created_at",{ascending:!1});if(s)throw s;const{data:i,error:a}=await pe.from("generic_notes").select(`
804          *,
805          folder:note_folders (id, name)
806        `).eq("user_id",n.id).order("created_at",{ascending:!1});if(a)throw a;const o=(e||[]).map(d=>
806({id:d.id,type:"journal",title:d.title||`Journal - ${d.entry_date}`,content:d.entry_content,createdAt:d.created_at,updatedAt:d.updated_at,entryDate:d.entry_date,templateId:d.template_id})),l=(r||[]).map(d=>{var h,f,p;return{id:d.id,type:"passage",title:d.passage_reference,content:d.note_content,createdAt:d.created_at,updatedAt:d.updated_at,passageReference:d.passage_reference,verseStartId:d.verse_start_id,verseEndId:d.verse_end_id,bookName:(f=(h=d.verse_start)==null?void 0:h.bible_books)==null?void 0:f.book_name,tags:((p=d.user_note_tags)==null?void 0:p.map(m=>m.tag_name))||[],templateId:d.template_id}}),u=(i||[]).map(d=>{var h;return{id:d.id,type:"generic",title:d.title||"Untitled",content:d.content,createdAt:d.created_at,updatedAt:d.updated_at,folderId:d.folder_id,folderName:((h=d.folder)==null?void 0:h.name)||null}});return[...o,...l,...u].sort((d,h)=>new Date(h.updatedAt).getTime()-new Date(d.updatedAt).getTime())},enabled:!!n})}function VPe(n){const{user:e}=Vt();return pt({queryKey:["journal-entry-by-id",n],queryFn:async()=>{if(!n)return null;const{data:t,error:r}=await pe.from("journal_entries").select("*").eq("id",n).single();if(r)throw r;return t},enabled:!!e&&!!n})}function HPe(n){const{user:e}=Vt();return pt({queryKey:["passage-note-by-id",n],queryFn:async()=>{if(!n)return null;const{data:t,error:r}=await pe.from("user_notes").select(`
807          *,
808          user_note_tags (id, tag_name)
809        `).eq("id",n).single();if(r)throw r;return t},enabled:!!e&&!!n})}function WPe(){const{user:n}=Vt(),e=$n();return kn({mutationFn:async({id:t,content:r,title:s,date:i,templateId:a})=>{if(!n)throw new Error("Not authenticated");const l=r.replace(/<[^>]*>/g,"").trim().split(/\s+/).filter(u=>u.length>0).length;if(t){const{error:u}=await pe.from("journal_entries").update({entry_content:r,title:s,word_count:l}).eq("id",t);if(u)throw u;return t}else{const{data:u,error:d}=await pe.from("journal_entries").insert({user_id:n.id,entry_date:i,entry_content:r,title:s,word_count:l,template_id:a}).select().single();if(d)throw d;return u.id}},onSuccess:()=>{e.invalidateQueries({queryKey:["all-notes-unified"]}),e.invalidateQueries({queryKey:["journal-entry-by-id"]})}})}function qPe(){const{user:n}=Vt(),e=$n();return kn({mutationFn:async({id:t,content:r,passageReference:s,verseStartId:i,verseEndId:a,tags:o,templateId:l})=>{if(!n)throw new Error("Not authenticated");if(t){const{error:u}=await pe.from("user_notes").update({note_content:r,passage_reference:s}).eq("id",t);if(u)throw u;if(await pe.from("user_note_tags").delete().eq("note_id",t),o.length>0){const d=o.map(h=>({note_id:t,tag_name:h.toLowerCase().trim()}));await pe.from("user_note_tags").insert(d)}return t}else{const{data:u,error:d}=await pe.from("user_notes").insert({user_id:n.id,verse_start_id:i,verse_end_id:a,passage_reference:s,note_content:r,template_id:l}).select().single();if(d)throw d;if(o.length>0){const h=o.map(f=>({note_id:u.id,tag_name:f.toLowerCase().trim()}));await pe.from("user_note_tags").insert(h)}return u.id}},onSuccess:()=>{e.invalidateQueries({queryKey:["all-notes-unified"]}),e.invalidateQueries({queryKey:["passage-note-by-id"]})}})}function sne(){const{user:n}=Vt(),e=$n();return kn({mutationFn:async({id:t,type:r})=>{if(!n)throw new Error("Not authenticated");if(r==="journal"){const{error:s}=await pe.from("journal_entries").delete().eq("id",t);if(s)throw s}else if(r==="passage"){await pe.from("user_note_tags").delete().eq("note_id",t);const{error:s}=await pe.from("user_notes").delete().eq("id",t);if(s)throw s}else if(r==="generic"){const{error:s}=await pe.from("generic_notes").delete().eq("id",t);if(s)throw s}},onSuccess:()=>{e.invalidateQueries({queryKey:["all-notes-unified"]}),e.invalidateQueries({queryKey:["generic-notes"]})}})}function GPe(){const{user:n}=Vt();return pt({queryKey:["all-tags",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:e,error:t}=await pe.from("user_note_tags").select("tag_name, note_id").order("tag_name");if(t)throw t;const r={};return e.forEach(s=>{r[s.tag_name]=(r[s.tag_name]||0)+1}),Object.entries(r).map(([s,i])=>({name:s,count:i}))},enabled:!!n})}function KPe(){const{user:n}=Vt();return pt({queryKey:["books-with-notes",n==null?void 0:n.id],queryFn:async()=>
809{if(!n)return[];const{data:e,error:t}=await pe.from("user_notes").select(`
810          verse_start:bible_verses!verse_start_id (
811            book_id,
812            bible_books (id, book_name, book_number)
813          )
814        `).eq("user_id",n.id);if(t)throw t;const r={};return e.forEach(s=>{var a;const i=(a=s.verse_start)==null?void 0:a.bible_books;i&&(r[i.id]||(r[i.id]={name:i.book_name,number:i.book_number,count:0}),r[i.id].count++)}),Object.entries(r).map(([s,{name:i,number:a,count:o}])=>({id:s,name:i,number:a,count:o})).sort((s,i)=>s.number-i.number)},enabled:!!n})}var JT="Collapsible",[YPe,r9e]=Hr(JT),[XPe,k5]=YPe(JT),ine=_.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...o}=n,[l,u]=Zi({prop:r,defaultProp:s??!1,onChange:a,caller:JT});return c.jsx(XPe,{scope:t,disabled:i,contentId:Ja(),open:l,onOpenToggle:_.useCallback(()=>u(d=>!d),[u]),children:c.jsx(st.div,{"data-state":A5(l),"data-disabled":i?"":void 0,...o,ref:e})})});ine.displayName=JT;var ane="CollapsibleTrigger",one=_.forwardRef((n,e)=>{const{__scopeCollapsible:t,...r}=n,s=k5(ane,t);return c.jsx(st.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":A5(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:$e(n.onClick,s.onOpenToggle)})});one.displayName=ane;var C5="CollapsibleContent",lne=_.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=k5(C5,n.__scopeCollapsible);return c.jsx(ss,{present:t||s.open,children:({present:i})=>c.jsx(ZPe,{...r,ref:e,present:i})})});lne.displayName=C5;var ZPe=_.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:r,children:s,...i}=n,a=k5(C5,t),[o,l]=_.useState(r),u=_.useRef(null),d=Ct(e,u),h=_.useRef(0),f=h.current,p=_.useRef(0),m=p.current,g=a.open||o,y=_.useRef(g),v=_.useRef(void 0);return _.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),Dr(()=>{const x=u.current;if(x){v.current=v.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,y.current||(x.style.transitionDuration=v.current.transitionDuration,x.style.animationName=v.current.animationName),l(r)}},[a.open,r]),c.jsx(st.div,{"data-state":A5(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...n.style},children:g&&s})});function A5(n){return n?"open":"closed"}var JPe=ine;const vV=JPe,yV=one,xV=lne,cne=_.createContext(null);function QPe({children:n}){const e=_.useRef(null),t=_.useCallback(s=>{e.current=s},[]),r=_.useCallback(async()=>e.current?await e.current():!0,[]);return c.jsx(cne.Provider,{value:{registerSaveHandler:t,saveCurrentNote:r},children:n})}function une(){const n=_.useContext(cne);if(!n)throw new Error("useNoteEditorBridge must be used within NoteEditorBridgeProvider");return n}function eDe({selectionMode:n,selectedNotes:e,onToggleSelection:t,onToggleSelectionMode:r}){const s=vr(),{noteId:i}=Xc();Ql();const{state:a}=aE(),o=a==="collapsed",{saveCurrentNote:l}=une(),[u,d]=_.useState(""),[h,f]=_.useState("all"),[p,m]=_.useState(!0),[g,y]=_.useState(!0),{data:v=[],isLoading:x}=rne(),{data:b=[]}=GPe(),{data:E=[]}=KPe(),S=_.useMemo(()=>{if(!u)return v;const j=u.toLowerCase();return v.filter(D=>{var R;return D.title.toLowerCase().includes(j)||D.content.toLowerCase().includes(j)||((R=D.tags)==null?void 0:R.some(M=>M.toLowerCase().includes(j)))})},[v,u]),k=_.useMemo(()=>v.slice(0,10),[v]);_.useMemo(()=>{const j={Today:[],Yesterday:[],"This Week":[],"This Month":[],Older:[]};return v.forEach(D=>{const R=new Date(D.updatedAt);bTe(R)?j.Today.push(D):wTe(R)?j.Yesterday.push(D):xTe(R)?j["This Week"].push(D):yTe(R)?j["This Month"].push(D):j.Older.push(D)}),j},[v]);const C=j=>{n?t(j.id):s(`/study/notes/${j.id}?tab=notes&type=${j.type}`)},A=async j=>{await l()&&s(`/study/notes/new?type=${j}&tab=notes`)},T=j=>{const D=i===j.id,R=e.has(j.id),M=j.content.replace(/<[^>]*>/g,"").slice(0,60);return c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>C(j),className:ke("h-auto py-2 px-3 flex-col items-start gap-0.5 w-full",D&&!n&&"bg-accent",n&&R&&"bg-primary/10 ring-1 ring-primary"),children:[c.jsxs("div",{className:"flex items-center gap-2 w-full",children:[n&&c.jsx("span",{className:"shrink-0",children:R?c.jsx(UG,{className:"h-4 w-4 text-primary"}):c.jsx(spe,{className:"h-4 w-4 text-muted-foreground"})}),j.type==="journal"?c.jsx(En,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):j.type==="generic"?c.jsx(mw,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):c.jsx(Gm,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium text-sm truncate flex-1",children:j.title})]}),!o&&c.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 pl-5",children:M||"Empty note"})]})},j.id)};return c.jsxs(Qte,{className:"border-r border-border",collapsible:"icon",children:[c.jsxs(tne,{className:"border-b border-border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[!
814o&&c.jsx("h2",{className:"font-serif text-lg font-semibold",children:"Notes"}),c.jsx(E5,{className:"shrink-0"})]}),!o&&c.jsxs("div",{className:"relative mt-2",children:[c.jsx(Eg,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Lt,{placeholder:"Search notes...",value:u,onChange:j=>d(j.target.value),className:"pl-8 h-9"})]})]}),c.jsx(nne,{children:c.jsxs(Or,{className:"h-[calc(100vh-180px)]",children:[c.jsx(Db,{children:c.jsx(Ob,{children:c.jsxs(Mb,{children:[c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>{f("home"),s("/study?tab=notes")},className:ke(h==="home"&&!i&&"bg-accent"),children:[c.jsx(oT,{className:"h-4 w-4"}),!o&&c.jsx("span",{children:"Home"})]})}),c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>A("journal"),children:[c.jsx(ka,{className:"h-4 w-4"}),!o&&c.jsx("span",{children:"New Journal Entry"})]})}),c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>A("generic"),children:[c.jsx(mw,{className:"h-4 w-4"}),!o&&c.jsx("span",{children:"New Note"})]})})]})})}),c.jsxs(Db,{children:[c.jsx(cC,{className:"text-xs uppercase tracking-wider",children:!o&&"Filter"}),c.jsx(Ob,{children:c.jsxs(Mb,{children:[c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f("all"),className:ke(h==="all"&&"bg-accent"),children:[c.jsx(zfe,{className:"h-4 w-4"}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"flex-1",children:"All Notes"}),c.jsx(jt,{variant:"secondary",className:"ml-auto text-xs",children:v.length})]})]})}),c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f("journal"),className:ke(h==="journal"&&"bg-accent"),children:[c.jsx(En,{className:"h-4 w-4"}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"flex-1",children:"Journal"}),c.jsx(jt,{variant:"secondary",className:"ml-auto text-xs",children:v.filter(j=>j.type==="journal").length})]})]})}),c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f("passage"),className:ke(h==="passage"&&"bg-accent"),children:[c.jsx(Gm,{className:"h-4 w-4"}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"flex-1",children:"Passage Notes"}),c.jsx(jt,{variant:"secondary",className:"ml-auto text-xs",children:v.filter(j=>j.type==="passage").length})]})]})}),c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f("generic"),className:ke(h==="generic"&&"bg-accent"),children:[c.jsx(mw,{className:"h-4 w-4"}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"flex-1",children:"Notes"}),c.jsx(jt,{variant:"secondary",className:"ml-auto text-xs",children:v.filter(j=>j.type==="generic").length})]})]})})]})})]}),!o&&c.jsx(vV,{open:p,onOpenChange:m,children:c.jsxs(Db,{children:[c.jsx(yV,{className:"w-full",children:c.jsxs(cC,{className:"text-xs uppercase tracking-wider cursor-pointer flex items-center justify-between",children:["Collections",c.jsx(cd,{className:ke("h-4 w-4 transition-transform",p&&"rotate-90")})]})}),c.jsx(xV,{children:c.jsx(Ob,{children:c.jsxs(Mb,{children:[b.slice(0,5).map(j=>c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f(`tag:${j.name}`),className:ke(h===`tag:${j.name}`&&"bg-accent"),children:[c.jsx(VG,{className:"h-4 w-4"}),c.jsx("span",{className:"flex-1 truncate",children:j.name}),c.jsx(jt,{variant:"outline",className:"text-xs",children:j.count})]})},j.name)),E.slice(0,5).map(j=>c.jsx(ol,{children:c.jsxs(ll,{onClick:()=>f(`book:${j.id}`),className:ke(h===`book:${j.id}`&&"bg-accent"),children:[c.jsx(wi,{className:"h-4 w-4"}),c.jsx("span",{className:"flex-1 truncate",children:j.name}),c.jsx(jt,{variant:"outline",className:"text-xs",children:j.count})]})},j.id))]})})})]})}),!o&&c.jsx(vV,{open:g,onOpenChange:y,children:c.jsxs(Db,{children:[c.jsx(yV,{className:"w-full",children:c.jsxs(cC,{className:"text-xs uppercase tracking-wider cursor-pointer flex items-center justify-between",children:["Recent Notes",c.jsx(cd,{className:ke("h-4 w-4 transition-transform",g&&"rotate-90")})]})}),c.jsx(xV,{children:c.jsx(Ob,{children:x?c.jsx("div",{className:"flex items-center justify-center py-4",children:c.jsx(et,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):c.jsx(Mb,{children:(u?S:k).filter(j=>{var D;if(h==="all")return!0;if(h==="journal")return j.type==="journal";if(h==="passage")return j.type==="passage";if(h==="generic")return j.type==="generic";if(h.startsWith("tag:")){const R=h.replace("tag:","");return(D=j.tags)==null?void 0:D.includes(R)}return h.startsWith("book:"),!0}).slice(0,15).map(T)})})})]})})]})}),!o&&c.jsx("div",{className:"border-t border-border p-2",children:c.jsxs(xe,{variant:n?"secondary":"ghost",size:"sm",onClick:r,className:"w-full justify-start gap-2",children:[c.jsx($G,{className:"h-4 w-4"}),n?"Exit Selection":"Manage Notes"]})})]})}function Ks(n){this.content=n}Ks.prototype={constructor:Ks,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Ks(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ks(t)},addToStart:function(n,e){return new Ks([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ks(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Ks(s)}
vendor: 1,522 bytes, line 814
814,forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ks.from(n),n.size?new Ks(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ks.from(n),n.size?new Ks(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ks.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ks.from=function(n){if(n instanceof Ks)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ks(e)};function dne(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let a=0;s.text[a]==i.text[a];a++)t++;return t}if(s.content.size||i.content.size){let a=dne(s.content,i.content,t+1);if(a!=null)return a}t+=s.nodeSize}}function hne(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let a=n.child(--s),o=e.child(--i),l=a.nodeSize;if(a==o){t-=l,r-=l;continue}if(!a.sameMarkup(o))return{a:t,b:r};if(a.isText&&a.text!=o.text){let u=0,d=Math.min(a.text.length,o.text.length);for(;u<d&&a.text[a.text.length-u-1]==o.text[o.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(a.content.size||o.content.size){let u=hne(a.content,o.content,t-1,r-1);if(u)return u}t-=l,r-=l}}
vendor: 4,095 bytes, line 814
814class Ue{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let a=0,o=0;o<t;a++){let l=this.content[a],u=o+l.nodeSize;if(u>e&&r(l,s+o,i||null,a)!==!1&&l.content.size){let d=o+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,s+d)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",a=!0;return this.nodesBetween(e,t,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,t-l):o.isLeaf?s?typeof s=="function"?s(o):s:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(a?a=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new Ue(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,a=0;a<t;i++){let o=this.content[i],l=a+o.nodeSize;l>e&&((a<e||l>t)&&(o.isText?o=o.cut(Math.max(0,e-a),Math.min(o.text.length,t-a)):o=o.cut(Math.max(0,e-a-1),Math.min(o.content.size,t-a-1))),r.push(o),s+=o.nodeSize),a=l}return new Ue(r,s)}cutByIndex(e,t){return e==t?Ue.empty:e==0&&t==this.content.length?this:new Ue(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new Ue(s,i)}addToStart(e){return new Ue([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ue(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return dne(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return hne(this,e,t,r)}findIndex(e){if(e==0)return uk(0,e);if(e==this.size)return uk(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?uk(t+1,i):uk(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Ue.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ue(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ue.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Ue(t||e,r)}static from(e){if(!e)return Ue.empty;if(e instanceof Ue)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ue([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ue.empty=new Ue([],0);const bP={index:0,offset:0};function uk(n,e){return bP.index=n,bP.offset=e,bP}function dA(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!dA(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!dA(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Hn=class sI{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;
vendor: 4,444 bytes, line 814
814if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&dA(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return sI.none;if(e instanceof sI)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Hn.none=[];class hA extends Error{}class ut{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=pne(this.content,e+this.openStart,t);return r&&new ut(r,this.openStart,this.openEnd)}removeBetween(e,t){return new ut(fne(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ut.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ut(Ue.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new ut(e,r,s)}}ut.empty=new ut(Ue.empty,0,0);function fne(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:a,offset:o}=n.findIndex(t);if(s==e||i.isText){if(o!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(fne(i.content,e-s-1,t-s-1)))}function pne(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),a=n.maybeChild(s);if(i==e||a.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let o=pne(a.content,e-i-1,t,a);return o&&n.replaceChild(s,a.copy(o))}function tDe(n,e,t){if(t.openStart>n.depth)throw new hA("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new hA("Inconsistent open depths");return mne(n,e,t,0)}function mne(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let a=mne(n,e,t,r+1);return i.copy(i.content.replaceChild(s,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,o=a.content;return Lm(a,o.cut(0,n.parentOffset).append(t.content).append(o.cut(e.parentOffset)))}else{let{start:a,end:o}=nDe(t,n);return Lm(i,vne(n,a,o,e,r))}else return Lm(i,fA(n,e,r))}function gne(n,e){if(!e.type.compatibleContent(n.type))throw new hA("Cannot join "+e.type.name+" onto "+n.type.name)}function iI(n,e,t){let r=n.node(t);return gne(r,e.node(t)),r}function Im(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Cw(n,e,t,r){let s=(e||n).node(t),i=0,a=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Im(n.nodeAfter,r),i++));for(let o=i;o<a;o++)Im(s.child(o),r);e&&e.depth==t&&e.textOffset&&Im(e.nodeBefore,r)}function Lm(n,e){return n.type.checkContent(e),n.copy(e)}function vne(n,e,t,r,s){let i=n.depth>s&&iI(n,e,s+1),a=r.depth>s&&iI(t,r,s+1),o=[];return Cw(null,n,s,o),i&&a&&e.index(s)==t.index(s)?(gne(i,a),Im(Lm(i,vne(n,e,t,r,s+1)),o)):(i&&Im(Lm(i,fA(n,e,s+1)),o),Cw(e,t,s,o),a&&Im(Lm(a,fA(t,r,s+1)),o)),Cw(r,null,s,o),new Ue(o)}function fA(n,e,t){let r=[];if(Cw(null,n,t,r),n.depth>
vendor: 8,691 bytes, line 814
814t){let s=iI(n,e,t+1);Im(Lm(s,fA(n,e,t+1)),r)}return Cw(e,null,t,r),new Ue(r)}function nDe(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(Ue.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class O1{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Hn.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let o=r;r=s,s=o}let i=r.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!s||!i[a].isInSet(s.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new pA(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let a=e;;){let{index:o,offset:l}=a.content.findIndex(i),u=i-l;if(r.push(a,o,s+l),!u||(a=a.child(o),a.isText))break;i=u-1,s+=l+1}return new O1(t,r,i)}static resolveCached(e,t){let r=bV.get(e);if(r)for(let i=0;i<r.elts.length;i++){let a=r.elts[i];if(a.pos==t)return a}else bV.set(e,r=new rDe);let s=r.elts[r.i]=O1.resolve(e,t);return r.i=(r.i+1)%sDe,s}}class rDe{constructor(){this.elts=[],this.i=0}}const sDe=12,bV=new WeakMap;class pA{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iDe=Object.create(null);let sf=class aI{constructor(e,t,r,s=Hn.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||Ue.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&dA(this.attrs,t||e.defaultAttrs||iDe)&&Hn.sameSet(this.marks,r||Hn.none)}copy(e=null){return e==this.content?this:new aI(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new aI(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return ut.empty;let s=this.resolve(e),i=this.resolve(t),a=r?0:s.sharedDepth(t),o=s.start(a),u=s.node(a).content.cut(s.pos-o,i.pos-o);return new ut(u,s.depth-a,i.depth-a)}replace(e,t,r){return tDe(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return O1.resolveCached(this,e)}resolveNoCache(e){return O1.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yne(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=Ue.empty,s=0,i=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,s,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Hn.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Hn.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=Ue.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};sf.prototype.text=void 0;class mA extends sf{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yne(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}
vendor: 5,524 bytes, lines 814-815
814mark(e){return e==this.marks?this:new mA(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new mA(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function yne(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ag{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new aDe(e,t);if(r.next==null)return ag.empty;let s=xne(r);r.next&&r.err("Unexpected trailing text");let i=fDe(hDe(s));return pDe(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(a,o){let l=a.matchFragment(e,r);if(l&&(!t||l.validEnd))return Ue.from(o.map(u=>u.createAndFill()));for(let u=0;u<a.next.length;u++){let{type:d,next:h}=a.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(h)==-1){s.push(h);let f=i(h,o.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let a=[];for(let o=s;o.type;o=o.via)a.push(o.type);return a.reverse()}for(let a=0;a<i.next.length;a++){let{type:o,next:l}=i.next[a];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in t)&&(!s.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:s}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)i+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return i}).join(`
815`)}}ag.empty=new ag(!0);class aDe{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function xne(n){let e=[];do e.push(oDe(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oDe(n){let e=[];do e.push(lDe(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function lDe(n){let e=dDe(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=cDe(n,e);else break;return e}function wV(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function cDe(n,e){let t=wV(n),r=t;return n.eat(",")&&(n.next!="}"?r=wV(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function uDe(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let a=t[i];a.isInGroup(e)&&s.push(a)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function dDe(n){if(n.eat("(")){let e=xne(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=uDe(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hDe(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(a,o,l){let u={term:l,to:o};return e[a].push(u),u}function s(a,o){a.forEach(l=>l.to=o)}function i(a,o){if(a.type=="choice")return a.exprs.reduce((l,u)=>l.concat(i(u,o)),[]);if(a.type=="seq")for(let l=0;;l++){let u=i(a.exprs[l],o);if(l==a.exprs.length-1)return u;s(u,o=t())}else if(a.type=="star"){let l=t();return r(o,l),s(i(a.expr,l),l),[r(l)]}else if(a.type=="plus"){let l=t();return s(i(a.expr,o),l),s(i(a.expr,l),l),[r(l)]}else{if(a.type=="opt")return[r(o)].concat(i(a.expr,o));if(a.type=="range"){let l=o;for(let u=0;u<a.min;u++){let d=t();s(i(a.expr,l),d),l=d}if(a.max==-1)s(i(a.expr,l),l);else for(let u=a.min;u<a.max;u++){let d=t();r(l,d),s(i(a.expr,l),d),l=d}return[r(l)]}else{if(a.type=="name")return[r(o,void 0,a.value)];throw new Error("Unknown expr type")}}}}function bne(n,e){return e-n}function _V(n,e){let t=[];return r(e),t.sort(bne);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let a=0;a<i.length;a++){let{term:o,to:l}=i[a];!o&&t.indexOf(l)==-1&&r(l)}}}function fDe(n){let e=Object.create(null);return t(_V(n,0));function t(r){let s=[];r.forEach(a=>
vendor: 13,309 bytes, lines 815-817
815{n[a].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let d=0;d<s.length;d++)s[d][0]==o&&(u=s[d][1]);_V(n,l).forEach(d=>{u||s.push([o,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new ag(r.indexOf(n.length-1)>-1);for(let a=0;a<s.length;a++){let o=s[a][1].sort(bne);i.next.push({type:s[a][0],next:e[o.join(",")]||t(o)})}return i}}function pDe(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,a=[];for(let o=0;o<s.next.length;o++){let{type:l,next:u}=s.next[o];a.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function wne(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function _ne(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Sne(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function Ene(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new gDe(n,r,e[r]);return t}let SV=class kne{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ene(e,r.attrs),this.defaultAttrs=wne(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ag.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:_ne(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new sf(this,this.computeAttrs(e),Ue.from(t),Hn.setFrom(r))}createChecked(e=null,t,r){return t=Ue.from(t),this.checkContent(t),new sf(this,this.computeAttrs(e),t,Hn.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=Ue.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(Ue.empty,!0);return i?new sf(this,e,t.append(i),Hn.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Sne(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Hn.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,a)=>r[i]=new kne(i,t,a));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function mDe(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class gDe{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?mDe(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class QT{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Ene(e,s.attrs),this.excluded=null;let i=wne(this.attrs);this.instance=i?new Hn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Hn(this,_ne(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,a)=>r[i]=new QT(i,s++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Sne(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Cne{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ks.from(e.nodes),t.marks=Ks.from(e.marks||{}),this.nodes=SV.compile(this.spec.nodes,this),this.marks=QT.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],a=i.spec.content||"",o=i.spec.marks;if(i.contentMatch=r[a]||(r[a]=ag.parse(a,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=o=="_"?null:o?EV(this,o.split(" ")):o==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],a=i.spec.excludes;i.excluded=a==null?[i]:a==""?[]:EV(this,a.split(" "))}this.nodeFromJSON=s=>sf.fromJSON(this,s),this.markFromJSON=s=>Hn.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof SV){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new mA(r,r.defaultAttrs,e,Hn.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function EV(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],a=i;if(i)t.push(i);else for(let o in n.marks){let l=n.marks[o];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function vDe(n){return n.tag!=null}function yDe(n){return n.style!=null}let Aw=class oI{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(vDe(s))this.tags.push(s);else if(yDe(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new CV(this,t,!1);return r.addAll(e,Hn.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new CV(this,t,!0);return r.addAll(e,Hn.none,t.from,t.to),ut.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(wDe(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let a=i.getAttrs(e);if(a===!1)continue;i.attrs=a||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let a=this.styles[i],o=a.style;if(!(o.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=t))){if(a.getAttrs){let l=a.getAttrs(t);if(l===!1)continue;a.attrs=l||void 0}return a}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,a=0;for(;a<t.length;a++){let o=t[a];if((o.priority==null?50:o.priority)<i)break}t.splice(a,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(a=>{r(a=AV(a)),a.mark||a.ignore||a.clearMark||(a.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(a=>{r(a=AV(a)),a.node||a.ignore||a.mark||(a.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new oI(e,oI.schemaRules(e)))}};const Ane={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},xDe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Nne={ol:!0,ul:!0},M1=1,lI=2,Nw=4;function kV(n,e,t){return e!=null?(e?M1:0)|(e==="full"?lI:0):n&&n.whitespace=="pre"?M1|lI:t&~Nw}class dk{constructor(e,t,r,s,i,a){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=a,this.content=[],this.activeMarks=Hn.none,this.match=i||(a&Nw?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Ue.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&M1)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=Ue.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Ue.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ane.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class CV{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,a=kV(null,t.preserveWhitespace,0)|(r?Nw:0);s?i=new dk(s.type,s.attrs,Hn.none,!0,t.topMatch||s.type.contentMatch,a):r?i=new dk(null,null,Hn.none,!0,null,a):i=new dk(e.schema.topNodeType,null,Hn.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&lI?"full":this.localPreserveWS||(s.options&M1)>0,{schema:a}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
816`);else if(a.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(a.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(a.linebreakReplacement.create(),t,!0),o[l]&&this.insertNode(a.text(o[l]),t,!/\S/.test(o[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=s.content[s.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(a.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Nne.hasOwnProperty(a)&&this.parser.normalizeLists&&bDe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:xDe.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,d=this.needsBlock;if(Ane.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let h=l&&l.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
817`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],a=r.getPropertyValue(i);if(a)for(let o=void 0;;){let l=this.parser.matchStyle(i,a,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(u=>!l.clearMark(u)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return t}addElementByRule(e,t,r,s){let i,a;
vendor: 4,119 bytes, line 817
817if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(a,t.attrs||null,r,t.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let a=r?e.childNodes[r]:e.firstChild,o=s==null?null:e.childNodes[s];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let a=this.open,o=0;a>=0;a--){let l=this.nodes[a],u=l.findWrapping(e);if(u&&(!s||s.length>u.length+o)&&(s=u,i=l,!u.length))break;if(l.solid){if(r)break;o+=2}}if(!s)return null;this.sync(i);for(let a=0;a<s.length;a++)t=this.enterInner(s[a],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let a=Hn.none;for(let o of s.concat(e.marks))(i.type?i.type.allowsMarkType(o.type):NV(o.type,e.type))&&(a=o.addToSet(a));return i.content.push(e.mark(a)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=kV(e,i,a.options);a.options&Nw&&a.content.length==0&&(o|=Nw);let l=Hn.none;return r=r.filter(u=>(a.type?a.type.allowsMarkType(u.type):NV(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new dk(e,t,l,s,null,o)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=M1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),a=(o,l)=>{for(;o>=0;o--){let u=t[o];if(u==""){if(o==t.length-1||o==0)continue;for(;l>=i;l--)if(a(o-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;l--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];
vendor: 4,398 bytes, line 817
817if(r.isTextblock&&r.defaultAttrs)return r}}}function bDe(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Nne.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function wDe(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function AV(n){let e={};for(let t in n)e[t]=n[t];return e}function NV(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],a=o=>{i.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:d}=o.edge(l);if(u==e||i.indexOf(d)<0&&a(d))return!0}};if(a(s.contentMatch))return!0}}class jg{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=wP(t).createDocumentFragment());let s=r,i=[];return e.forEach(a=>{if(i.length||a.marks.length){let o=0,l=0;for(;o<i.length&&l<a.marks.length;){let u=a.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(i[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<i.length;)s=i.pop()[1];for(;l<a.marks.length;){let u=a.marks[l++],d=this.serializeMark(u,a.isInline,t);d&&(i.push([u,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=uC(wP(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&uC(wP(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return uC(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new jg(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=TV(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return TV(e.marks)}}function TV(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function wP(n){return n.document||window.document}const jV=new WeakMap;function _De(n){let e=jV.get(n);return e===void 0&&jV.set(n,e=SDe(n)),e}function SDe(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function uC(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=_De(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=s.indexOf(" ");a>0&&(t=s.slice(0,a),s=s.slice(a+1));let o,l=t?n.createElementNS(t,s):n.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let h in u)if(u[h]!=null){let f=h.indexOf(" ");f>0?l.setAttributeNS(h.slice(0,f),h.slice(f+1),u[h]):h=="style"&&l.style?l.style.cssText=u[h]:l.setAttribute(h,u[h])}}for(let h=d;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=uC(n,f,t,r);if(l.appendChild(p),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:l,contentDOM:o}}const Tne=65535,jne=Math.pow(2,16);function EDe(n,e){return n+e*jne}function RV(n){return n&Tne}function kDe(n){return(n-(n&Tne))/jne}const Rne=1,Pne=2,dC=4,Dne=8;class cI{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Dne)>0}get deletedBefore(){return(this.delInfo&(Rne|dC))>0}get deletedAfter(){return(this.delInfo&(Pne|dC))>0}get deletedAcross(){return(this.delInfo&dC)>0}}class Ya{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ya.empty)return Ya.empty}recover(e){let t=0,r=RV(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+kDe(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,a=this.inverted?1:2;
vendor: 10,893 bytes, line 817
817for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?s:0);if(l>e)break;let u=this.ranges[o+i],d=this.ranges[o+a],h=l+u;if(e<=h){let f=u?e==l?-1:e==h?1:t:t,p=l+s+(f<0?0:d);if(r)return p;let m=e==(t<0?l:h)?null:EDe(o/3,e-l),g=e==l?Pne:e==h?Rne:dC;return(t<0?e!=l:e!=h)&&(g|=Dne),new cI(p,g,m)}s+=d-u}return r?e+s:new cI(e+s,0,null)}touches(e,t){let r=0,s=RV(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[o+i],d=l+u;if(e<=d&&o==s*3)return!0;r+=this.ranges[o+a]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let a=this.ranges[s],o=a-(this.inverted?i:0),l=a+(this.inverted?0:i),u=this.ranges[s+t],d=this.ranges[s+r];e(o,o+u,l,l+d),i+=d-u}}invert(){return new Ya(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ya.empty:new Ya(e<0?[0,-e,0]:[0,0,e])}}Ya.empty=new Ya([]);let One=class uI{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new uI(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new uI;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let a=this._maps[i],o=a.mapResult(e,t);if(o.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(o.recover);continue}}s|=o.delInfo,e=o.pos}return r?e:new cI(e,s,null)}};const _P=Object.create(null);class Ti{getMap(){return Ya.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=_P[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in _P)throw new RangeError("Duplicate use of step JSON ID "+e);return _P[e]=t,t.prototype.jsonID=e,t}}class es{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new es(e,null)}static fail(e){return new es(null,e)}static fromReplace(e,t,r,s){try{return es.ok(e.replace(t,r,s))}catch(i){if(i instanceof hA)return es.fail(i.message);throw i}}}function N5(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(N5(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return Ue.fromArray(r)}class $h extends Ti{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ut(N5(t.content,(a,o)=>!a.isAtom||!o.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),s),t.openStart,t.openEnd);return es.fromReplace(e,this.from,this.to,i)}invert(){return new zl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $h(t.pos,r.pos,this.mark)}merge(e){return e instanceof $h&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $h(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $h(t.from,t.to,e.markFromJSON(t.mark))}}Ti.jsonID("addMark",$h);class zl extends Ti{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new ut(N5(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return es.fromReplace(e,this.from,this.to,r)}invert(){return new $h(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new zl(t.pos,r.pos,this.mark)}merge(e){return e instanceof zl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zl(t.from,t.to,e.markFromJSON(t.mark))}}Ti.jsonID("removeMark",zl);class Uh extends Ti{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return es.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return es.fromReplace(e,this.pos,this.pos+1,new ut(Ue.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Uh(this.pos,t.marks[s]);return new Uh(this.pos,this.mark)}}return new og(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Uh(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Uh(t.pos,e.markFromJSON(t.mark))}}Ti.jsonID("addNodeMark",Uh);class og extends Ti{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return es.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return es.fromReplace(e,this.pos,this.pos+1,new ut(Ue.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Uh(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new og(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new og(t.pos,e.markFromJSON(t.mark))}}Ti.jsonID("removeNodeMark",og);class Rs extends Ti{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&dI(e,this.from,this.to)?es.fail("Structure replace would overwrite content"):es.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ya([this.from,this.to-this.from,this.slice.size])}invert(e){return new Rs(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Rs(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Rs)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ut.empty:new ut(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Rs(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ut.empty:new ut(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Rs(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Rs(t.from,t.to,ut.fromJSON(e,t.slice),!!t.structure)}}Ti.jsonID("replace",Rs);class Ms extends Ti{constructor(e,t,r,s,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(dI(e,this.from,this.gapFrom)||dI(e,this.gapTo,this.to)))return es.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return es.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?es.fromReplace(e,this.from,this.to,r):es.fail("Content does not fit in gap")}getMap(){return new Ya([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ms(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Ms(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ms(t.from,t.to,t.gapFrom,t.gapTo,ut.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ti.jsonID("replaceAround",Ms);function dI(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let a=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,s--}}return!1}function CDe(n,e,t,r){let s=[],i=[],a,o;n.doc.nodesBetween(e,t,(l,u,d)=>{if(!l.isInline)return;let h=l.marks;if(!r.isInSet(h)&&d.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+l.nodeSize,t),m=r.addToSet(h);for(let g=0;g<h.length;g++)h[g].isInSet(m)||(a&&a.to==f&&a.mark.eq(h[g])?a.to=p:s.push(a=new zl(f,p,h[g])));o&&o.to==f?o.to=p:i.push(o=new $h(f,p,r))}}
vendor: 7,335 bytes, lines 817-818
817),s.forEach(l=>n.step(l)),i.forEach(l=>n.step(l))}function ADe(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(a,o)=>{if(!a.isInline)return;i++;let l=null;if(r instanceof QT){let u=a.marks,d;for(;d=r.isInSet(u);)(l||(l=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(a.marks)&&(l=[r]):l=a.marks;if(l&&l.length){let u=Math.min(o+a.nodeSize,t);for(let d=0;d<l.length;d++){let h=l[d],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&h.eq(s[p].style)&&(f=m)}f?(f.to=u,f.step=i):s.push({style:h,from:Math.max(o,e),to:u,step:i})}}}),s.forEach(a=>n.step(new zl(a.from,a.to,a.style)))}function T5(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),a=[],o=e+1;for(let l=0;l<i.childCount;l++){let u=i.child(l),d=o+u.nodeSize,h=r.matchType(u.type);if(!h)a.push(new Rs(o,d,ut.empty));else{r=h;for(let f=0;f<u.marks.length;f++)t.allowsMarkType(u.marks[f].type)||n.step(new zl(o,d,u.marks[f]));if(s&&u.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(u.text);)m||(m=new ut(Ue.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),a.push(new Rs(o+f.index,o+f.index+f[0].length,m))}}o=d}if(!r.validEnd){let l=r.fillBefore(Ue.empty,!0);n.replace(o,o,new ut(l,0,0))}for(let l=a.length-1;l>=0;l--)n.step(a[l])}function NDe(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function z0(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let a=n.$from.node(r),o=n.$from.index(r)+s,l=n.$to.indexAfter(r)-i;if(r<n.depth&&a.canReplace(o,l,t))return r;if(r==0||a.type.spec.isolating||!NDe(a,o,l))break;o&&(s=1),l<a.childCount&&(i=1)}return null}function TDe(n,e,t){let{$from:r,$to:s,depth:i}=e,a=r.before(i+1),o=s.after(i+1),l=a,u=o,d=Ue.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,d=Ue.from(r.node(m).copy(d)),h++):l--;let f=Ue.empty,p=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=Ue.from(s.node(m).copy(f)),p++):u++;n.step(new Ms(l,u,a,o,new ut(d.append(f),h,p),d.size-h,!0))}function j5(n,e,t=null,r=n){let s=jDe(n,e),i=s&&RDe(r,e);return i?s.map(PV).concat({type:e,attrs:t}).concat(i.map(PV)):null}function PV(n){return{type:n,attrs:null}}function jDe(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let a=i.length?i[0]:e;return t.canReplaceWith(r,s,a)?i:null}function RDe(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),a=e.contentMatch.findWrapping(i.type);if(!a)return null;let l=(a.length?a[a.length-1]:e).contentMatch;for(let u=r;l&&u<s;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:a}function PDe(n,e,t){let r=Ue.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let o=t[a].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ue.from(t[a].type.create(t[a].attrs,r))}let s=e.start,i=e.end;n.step(new Ms(s,i,s,i,new ut(r,0,0),t.length,!0))}function DDe(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(a,o)=>{let l=typeof s=="function"?s(a):s;if(a.isTextblock&&!a.hasMarkup(r,l)&&ODe(n.doc,n.mapping.slice(i).map(o),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Ine(n,a,o,i),T5(n,n.mapping.slice(i).map(o,1),r,void 0,u===null);let d=n.mapping.slice(i),h=d.map(o,1),f=d.map(o+a.nodeSize,1);return n.step(new Ms(h,f,h+1,f-1,new ut(Ue.from(r.create(l,null,a.marks)),0,0),1,!0)),u===!0&&Mne(n,a,o,i),!1}})}function Mne(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let a,o=/\r?\n|\r/g;for(;a=o.exec(s.text);){let l=n.mapping.slice(r).map(t+1+i+a.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ine(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+i);n.replaceWith(a,a+1,e.type.schema.text(`
818`))}})}function ODe(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function MDe(n,e,t,r,s){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let a=t.create(r,null,s||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,a);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ms(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ut(Ue.from(a),0,0),1,!0))}function dy(n,e,t=1,r){let s=n.resolve(e),i=s.depth-t,a=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!a.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=t-2;u>i;u--,d--){let h=s.node(u),f=s.index(u);if(h.type.spec.isolating)return!1;let p=h.content.cutByIndex(f,h.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||h;if(!h.canReplace(f+1,h.childCount)||!g.type.validContent(p))return!1}let o=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(o,o,l?l.type:s.node(i+1).type)}function IDe(n,e,t=1,r){let s=n.doc.resolve(e),i=Ue.empty,a=Ue.empty;for(let o=s.depth,l=s.depth-t,u=t-1;o>l;o--,u--){i=Ue.from(s.node(o).copy(i));let d=r&&r[u];a=Ue.from(d?d.type.create(d.attrs,a):s.node(o).copy(a))}n.step(new Rs(e,e,new ut(i.append(a),t,t),!0))}function Bf(n,e){let t=n.resolve(e),r=t.index();return Lne(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function LDe(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),a=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Lne(n,e){return!!(n&&e&&!n.isLeaf&&LDe(n,e))}function ej(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let i,a,o=r.index(s);if(s==r.depth?(i=r.nodeBefore,a=r.nodeAfter):t>0?(i=r.node(s+1),o++,a=r.node(s).maybeChild(o)):(i=r.node(s).maybeChild(o-1),a=r.node(s+1)),i&&!i.isTextblock&&Lne(i,a)&&r.node(s).canReplace(o,o+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function FDe(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,i=n.doc.resolve(e-t),a=i.node().type;if(s&&a.inlineContent){let d=a.whitespace=="pre",h=!!a.contentMatch.matchType(s);d&&!h?r=!1:!d&&h&&(r=!0)}let o=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);Ine(n,d.node(),d.before(),o)}a.inlineContent&&T5(n,e+t-1,a,i.node().contentMatchAt(i.index()),r==null);let l=n.mapping.slice(o),u=l.map(e-t);if(n.step(new Rs(u,l.map(e+t,-1),ut.empty,!0)),r===!0){let d=n.doc.resolve(u);Mne(n,d.node(),d.before(),n.steps.length)}return n}function BDe(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,t))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,t))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Fne(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;
vendor: 5,140 bytes, line 818
818i<=(t.openStart==0&&t.size?2:1);i++)for(let a=r.depth;a>=0;a--){let o=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,l=r.index(a)+(o>0?1:0),u=r.node(a),d=!1;if(i==1)d=u.canReplace(l,l,s);else{let h=u.contentMatchAt(l).findWrapping(s.firstChild.type);d=h&&u.canReplaceWith(l,l,h[0])}if(d)return o==0?r.pos:o<0?r.before(a+1):r.after(a+1)}return null}function tj(n,e,t=e,r=ut.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return Bne(s,i,r)?new Rs(e,t,r):new zDe(s,i,r).fit()}function Bne(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class zDe{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=Ue.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=Ue.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,a=r.depth,o=s.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let l=new ut(i,a,o);return e>-1?new Ms(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Rs(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=SP(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let a=s.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:u}=this.frontier[o],d,h=null;if(t==1&&(a?u.matchType(a.type)||(h=u.fillBefore(Ue.from(a),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:o,parent:i,inject:h};if(t==2&&a&&(d=u.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:o,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=SP(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new ut(e,t+1,Math.max(r,s.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=SP(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new ut(Ib(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new ut(Ib(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let a=this.unplaced,o=r?r.content:a.content,l=a.openStart-e,u=0,d=[],{match:h,type:f}=this.frontier[t];if(s){for(let g=0;g<s.childCount;g++)d.push(s.child(g));h=h.matchFragment(s)}let p=o.size+e-(a.content.size-a.openEnd);for(;u<o.childCount;){let g=o.child(u),y=h.matchType(g.type);if(!y)break;u++,(u>1||l==0||g.content.size)&&(h=y,d.push(zne(g.mark(f.allowedMarks(g.marks)),u==1?l:0,u==o.childCount?p:-1)))}let m=u==o.childCount;m||(p=-1),this.placed=Lb(this.placed,t,Ue.from(d)),this.frontier[t].match=h,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=o;g<p;g++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=m?e==0?ut.empty:new ut(Ib(a.content,e-1,1),e-1,p<0?a.openEnd:e-1):new ut(Ib(a.content,e,u),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!EP(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=EP(e,t,s,r,i);if(a){for(let o=t-1;o>=0;o--){let{match:l,type:u}=this.frontier[o],d=EP(e,o,u,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Lb(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Lb(this.placed,this.depth,Ue.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Ue.empty,!0);t.childCount&&(this.placed=Lb(this.placed,this.frontier.length,t))}}function Ib(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ib(n.firstChild.content,e-1,t)))}
vendor: 4,648 bytes, line 818
818function Lb(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Lb(n.lastChild.content,e-1,t)))}function SP(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function zne(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,zne(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(Ue.empty,!0)))),n.copy(r)}function EP(n,e,t,r,s){let i=n.node(e),a=s?n.indexAfter(e):n.index(e);if(a==i.childCount&&!t.compatibleContent(i.type))return null;let o=r.fillBefore(i.content,!0,a);return o&&!$De(t,i.content,a)?o:null}function $De(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function UDe(n){return n.spec.defining||n.spec.definingForContent}function VDe(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(Bne(s,i,r))return n.step(new Rs(e,t,r));let a=Une(s,i);a[a.length-1]==0&&a.pop();let o=-(s.depth+1);a.unshift(o);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;a.indexOf(f)>-1?o=f:s.before(f)==p&&a.splice(1,0,-f)}let l=a.indexOf(o),u=[],d=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(u.push(m),p==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let p=u[f],m=UDe(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(o)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<a.length;g++){let y=a[(g+l)%a.length],v=!0;y<0&&(v=!1,y=-y);let x=s.node(y-1),b=s.index(y-1);if(x.canReplaceWith(b,b,m.type,m.marks))return n.replace(s.before(y),v?i.after(y):t,new ut($ne(r.content,0,r.openStart,p),p,r.openEnd))}}let h=n.steps.length;for(let f=a.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>h));f--){let p=a[f];p<0||(e=s.before(p),t=i.after(p))}}function $ne(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy($ne(i.content,e+1,t,r,i)))}if(e>r){let i=s.contentMatchAt(0),a=i.fillBefore(n).append(n);n=a.append(i.matchFragment(a).fillBefore(Ue.empty,!0))}return n}function HDe(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=BDe(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new ut(Ue.from(r),0,0))}function WDe(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),i=Une(r,s);for(let a=0;a<i.length;a++){let o=i[a],l=a==i.length-1;if(l&&o==0||r.node(o).type.contentMatch.validEnd)return n.delete(r.start(o),s.end(o));if(o>0&&(l||r.node(o-1).canReplace(r.index(o-1),s.indexAfter(o-1))))return n.delete(r.before(o),s.after(o))}for(let a=1;a<=r.depth&&a<=s.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&s.end(a)-t!=s.depth-a&&r.start(a-1)==s.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),s.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function Une(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class hy extends Ti{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return es.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return es.fromReplace(e,this.pos,this.pos+1,new ut(Ue.from(s),0,t.isLeaf?0:1))}getMap(){return Ya.empty}invert(e){return new hy(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new hy(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new hy(t.pos,t.attr,t.value)}}Ti.jsonID("attr",hy);class I1 extends Ti{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return es.ok(r)}getMap(){return Ya.empty}invert(e){return new I1(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new I1(t.attr,t.value)}}Ti.jsonID("docAttr",I1);
vendor: 3,268 bytes, line 818
818let Jx=class extends Error{};Jx=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Jx.prototype=Object.create(Error.prototype);Jx.prototype.constructor=Jx;Jx.prototype.name="TransformError";class Vne{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new One}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Jx(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=ut.empty){let s=tj(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new ut(Ue.from(r),0,0))}delete(e,t){return this.replace(e,t,ut.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return VDe(this,e,t,r),this}replaceRangeWith(e,t,r){return HDe(this,e,t,r),this}deleteRange(e,t){return WDe(this,e,t),this}lift(e,t){return TDe(this,e,t),this}join(e,t=1){return FDe(this,e,t),this}wrap(e,t){return PDe(this,e,t),this}setBlockType(e,t=e,r,s=null){return DDe(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return MDe(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new hy(e,t,r)),this}setDocAttribute(e,t){return this.step(new I1(e,t)),this}addNodeMark(e,t){return this.step(new Uh(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Hn)t.isInSet(r.marks)&&this.step(new og(e,t));else{let s=r.marks,i,a=[];for(;i=t.isInSet(s);)a.push(new og(e,i)),s=i.removeFromSet(s);for(let o=a.length-1;o>=0;o--)this.step(a[o])}return this}split(e,t=1,r){return IDe(this,e,t,r),this}addMark(e,t,r){return CDe(this,e,t,r),this}removeMark(e,t,r){return ADe(this,e,t,r),this}clearIncompatible(e,t,r){return T5(this,e,t,r),this}}const kP=Object.create(null);class Jt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qDe(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ut.empty){let r=t.content.lastChild,s=null;for(let o=0;o<t.openEnd;o++)s=r,r=r.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:l,$to:u}=a[o],d=e.mapping.slice(i);e.replaceRange(d.map(l.pos),d.map(u.pos),o?ut.empty:t),o==0&&MV(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:a,$to:o}=s[i],l=e.mapping.slice(r),u=l.map(a.pos),d=l.map(o.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),MV(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new zt(e):dv(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let a=t<0?dv(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):dv(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(a)return a}return null}
vendor: 4,107 bytes, line 818
818static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Fo(e.node(0))}static atStart(e){return dv(e,e,0,0,1)||new Fo(e)}static atEnd(e){return dv(e,e,e.content.size,e.childCount,-1)||new Fo(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=kP[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in kP)throw new RangeError("Duplicate use of selection JSON ID "+e);return kP[e]=t,t.prototype.jsonID=e,t}getBookmark(){return zt.between(this.$anchor,this.$head).getBookmark()}}Jt.prototype.visible=!0;class qDe{constructor(e,t){this.$from=e,this.$to=t}}let DV=!1;function OV(n){!DV&&!n.parent.inlineContent&&(DV=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class zt extends Jt{constructor(e,t=e){OV(e),OV(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Jt.near(r);let s=e.resolve(t.map(this.anchor));return new zt(s.parent.inlineContent?s:r,r)}replace(e,t=ut.empty){if(super.replace(e,t),t==ut.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new nj(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new zt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=Jt.findFrom(t,r,!0)||Jt.findFrom(t,-r,!0);if(i)t=i.$head;else return Jt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(Jt.findFrom(e,-r,!0)||Jt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new zt(e,t)}}Jt.jsonID("text",zt);class nj{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nj(e.map(this.anchor),e.map(this.head))}resolve(e){return zt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Tt extends Jt{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?Jt.near(i):new Tt(i)}content(){return new ut(Ue.from(this.node),0,0)}eq(e){return e instanceof Tt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new R5(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Tt(e.resolve(t.anchor))}static create(e,t){return new Tt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Tt.prototype.visible=!1;Jt.jsonID("node",Tt);class R5{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new nj(r,r):new R5(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Tt.isSelectable(r)?new Tt(t):Jt.near(t)}}class Fo extends Jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ut.empty){if(t==ut.empty){e.delete(0,e.doc.content.size);let r=Jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Fo(e)}map(e){return new Fo(e)}eq(e){return e instanceof Fo}getBookmark(){return GDe}}Jt.jsonID("all",Fo);const GDe={map(){return this},resolve(n){return new Fo(n)}};function dv(n,e,t,r,s,i=!1){if(e.inlineContent)return zt.create(n,t);for(let a=r-(s>0?0:1);s>0?a<e.childCount:a>=0;a+=s){let o=e.child(a);if(o.isAtom){if(!i&&Tt.isSelectable(o))return Tt.create(n,t-(s<0?o.nodeSize:0))}else{let l=dv(n,o,t+s,s<0?o.childCount:0,s,i);if(l)return l}t+=o.nodeSize*s}return null}function MV(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof Rs||s instanceof Ms))return;let i=n.mapping.maps[r],a;
vendor: 4,012 bytes, line 818
818i.forEach((o,l,u,d)=>{a==null&&(a=d)}),n.setSelection(Jt.near(n.doc.resolve(a),t))}const IV=1,hk=2,LV=4;class KDe extends Vne{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|IV)&~hk,this.storedMarks=null,this}get selectionSet(){return(this.updated&IV)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=hk,this}ensureMarks(e){return Hn.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&hk)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~hk,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Hn.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let a=this.doc.resolve(t);i=r==t?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Jt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=LV,this}get scrolledIntoView(){return(this.updated&LV)>0}}function FV(n,e){return!e||!n?n:n.bind(e)}class Fb{constructor(e,t,r){this.name=e,this.init=FV(t.init,r),this.apply=FV(t.apply,r)}}const YDe=[new Fb("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Fb("selection",{init(n,e){return n.selection||Jt.atStart(e.doc)},apply(n){return n.selection}}),new Fb("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Fb("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class CP{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=YDe.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Fb(r.key,r.spec.state,r))})}}class qv{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let l=s?s[a].n:0,u=s?s[a].state:this,d=l<t.length&&o.spec.appendTransaction.call(o,l?t.slice(l):t,u,r);
vendor: 11,063 bytes, lines 818-819
818if(d&&r.filterTransaction(d,a)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let h=0;h<this.config.plugins.length;h++)s.push(h<a?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),i=!0}s&&(s[a]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new qv(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new KDe(this)}static create(e){let t=new CP(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new qv(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new CP(this.schema,e.plugins),r=t.fields,s=new qv(t);for(let i=0;i<r.length;i++){let a=r[i].name;s[a]=this.hasOwnProperty(a)?this[a]:r[i].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new CP(e.schema,e.plugins),i=new qv(s);return s.fields.forEach(a=>{if(a.name=="doc")i.doc=sf.fromJSON(e.schema,t.doc);else if(a.name=="selection")i.selection=Jt.fromJSON(i.doc,t.selection);else if(a.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let o in r){let l=r[o],u=l.spec.state;if(l.key==a.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[a.name]=u.fromJSON.call(l,e,t[o],i);return}}i[a.name]=a.init(e,i)}}),i}}function Hne(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Hne(s,e,{})),t[r]=s}return t}class yr{constructor(e){this.spec=e,this.props={},e.props&&Hne(e.props,this,this.props),this.key=e.key?e.key.key:Wne("plugin")}getState(e){return e[this.key]}}const AP=Object.create(null);function Wne(n){return n in AP?n+"$"+ ++AP[n]:(AP[n]=0,n+"$")}class ws{constructor(e="key"){this.key=Wne(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const XDe=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function qne(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const ZDe=(n,e,t)=>{let r=qne(n,t);if(!r)return!1;let s=P5(r);if(!s){let a=r.blockRange(),o=a&&z0(a);return o==null?!1:(e&&e(n.tr.lift(a,o).scrollIntoView()),!0)}let i=s.nodeBefore;if(Xne(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Qx(i,"end")||Tt.isSelectable(i)))for(let a=r.depth;;a--){let o=tj(n.doc,r.before(a),r.after(a),ut.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Qx(i,"end")?Jt.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):Tt.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},JDe=(n,e,t)=>{let r=qne(n,t);if(!r)return!1;let s=P5(r);return s?Gne(n,s,e):!1},QDe=(n,e,t)=>{let r=Kne(n,t);if(!r)return!1;let s=D5(r);return s?Gne(n,s,e):!1};function Gne(n,e,t){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let a=e.nodeAfter,o=a,l=e.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let d=o.firstChild;if(!d)return!1;o=d}let u=tj(n.doc,i,l,ut.empty);if(!u||u.from!=i||u instanceof Rs&&u.slice.size>=l-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(zt.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Qx(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const eOe=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=P5(r)}let a=i&&i.nodeBefore;return!a||!Tt.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Tt.create(n.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function P5(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Kne(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const tOe=(n,e,t)=>{let r=Kne(n,t);if(!r)return!1;let s=D5(r);if(!s)return!1;let i=s.nodeAfter;if(Xne(n,s,e,1))return!0;if(r.parent.content.size==0&&(Qx(i,"start")||Tt.isSelectable(i))){let a=tj(n.doc,r.before(),r.after(),ut.empty);if(a&&a.slice.size<a.to-a.from){if(e){let o=n.tr.step(a);o.setSelection(Qx(i,"start")?Jt.findFrom(o.doc.resolve(o.mapping.map(s.pos)),1):Tt.create(o.doc,o.mapping.map(s.pos))),e(o.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},nOe=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=D5(r)}let a=i&&i.nodeAfter;return!a||!Tt.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Tt.create(n.doc,i.pos)).scrollIntoView()),!0)};function D5(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const rOe=(n,e)=>{let t=n.selection,r=t instanceof Tt,s;if(r){if(t.node.isTextblock||!Bf(n.doc,t.from))return!1;s=t.from}else if(s=ej(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(Tt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},sOe=(n,e)=>{let t=n.selection,r;if(t instanceof Tt){if(t.node.isTextblock||!Bf(n.doc,t.to))return!1;r=t.to}else if(r=ej(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},iOe=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&z0(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},aOe=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
819`).scrollIntoView()),!0)};function Yne(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const oOe=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),i=t.indexAfter(-1),a=Yne(s.contentMatchAt(i));if(!a||!s.canReplaceWith(i,i,a))return!1;if(e){let o=t.after(),l=n.tr.replaceWith(o,o,a.createAndFill());l.setSelection(Jt.near(l.doc.resolve(o),1)),e(l.scrollIntoView())}return!0},lOe=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof Fo||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Yne(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let a=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,o=n.tr.insert(a,i.createAndFill());o.setSelection(zt.create(o.doc,a+1)),e(o.scrollIntoView())}return!0},cOe=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(dy(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&z0(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)},uOe=(n,e)=>{let{$from:t,to:r}=n.selection,s,i=t.sharedDepth(r);return i==0?!1:(s=t.before(i),e&&e(n.tr.setSelection(Tt.create(n.doc,s))),!0)};function dOe(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Bf(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Xne(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,a,o,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&dOe(n,e,t))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(a=(o=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&o.matchType(a[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,m=Ue.empty;for(let v=a.length-1;v>=0;v--)m=Ue.from(a[v].create(null,m));m=Ue.from(s.copy(m));let g=n.tr.step(new Ms(e.pos-1,p,e.pos,p,new ut(m,1,0),a.length,!0)),y=g.doc.resolve(p+2*a.length);y.nodeAfter&&y.nodeAfter.type==s.type&&Bf(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:Jt.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),f=h&&z0(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(u&&Qx(i,"start",!0)&&Qx(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let v=Ue.empty;for(let b=m.length-1;b>=0;b--)v=Ue.from(m[b].copy(v));let x=n.tr.step(new Ms(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new ut(v,m.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function Zne(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(t&&t(e.tr.setSelection(zt.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const hOe=Zne(-1),fOe=Zne(1);function pOe(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,a=s.blockRange(i),o=a&&j5(a,n,e);return o?(r&&r(t.tr.wrap(a,o).scrollIntoView()),!0):!1}}function BV(n,e=null){return function(t,r){let s=!1;for(let i=0;i<t.selection.ranges.length&&!s;i++){let{$from:{pos:a},$to:{pos:o}}=t.selection.ranges[i];t.doc.nodesBetween(a,o,(l,u)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)s=!0;else{let d=t.doc.resolve(u),h=d.index();s=d.parent.canReplaceWith(h,h+1,n)}})}if(!s)return!1;if(r){let i=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[a];i.setBlockType(o,l,n,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function mOe(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,a=s.blockRange(i);if(!a)return!1;let o=r?t.tr:null;return gOe(o,a,n,e)?(r&&r(o.scrollIntoView()),!0):!1}}function gOe(n,e,t,r=null){let s=!1,i=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=a.resolve(e.start-2);i=new pA(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new pA(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let o=j5(i,t,r,e);return o?(n&&vOe(n,e,o,s,t),!0):!1}function vOe(n,e,t,r,s){let i=Ue.empty;for(let d=t.length-1;d>=0;
vendor: 4,112 bytes, line 819
819d--)i=Ue.from(t[d].type.create(t[d].attrs,i));n.step(new Ms(e.start-(r?2:0),e.end,e.start,e.end,new ut(i,0,0),t.length,!0));let a=0;for(let d=0;d<t.length;d++)t[d].type==s&&(a=d+1);let o=t.length-a,l=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,h=e.endIndex,f=!0;d<h;d++,f=!1)!f&&dy(n.doc,l,o)&&(n.split(l,o),l+=2*o),l+=u.child(d).nodeSize;return n}function yOe(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,a=>a.childCount>0&&a.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?xOe(e,t,n,i):bOe(e,t,i):!0:!1}}function xOe(n,e,t,r){let s=n.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(s.step(new Ms(i-1,a,i,a,new ut(Ue.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new pA(s.doc.resolve(r.$from.pos),s.doc.resolve(a),r.depth));const o=z0(r);if(o==null)return!1;s.lift(r,o);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Bf(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function bOe(n,e,t){let r=n.tr,s=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(t.start),a=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let o=t.startIndex==0,l=t.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(o?0:1),d+1,a.content.append(l?Ue.empty:Ue.from(s))))return!1;let h=i.pos,f=h+a.nodeSize;return r.step(new Ms(h-(o?1:0),f+(l?1:0),h+1,f-1,new ut((o?Ue.empty:Ue.from(s.copy(Ue.empty))).append(l?Ue.empty:Ue.from(s.copy(Ue.empty))),o?0:1,l?0:1),o?0:1)),e(r.scrollIntoView()),!0}function wOe(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let a=i.startIndex;if(a==0)return!1;let o=i.parent,l=o.child(a-1);if(l.type!=n)return!1;if(t){let u=l.lastChild&&l.lastChild.type==o.type,d=Ue.from(u?n.create():null),h=new ut(Ue.from(n.create(null,Ue.from(o.type.create(null,d)))),u?3:1,0),f=i.start,p=i.end;t(e.tr.step(new Ms(f-(u?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0}}const Xs=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},e0=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let hI=null;const hu=function(n,e,t){let r=hI||(hI=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},_Oe=function(){hI=null},lg=function(n,e,t,r){return t&&(zV(n,e,t,r,-1)||zV(n,e,t,r,1))},SOe=/^(img|br|input|textarea|hr)$/i;function zV(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:No(n))){let a=n.parentNode;if(!a||a.nodeType!=1||oE(n)||SOe.test(n.nodeName)||n.contentEditable=="false")return!1;e=Xs(n)+(s<0?0:1),n=a}else if(n.nodeType==1){let a=n.childNodes[e+(s<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((i=a.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=a,e=s<0?No(n):0}else return!1}}function No(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function EOe(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=No(n)}else if(n.parentNode&&!oE(n))e=Xs(n),n=n.parentNode;else return null}}function kOe(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!oE(n))e=Xs(n)+1,n=n.parentNode;else return null}}function COe(n,e,t){for(let r=e==0,s=e==No(n);r||s;){if(n==t)return!0;let i=Xs(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==No(n)}}function oE(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const rj=function(n){return n.focusNode&&lg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function up(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function AOe(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function NOe(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);
vendor: 18,936 bytes, lines 819-820
819if(r)return{node:r.offsetNode,offset:Math.min(No(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(No(r.startContainer),r.startOffset)}}}const Gc=typeof navigator<"u"?navigator:null,$V=typeof document<"u"?document:null,zf=Gc&&Gc.userAgent||"",fI=/Edge\/(\d+)/.exec(zf),Jne=/MSIE \d/.exec(zf),pI=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zf),Ea=!!(Jne||pI||fI),af=Jne?document.documentMode:pI?+pI[1]:fI?+fI[1]:0,Bo=!Ea&&/gecko\/(\d+)/i.test(zf);Bo&&+(/Firefox\/(\d+)/.exec(zf)||[0,0])[1];const mI=!Ea&&/Chrome\/(\d+)/.exec(zf),Ps=!!mI,Qne=mI?+mI[1]:0,Ni=!Ea&&!!Gc&&/Apple Computer/.test(Gc.vendor),t0=Ni&&(/Mobile\/\w+/.test(zf)||!!Gc&&Gc.maxTouchPoints>2),Eo=t0||(Gc?/Mac/.test(Gc.platform):!1),ere=Gc?/Win/.test(Gc.platform):!1,Xu=/Android \d/.test(zf),lE=!!$V&&"webkitFontSmoothing"in $V.documentElement.style,TOe=lE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function jOe(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function tu(n,e){return typeof n=="number"?n:n[e]}function ROe(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function UV(n,e,t){let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let a=t||n.dom;a;){if(a.nodeType!=1){a=e0(a);continue}let o=a,l=o==i.body,u=l?jOe(i):ROe(o),d=0,h=0;if(e.top<u.top+tu(r,"top")?h=-(u.top-e.top+tu(s,"top")):e.bottom>u.bottom-tu(r,"bottom")&&(h=e.bottom-e.top>u.bottom-u.top?e.top+tu(s,"top")-u.top:e.bottom-u.bottom+tu(s,"bottom")),e.left<u.left+tu(r,"left")?d=-(u.left-e.left+tu(s,"left")):e.right>u.right-tu(r,"right")&&(d=e.right-u.right+tu(s,"right")),d||h)if(l)i.defaultView.scrollBy(d,h);else{let p=o.scrollLeft,m=o.scrollTop;h&&(o.scrollTop+=h),d&&(o.scrollLeft+=d);let g=o.scrollLeft-p,y=o.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(f))break;a=f=="absolute"?a.offsetParent:e0(a)}}function POe(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,a=t+1;a<Math.min(innerHeight,e.bottom);a+=5){let o=n.root.elementFromPoint(i,a);if(!o||o==n.dom||!n.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=t-20){r=o,s=l.top;break}}return{refDOM:r,refTop:s,stack:tre(n.dom)}}function tre(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=e0(r));return e}function DOe({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;nre(t,r==0?0:r-e)}function nre(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Qg=null;function OOe(n){if(n.setActive)return n.setActive();if(Qg)return n.focus(Qg);let e=tre(n);n.focus(Qg==null?{get preventScroll(){return Qg={preventScroll:!0},!0}}:void 0),Qg||(Qg=!1,nre(e,0))}function rre(n,e){let t,r=2e8,s,i=0,a=e.top,o=e.top,l,u;for(let d=n.firstChild,h=0;d;d=d.nextSibling,h++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=hu(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=a&&m.bottom>=o){a=Math.max(m.bottom,a),o=Math.min(m.top,o);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=d,r=g,s=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=h+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=h+1)}}return!t&&l&&(t=l,s=u,r=0),t&&t.nodeType==3?MOe(t,s):!t||r&&t.nodeType==1?{node:n,offset:i}:rre(t,s)}function MOe(n,e){let t=n.nodeValue.length,r=document.createRange(),s;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let a=Fd(r,1);if(a.top!=a.bottom&&O5(e,a)){s={node:n,offset:i+(e.left>=(a.left+a.right)/2?1:0)};break}}return r.detach(),s||{node:n,offset:0}}function O5(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function IOe(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function LOe(n,e,t){let{node:r,offset:s}=rre(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();i=a.left!=a.right&&t.left>(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(r,s,i)}function FOe(n,e,t,r){let s=-1;for(let i=e,a=!1;i!=n.dom;){let o=n.docView.nearestDesc(i,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!a&&l.left>r.left||l.top>r.top?s=o.posBefore:(!a&&l.right<r.left||l.bottom<r.top)&&(s=o.posAfter),a=!0),!o.contentDOM&&s<0&&!o.node.isText))return(o.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?o.posBefore:o.posAfter;i=o.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function sre(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let a=n.childNodes[i];if(a.nodeType==1){let o=a.getClientRects();for(let l=0;l<o.length;l++){let u=o[l];if(O5(e,u))return sre(a,e,u)}}if((i=(i+1)%r)==s)break}return n}function BOe(n,e){let t=n.dom.ownerDocument,r,s=0,i=NOe(t,e.left,e.top);i&&({node:r,offset:s}=i);let a=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),o;if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let u=n.dom.getBoundingClientRect();if(!O5(e,u)||(a=sre(n.dom,e,u),!a))return null}if(Ni)for(let u=a;r&&u;u=e0(u))u.draggable&&(r=void 0);if(a=IOe(a,e),r){if(Bo&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&s++}let u;lE&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?o=n.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(o=FOe(n,r,s,e))}o==null&&(o=LOe(n,a,e));let l=n.docView.nearestDesc(a,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function VV(n){return n.top<n.bottom||n.left<n.right}function Fd(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(VV(r))return r}return Array.prototype.find.call(t,VV)||n.getBoundingClientRect()}const zOe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ire(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),a=lE||Bo;if(r.nodeType==3)if(a&&(zOe.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let l=Fd(hu(r,s,s),t);if(Bo&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=Fd(hu(r,s-1,s-1),-1);if(u.top==l.top){let d=Fd(hu(r,s,s+1),-1);if(d.top!=l.top)return ob(d,d.left<u.left)}}return l}else{let l=s,u=s,d=t<0?1:-1;return t<0&&!s?(u++,d=-1):t>=0&&s==r.nodeValue.length?(l--,d=1):t<0?l--:u++,ob(Fd(hu(r,l,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==No(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return NP(l.getBoundingClientRect(),!1)}if(i==null&&s<No(r)){let l=r.childNodes[s];if(l.nodeType==1)return NP(l.getBoundingClientRect(),!0)}return NP(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==No(r))){let l=r.childNodes[s-1],u=l.nodeType==3?hu(l,No(l)-(a?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return ob(Fd(u,1),!1)}if(i==null&&s<No(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?hu(l,0,a?0:1):l.nodeType==1?l:null:null;if(u)return ob(Fd(u,-1),!0)}return ob(Fd(r.nodeType==3?hu(r):r,-t),t>=0)}function ob(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function NP(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function are(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function $Oe(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return are(n,e,()=>{let{node:i}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let o=n.docView.nearestDesc(i,!0);if(!o)break;if(o.node.isBlock){i=o.contentDOM||o.dom;break}i=o.dom.parentNode}let a=ire(n,s.pos,1);for(let o=i.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=hu(o,0,o.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let d=l[u];if(d.bottom>d.top+1&&(t=="up"?a.top-d.top>(d.bottom-a.top)*2:d.bottom-a.bottom>(a.bottom-d.top)*2))return!1}}return!0})}const UOe=/[\u0590-\u08ac]/;function VOe(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,a=s==r.parent.content.size,o=n.domSelection();return o?!UOe.test(r.parent.textContent)||!o.modify?t=="left"||t=="backward"?i:a:are(n,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:d,anchorOffset:h}=n.domSelectionRange(),f=o.caretBidiLevel;o.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==g;try{o.collapse(d,h),l&&(l!=d||u!=h)&&o.extend&&o.extend(l,u)}catch{}return f!=null&&(o.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let HV=null,WV=null,qV=!1;function HOe(n,e,t){return HV==e&&WV==t?qV:(HV=e,WV=t,qV=t=="up"||t=="down"?$Oe(n,e,t):VOe(n,e,t))}const zo=0,GV=1,_p=2,Kc=3;class cE{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=zo,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let s=this.children[t];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,a;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(a)+a.size:this.posAtStart}else{let i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Xs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),a;if(i&&(!t||i.node))if(r&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let a=0;a<s.children.length;a++){let o=s.children[a];if(o.size){s=o;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let a=this.children[r],o=i+a.size;if(o>e||a instanceof lre){s=e-i;break}i=o}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof ore&&i.side>=0;r--);if(t<=0){let i,a=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,a=!1);return i&&t&&a&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Xs(i.dom)+1:0}}else{let i,a=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,a=!1);return i&&a&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Xs(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let a=r,o=0;;o++){let l=this.children[o],u=a+l.size;if(s==-1&&e<=u){let d=a+l.border;if(e>=d&&t<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=a;for(let h=o;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=Xs(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(u>t||o==this.children.length-1)){t=u;for(let d=o+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){i=Xs(h.dom);break}t+=h.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=u}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(i>m&&a<y)return g.setSelection(e-m-g.border,t-m-g.border,r,s);m=y}let o=this.domFromPos(e,e?-1:1),l=t==e?o:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),h=!1;if((Bo||Ni)&&e==t){let{node:p,offset:m}=o;if(p.nodeType==3){if(h=!!(m&&p.nodeValue[m-1]==`
820`),h&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(o=l={node:y.parentNode,offset:Xs(y)+1});break}let v=g.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let g=p.childNodes[m-1];h=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Bo&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||h&&Ni)&&lg(o.node,o.offset,d.anchorNode,d.anchorOffset)&&lg(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((u.extend||e==t)&&!(h&&Bo)){u.collapse(o.node,o.offset);try{e!=t&&u.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let m=o;o=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],a=r+i.size;if(r==a?e<=a&&t>=r:e<a&&t>r){let o=r+i.border,l=a-i.border;if(e>=o&&t<=l){this.dirty=e==r||t==a?_p:GV,e==o&&t==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Kc:i.markDirty(e-o,t-o);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?_p:Kc}r=a}this.dirty=_p}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?_p:GV;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ore extends cE{constructor(e,t,r,s){let i,a=t.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let o=document.createElement("span");o.appendChild(a),a=o}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==zo&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class WOe extends cE{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class cg extends cE{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],a=i&&i(t,s,r);return(!a||!a.dom)&&(a=jg.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new cg(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&Kc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Kc&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=zo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=zo}}slice(e,t,r){let s=cg.create(this.parent,this.mark,!0,r),i=this.children,a=this.size;t<a&&(i=vI(i,t,a,r)),e>0&&(i=vI(i,0,e,r));for(let o=0;o<i.length;o++)i[o].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class of extends cE{constructor(e,t,r,s,i,a,o,l,u){super(e,[],i,a),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=o}
vendor: 24,727 bytes, line 820
820static create(e,t,r,s,i,a){let o=i.nodeViews[t.type.name],l,u=o&&o(t,i,()=>{if(!l)return a;if(l.parent)return l.parent.posBeforeChild(l)},r,s),d=u&&u.dom,h=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=jg.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=dre(d,r,t),u?l=new qOe(e,t,r,s,d,h||null,f,u,i,a+1):t.isText?new sj(e,t,r,s,d,f,i):new of(e,t,r,s,d,h||null,f,i,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ue.empty)}return e}matchesNode(e,t,r){return this.dirty==zo&&e.eq(this.node)&&gA(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,l=new KOe(this,a&&a.node,e);ZOe(this.node,this.innerDeco,(u,d,h)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!h&&l.syncToMarks(d==this.node.childCount?Hn.none:this.node.child(d).marks,r,e),l.placeWidget(u,e,s)},(u,d,h,f)=>{l.syncToMarks(u.marks,r,e);let p;l.findNodeMatch(u,d,h,f)||o&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(u,d,h,p,e)||l.updateNextNode(u,d,h,e,f,s)||l.addNode(u,d,h,e,s),s+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==_p)&&(a&&this.protectLocalComposition(e,a),cre(this.contentDOM,this.children,e),t0&&JOe(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof zt)||r<t||s>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let a=i.nodeValue,o=QOe(this.node.content,a,r-t,s-t);return o<0?null:{node:i,pos:o,text:a}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new WOe(this,i,t,s);e.input.compositionNodes.push(a),this.children=vI(this.children,r,r+s.length,e,a)}update(e,t,r,s){return this.dirty==Kc||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=zo}updateOuterDeco(e){if(gA(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ure(this.dom,this.nodeDOM,gI(this.outerDeco,this.node,t),gI(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function KV(n,e,t,r,s){dre(r,e,n);let i=new of(void 0,n,e,t,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class sj extends of{constructor(e,t,r,s,i,a,o){super(e,t,r,s,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==Kc||this.dirty!=zo&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=zo||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=zo,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),i=document.createTextNode(s.text);return new sj(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Kc)}get domAtom(){return!1}isText(e){return this.node.text==e}}class lre extends cE{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==zo&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qOe extends of{constructor(e,t,r,s,i,a,o,l,u,d){super(e,t,r,s,i,a,o,u,d),this.spec=l}update(e,t,r,s){if(this.dirty==Kc)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function cre(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let a=e[i],o=a.dom;if(o.parentNode==n){for(;o!=r;)r=YV(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(o,r);if(a instanceof cg){let l=r?r.previousSibling:n.lastChild;cre(a.contentDOM,a.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=YV(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Tw=function(n){n&&(this.nodeName=n)};Tw.prototype=Object.create(null);const Sp=[new Tw];function gI(n,e,t){if(n.length==0)return Sp;let r=t?Sp[0]:new Tw,s=[r];for(let i=0;i<n.length;i++){let a=n[i].type.attrs;if(a){a.nodeName&&s.push(r=new Tw(a.nodeName));for(let o in a){let l=a[o];l!=null&&(t&&s.length==1&&s.push(r=new Tw(e.isInline?"span":"div")),o=="class"?r.class=(r.class?r.class+" ":"")+l:o=="style"?r.style=(r.style?r.style+";":"")+l:o!="nodeName"&&(r[o]=l))}}}return s}function ure(n,e,t,r){if(t==Sp&&r==Sp)return e;let s=e;for(let i=0;i<r.length;i++){let a=r[i],o=t[i];if(i){let l;o&&o.nodeName==a.nodeName&&s!=n&&(l=s.parentNode)&&l.nodeName.toLowerCase()==a.nodeName||(l=document.createElement(a.nodeName),l.pmIsDeco=!0,l.appendChild(s),o=Sp[0]),s=l}GOe(s,o||Sp[0],a)}return s}function GOe(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function dre(n,e,t){return ure(n,n,Sp,gI(e,t,n.nodeType!=1))}function gA(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function YV(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class KOe{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=YOe(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let s=0,i=this.stack.length>>1,a=Math.min(i,e.length);for(;s<a&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=zo,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[i])&&!this.isLocked(u.dom)){o=l;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let l=cg.create(this.top,e[i],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,r,s){let i=-1,a;if(s>=this.preMatch.index&&(a=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,r))i=this.top.children.indexOf(a,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let u=this.top.children[o];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){i=o;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let a=this.top.children[s];return a.dirty==Kc&&a.dom==a.contentDOM&&(a.dirty=_p),a.update(e,t,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,i,a){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof of){let u=this.preMatch.matched.get(l);if(u!=null&&u!=i)return!1;let d=l.dom,h,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Kc&&gA(t,l.outerDeco));if(!f&&l.update(e,t,r,s))return this.destroyBetween(this.index,o),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(l,e,t,r,s,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=_p,h.updateChildren(s,a+1),h.dirty=zo),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!gA(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let o=of.create(this.top,t,r,s,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let l of o.children)l.parent=o}return e.destroy(),o}addNode(e,t,r,s,i){let a=of.create(this.top,e,t,r,s,i);a.contentDOM&&a.updateChildren(s,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new ore(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof cg;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof sj)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ni||Ps)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new lre(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function YOe(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,a=[];e:for(;s>0;){let o;for(;;)if(r){let u=t.children[r-1];if(u instanceof cg)t=u,r=u.children.length;else{o=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=o.node;if(l){if(l!=n.child(s-1))break;--s,i.set(o,s),a.push(o)}}return{index:s,matched:i,matches:a.reverse()}}function XOe(n,e){return n.type.side-e.type.side}function ZOe(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let a=0,o=[],l=null;for(let u=0;;){let d,h;for(;a<s.length&&s[a].to==i;){let y=s[a++];y.widget&&(d?(h||(h=[d])).push(y):d=y)}if(d)if(h){h.sort(XOe);for(let y=0;y<h.length;y++)t(h[y],u,!!l)}else t(d,u,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(u<n.childCount)p=u,f=n.child(u++);else break;for(let y=0;y<o.length;y++)o[y].to<=i&&o.splice(y--,1);for(;a<s.length&&s[a].from<=i&&s[a].to>i;)o.push(s[a++]);let m=i+f.nodeSize;if(f.isText){let y=m;a<s.length&&s[a].from<y&&(y=s[a].from);for(let v=0;v<o.length;v++)o[v].to<y&&(y=o[v].to);y<m&&(l=f.cut(y-i),f=f.cut(0,y-i),m=y,p=-1)}else for(;a<s.length&&s[a].to<m;)a++;let g=f.isInline&&!f.isLeaf?o.filter(y=>!y.inline):o.slice();r(f,g,e.forChild(i,f),p),i=m}}function JOe(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function QOe(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let a=n.child(s++),o=i;if(i+=a.nodeSize,!a.isText)continue;let l=a.text;for(;s<n.childCount;){let u=n.child(s++);if(i+=u.nodeSize,!u.isText)break;l+=u.text}if(i>=t){if(i>=r&&l.slice(r-e.length-o,r-o)==e)return r-e.length;let u=o<r?l.lastIndexOf(e,r-o-1):-1;if(u>=0&&u+e.length+o>=t)return o+u;if(t==r&&l.length>=r+e.length-o&&l.slice(r-o,r-o+e.length)==e)return r}}return-1}function vI(n,e,t,r,s){let i=[];for(let a=0,o=0;a<n.length;a++){let l=n[a],u=o,d=o+=l.size;u>=t||d<=e?i.push(l):(u<e&&i.push(l.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>t&&i.push(l.slice(t-u,l.size,r)))}return i}function M5(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let o=r.resolve(a),l,u;if(rj(t)){for(l=a;s&&!s.node;)s=s.parent;let h=s.node;if(s&&h.isAtom&&Tt.isSelectable(h)&&s.parent&&!(h.isInline&&COe(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new Tt(a==f?o:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=a,f=a;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);h=Math.min(h,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(h<0)return null;[l,a]=f==n.state.selection.anchor?[f,h]:[h,f],o=r.resolve(a)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!u){let h=e=="pointer"||n.state.selection.head<o.pos&&!i?1:-1;u=I5(n,d,o,h)}return u}function hre(n){return n.editable?n.hasFocus():pre(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Qu(n,e=!1){let t=n.state.selection;if(fre(n,t),!!hre(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ps){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&lg(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)tMe(n);else{let{anchor:r,head:s}=t,i,a;XV&&!(t instanceof zt)&&(t.$from.parent.inlineContent||(i=ZV(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=ZV(n,t.to))),n.docView.setSelection(r,s,n,e),XV&&(i&&JV(i),a&&JV(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&eMe(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const XV=Ni||Ps&&Qne<63;function ZV(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Ni&&s&&s.contentEditable=="false")return TP(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return TP(s);if(i)return TP(i)}}function TP(n){return n.contentEditable="true",Ni&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function JV(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function eMe(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!hre(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function tMe(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Xs(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ea&&af<=11&&(t.disabled=!0,t.disabled=!1)}function fre(n,e){if(e instanceof Tt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(QV(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else QV(n)}function QV(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function I5(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||zt.between(e,t,r)}function eH(n){return n.editable&&!n.hasFocus()?!1:pre(n)}function pre(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function nMe(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return lg(e.node,e.offset,t.anchorNode,t.anchorOffset)}function yI(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Jt.findFrom(i,e)}function Wd(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function tH(n,e,t){let r=n.state.selection;if(r instanceof zt)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Wd(n,new zt(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=yI(n.state,e);return s&&s instanceof Tt?Wd(n,s):!1}else if(!(Eo&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,a;if(!i||i.isText)return!1;let o=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(a=n.docView.descAt(o))&&!a.contentDOM?Tt.isSelectable(i)?Wd(n,new Tt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):lE?Wd(n,new zt(n.state.doc.resolve(e<0?o:o+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Tt&&r.node.isInline)return Wd(n,new zt(e>0?r.$to:r.$from));{let s=yI(n.state,e);return s?Wd(n,s):!1}}}function vA(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function jw(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function ev(n,e){return e<0?rMe(n):sMe(n)}function rMe(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,a=!1;for(Bo&&t.nodeType==1&&r<vA(t)&&jw(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let o=t.childNodes[r-1];if(jw(o,-1))s=t,i=--r;else if(o.nodeType==3)t=o,r=t.nodeValue.length;else break}}else{if(mre(t))break;{let o=t.previousSibling;for(;o&&jw(o,-1);)s=t.parentNode,i=Xs(o),o=o.previousSibling;if(o)t=o,r=vA(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?xI(n,t,r):s&&xI(n,s,i)}function sMe(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=vA(t),i,a;for(;;)if(r<s){if(t.nodeType!=1)break;let o=t.childNodes[r];if(jw(o,1))i=t,a=++r;else break}else{if(mre(t))break;{let o=t.nextSibling;for(;o&&jw(o,1);)i=o.parentNode,a=Xs(o)+1,o=o.nextSibling;if(o)t=o,r=0,s=vA(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&xI(n,i,a)}function mre(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function iMe(n,e){for(;n&&e==n.childNodes.length&&!oE(n);)e=Xs(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function aMe(n,e){for(;n&&!e&&!oE(n);)e=Xs(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function xI(n,e,t){if(e.nodeType!=3){let i,a;(a=iMe(e,t))?(e=a,t=0):(i=aMe(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(rj(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&Qu(n)},50)}function nH(n,e){let t=n.state.doc.resolve(e);if(!(Ps||ere)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),a=(i.top+i.bottom)/2;if(a>s.top&&a<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),a=(i.top+i.bottom)/2;if(a>s.top&&a<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function rH(n,e,t){let r=n.state.selection;if(r instanceof zt&&!r.empty||t.indexOf("s")>-1||Eo&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=yI(n.state,e);if(a&&a instanceof Tt)return Wd(n,a)}if(!s.parent.inlineContent){let a=e<0?s:i,o=r instanceof Fo?Jt.near(a,e):Jt.findFrom(a,e);return o?Wd(n,o):!1}return!1}function sH(n,e){if(!(n.state.selection instanceof zt))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let a=n.state.tr;return e<0?a.delete(t.pos-i.nodeSize,t.pos):a.delete(t.pos,t.pos+i.nodeSize),n.dispatch(a),!0}return!1}function iH(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function oMe(n){if(!Ni||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;iH(n,r,"true"),setTimeout(()=>iH(n,r,"false"),20)}return!1}function lMe(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function cMe(n,e){let t=e.keyCode,r=lMe(e);if(t==8||Eo&&t==72&&r=="c")return sH(n,-1)||ev(n,-1);if(t==46&&!e.shiftKey||Eo&&t==68&&r=="c")return sH(n,1)||ev(n,1);if(t==13||t==27)return!0;if(t==37||Eo&&t==66&&r=="c"){let s=t==37?nH(n,n.state.selection.from)=="ltr"?-1:1:-1;return tH(n,s,r)||ev(n,s)}else if(t==39||Eo&&t==70&&r=="c"){let s=t==39?nH(n,n.state.selection.from)=="ltr"?1:-1:1;return tH(n,s,r)||ev(n,s)}else{if(t==38||Eo&&t==80&&r=="c")return rH(n,-1,r)||ev(n,-1);if(t==40||Eo&&t==78&&r=="c")return oMe(n)||rH(n,1,r)||ev(n,1);if(r==(Eo?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function L5(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let a=n.someProp("clipboardSerializer")||jg.fromSchema(n.state.schema),o=wre(),l=o.createElement("div");l.appendChild(a.serializeFragment(r,{document:o}));let u=l.firstChild,d,h=0;for(;u&&u.nodeType==1&&(d=bre[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=o.createElement(d[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),h++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${h?` -${h}`:""} ${JSON.stringify(t)}`);
vendor: 4,120 bytes, lines 820-823
820let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
821
822`);return{dom:l,text:f,slice:e}}function gre(n,e,t,r,s){let i=s.parent.type.spec.code,a,o;if(!t&&!e)return null;let l=!!e&&(r||i||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return o=new ut(Ue.from(n.state.schema.text(e.replace(/\r\n?/g,`
823`))),0,0),n.someProp("transformPasted",f=>{o=f(o,n,!0)}),o;let h=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(h)o=h;else{let f=s.marks(),{schema:p}=n.state,m=jg.fromSchema(p);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=a.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),a=fMe(t),lE&&pMe(a);let u=a&&a.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let f=a.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;a=f}if(o||(o=(n.someProp("clipboardParser")||n.someProp("domParser")||Aw.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!uMe.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)o=mMe(aH(o,+d[1],+d[2]),d[4]);else if(o=ut.maxOpen(dMe(o.content,s),!0),o.openStart||o.openEnd){let h=0,f=0;for(let p=o.content.firstChild;h<o.openStart&&!p.type.spec.isolating;h++,p=p.firstChild);for(let p=o.content.lastChild;f<o.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);o=aH(o,h,f)}return n.someProp("transformPasted",h=>{o=h(o,n,l)}),o}const uMe=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function dMe(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,a=[];if(n.forEach(o=>{if(!a)return;let l=s.findWrapping(o.type),u;if(!l)return a=null;if(u=a.length&&i.length&&yre(l,i,o,a[a.length-1],0))a[a.length-1]=u;else{a.length&&(a[a.length-1]=xre(a[a.length-1],i.length));let d=vre(o,l);a.push(d),s=s.matchType(d.type),i=l}}),a)return Ue.from(a)}return n}function vre(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,Ue.from(n));return n}function yre(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=yre(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(Ue.from(vre(t,n,s+1))))}}function xre(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,xre(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(Ue.empty,!0);return n.copy(t.append(r))}function bI(n,e,t,r,s,i){let a=e<0?n.firstChild:n.lastChild,o=a.content;return n.childCount>1&&(i=0),s<r-1&&(o=bI(o,e,t,r,s+1,i)),s>=t&&(o=e<0?a.contentMatchAt(0).fillBefore(o,i<=s).append(o):o.append(a.contentMatchAt(a.childCount).fillBefore(Ue.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(o))}function aH(n,e,t){return e<n.openStart&&(n=new ut(bI(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new ut(bI(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const bre={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let oH=null;function wre(){return oH||(oH=document.implementation.createHTMLDocument("title"))}let jP=null;function hMe(n){let e=window.trustedTypes;return e?(jP||(jP=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),jP.createHTML(n)):n}function fMe(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=wre().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&bre[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=hMe(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function pMe(n){let e=n.querySelectorAll(Ps?"span:not([class]):not([style])":"span.Apple-converted-s
823pace");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function mMe(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:a}=n;for(let o=r.length-2;o>=0;o-=2){let l=t.nodes[r[o]];if(!l||l.hasRequiredAttrs())break;s=Ue.from(l.create(r[o+1],s)),i++,a++}return new ut(s,i,a)}const Qi={},ea={},gMe={touchstart:!0,touchmove:!0};class vMe{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function yMe(n){for(let e in Qi){let t=Qi[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{bMe(n,r)&&!F5(n,r)&&(n.editable||!(r.type in ea))&&t(n,r)},gMe[e]?{passive:!0}:void 0)}Ni&&n.dom.addEventListener("input",()=>null),wI(n)}function Vh(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function xMe(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function wI(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>F5(n,r))})}function F5(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function bMe(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function wMe(n,e){!F5(n,e)&&Qi[e.type]&&(n.editable||!(e.type in ea))&&Qi[e.type](n,e)}ea.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Sre(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Xu&&Ps&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),t0&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,up(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||cMe(n,t)?t.preventDefault():Vh(n,"key")};ea.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ea.keypress=(n,e)=>{let t=e;if(Sre(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Eo&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof zt)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",a=>a(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function ij(n){return{left:n.clientX,top:n.clientY}}function _Me(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function B5(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let a=i.depth+1;a>0;a--)if(n.someProp(e,o=>a>i.depth?o(n,t,i.nodeAfter,i.before(a),s,!0):o(n,t,i.node(a),i.before(a),s,!1)))return!0;return!1}function fy(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function SMe(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Tt.isSelectable(r)?(fy(n,new Tt(t)),!0):!1}function EMe(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof Tt&&(r=t.node);let i=n.state.doc.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a);
vendor: 23,817 bytes, line 823
823if(Tt.isSelectable(o)){r&&t.$from.depth>0&&a>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(a);break}}return s!=null?(fy(n,Tt.create(n.state.doc,s)),!0):!1}function kMe(n,e,t,r,s){return B5(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?EMe(n,t):SMe(n,t))}function CMe(n,e,t,r){return B5(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function AMe(n,e,t,r){return B5(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||NMe(n,t,r)}function NMe(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(fy(n,zt.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let a=i>s.depth?s.nodeAfter:s.node(i),o=s.before(i);if(a.inlineContent)fy(n,zt.create(r,o+1,o+1+a.content.size));else if(Tt.isSelectable(a))fy(n,Tt.create(r,o));else continue;return!0}}function z5(n){return yA(n)}const _re=Eo?"metaKey":"ctrlKey";Qi.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=z5(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&_Me(t,n.input.lastClick)&&!t[_re]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let a=n.posAtCoords(ij(t));a&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new TMe(n,a,t,!!r)):(i=="doubleClick"?CMe:AMe)(n,a.pos,a.inside,t)?t.preventDefault():Vh(n,"pointer"))};class TMe{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[_re],this.allowDefault=r.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,a=d.depth?d.before():0}const o=s?null:r.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Tt&&u.from<=a&&u.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Bo&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Vh(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qu(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ij(e))),this.updateAllowDefault(e),this.allowDefault||!t?Vh(this.view,"pointer"):kMe(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ni&&this.mightDrag&&!this.mightDrag.node.isAtom||Ps&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(fy(this.view,Jt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Vh(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vh(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Qi.touchstart=n=>{n.input.lastTouch=Date.now(),z5(n),Vh(n,"pointer")};Qi.touchmove=n=>{n.input.lastTouch=Date.now(),Vh(n,"pointer")};Qi.contextmenu=n=>z5(n);function Sre(n,e){return n.composing?!0:Ni&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const jMe=Xu?5e3:-1;ea.compositionstart=ea.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof zt&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ps&&ere&&RMe(n)))n.markCursor=n.state.storedMarks||t.marks(),yA(n,!0),n.markCursor=null;else if(yA(n,!e.selection.empty),Bo&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let a=i<0?s.lastChild:s.childNodes[i-1];if(!a)break;if(a.nodeType==3){let o=n.domSelection();o&&o.collapse(a,a.nodeValue.length);break}else s=a,i=-1}}n.input.composing=!0}Ere(n,jMe)};function RMe(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}ea.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ere(n,20))};function Ere(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>yA(n),e))}function kre(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=DMe());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function PMe(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=EOe(e.focusNode,e.focusOffset),r=kOe(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let a=t.pmViewDesc;if(!(!a||!a.isText(t.nodeValue)))return r}}return t||r}function DMe(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function yA(n,e=!1){if(!(Xu&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),kre(n),e||n.docView&&n.docView.dirty){let t=M5(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function OMe(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const L1=Ea&&af<15||t0&&TOe<604;Qi.copy=ea.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=L1?null:t.clipboardData,a=r.content(),{dom:o,text:l}=L5(n,a);i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",l)):OMe(n,o),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function MMe(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function IMe(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?F1(n,r.value,null,s,e):F1(n,r.textContent,r.innerHTML,s,e)},50)}function F1(n,e,t,r,s){let i=gre(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,s,i||ut.empty)))return!0;if(!i)return!1;let a=MMe(i),o=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(i);return n.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Cre(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ea.paste=(n,e)=>{let t=e;if(n.composing&&!Xu)return;let r=L1?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&F1(n,Cre(r),r.getData("text/html"),s,t)?t.preventDefault():IMe(n,t)};class Are{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const LMe=Eo?"altKey":"ctrlKey";function Nre(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[LMe]}Qi.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(ij(t)),a;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Tt?s.to-1:s.to))){if(r&&r.mightDrag)a=Tt.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(a=Tt.create(n.state.doc,h.posBefore))}}let o=(a||n.state.selection).content(),{dom:l,text:u,slice:d}=L5(n,o);(!t.dataTransfer.files.length||!Ps||Qne>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(L1?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",L1||t.dataTransfer.setData("text/plain",u),n.dragging=new Are(d,Nre(n,t),a)};Qi.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ea.dragover=ea.dragenter=(n,e)=>e.preventDefault();ea.drop=(n,e)=>{try{FMe(n,e,n.dragging)}finally{n.dragging=null}};function FMe(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(ij(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=gre(n,Cre(e.dataTransfer),L1?null:e.dataTransfer.getData("text/html"),!1,s);let a=!!(t&&Nre(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||ut.empty,a))){e.preventDefault();return}if(!i)return;e.preventDefault();let o=i?Fne(n.state.doc,s.pos,i):s.pos;o==null&&(o=s.pos);let l=n.state.tr;if(a){let{node:p}=t;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(o),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=l.doc;if(d?l.replaceRangeWith(u,u,i.content.firstChild):l.replaceRange(u,u,i),l.doc.eq(h))return;let f=l.doc.resolve(u);if(d&&Tt.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Tt(f));else{let p=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,y,v)=>p=v),l.setSelection(I5(n,f,l.doc.resolve(p)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Qi.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Qu(n)},20))};Qi.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Qi.beforeinput=(n,e)=>{if(Ps&&Xu&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,up(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in ea)Qi[n]=ea[n];function B1(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class xA{constructor(e,t){this.toDOM=e,this.spec=t||Fm,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:a}=e.mapResult(t.from+s,this.side<0?-1:1);return a?null:new Wi(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof xA&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&B1(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class lf{constructor(e,t){this.attrs=e,this.spec=t||Fm}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=a?null:new Wi(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof lf&&B1(this.attrs,e.attrs)&&B1(this.spec,e.spec)}static is(e){return e.type instanceof lf}destroy(){}}let BMe=class Tre{constructor(e,t){this.attrs=e,this.spec=t||Fm}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let a=e.mapResult(t.to+s,-1);return a.deleted||a.pos<=i.pos?null:new Wi(i.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof Tre&&B1(this.attrs,e.attrs)&&B1(this.spec,e.spec)}destroy(){}};class Wi{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Wi(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Wi(e,e,new xA(t,r))}static inline(e,t,r,s){return new Wi(e,t,new lf(r,s))}static node(e,t,r,s){return new Wi(e,t,new BMe(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof lf}get widget(){return this.type instanceof xA}}const hv=[],Fm={};class dr{constructor(e,t){this.local=e.length?e:hv,this.children=t.length?t:hv}static create(e,t){return t.length?bA(t,e,0,Fm):vi}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+s,o.to+s))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,r,s+o,i)}}map(e,t,r){return this==vi||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Fm)}mapInner(e,t,r,s,i){let a;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,r,s);l&&l.type.valid(t,l)?(a||(a=[])).push(l):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?zMe(this.children,a||[],e,t,r,s,i):a?new dr(a.sort(Bm),hv):vi}add(e,t){return t.length?this==vi?dr.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((o,l)=>{let u=l+r,d;if(d=Rre(t,o,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(o,d,u+1):s.splice(i,0,l,l+o.nodeSize,bA(d,o,u+1,Fm)),i+=3}});let a=jre(i?Pre(t):t,-r);for(let o=0;o<a.length;o++)a[o].type.valid(e,a[o])||a.splice(o--,1);return new dr(a.length?this.local.concat(a).sort(Bm):this.local,s||this.children)}remove(e){return e.length==0||this==vi?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let a,o=r[i]+t,l=r[i+1]+t;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>o&&h.to<l&&(e[d]=null,(a||(a=[])).push(h));if(!a)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(a,o+1);u!=vi?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,a;i<e.length;i++)if(a=e[i])for(let o=0;o<s.length;o++)s[o].eq(a,t)&&(s==this.local&&(s=this.local.slice()),s.splice(o--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new dr(s,r):vi}forChild(e,t){if(this==vi)return this;if(t.isLeaf)return dr.empty;let r,s;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(r=this.children[o+2]);break}let i=e+1,a=i+t.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<a&&l.to>i&&l.type instanceof lf){let u=Math.max(i,l.from)-i,d=Math.min(a,l.to)-i;u<d&&(s||(s=[])).push(l.copy(u,d))}}if(s){let o=new dr(s.sort(Bm),hv);return r?new Zd([o,r]):o}return r||vi}eq(e){if(this==e)return!0;if(!(e instanceof dr)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return $5(this.localsInner(e))}localsInner(e){if(this==vi)return hv;if(e.inlineContent||!this.local.some(lf.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof lf||t.push(this.local[r]);return t}forEachSet(e){e(this)}}dr.empty=new dr([],[]);dr.removeOverlap=$5;const vi=dr.empty;class Zd{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Fm));return Zd.from(r)}forChild(e,t){if(t.isLeaf)return dr.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=vi&&(i instanceof Zd?r=r.concat(i.members):r.push(i))}return Zd.from(r)}eq(e){if(!(e instanceof Zd)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let a=0;a<i.length;a++)t.push(i[a])}}return t?$5(r?t:t.sort(Bm)):hv}static from(e){switch(e.length){case 0:return vi;case 1:return e[0];default:return new Zd(e.every(t=>t instanceof dr)?e:e.reduce((t,r)=>t.concat(r instanceof dr?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function zMe(n,e,t,r,s,i,a){let o=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let h=0;t.maps[u].forEach((f,p,m,g)=>{let y=g-m-(p-f);for(let v=0;v<o.length;v+=3){let x=o[v+1];if(x<0||f>x+d-h)continue;let b=o[v]+d-h;p>=b?o[v+1]=f<=b?-2:-1:f>=d&&y&&(o[v]+=y,o[v+1]+=y)}h+=y}),d=t.maps[u].map(d,-1)}let l=!1;for(let u=0;u<o.length;u+=3)if(o[u+1]<0){if(o[u+1]==-2){l=!0,o[u+1]=-1;continue}let d=t.map(n[u]+i),h=d-s;if(h<0||h>=r.content.size){l=!0;continue}let f=t.map(n[u+1]+i,-1),p=f-s,{index:m,offset:g}=r.content.findIndex(h),y=r.maybeChild(m);if(y&&g==h&&g+y.nodeSize==p){let v=o[u+2].mapInner(t,y,d+1,n[u]+i+1,a);v!=vi?(o[u]=h,o[u+1]=p,o[u+2]=v):(o[u+1]=-2,l=!0)}else l=!0}if(l){let u=$Me(o,n,e,t,s,i,a),d=bA(u,r,0,a);e=d.local;for(let h=0;h<o.length;h+=3)o[h+1]<0&&(o.splice(h,3),h-=3);for(let h=0,f=0;h<d.children.length;h+=3){let p=d.children[h];for(;f<o.length&&o[f]<p;)f+=3;o.splice(f,0,d.children[h],d.children[h+1],d.children[h+2])}}return new dr(e.sort(Bm),o)}function jre(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Wi(s.from+e,s.to+e,s.type))}return t}function $Me(n,e,t,r,s,i,a){function o(l,u){for(let d=0;d<l.local.length;d++){let h=l.local[d].map(r,s,u);h?t.push(h):a.onRemove&&a.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)o(l.children[d+2],l.children[d]+u+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&o(n[l+2],e[l]+i+1);return t}function Rre(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,a;i<n.length;i++)(a=n[i])&&a.from>t&&a.to<r&&((s||(s=[])).push(a),n[i]=null);return s}function Pre(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function bA(n,e,t,r){let s=[],i=!1;e.forEach((o,l)=>{let u=Rre(n,o,l+t);if(u){i=!0;let d=bA(u,o,t+l+1,r);d!=vi&&s.push(l,l+o.nodeSize,d)}});let a=jre(i?Pre(n):n,-t).sort(Bm);for(let o=0;o<a.length;o++)a[o].type.valid(e,a[o])||(r.onRemove&&r.onRemove(a[o].spec),a.splice(o--,1));return a.length||s.length?new dr(a,s):vi}function Bm(n,e){return n.from-e.from||n.to-e.to}function $5(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),lH(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),lH(e,s,r.copy(i.from,r.to)));break}}}return e}function lH(n,e,t){for(;e<n.length&&Bm(t,n[e])>0;)e++;n.splice(e,0,t)}function RP(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=vi&&e.push(r)}),n.cursorWrapper&&e.push(dr.create(n.state.doc,[n.cursorWrapper.deco])),Zd.from(e)}const UMe={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VMe=Ea&&af<=11;class HMe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class WMe{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new HMe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Ea&&af<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),VMe&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,UMe)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(eH(this.view)){if(this.suppressingSelectionUpdates)return Qu(this.view);if(Ea&&af<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&lg(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=e0(i))t.add(i);for(let i=e.anchorNode;i;i=e0(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&eH(e)&&!this.ignoreSelectionChange(r),i=-1,a=-1,o=!1,l=[];
vendor: 2,243 bytes, line 823
823if(e.editable)for(let d=0;d<t.length;d++){let h=this.registerMutation(t[d],l);h&&(i=i<0?h.from:Math.min(h.from,i),a=a<0?h.to:Math.max(h.to,a),h.typeOver&&(o=!0))}if(Bo&&l.length){let d=l.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,f]=d;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!h||KMe(e,h)!=p)&&f.remove()}}}else if((Ps||Ni)&&l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let h=d.nextSibling;h&&h.nodeType==1&&h.contentEditable=="false"&&d.parentNode.removeChild(d)}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&rj(r)&&(u=M5(e))&&u.eq(Jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Qu(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,a),qMe(e)),this.handleDOMChange(i,a,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Qu(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let h=e.addedNodes[d];t.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Ea&&af<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:f}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let a=s&&s.parentNode==e.target?Xs(s)+1:0,o=r.localPosFromDOM(e.target,a,-1),l=i&&i.parentNode==e.target?Xs(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:o,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAt
vendor: 4,932 bytes, line 823
823End+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let cH=new WeakMap,uH=!1;function qMe(n){if(!cH.has(n)&&(cH.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Bo,uH)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),uH=!0}}function dH(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return lg(a.node,a.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function GMe(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return dH(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?dH(n,t):null}function KMe(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function YMe(n,e,t){let{node:r,fromOffset:s,toOffset:i,from:a,to:o}=n.docView.parseRange(e,t),l=n.domSelectionRange(),u,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:l.anchorOffset}],rj(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Ps&&n.input.lastKeyCode===8)for(let y=i;y>s;y--){let v=r.childNodes[y-1],x=v.pmViewDesc;if(v.nodeName=="BR"&&!x){i=y;break}if(!x||x.size)break}let h=n.state.doc,f=n.someProp("domParser")||Aw.fromSchema(n.state.schema),p=h.resolve(a),m=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:XMe,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=y),m={anchor:y+a,head:v+a}}return{doc:g,sel:m,from:a,to:o}}function XMe(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ni&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ni&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ZMe=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function JMe(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let C=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=M5(n,C);if(A&&!n.state.selection.eq(A)){if(Ps&&Xu&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",j=>j(n,up(13,"Enter"))))return;let T=n.state.tr.setSelection(A);C=="pointer"?T.setMeta("pointer",!0):C=="key"&&T.scrollIntoView(),i&&T.setMeta("composition",i),n.dispatch(T)}return}let a=n.state.doc.resolve(e),o=a.sharedDepth(t);e=a.before(o+1),t=n.state.doc.resolve(t).after(o+1);let l=n.state.selection,u=YMe(n,e,t),d=n.state.doc,h=d.slice(u.from,u.to),f,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,p="end"):(f=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=tIe(h.content,u.doc.content,u.from,f,p);if(m&&n.input.domChangeCount++,(t0&&n.input.lastIOSEnter>Date.now()-225||Xu)&&s.some(C=>C.nodeType==1&&!ZMe.test(C.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",C=>C(n,up(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof zt&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let C=hH(n,n.state.doc,u.sel);if(C&&!C.eq(n.state.selection)){let A=n.state.tr.setSelection(C);i&&A.setMeta("composition",i),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof zt&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Ea&&af<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),v=d.resolve(m.start),x=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((t0&&n.input.lastIOSEnter>Date.now()-225&&(!x||s.some(C=>
vendor: 5,603 bytes, line 823
823C.nodeName=="DIV"||C.nodeName=="P"))||!x&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",C=>C(n,up(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&eIe(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",C=>C(n,up(8,"Backspace")))){Xu&&Ps&&n.domObserver.suppressSelectionUpdates();return}Ps&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Xu&&!x&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(C){return C(n,up(13,"Enter"))})},20));let b=m.start,E=m.endA,S=C=>{let A=C||n.state.tr.replace(b,E,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let T=hH(n,A.doc,u.sel);T&&!(Ps&&n.composing&&T.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(T.head==b||T.head==A.mapping.map(E)-1)||Ea&&T.empty&&T.head==b)&&A.setSelection(T)}return i&&A.setMeta("composition",i),A.scrollIntoView()},k;if(x)if(g.pos==y.pos){Ea&&af<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Qu(n),20));let C=S(n.state.tr.delete(b,E)),A=d.resolve(m.start).marksAcross(d.resolve(m.endA));A&&C.ensureMarks(A),n.dispatch(C)}else if(m.endA==m.endB&&(k=QMe(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let C=S(n.state.tr);k.type=="add"?C.addMark(b,E,k.mark):C.removeMark(b,E,k.mark),n.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,y.parentOffset),A=()=>S(n.state.tr.insertText(C,b,E));n.someProp("handleTextInput",T=>T(n,b,E,C,A))||n.dispatch(A())}else n.dispatch(S());else n.dispatch(S())}function hH(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:I5(n,e.resolve(t.anchor),e.resolve(t.head))}function QMe(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,a,o,l;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(s.length==1&&i.length==0)o=s[0],a="add",l=d=>d.mark(o.addToSet(d.marks));else if(s.length==0&&i.length==1)o=i[0],a="remove",l=d=>d.mark(o.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(l(e.child(d)));if(Ue.from(u).eq(n))return{mark:o,type:a}}function eIe(n,e,t,r,s){if(t-e<=s.pos-r.pos||PP(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let o=i.nodeAfter;return o!=null&&t==e+o.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let a=n.resolve(PP(i,!0,!0));return!a.parent.isTextblock||a.pos>t||PP(a,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function PP(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function tIe(n,e,t,r,s){let i=n.findDiffStart(e,t);if(i==null)return null;let{a,b:o}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(a,o));r-=a+l-i}if(a<i&&n.size<e.size){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&fH(e.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}else if(o<i){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<n.size&&fH(n.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}return{start:i,endA:a,endB:o}}function fH(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Dre{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new vMe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(yH),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=gH(this),mH(this),this.nodeViews=vH(this),this.docView=KV(this.state.doc,pH(this),RP(this),this.dom,this),this.domObserver=new WMe(this,(r,s,i,a)=>JMe(this,r,s,i,a)),this.domObserver.start(),yMe(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&wI(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(yH),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,i=!1,a=!1;e.storedMarks&&this.composing&&(kre(this),a=!0),this.state=e;let o=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(o||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=vH(this);rIe(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(o||t.handleDOMEvents!=this._props.handleDOMEvents)&&wI(this),this.editable=gH(this),mH(this);let l=RP(this),u=pH(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(e.doc,u,l);
vendor: 8,770 bytes, line 823
823(h||!e.selection.eq(s.selection))&&(a=!0);let f=d=="preserve"&&a&&this.dom.style.overflowAnchor==null&&POe(this);if(a){this.domObserver.stop();let p=h&&(Ea||Ps)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&nIe(s.selection,e.selection);if(h){let m=Ps?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=PMe(this)),(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=KV(e.doc,u,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&nMe(this))?Qu(this,p):(fre(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&DOe(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Tt){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&UV(this,t.getBoundingClientRect(),e)}else UV(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new Are(e.slice,e.move,s<0?void 0:Tt.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let a=0;a<this.directPlugins.length;a++){let o=this.directPlugins[a].props[e];if(o!=null&&(s=t?t(o):o))return s}let i=this.state.plugins;if(i)for(let a=0;a<i.length;a++){let o=i[a].props[e];if(o!=null&&(s=t?t(o):o))return s}}hasFocus(){if(Ea){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&OOe(this.dom),Qu(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return BOe(this,e)}coordsAtPos(e,t=1){return ire(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return HOe(this,t||this.state,e)}pasteHTML(e,t){return F1(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return F1(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return L5(this,e)}destroy(){this.docView&&(xMe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],RP(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_Oe())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return wMe(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ni&&this.root.nodeType===11&&AOe(this.dom.ownerDocument)==this.dom&&GMe(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Dre.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function pH(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Wi.node(0,n.state.doc.content.size,e)]}function mH(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Wi.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function gH(n){return!n.someProp("editable",e=>e(n.state)===!1)}function nIe(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function vH(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function rIe(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function yH(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var xf={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},wA={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},sIe=typeof navigator<"u"&&/Mac/.test(navigator.platform),iIe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Zs=0;Zs<10;Zs++)xf[48+Zs]=xf[96+Zs]=String(Zs);for(var Zs=1;Zs<=24;Zs++)xf[Zs+111]="F"+Zs;for(var Zs=65;Zs<=90;Zs++)xf[Zs]=String.fromCharCode(Zs+32),wA[Zs]=String.fromCharCode(Zs);for(var DP in xf)wA.hasOwnProperty(DP)||(wA[DP]=xf[DP]);function aIe(n){var e=sIe&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||iIe&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?wA:xf)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const oIe=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lIe=typeof navigator<"u"&&/Win/.test(navigator.platform);function cIe(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,a;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))a=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))oIe?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),a&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function uIe(n){let e=Object.create(null);for(let t in n)e[cIe(t)]=n[t];return e}function OP(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function dIe(n){return new yr({props:{handleKeyDown:Ore(n)}})}function Ore(n){let e=uIe(n);return function(t,r){let s=aIe(r),i,a=e[OP(s,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let o=e[OP(s,r,!1)];if(o&&o(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(lIe&&r.ctrlKey&&r.altKey)&&(i=xf[r.keyCode])&&i!=s){let o=e[OP(i,r)];if(o&&o(t.state,t.dispatch,t))return!0}}return!1}}var hIe=Object.defineProperty,U5=(n,e)=>{for(var t in e)hIe(n,t,{get:e[t],enumerable:!0})};function aj(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=t;
vendor: 72,004 bytes, lines 823-904
823return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var oj=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:s}=t,{tr:i}=r,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([o,l])=>[o,(...d)=>{const h=l(...d)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:a}=s,o=[],l=!!e,u=e||i.tr,d=()=>(!l&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),o.every(f=>f===!0)),h={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...g)=>{const y=this.buildProps(u,t),v=p(...g)(y);return o.push(v),h}])),run:d};return h}createCan(e){const{rawCommands:t,state:r}=this,s=!1,i=e||r.tr,a=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(t).map(([l,u])=>[l,(...d)=>u(...d)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}buildProps(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:a}=s,o={tr:e,editor:s,view:a,state:aj({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...d)=>u(...d)(o)]))}};return o}},Mre={};U5(Mre,{blur:()=>fIe,clearContent:()=>pIe,clearNodes:()=>mIe,command:()=>gIe,createParagraphNear:()=>vIe,cut:()=>yIe,deleteCurrentNode:()=>xIe,deleteNode:()=>bIe,deleteRange:()=>wIe,deleteSelection:()=>_Ie,enter:()=>SIe,exitCode:()=>EIe,extendMarkRange:()=>kIe,first:()=>CIe,focus:()=>NIe,forEach:()=>TIe,insertContent:()=>jIe,insertContentAt:()=>DIe,joinBackward:()=>IIe,joinDown:()=>MIe,joinForward:()=>LIe,joinItemBackward:()=>FIe,joinItemForward:()=>BIe,joinTextblockBackward:()=>zIe,joinTextblockForward:()=>$Ie,joinUp:()=>OIe,keyboardShortcut:()=>VIe,lift:()=>HIe,liftEmptyBlock:()=>WIe,liftListItem:()=>qIe,newlineInCode:()=>GIe,resetAttributes:()=>KIe,scrollIntoView:()=>YIe,selectAll:()=>XIe,selectNodeBackward:()=>ZIe,selectNodeForward:()=>JIe,selectParentNode:()=>QIe,selectTextblockEnd:()=>eLe,selectTextblockStart:()=>tLe,setContent:()=>nLe,setMark:()=>_Le,setMeta:()=>SLe,setNode:()=>ELe,setNodeSelection:()=>kLe,setTextDirection:()=>CLe,setTextSelection:()=>ALe,sinkListItem:()=>NLe,splitBlock:()=>TLe,splitListItem:()=>jLe,toggleList:()=>RLe,toggleMark:()=>PLe,toggleNode:()=>DLe,toggleWrap:()=>OLe,undoInputRule:()=>MLe,unsetAllMarks:()=>ILe,unsetMark:()=>LLe,unsetTextDirection:()=>FLe,updateAttributes:()=>BLe,wrapIn:()=>zLe,wrapInList:()=>$Le});var fIe=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),pIe=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),mIe=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:a})=>{n.doc.nodesBetween(i.pos,a.pos,(o,l)=>{if(o.type.isText)return;const{doc:u,mapping:d}=e,h=u.resolve(d.map(l)),f=u.resolve(d.map(l+o.nodeSize)),p=h.blockRange(f);if(!p)return;const m=z0(p);if(o.type.isTextblock){const{defaultType:g}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},gIe=n=>e=>n(e),vIe=()=>({state:n,dispatch:e})=>lOe(n,e),yIe=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,i.content),r.setSelection(new zt(r.doc.resolve(Math.max(a-1,0)))),!0},xIe=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),l=s.after(i);n.delete(o,l).scrollIntoView()}return!0}return!1};function ns(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var bIe=n=>({tr:e,state:t,dispatch:r})=>{const s=ns(n,t.schema),i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===s){if(r){const l=i.before(a),u=i.after(a);e.delete(l,u).scrollIntoView()}return!0}return!1},wIe=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},_Ie=()=>({state:n,dispatch:e})=>XDe(n,e),SIe=()=>({commands:n})=>n.keyboardShortcut("Enter"),EIe=()=>({state:n,dispatch:e})=>oOe(n,e);function V5(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function _A(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:V5(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Ire(n,e,t={}){return n.find(r=>r.type===e&&_A(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function xH(n,e,t={}){return!!Ire(n,e,t)}function H5(n,e,t){var r;if(!n||!e)return;let s=n.parent.childAfter(n.parentOffset);if((!s.node||!s.node.marks.some(d=>d.type===e))&&(s=n.parent.childBefore(n.parentOffset)),!s.node||!s.node.marks.some(d=>d.type===e)||(t=t||((r=s.node.marks[0])==null?void 0:r.attrs),!Ire([...s.node.marks],e,t)))return;let a=s.index,o=n.start()+s.offset,l=a+1,u=o+s.node.nodeSize;for(;a>0&&xH([...n.parent.child(a-1).marks],e,t);)a-=1,o-=n.parent.child(a).nodeSize;for(;l<n.parent.childCount&&xH([...n.parent.child(l).marks],e,t);)u+=n.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function Ad(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var kIe=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const i=Ad(n,r.schema),{doc:a,selection:o}=t,{$from:l,from:u,to:d}=o;if(s){const h=H5(l,i,e);if(h&&h.from<=u&&h.to>=d){const f=zt.create(a,h.from,h.to);t.setSelection(f)}}return!0},CIe=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Lre(n){return n instanceof zt}function Ep(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Fre(n,e=null){if(!e)return null;const t=Jt.atStart(n),r=Jt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?zt.create(n,Ep(0,s,i),Ep(n.content.size,s,i)):zt.create(n,Ep(e,s,i),Ep(e,s,i))}function AIe(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function W5(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var NIe=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const a=()=>{(W5()||AIe())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!Lre(t.state.selection))return a(),!0;const o=Fre(s.doc,n)||t.state.selection,l=t.state.selection.eq(o);return i&&(l||s.setSelection(o),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),a()),!0},TIe=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),jIe=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Bre=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Bre(r)}return n};function fk(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Bre(t)}function z1(n,e,t){if(n instanceof sf||n instanceof Ue)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return Ue.fromArray(n.map(o=>e.nodeFromJSON(o)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),z1("",e,t)}if(s){if(t.errorOnInvalidContent){let a=!1,o="";const l=new Cne({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(a=!0,o=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Aw.fromSchema(l).parseSlice(fk(n),t.parseOptions):Aw.fromSchema(l).parse(fk(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const i=Aw.fromSchema(e);return t.slice?i.parseSlice(fk(n),t.parseOptions).content:i.parse(fk(n),t.parseOptions)}return z1("",e,t)}function RIe(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof Rs||s instanceof Ms))return;const i=n.mapping.maps[r];let a=0;i.forEach((o,l,u,d)=>{a===0&&(a=d)}),n.setSelection(Jt.near(n.doc.resolve(a),t))}var PIe=n=>!("type"in n),DIe=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{var a;if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let o;const l=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{z1(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){l(y)}try{o=z1(e,i.schema,{parseOptions:u,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:i.options.enableContentCheck})}catch(y){return l(y),!1}let{from:d,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,p=!0;if((PIe(o)?o:[o]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===h&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,h+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof Ue){let y="";e.forEach(v=>{v.text&&(y+=v.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,h)}else{g=o;const y=r.doc.resolve(d),v=y.node(),x=y.parentOffset===0,b=v.isText||v.isTextblock,E=v.content.size>0;x&&b&&E&&(d=Math.max(0,d-1)),r.replaceWith(d,h,g)}t.updateSelection&&RIe(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},OIe=()=>({state:n,dispatch:e})=>rOe(n,e),MIe=()=>({state:n,dispatch:e})=>sOe(n,e),IIe=()=>({state:n,dispatch:e})=>ZDe(n,e),LIe=()=>({state:n,dispatch:e})=>tOe(n,e),FIe=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ej(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},BIe=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ej(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},zIe=()=>({state:n,dispatch:e})=>JDe(n,e),$Ie=()=>({state:n,dispatch:e})=>QDe(n,e);function zre(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function UIe(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,a;for(let o=0;o<e.length-1;o+=1){const l=e[o];if(/^(cmd|meta|m)$/i.test(l))a=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))W5()||zre()?a=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var VIe=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=UIe(n).split(/-(?!$)/),a=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),o=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,o))});return l==null||l.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function bf(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,a=e?ns(e,n.schema):null,o=[];n.doc.nodesBetween(r,s,(h,f)=>{if(h.isText)return;const p=Math.max(r,f),m=Math.min(s,f+h.nodeSize);o.push({node:h,from:p,to:m})});const l=s-r,u=o.filter(h=>a?a.name===h.node.type.name:!0).filter(h=>_A(h.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((h,f)=>h+f.to-f.from,0)>=l}var HIe=(n,e={})=>({state:t,dispatch:r})=>{const s=ns(n,t.schema);return bf(t,s,e)?iOe(t,r):!1},WIe=()=>({state:n,dispatch:e})=>cOe(n,e),qIe=n=>({state:e,dispatch:t})=>{const r=ns(n,e.schema);return yOe(r)(e,t)},GIe=()=>({state:n,dispatch:e})=>aOe(n,e);function lj(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function bH(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}var KIe=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,a=null;const o=lj(typeof n=="string"?n:n.name,r.schema);if(!o)return!1;o==="node"&&(i=ns(n,r.schema)),o==="mark"&&(a=Ad(n,r.schema));let l=!1;return t.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,h)=>{i&&i===d.type&&(l=!0,s&&t.setNodeMarkup(h,void 0,bH(d.attrs,e))),a&&d.marks.length&&d.marks.forEach(f=>{a===f.type&&(l=!0,s&&t.addMark(h,h+d.nodeSize,a.create(bH(f.attrs,e))))})})}),l},YIe=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),XIe=()=>({tr:n,dispatch:e})=>{if(e){const t=new Fo(n.doc);n.setSelection(t)}return!0},ZIe=()=>({state:n,dispatch:e})=>eOe(n,e),JIe=()=>({state:n,dispatch:e})=>nOe(n,e),QIe=()=>({state:n,dispatch:e})=>uOe(n,e),eLe=()=>({state:n,dispatch:e})=>fOe(n,e),tLe=()=>({state:n,dispatch:e})=>hOe(n,e);function _I(n,e,t={},r={}){return z1(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var nLe=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:a,commands:o})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const u=_I(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return a&&i.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!t),!0}return a&&i.setMeta("preventUpdate",!t),o.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function $re(n,e){const t=Ad(e,n.schema),{from:r,to:s,empty:i}=n.selection,a=[];i?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,l=>{a.push(...l.marks)});const o=a.find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function Ure(n,e){const t=new Vne(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function rLe(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function sLe(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function iLe(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function cj(n){return e=>iLe(e.$from,n)}function Et(n,e,t){return n.config[e]===void 0&&n.parent?Et(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Et(n.parent,e,t):null}):n.config[e]}function q5(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=Et(e,"addExtensions",t);return r?[e,...q5(r())]:e}).flat(10)}function G5(n,e){const t=jg.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function Vre(n){return typeof n=="function"}function Dn(n,e=void 0,...t){return Vre(n)?e?n.bind(e)(...t):n(...t):n}function aLe(n={}){return Object.keys(n).length===0&&n.constructor===Object}function n0(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),r=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Hre(n){const e=[],{nodeExtensions:t,markExtensions:r}=n0(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const o={name:a.name,options:a.options,storage:a.storage,extensions:s},l=Et(a,"addGlobalAttributes",o);if(!l)return;l().forEach(d=>{d.types.forEach(h=>{Object.entries(d.attributes).forEach(([f,p])=>{e.push({type:h,name:f,attribute:{...i,...p}})})})})}),s.forEach(a=>{const o={name:a.name,options:a.options,storage:a.storage},l=Et(a,"addAttributes",o);if(!l)return;const u=l();Object.entries(u).forEach(([d,h])=>{const f={...i,...h};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:a.name,name:d,attribute:f})})}),e}function rs(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],u=o.filter(d=>!l.includes(d));r[s]=[...l,...u].join(" ")}else if(s==="style"){const o=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[s]?r[s].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;l.forEach(d=>{const[h,f]=d.split(":").map(p=>p.trim());u.set(h,f)}),o.forEach(d=>{const[h,f]=d.split(":").map(p=>p.trim());u.set(h,f)}),r[s]=Array.from(u.entries()).map(([d,h])=>`${d}: ${h}`).join("; ")}else r[s]=i}),r},{})}function SA(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>rs(t,r),{})}function oLe(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function wH(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((i,a)=>{const o=a.attribute.parseHTML?a.attribute.parseHTML(t):oLe(t.getAttribute(a.name));return o==null?i:{...i,[a.name]:o}},{});return{...r,...s}}}}function _H(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&aLe(t)?!1:t!=null))}function SH(n){var e,t;const r={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(r.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function lLe(n,e){var t;const r=Hre(n),{nodeExtensions:s,markExtensions:i}=n0(n),a=(t=s.find(u=>Et(u,"topNode")))==null?void 0:t.name,o=Object.fromEntries(s.map(u=>{const d=r.filter(v=>v.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=n.reduce((v,x)=>{const b=Et(x,"extendNodeSchema",h);return{...v,...b?b(u):{}}},{}),p=_H({...f,content:Dn(Et(u,"content",h)),marks:Dn(Et(u,"marks",h)),group:Dn(Et(u,"group",h)),inline:Dn(Et(u,"inline",h)),atom:Dn(Et(u,"atom",h)),selectable:Dn(Et(u,"selectable",h)),draggable:Dn(Et(u,"draggable",h)),code:Dn(Et(u,"code",h)),whitespace:Dn(Et(u,"whitespace",h)),linebreakReplacement:Dn(Et(u,"linebreakReplacement",h)),defining:Dn(Et(u,"defining",h)),isolating:Dn(Et(u,"isolating",h)),attrs:Object.fromEntries(d.map(SH))}),m=Dn(Et(u,"parseHTML",h));m&&(p.parseDOM=m.map(v=>wH(v,d)));const g=Et(u,"renderHTML",h);g&&(p.toDOM=v=>g({node:v,HTMLAttributes:SA(v,d)}));const y=Et(u,"renderText",h);return y&&(p.toText=y),[u.name,p]})),l=Object.fromEntries(i.map(u=>{const d=r.filter(y=>y.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},f=n.reduce((y,v)=>{const x=Et(v,"extendMarkSchema",h);return{...y,...x?x(u):{}}},{}),p=_H({...f,inclusive:Dn(Et(u,"inclusive",h)),excludes:Dn(Et(u,"excludes",h)),group:Dn(Et(u,"group",h)),spanning:Dn(Et(u,"spanning",h)),code:Dn(Et(u,"code",h)),attrs:Object.fromEntries(d.map(SH))}),m=Dn(Et(u,"parseHTML",h));m&&(p.parseDOM=m.map(y=>wH(y,d)));const g=Et(u,"renderHTML",h);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:SA(y,d)})),[u.name,p]}));return new Cne({topNode:a,nodes:o,marks:l})}function cLe(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function K5(n){return n.sort((t,r)=>{const s=Et(t,"priority")||100,i=Et(r,"priority")||100;return s>i?-1:s<i?1:0})}function Wre(n){const e=K5(q5(n)),t=cLe(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function qre(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
824
825`,textSerializers:a={}}=t||{};let o="";return n.nodesBetween(r,s,(l,u,d,h)=>{var f;l.isBlock&&u>r&&(o+=i);const p=a==null?void 0:a[l.type.name];if(p)return d&&(o+=p({node:l,pos:u,parent:d,index:h,range:e})),!1;l.isText&&(o+=(f=l==null?void 0:l.text)==null?void 0:f.slice(Math.max(r,u)-u,s-u))}),o}function uLe(n,e){const t={from:0,to:n.content.size};return qre(n,t,e)}function Gre(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function dLe(n,e){const t=ns(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,o=>{i.push(o)});const a=i.reverse().find(o=>o.type.name===t.name);return a?{...a.attrs}:{}}function Kre(n,e){const t=lj(typeof e=="string"?e:e.name,n.schema);return t==="node"?dLe(n,e):t==="mark"?$re(n,e):{}}function hLe(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function fLe(n){const e=hLe(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,a)=>a!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Yre(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const a=[];if(s.ranges.length)s.forEach((o,l)=>{a.push({from:o,to:l})});else{const{from:o,to:l}=t[i];if(o===void 0||l===void 0)return;a.push({from:o,to:l})}a.forEach(({from:o,to:l})=>{const u=e.slice(i).map(o,-1),d=e.slice(i).map(l),h=e.invert().map(u,-1),f=e.invert().map(d);r.push({oldRange:{from:h,to:f},newRange:{from:u,to:d}})})}),fLe(r)}function Y5(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=t.resolve(n),a=H5(i,s.type);a&&r.push({mark:s,...a})}):t.nodesBetween(n,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(a=>({from:i,to:i+s.nodeSize,mark:a})))}),r}var pLe=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,a=null;for(;i>0&&a===null;){const o=s.node(i);(o==null?void 0:o.type.name)===e?a=o:i-=1}return[a,i]};function MP(n,e){return e.nodes[n]||e.marks[n]||null}function hC(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var mLe=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,a,o)=>{var l,u;const d=((u=(l=s.type.spec).toText)==null?void 0:u.call(l,{node:s,pos:i,parent:a,index:o}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),t};function SI(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Ad(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(h=>i?i.name===h.type.name:!0).find(h=>_A(h.attrs,t,{strict:!1}));let a=0;const o=[];if(s.forEach(({$from:h,$to:f})=>{const p=h.pos,m=f.pos;n.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const v=Math.max(p,y),x=Math.min(m,y+g.nodeSize),b=x-v;a+=b,o.push(...g.marks.map(E=>({mark:E,from:v,to:x})))})}),a===0)return!1;const l=o.filter(h=>i?i.name===h.mark.type.name:!0).filter(h=>_A(h.mark.attrs,t,{strict:!1})).reduce((h,f)=>h+f.to-f.from,0),u=o.filter(h=>i?h.mark.type!==i&&h.mark.type.excludes(i):!0).reduce((h,f)=>h+f.to-f.from,0);return(l>0?l+u:l)>=a}function gLe(n,e,t={}){if(!e)return bf(n,null,t)||SI(n,null,t);const r=lj(e,n.schema);return r==="node"?bf(n,e,t):r==="mark"?SI(n,e,t):!1}var vLe=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=cj(o=>o.type.name===e)(n.selection);if(!i)return!1;const a=n.doc.resolve(i.pos+1);return s.pos+1===a.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},yLe=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function EH(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function kH(n,e){const{nodeExtensions:t}=n0(e),r=t.find(a=>a.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Dn(Et(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function uj(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(uj(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Xre(n){return n instanceof Tt}var Zre=class Jre{constructor(e){this.position=e}static fromJSON(e){return new Jre(e.position)}toJSON(){return{position:this.position}}};function xLe(n,e){const t=e.mapping.mapResult(n.position);return{position:new Zre(t.pos),mapResult:t}}function bLe(n){return new Zre(n)}function wLe(n,e,t){var r;const{selection:s}=e;let i=null;if(Lre(s)&&(i=s.$cursor),i){const o=(r=n.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(o)||!o.some(u=>u.type.excludes(t)))}const{ranges:a}=s;return a.some(({$from:o,$to:l})=>{let u=o.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(o.pos,l.pos,(d,h,f)=>{if(u)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=p&&m}return!u}),u})}var _Le=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:a,ranges:o}=i,l=Ad(n,r.schema);if(s)if(a){const u=$re(r,l);t.addStoredMark(l.create({...u,...e}))}else o.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;r.doc.nodesBetween(d,h,(f,p)=>{const m=Math.max(p,d),g=Math.min(p+f.nodeSize,h);f.marks.find(v=>v.type===l)?f.marks.forEach(v=>{l===v.type&&t.addMark(m,g,l.create({...v.attrs,...e}))}):t.addMark(m,g,l.create(e))})});return wLe(r,t,l)},SLe=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),ELe=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=ns(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:o})=>BV(i,{...a,...e})(t)?!0:o.clearNodes()).command(({state:o})=>BV(i,{...a,...e})(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},kLe=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ep(n,0,r.content.size),i=Tt.create(r,s);e.setSelection(i)}return!0},CLe=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let a,o;return typeof e=="number"?(a=e,o=e):e&&"from"in e&&"to"in e?(a=e.from,o=e.to):(a=i.from,o=i.to),s&&t.doc.nodesBetween(a,o,(l,u)=>{l.isText||t.setNodeMarkup(u,void 0,{...l.attrs,dir:n})}),!0},ALe=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,a=zt.atStart(r).from,o=zt.atEnd(r).to,l=Ep(s,a,o),u=Ep(i,a,o),d=zt.create(r,l,u);e.setSelection(d)}return!0},NLe=n=>({state:e,dispatch:t})=>{const r=ns(n,e.schema);return wOe(r)(e,t)};function CH(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e==null?void 0:e.includes(s.type.name));n.tr.ensureMarks(r)}}var TLe=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:a}=e,{$from:o,$to:l}=i,u=s.extensionManager.attributes,d=hC(u,o.node().type.name,o.node().attrs);if(i instanceof Tt&&i.node.isBlock)return!o.parentOffset||!dy(a,o.pos)?!1:(r&&(n&&CH(t,s.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const h=l.parentOffset===l.parent.content.size,f=o.depth===0?void 0:rLe(o.node(-1).contentMatchAt(o.indexAfter(-1)));let p=h&&f?[{type:f,attrs:d}]:void 0,m=dy(e.doc,e.mapping.map(o.pos),1,p);if(!p&&!m&&dy(e.doc,e.mapping.map(o.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(i instanceof zt&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,p),f&&!h&&!o.parentOffset&&o.parent.type!==f)){const g=e.mapping.map(o.before()),y=e.doc.resolve(g);o.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(o.before()),f)}n&&CH(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},jLe=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{var a;const o=ns(n,r.schema),{$from:l,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(u))return!1;const h=l.node(-1);if(h.type!==o)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let v=Ue.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-x;A>=l.depth-3;A-=1)v=Ue.from(l.node(A).copy(v));const b=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,E={...hC(f,l.node().type.name,l.node().attrs),...e},S=((a=o.contentMatch.defaultType)==null?void 0:a.createAndFill(E))||void 0;v=v.append(Ue.from(o.createAndFill(null,S)||void 0));const k=l.before(l.depth-(x-1));t.replace(k,l.after(-b),new ut(v,4-x,0));let C=-1;t.doc.nodesBetween(k,t.doc.content.size,(A,T)=>{if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=T+1)}),C>-1&&t.setSelection(zt.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const p=u.pos===l.end()?h.contentMatchAt(0).defaultType:null,m={...hC(f,h.type.name,h.attrs),...e},g={...hC(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,u.pos);const y=p?[{type:o,attrs:m},{type:p,attrs:g}]:[{type:o,attrs:m}];if(!dy(t.doc,l.pos,2))return!1;if(s){const{selection:v,storedMarks:x}=r,{splittableMarks:b}=i.extensionManager,E=x||v.$to.parentOffset&&v.$from.marks();if(t.split(l.pos,2,y).scrollIntoView(),!E||!s)return!0;const S=E.filter(k=>b.includes(k.type.name));t.ensureMarks(S)}return!0},IP=(n,e)=>{const t=cj(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Bf(n.doc,t.pos)&&n.join(t.pos),!0},LP=(n,e)=>{const t=cj(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Bf(n.doc,r)&&n.join(r),!0},RLe=(n,e,t,r={})=>({editor:s,tr:i,state:a,dispatch:o,chain:l,commands:u,can:d})=>{const{extensions:h,splittableMarks:f}=s.extensionManager,p=ns(n,a.schema),m=ns(e,a.schema),{selection:g,storedMarks:y}=a,{$from:v,$to:x}=g,b=v.blockRange(x),E=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const S=cj(k=>kH(k.type.name,h))(g);if(b.depth>=1&&S&&b.depth-S.depth<=1){if(S.node.type===p)return u.liftListItem(m);if(kH(S.node.type.name,h)&&p.validContent(S.node.content)&&o)return l().command(()=>(i.setNodeMarkup(S.pos,p),!0)).command(()=>IP(i,p)).command(()=>LP(i,p)).run()}return!t||!E||!o?l().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>IP(i,p)).command(()=>LP(i,p)).run():l().command(()=>{const k=d().wrapInList(p,r),C=E.filter(A=>f.includes(A.type.name));return i.ensureMarks(C),k?!0:u.clearNodes()}).wrapInList(p,r).command(()=>IP(i,p)).command(()=>LP(i,p)).run()},PLe=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,a=Ad(n,r.schema);return SI(r,a,e)?s.unsetMark(a,{extendEmptyMarkRange:i}):s.setMark(a,e)},DLe=(n,e,t={})=>({state:r,commands:s})=>{const i=ns(n,r.schema),a=ns(e,r.schema),o=bf(r,i,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),o?s.setNode(a,l):s.setNode(i,{...l,...t})},OLe=(n,e={})=>({state:t,commands:r})=>{const s=ns(n,t.schema);return bf(t,s,e)?r.lift(s):r.wrapIn(s,e)},MLe=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const a=n.tr,o=i.transform;for(let l=o.steps.length-1;l>=0;l-=1)a.step(o.steps[l].invert(o.docs[l]));if(i.text){const l=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,n.schema.text(i.text,l))}else a.delete(i.from,i.to)}return!0}}return!1},ILe=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:s}=t;return r||e&&s.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},LLe=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:a=!1}=e,{selection:o}=t,l=Ad(n,r.schema),{$from:u,empty:d,ranges:h}=o;if(!s)return!0;if(d&&a){let{from:f,to:p}=o;const m=(i=u.marks().find(y=>y.type===l))==null?void 0:i.attrs,g=H5(u,l,m);g&&(f=g.from,p=g.to),t.removeMark(f,p,l)}else h.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},FLe=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,a;return typeof n=="number"?(i=n,a=n):n&&"from"in n&&"to"in n?(i=n.from,a=n.to):(i=s.from,a=s.to),r&&e.doc.nodesBetween(i,a,(o,l)=>{if(o.isText)return;const u={...o.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},BLe=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,a=null;const o=lj(typeof n=="string"?n:n.name,r.schema);if(!o)return!1;o==="node"&&(i=ns(n,r.schema)),o==="mark"&&(a=Ad(n,r.schema));let l=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;let f,p,m,g;t.selection.empty?r.doc.nodesBetween(d,h,(y,v)=>{i&&i===y.type&&(l=!0,m=Math.max(v,d),g=Math.min(v+y.nodeSize,h),f=v,p=y)}):r.doc.nodesBetween(d,h,(y,v)=>{v<d&&i&&i===y.type&&(l=!0,m=Math.max(v,d),g=Math.min(v+y.nodeSize,h),f=v,p=y),v>=d&&v<=h&&(i&&i===y.type&&(l=!0,s&&t.setNodeMarkup(v,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(x=>{if(a===x.type&&(l=!0,s)){const b=Math.max(v,d),E=Math.min(v+y.nodeSize,h);t.addMark(b,E,a.create({...x.attrs,...e}))}}))}),p&&(f!==void 0&&s&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),a&&p.marks.length&&p.marks.forEach(y=>{a===y.type&&s&&t.addMark(m,g,a.create({...y.attrs,...e}))}))}),l},zLe=(n,e={})=>({state:t,dispatch:r})=>{const s=ns(n,t.schema);return pOe(s,e)(t,r)},$Le=(n,e={})=>({state:t,dispatch:r})=>{const s=ns(n,t.schema);return mOe(s,e)(t,r)},ULe=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(s=>s.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(s=>s!==t):delete this.callbacks[e]),this}once(e,t){const r=(...s)=>{this.off(e,r),t.apply(this,s)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}},dj=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},VLe=(n,e)=>{if(V5(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function pk(n){var e;const{editor:t,from:r,to:s,text:i,rules:a,plugin:o}=n,{view:l}=t;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const h=mLe(u)+i;return a.forEach(f=>{if(d)return;const p=VLe(h,f.find);if(!p)return;const m=l.state.tr,g=aj({state:l.state,transaction:m}),y={from:r-(p[0].length-i.length),to:s},{commands:v,chain:x,can:b}=new oj({editor:t,state:g});f.handler({state:g,range:y,match:p,commands:v,chain:x,can:b})===null||!m.steps.length||(f.undoable&&m.setMeta(o,{transform:m,from:r,to:s,text:i}),l.dispatch(m),d=!0)}),d}function HLe(n){const{editor:e,rules:t}=n,r=new yr({state:{init(){return null},apply(s,i,a){const o=s.getMeta(r);if(o)return o;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=G5(Ue.from(d),a.schema);const{from:h}=l,f=h+d.length;pk({editor:e,from:h,to:f,text:d,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,a,o){return pk({editor:e,from:i,to:a,text:o,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&pk({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:a}=s.state.selection;return a?pk({editor:e,from:a.pos,to:a.pos,text:`
826`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function WLe(n){return Object.prototype.toString.call(n).slice(8,-1)}function mk(n){return WLe(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Qre(n,e){const t={...n};return mk(n)&&mk(e)&&Object.keys(e).forEach(r=>{mk(e[r])&&mk(n[r])?t[r]=Qre(n[r],e[r]):t[r]=e[r]}),t}var X5=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Dn(Et(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Dn(Et(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Qre(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Rg=class ese extends X5{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new ese(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const a=s.marks();if(!!!a.find(u=>(u==null?void 0:u.type.name)===t.name))return!1;const l=a.find(u=>(u==null?void 0:u.type.name)===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function qLe(n){return typeof n=="number"}var GLe=class{constructor(n){this.find=n.find,this.handler=n.handler}},KLe=(n,e,t)=>{if(V5(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=n,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function YLe(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:a,dropEvent:o}=n,{commands:l,chain:u,can:d}=new oj({editor:e,state:t}),h=[];return t.doc.nodesBetween(r,s,(p,m)=>{var g,y,v,x,b;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const E=(b=(x=(v=p.content)==null?void 0:v.size)!=null?x:p.nodeSize)!=null?b:0,S=Math.max(r,m),k=Math.min(s,m+E);if(S>=k)return;const C=p.isText?p.text||"":p.textBetween(S-m,k-m,void 0,"");KLe(C,i.find,a).forEach(T=>{if(T.index===void 0)return;const j=S+T.index+1,D=j+T[0].length,R={from:t.tr.mapping.map(j),to:t.tr.mapping.map(D)},M=i.handler({state:t,range:R,match:T,commands:l,chain:u,can:d,pasteEvent:a,dropEvent:o});h.push(M)})}),h.every(p=>p!==null)}var gk=null,XLe=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function ZLe(n){const{editor:e,rules:t}=n;let r=null,s=!1,i=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,o;try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}const l=({state:d,from:h,to:f,rule:p,pasteEvt:m})=>{const g=d.tr,y=aj({state:d,transaction:g});if(!(!YLe({editor:e,state:y,from:Math.max(h-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:o})||!g.steps.length)){try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new yr({view(h){const f=m=>{var g;r=(g=h.dom.parentElement)!=null&&g.contains(m.target)?h.dom.parentElement:null,r&&(gk=e)},p=()=>{gk&&(gk=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(h,f)=>{if(i=r===h.dom.parentElement,o=f,!i){const p=gk;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(h,f)=>{var p;const m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return a=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(h,f,p)=>{const m=h[0],g=m.getMeta("uiEvent")==="paste"&&!s,y=m.getMeta("uiEvent")==="drop"&&!i,v=m.getMeta("applyPasteRules"),x=!!v;if(!g&&!y&&!x)return;if(x){let{text:S}=v;typeof S=="string"?S=S:S=G5(Ue.from(S),p.schema);const{from:k}=v,C=k+S.length,A=XLe(S);return l({rule:d,state:p,from:k,to:{b:C},pasteEvt:A})}const b=f.doc.content.findDiffStart(p.doc.content),E=f.doc.content.findDiffEnd(p.doc.content);if(!(!qLe(b)||!E||b===E.b))return l({rule:d,state:p,from:b,to:E,pasteEvt:a})}}))}var hj=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Wre(n),this.schema=lLe(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:MP(e.name,this.schema)},r=Et(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return K5([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:MP(r.name,this.schema)},i=[],a=Et(r,"addKeyboardShortcuts",s);let o={};if(r.type==="mark"&&Et(r,"exitable",s)&&(o.ArrowRight=()=>Rg.handleExit({editor:n,mark:r})),a){const f=Object.fromEntries(Object.entries(a()).map(([p,m])=>[p,()=>m({editor:n})]));o={...o,...f}}const l=dIe(o);i.push(l);const u=Et(r,"addInputRules",s);if(EH(r,n.options.enableInputRules)&&u){const f=u();if(f&&f.length){const p=HLe({editor:n,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const d=Et(r,"addPasteRules",s);if(EH(r,n.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=ZLe({editor:n,rules:f});i.push(...p)}}const h=Et(r,"addProseMirrorPlugins",s);if(h){const f=h();i.push(...f)}return i})}get attributes(){return Hre(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=n0(this.extensions);return Object.fromEntries(e.filter(t=>!!Et(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ns(t.name,this.schema)},i=Et(t,"addNodeView",s);if(!i)return[];const a=i();if(!a)return[];const o=(l,u,d,h,f)=>{const p=SA(l,r);return a({node:l,view:u,getPos:d,decorations:h,innerDecorations:f,editor:n,extension:t,HTMLAttributes:p})};return[t.name,o]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=n0(this.extensions);return Object.fromEntries(e.filter(t=>!!Et(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ad(t.name,this.schema)},i=Et(t,"addMarkView",s);if(!i)return[];const a=(o,l,u)=>{const d=SA(o,r);return i()({mark:o,view:l,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:h=>{d4e(o,n,h)}})};return[t.name,a]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:MP(e.name,this.schema)};e.type==="mark"&&((t=Dn(Et(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=Et(e,"onBeforeCreate",r),i=Et(e,"onCreate",r),a=Et(e,"onUpdate",r),o=Et(e,"onSelectionUpdate",r),l=Et(e,"onTransaction",r),u=Et(e,"onFocus",r),d=Et(e,"onBlur",r),h=Et(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),a&&this.editor.on("update",a),o&&this.editor.on("selectionUpdate",o),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};hj.resolve=Wre;hj.sort=K5;hj.flatten=q5;var JLe={};U5(JLe,{ClipboardTextSerializer:()=>nse,Commands:()=>rse,Delete:()=>sse,Drop:()=>ise,Editable:()=>ase,FocusEvents:()=>lse,Keymap:()=>cse,Paste:()=>use,Tabindex:()=>dse,TextDirection:()=>hse,focusEventsPluginKey:()=>ose});var Wr=class tse extends X5{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new tse(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},nse=Wr.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new yr({key:new ws("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,{ranges:i}=s,a=Math.min(...i.map(d=>d.$from.pos)),o=Math.max(...i.map(d=>d.$to.pos)),l=Gre(t);return qre(r,{from:a,to:o},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),rse=Wr.create({name:"commands",addCommands(){return{...Mre}}}),sse=Wr.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,s;const i=()=>{var a,o,l,u;if((u=(l=(o=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:o.filterTransaction)==null?void 0:l.call(o,n))!=null?u:n.getMeta("y-sync$"))return;const d=Ure(n.before,[n,...e]);Yre(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,v=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!v,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof zl){const v=f.slice(m).map(p.from,-1),x=f.slice(m).map(p.to),b=f.invert().map(v,-1),E=f.invert().map(x),S=(g=d.doc.nodeAt(v-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),k=(y=d.doc.nodeAt(x))==null?void 0:y.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:E},newRange:{from:v,to:x},partial:!!(k||S),editor:this.editor,transaction:n,combinedTransform:d})}})};(s=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),ise=Wr.create({name:"drop",addProseMirrorPlugins(){return[new yr({key:new ws("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),ase=Wr.create({name:"editable",addProseMirrorPlugins(){return[new yr({key:new ws("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ose=new ws("focusEvents"),lse=Wr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new yr({key:ose,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),cse=Wr.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:o})=>{const{selection:l,doc:u}=o,{empty:d,$anchor:h}=l,{pos:f,parent:p}=h,m=h.parent.isTextblock&&f>0?o.doc.resolve(f-1):h,g=m.parent.type.spec.isolating,y=h.pos-h.parentOffset,v=g&&m.parent.childCount===1?y===h.pos:Jt.atStart(u).from===f;return!d||!p.type.isTextblock||p.textContent.length||!v||v&&h.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return W5()||zre()?i:s},addProseMirrorPlugins(){return[new yr({key:new ws("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),s=n.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:a,to:o}=e.selection,l=Jt.atStart(e.doc).from,u=Jt.atEnd(e.doc).to;if(i||!(a===l&&o===u)||!uj(t.doc))return;const f=t.tr,p=aj({state:t,transaction:f}),{commands:m}=new oj({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),use=Wr.create({name:"paste",addProseMirrorPlugins(){return[new yr({key:new ws("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),dse=Wr.create({name:"tabindex",addProseMirrorPlugins(){return[new yr({key:new ws("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),hse=Wr.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=n0(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new yr({key:new ws("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),QLe=class fv{constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new fv(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new fv(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new fv(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const o=this.resolvedPos.doc.resolve(a);if(!s&&o.depth<=this.depth)return;const l=new fv(o,this.editor,s,s?t:null);s&&(l.actualDepth=this.depth+1),e.push(new fv(o,this.editor,s,s?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const i=s.node.attrs,a=Object.keys(t);for(let o=0;o<a.length;o+=1){const l=a[o];if(i[l]!==t[l])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(t);return this.children.forEach(a=>{r&&s.length>0||(a.node.type.name===e&&i.every(l=>t[l]===a.node.attrs[l])&&s.push(a),!(r&&s.length>0)&&(s=s.concat(a.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},e4e=`.ProseMirror {
827  position: relative;
828}
829
830.ProseMirror {
831  word-wrap: break-word;
832  white-space: pre-wrap;
833  white-space: break-spaces;
834  -webkit-font-variant-ligatures: none;
835  font-variant-ligatures: none;
836  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
837}
838
839.ProseMirror [contenteditable="false"] {
840  white-space: normal;
841}
842
843.ProseMirror [contenteditable="false"] [contenteditable="true"] {
844  white-space: pre-wrap;
845}
846
847.ProseMirror pre {
848  white-space: pre-wrap;
849}
850
851img.ProseMirror-separator {
852  display: inline !important;
853  border: none !important;
854  margin: 0 !important;
855  width: 0 !important;
856  height: 0 !important;
857}
858
859.ProseMirror-gapcursor {
860  display: none;
861  pointer-events: none;
862  position: absolute;
863  margin: 0;
864}
865
866.ProseMirror-gapcursor:after {
867  content: "";
868  display: block;
869  position: absolute;
870  top: -2px;
871  width: 20px;
872  border-top: 1px solid black;
873  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
874}
875
876@keyframes ProseMirror-cursor-blink {
877  to {
878    visibility: hidden;
879  }
880}
881
882.ProseMirror-hideselection *::selection {
883  background: transparent;
884}
885
886.ProseMirror-hideselection *::-moz-selection {
887  background: transparent;
888}
889
890.ProseMirror-hideselection * {
891  caret-color: transparent;
892}
893
894.ProseMirror-focused .ProseMirror-gapcursor {
895  display: block;
896}`;function t4e(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}var n4e=class extends ULe{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:xLe,createMappablePosition:bLe},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Fre(e,this.options.autofocus);this.editorState=qv.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=t4e(e4e,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Vre(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;t=t.filter(a=>!a.key.startsWith(i))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[ase,nse.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),rse,lse,cse,dse,ise,use,sse,hse.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new hj(r,this)}createCommandManager(){this.commandManager=new oj({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=_I(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=_I(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new Dre(n,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const a=t.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),o=a==null?void 0:a.getMeta("focus"),l=a==null?void 0:a.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:a}),l&&this.emit("blur",{editor:this,event:l.event,transaction:a}),!(n.getMeta("preventUpdate")||!t.some(u=>u.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return Kre(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return gLe(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return G5(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
897
898`,textSerializers:t={}}=n||{};return uLe(this.state.doc,{blockSeparator:e,textSerializers:{...Gre(this.schema),...t}})}get isEmpty(){return uj(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new QLe(e,this)}get $doc(){return this.$pos(0)}};function r0(n){return new dj({find:n.find,handler:({state:e,range:t,match:r})=>{const s=Dn(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,a=r[r.length-1],o=r[0];if(a){const l=o.search(/\S/),u=t.from+o.indexOf(a),d=u+a.length;if(Y5(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+l,u);const f=t.from+l+a.length;i.addMark(t.from+l,f,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function r4e(n){return new dj({find:n.find,handler:({state:e,range:t,match:r})=>{const s=Dn(n.getAttributes,void 0,r)||{},{tr:i}=e,a=t.from;let o=t.to;const l=n.type.create(s);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=a+u;d>o?d=o:o=d+r[1].length;const h=r[0][r[0].length-1];i.insertText(h,a+r[0].length-1),i.replaceWith(d,o,l)}else if(r[0]){const u=n.type.isInline?a:a-1;i.insert(u,n.type.create(s)).delete(i.mapping.map(a),i.mapping.map(o))}i.scrollIntoView()},undoable:n.undoable})}function EI(n){return new dj({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=Dn(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function s0(n){return new dj({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=Dn(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),l=a.doc.resolve(t.from).blockRange(),u=l&&j5(l,n.type,i);if(!u)return null;if(a.wrap(l,u),n.keepMarks&&n.editor){const{selection:h,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,m=f||h.$to.parentOffset&&h.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const h=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(h,i).run()}const d=a.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Bf(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&a.join(t.from-1)},undoable:n.undoable})}function s4e(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof Tt){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var i4e={};U5(i4e,{createAtomBlockMarkdownSpec:()=>a4e,createBlockMarkdownSpec:()=>o4e,createInlineMarkdownSpec:()=>u4e,parseAttributes:()=>Z5,parseIndentedBlocks:()=>kI,renderNestedMarkdownContent:()=>Q5,serializeAttributes:()=>J5});function Z5(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const u=s.map(d=>d.trim().slice(1));e.class=u.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(a)).forEach(([,u,d])=>{var h;const f=parseInt(((h=d.match(/__QUOTED_(\d+)__/))==null?void 0:h[1])||"0",10),p=t[f];p&&(e[u]=p.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function J5(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function a4e(n){const{nodeName:e,name:t,parseAttributes:r=Z5,serializeAttributes:s=J5,defaultAttributes:i={},requiredAttributes:a=[],allowedAttributes:o}=n,l=t||e,u=d=>{if(!o)return d;const h={};return o.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{const f={...i,...d.attributes};return h.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){const p=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(p);if(!m)return;const g=m[1]||"",y=r(g);if(!a.find(x=>!(x in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const h=u(d.attrs||{}),f=s(h),p=f?` {${f}}`:"";return`:::${l}${p} :::`}}}function o4e(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=Z5,serializeAttributes:i=J5,defaultAttributes:a={},content:o="block",allowedAttributes:l}=n,u=t||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{p in h&&(f[p]=h[p])}),f};return{parseMarkdown:(h,f)=>{let p;if(r){const g=r(h);p=typeof g=="string"?[{type:"text",text:g}]:g}else o==="block"?p=f.parseChildren(h.tokens||[]):p=f.parseInline(h.tokens||[]);const m={...a,...h.attributes};return f.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(h){var f;const p=new RegExp(`^:::${u}`,"m"),m=(f=h.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(h,f,p){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=h.match(g);if(!y)return;const[v,x=""]=y,b=s(x);let E=1;const S=v.length;let k="";const C=/^:::([\w-]*)(\s.*)?/gm,A=h.slice(S);for(C.lastIndex=0;;){const T=C.exec(A);if(T===null)break;const j=T.index,D=T[1];if(!((m=T[2])!=null&&m.endsWith(":::"))){if(D)E+=1;else if(E-=1,E===0){const R=A.slice(0,j);k=R.trim();const M=h.slice(0,S+j+T[0].length);let N=[];if(k)if(o==="block")for(N=p.blockTokens(R),N.forEach(U=>{U.text&&(!U.tokens||U.tokens.length===0)&&(U.tokens=p.inlineTokens(U.text))});N.length>0;){const U=N[N.length-1];if(U.type==="paragraph"&&(!U.text||U.text.trim()===""))N.pop();else break}else N=p.inlineTokens(k);return{type:e,raw:M,attributes:b,content:k,tokens:N}}}}}},renderMarkdown:(h,f)=>{const p=d(h.attrs||{}),m=i(p),g=m?` {${m}}`:"",y=f.renderChildren(h.content||[],`
899
900`);return`:::${u}${g}
901
902${y}
903
904:::`}}}function l4e(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,a]=r;e[s]=i||a,r=t.exec(n)}return e}function c4e(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function u4e(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=l4e,serializeAttributes:i=c4e,defaultAttributes:a={},selfClosing:o=!1,allowedAttributes:l}=n,u=t||e,d=f=>{if(!l)return f;const p={};return l.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in f){const v=f[g];if(y!==void 0&&v===y)return;p[g]=v}}),p},h=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...a,...f.attributes};if(o)return p.createNode(e,m);const g=r?r(f):f.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=o?new RegExp(`\\[${h}\\s*[^\\]]*\\]`):new RegExp(`\\[${h}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${h}\\]`),m=f.match(p),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(f,p,m){const g=o?new RegExp(`^\\[${h}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${h}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${h}\\]`),y=f.match(g);if(!y)return;let v="",x="";if(o){const[,E]=y;x=E}else{const[,E,S]=y;x=E,v=S||""}const b=s(x.trim());return{type:e,raw:y[0],content:v.trim(),attributes:b}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const m=d(f.attrs||{}),g=i(m),y=g?` ${g}`:"";return o?`[${u}${y}]`:`[${u}${y}]${p}[/${u}]`}}
904}function kI(n,e,t){var r,s,i,a;const o=n.split(`
905`),l=[];let u="",d=0;const h=e.baseIndentSize||2;for(;d<o.length;){const f=o[d],p=f.match(e.itemPattern);if(!p){if(l.length>0)break;if(f.trim()===""){d+=1,u=`${u}${f}
906`;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:y}=m;u=`${u}${f}
907`;const v=[y];for(d+=1;d<o.length;){const S=o[d];if(S.trim()===""){const C=o.slice(d+1).findIndex(j=>j.trim()!=="");if(C===-1)break;if((((s=(r=o[d+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){v.push(S),u=`${u}${S}
908`,d+=1;continue}else break}if((((a=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:a.length)||0)>g)v.push(S),u=`${u}${S}
909`,d+=1;else break}let x;const b=v.slice(1);if(b.length>0){const S=b.map(k=>k.slice(g+h)).join(`
910`);S.trim()&&(e.customNestedParser?x=e.customNestedParser(S):x=t.blockTokens(S))}const E=e.createToken(m,x);l.push(E)}if(l.length!==0)return{items:l,raw:u}}function Q5(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const s=typeof t=="function"?t(r):t,[i,...a]=n.content,o=e.renderChildren([i]),l=[`${s}${o}`];return a&&a.length>0&&a.forEach(u=>{const d=e.renderChildren([u]);if(d){const h=d.split(`
911`).map(f=>f?e.indent(f):"").join(`
912`);l.push(h)}}),l.join(`
913`)}function d4e(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,a=n;s.descendants((o,l)=>{const u=i.mapping.map(l),d=i.mapping.map(l)+o.nodeSize;let h=null;if(o.marks.forEach(p=>{if(p!==a)return!1;h=p}),!h)return;let f=!1;if(Object.keys(t).forEach(p=>{t[p]!==h.attrs[p]&&(f=!0)}),f){const p=n.type.create({...n.attrs,...t});i.removeMark(u,d,n.type),i.addMark(u,d,p)}}),i.docChanged&&e.view.dispatch(i)}var oo=class fse extends X5{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new fse(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function ug(n){return new GLe({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=Dn(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:a}=e,o=r[r.length-1],l=r[0];let u=t.to;if(o){const d=l.search(/\S/),h=t.from+l.indexOf(o),f=h+o.length;if(Y5(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>h).length)return null;f<t.to&&a.delete(f,t.to),h>t.from&&a.delete(t.from+d,h),u=t.from+d+o.length,a.addMark(t.from+d,u,n.type.create(i||{})),a.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:h4e,getOwnPropertySymbols:f4e}=Object,{hasOwnProperty:p4e}=Object.prototype;function FP(n,e){return function(r,s,i){return n(r,s,i)&&e(r,s,i)}}function vk(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:i}=s,a=i.get(t),o=i.get(r);if(a&&o)return a===r&&o===t;i.set(t,r),i.set(r,t);const l=n(t,r,s);return i.delete(t),i.delete(r),l}}function m4e(n){return n!=null?n[Symbol.toStringTag]:void 0}function AH(n){return h4e(n).concat(f4e(n))}const g4e=Object.hasOwn||((n,e)=>p4e.call(n,e));function Pg(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const v4e="__v",y4e="__o",x4e="_owner",{getOwnPropertyDescriptor:NH,keys:TH}=Object;function b4e(n,e){return n.byteLength===e.byteLength&&EA(new Uint8Array(n),new Uint8Array(e))}function w4e(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function _4e(n,e){return n.byteLength===e.byteLength&&EA(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function S4e(n,e){return Pg(n.getTime(),e.getTime())}function E4e(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function k4e(n,e){return n===e}function jH(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.entries();let a,o,l=0;for(;(a=i.next())&&!a.done;){const u=e.entries();let d=!1,h=0;for(;(o=u.next())&&!o.done;){if(s[h]){h++;continue}const f=a.value,p=o.value;if(t.equals(f[0],p[0],l,h,n,e,t)&&t.equals(f[1],p[1],f[0],p[0],n,e,t)){d=s[h]=!0;break}h++}if(!d)return!1;l++}return!0}const C4e=Pg;function A4e(n,e,t){const r=TH(n);let s=r.length;if(TH(e).length!==s)return!1;for(;s-- >0;)if(!pse(n,e,t,r[s]))return!1;return!0}function lb(n,e,t){const r=AH(n);let s=r.length;if(AH(e).length!==s)return!1;let i,a,o;for(;s-- >0;)if(i=r[s],!pse(n,e,t,i)||(a=NH(n,i),o=NH(e,i),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function N4e(n,e){return Pg(n.valueOf(),e.valueOf())}function T4e(n,e){return n.source===e.source&&n.flags===e.flags}function RH(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.values();let a,o;for(;(a=i.next())&&!a.done;){const l=e.values();let u=!1,d=0;for(;(o=l.next())&&!o.done;
913){if(!s[d]&&t.equals(a.value,o.value,a.value,o.value,n,e,t)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function EA(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function j4e(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function pse(n,e,t,r){return(r===x4e||r===y4e||r===v4e)&&(n.$$typeof||e.$$typeof)?!0:g4e(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const R4e="[object ArrayBuffer]",P4e="[object Arguments]",D4e="[object Boolean]",O4e="[object DataView]",M4e="[object Date]",I4e="[object Error]",L4e="[object Map]",F4e="[object Number]",B4e="[object Object]",z4e="[object RegExp]",$4e="[object Set]",U4e="[object String]",V4e={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},H4e="[object URL]",W4e=Object.prototype.toString;function q4e({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(y,v,x){if(y===v)return!0;if(y==null||v==null)return!1;const b=typeof y;if(b!==typeof v)return!1;if(b!=="object")return b==="number"?o(y,v,x):b==="function"?i(y,v,x):!1;const E=y.constructor;if(E!==v.constructor)return!1;if(E===Object)return l(y,v,x);if(Array.isArray(y))return e(y,v,x);if(E===Date)return r(y,v,x);if(E===RegExp)return d(y,v,x);if(E===Map)return a(y,v,x);if(E===Set)return h(y,v,x);const S=W4e.call(y);if(S===M4e)return r(y,v,x);if(S===z4e)return d(y,v,x);if(S===L4e)return a(y,v,x);if(S===$4e)return h(y,v,x);if(S===B4e)return typeof y.then!="function"&&typeof v.then!="function"&&l(y,v,x);if(S===H4e)return p(y,v,x);if(S===I4e)return s(y,v,x);if(S===P4e)return l(y,v,x);if(V4e[S])return f(y,v,x);if(S===R4e)return n(y,v,x);if(S===O4e)return t(y,v,x);if(S===D4e||S===F4e||S===U4e)return u(y,v,x);if(m){let k=m[S];if(!k){const C=m4e(y);C&&(k=m[C])}if(k)return k(y,v,x)}return!1}}function G4e({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:b4e,areArraysEqual:t?lb:w4e,areDataViewsEqual:_4e,areDatesEqual:S4e,areErrorsEqual:E4e,areFunctionsEqual:k4e,areMapsEqual:t?FP(jH,lb):jH,areNumbersEqual:C4e,areObjectsEqual:t?lb:A4e,arePrimitiveWrappersEqual:N4e,areRegExpsEqual:T4e,areSetsEqual:t?FP(RH,lb):RH,areTypedArraysEqual:t?FP(EA,lb):EA,areUrlsEqual:j4e,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=vk(r.areArraysEqual),i=vk(r.areMapsEqual),a=vk(r.areObjectsEqual),o=vk(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:a,areSetsEqual:o})}return r}function K4e(n){return function(e,t,r,s,i,a,o){return n(e,t,o)}}function Y4e({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(o,l){const{cache:u=n?new WeakMap:void 0,meta:d}=t();return e(o,l,{cache:u,equals:r,meta:d,strict:s})};if(n)return function(o,l){return e(o,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(o,l){return e(o,l,i)}}const X4e=$f();$f({strict:!0});$f({circular:!0});$f({circular:!0,strict:!0});$f({createInternalComparator:()=>Pg});$f({strict:!0,createInternalComparator:()=>Pg});$f({circular:!0,createInternalComparator:()=>Pg});$f({circular:!0,createInternalComparator:()=>Pg,strict:!0});function $f(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,i=G4e(n),a=q4e(i),o=t?t(a):K4e(a);return Y4e({circular:e,comparator:a,createState:r,equals:o,strict:s})}var mse={exports:{}},gse={};/**
914 * @license React
915 * use-sync-external-store-shim/with-selector.production.js
916 *
917 * Copyright (c) Meta Platforms, Inc. and affiliates.
918 *
919 * This source code is licensed under the MIT license found in the
920 * LICENSE file in the root directory of this source tree.
921 */var fj=_,Z4e=UT;function J4e(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Q4e=typeof Object.is=="function"?Object.is:J4e,eFe=Z4e.useSyncExternalStore,tFe=fj.useRef,nFe=fj.useEffect,rFe=fj.useMemo,sFe=fj.useDebugValue;gse.useSyncExternalStoreWithSelector=function(n,e,t,r,s){var i=tFe(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=rFe(function(){function l(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return h=m}return h=p}if(m=h,Q4e(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,h=g)}var u=!1,d,h,f=t===void 0?null:t;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,t,r,s]);var o=eFe(n,i[0],i[1]);return nFe(function(){a.hasValue=!0,a.value=o},[o]),sFe(o),o};mse.exports=gse;var iFe=mse.exports,aFe=(...n)=>e=>
921{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},oFe=({contentComponent:n})=>{const e=UT.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return c.jsx(c.Fragment,{children:Object.values(e)})};function lFe(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:uF.createPortal(r.reactElement,r.element,t)},n.forEach(s=>s())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(s=>s())}}}var cFe=class extends Oe.Component{constructor(n){var e;super(n),this.editorContentRef=Oe.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=n.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&((n=e.view.dom)!=null&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=lFe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:aFe(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&c.jsx(oFe,{contentComponent:n.contentComponent})]})}},uFe=_.forwardRef((n,e)=>{const t=Oe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return Oe.createElement(cFe,{key:t,innerRef:e,...n})}),dFe=Oe.memo(uFe),hFe=typeof window<"u"?_.useLayoutEffect:_.useEffect,fFe=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function pFe(n){var e;const[t]=_.useState(()=>new fFe(n.editor)),r=iFe.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:X4e);return hFe(()=>t.watch(n.editor),[n.editor,t]),_.useDebugValue(r),r}var mFe=!1,CI=typeof window>"u",gFe=CI||!!(typeof window<"u"&&window.next),vFe=class vse{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return CI||gFe?null:this.createEditor();if(this.options.current.immediatelyRender&&CI&&mFe)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)}
921,onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new n4e(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((s,i)=>{var a;return s===((a=t.extensions)==null?void 0:a[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?vse.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function yFe(n={},e=[]){const t=_.useRef(n);t.current=n;const[r]=_.useState(()=>new vFe(t)),s=UT.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(s),_.useEffect(r.onRender(e)),pFe({editor:s,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&i===0?0:i+1}),s}var xFe=_.createContext({editor:null});xFe.Consumer;var bFe=_.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),wFe=()=>_.useContext(bFe);Oe.forwardRef((n,e)=>{const{onDragStart:t}=wFe(),r=n.as||"div";return c.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});Oe.createContext({markViewContentRef:()=>{}});var kA=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},_Fe=/^\s*>\s$/,SFe=oo.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return kA("blockquote",{...rs(this.options.HTMLAttributes,n),children:kA("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(s=>{const o=e.renderChildren([s]).split(`
922`).map(l=>l.trim()===""?t:`${t} ${l}`);r.push(o.join(`
923`))}),r.join(`
924${t}
925`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[s0({find:_Fe,type:this.type})]}}),EFe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,kFe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,CFe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,AFe=/(?
vendor: 4,761 bytes, lines 925-936
925:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,NFe=Rg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return kA("strong",{...rs(this.options.HTMLAttributes,n),children:kA("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[r0({find:EFe,type:this.type}),r0({find:CFe,type:this.type})]},addPasteRules(){return[ug({find:kFe,type:this.type}),ug({find:AFe,type:this.type})]}}),TFe=/(^|[^`])`([^`]+)`(?!`)$/,jFe=/(^|[^`])`([^`]+)`(?!`)/g,RFe=Rg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",rs(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[r0({find:TFe,type:this.type})]},addPasteRules(){return[ug({find:jFe,type:this.type})]}}),BP=4,PFe=/^```([a-z]+)?[\s\n]$/,DFe=/^~~~([a-z]+)?[\s\n]$/,OFe=oo.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:BP,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(a=>a.startsWith(t)).map(a=>a.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",rs(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(`
926`):r=`\`\`\`${s}
927
928\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:BP,{state:r}=n,{selection:s}=r,{$from:i,empty:a}=s;if(i.parent.type!==this.type)return!1;const o=" ".repeat(t);return a?n.commands.insertContent(o):n.commands.command(({tr:l})=>{const{from:u,to:d}=s,p=r.doc.textBetween(u,d,`
929`,`
930`).split(`
931`).map(m=>o+m).join(`
932`);return l.replaceWith(u,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:BP,{state:r}=n,{selection:s}=r,{$from:i,empty:a}=s;return i.parent.type!==this.type?!1:a?n.commands.command(({tr:o})=>{var l;const{pos:u}=i,d=i.start(),h=i.end(),p=r.doc.textBetween(d,h,`
933`,`
934`).split(`
935`);let m=0,g=0;const y=u-d;for(let k=0;k<p.length;k+=1){if(g+p[k].length>=y){m=k;break}g+=p[k].length+1}const x=((l=p[m].match(/^ */))==null?void 0:l[0])||"",b=Math.min(x.length,t);if(b===0)return!0;let E=d;for(let k=0;k<m;k+=1)E+=p[k].length+1;return o.delete(E,E+b),u-E<=b&&o.setSelection(zt.create(o.doc,E)),!0}):n.commands.command(({tr:o})=>{const{from:l,to:u}=s,f=r.doc.textBetween(l,u,`
936`,`
937`).split(`
938`).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return p.slice(y)}).join(`
939`);return o.replaceWith(l,u,r.schema.text(f)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
940
941`);return!i||!a?!1:n.chain().command(({tr:o})=>(o.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const o=s.after();return o===void 0?!1:r.nodeAt(o)?n.commands.command(({tr:u})=>(u.setSelection(Jt.near(r.resolve(o))),!0)):n.commands.exitCode()}}},addInputRules(){return[EI({find:PFe,type:this.type,getAttributes:n=>({language:n[1]})}),EI({find:DFe,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new yr({key:new ws("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!t||!i)return!1;const{tr:a,schema:o}=n.state,l=o.text(t.replace(/\r\n?/g,`
942`));return a.replaceSelectionWith(this.type.create({language:i},l)),a.selection.$from.parent.type!==this.type&&a.setSelection(zt.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),n.dispatch(a),!0}}})]}}),MFe=oo.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
943
944`):""}),IFe=oo.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",rs(this.options.HTMLAttributes,n)]},renderText(){return`
945`},renderMarkdown:()=>`  
946`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&l&&a){const h=l.filter(f=>o.includes(f.type.name));u.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),LFe=oo.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,rs(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>EI({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}}
946)\\s$`),type:this.type,getAttributes:{level:n}}))}}),FFe=oo.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",rs(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!s4e(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Xre(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:a,dispatch:o})=>{if(o){const{$to:l}=a.selection,u=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?a.setSelection(zt.create(a.doc,l.pos+1)):l.nodeAfter.isBlock?a.setSelection(Tt.create(a.doc,l.pos)):a.setSelection(zt.create(a.doc,l.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,h=d==null?void 0:d.create();h&&(a.insert(u,h),a.setSelection(zt.create(a.doc,u+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[r4e({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 4,463 bytes, line 946
946ype})]}}),BFe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zFe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,$Fe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,UFe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,VFe=Rg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",rs(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r0({find:BFe,type:this.type}),r0({find:$Fe,type:this.type})]},addPasteRules(){return[ug({find:zFe,type:this.type}),ug({find:UFe,type:this.type})]}});const HFe="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
946ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",WFe="ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
946ºÐ´2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3Õ°Õ¡Õµ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1ì»´2삼성2한국2",AI="numeric",NI="ascii",TI="alpha",Rw="asciinumeric",Bb="alphanumeric",jI="domain",yse="emoji",qFe="scheme",GFe="slashscheme",zP="whitespace";function KFe(n,e){return n in e||(e[n]=[]),e[n]}function kp(n,e,t){e[AI]&&(e[Rw]=!0,e[Bb]=!0),e[NI]&&(e[Rw]=!0,e[TI]=!0),e[Rw]&&(e[Bb]=!0),e[TI]&&(e[Bb]=!0),e[Bb]&&(e[jI]=!0),e[yse]&&(e[jI]=!0);for(const r in e){const s=KFe(r,t);s.indexOf(n)<0&&s.push(n)}}function YFe(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ga(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}ga.groups={};ga.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||ga.groups;let s;return e&&e.j?s=e:(s=new ga(e),t&&r&&kp(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let a=0;a<i-1;a++)s=s.tt(n[a]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||ga.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const i=e;let a,o=s.go(n);if(o?(a=new ga,Object.assign(a.j,o.j),a.jr.push.apply(a.jr,o.jr),a.jd=o.jd,a.t=o.t):a=new ga,i){if(r)if(a.t&&typeof a.t=="string"){const l=Object.assign(YFe(a.t,r),t);kp(i,l,r)}else t&&kp(i,t,r);a.t=i}return s.j[n]=a,a}};const Xt=(n,e,t,r,s)=>n.ta(e,t,r,s),br=(n,e,t,r,s)=>n.tr(e,t,r,s),PH=(n,e,t,r,s)=>n.ts(e,t,r,s),He=(n,e,t,r,s)=>n.tt(e,t,r,s),lu="WORD",RI="UWORD",xse="ASCIINUMERICAL",bse="ALPHANUMERICAL",$1="LOCALHOST",PI="TLD",DI="UTLD",fC="SCHEME",pv="SLASH_SCHEME",eB="NUM",OI="WS",tB="NL",Pw="OPENBRACE",Dw="CLOSEBRACE",CA="OPENBRACKET",AA="CLOSEBRACKET",NA="OPENPAREN",TA="CLOSEPAREN",jA="OPENANGLEBRACKET",RA="CLOSEANGLEBRACKET",PA="FULLWIDTHLEFTPAREN",DA="FULLWIDTHRIGHTPAREN",OA="LEFTCORNERBRACKET",MA="RIGHTCORNERBRACKET",IA="LEFTWHITECORNERBRACKET",LA="RIGHTWHITECORNERBRACKET",FA="FULLWIDTHLESSTHAN",BA="FULLWIDTHGREATERTHAN",zA="AMPERSAND",$A="APOSTROPHE",UA="ASTERISK",qd="AT",VA="BACKSLASH",HA="BACKTICK",WA="CARET",Jd="COLON",nB="COMMA",qA="DOLLAR",oc="DOT",GA="EQUALS",rB="EXCLAMATION",mo="HYPHEN",Ow="PERCENT",KA="PIPE",YA="PLUS",XA="POUND",Mw="QUERY",sB="QUOTE",wse="FULLWIDTHMIDDLEDOT",iB="SEMI",lc="SLASH",Iw="TILDE",ZA="UNDERSCORE",_se="EMOJI",JA="SYM";var Sse=Object.freeze({__proto__:null,ALPHANUMERICAL:bse,AMPERSAND:zA,APOSTROPHE:$A,ASCIINUMERICAL:xse,ASTERISK:UA,AT:qd,BACKSLASH:VA,BACKTICK:HA,CARET:WA,CLOSEANGLEBRACKET:RA,CLOSEBRACE:Dw,CLOSEBRACKET:AA,CLOSEPAREN:TA,COLON:Jd,COMMA:nB,DOLLAR:qA,DOT:oc,EMOJI:_se,EQUALS:GA,EXCLAMATION:rB,FULLWIDTHGREATERTHAN:BA,FULLWIDTHLEFTPAREN:PA,FULLWIDTHLESSTHAN:FA,FULLWIDTHMIDDLEDOT:wse,FULLWIDTHRIGHTPAREN:DA,HYPHEN:mo,LEFTCORNERBRACKET:OA,LEFTWHITECORNERBRACKET:IA,LOCALHOST:$1,NL:tB,NUM:eB,OPENANGLEBRACKET:jA,OPENBRACE:Pw,OPENBRACKET:CA,OPENPAREN:NA,PERCENT:Ow,PIPE:KA,PLUS:YA,POUND:XA,QUERY:Mw,QUOTE:sB,RIGHTCORNERBRACKET:MA,RIGHTWHITECORNERBRACKET:LA,SCHEME:fC,SEMI:iB,SLASH:lc,SLASH_SCHEME:pv,SYM:JA,TILDE:Iw,TLD:PI,UNDERSCORE:ZA,UTLD:DI,UWORD:RI,WORD:lu,WS:OI});
vendor: 11,892 bytes, lines 946-950
946const nu=/[a-z]/,cb=new RegExp("\\p{L}","u"),$P=new RegExp("\\p{Emoji}","u"),ru=/\d/,UP=/\s/,DH="\r",VP=`
947`,XFe="️",ZFe="‍",HP="";let yk=null,xk=null;function JFe(n=[]){const e={};ga.groups=e;const t=new ga;yk==null&&(yk=OH(HFe)),xk==null&&(xk=OH(WFe)),He(t,"'",$A),He(t,"{",Pw),He(t,"}",Dw),He(t,"[",CA),He(t,"]",AA),He(t,"(",NA),He(t,")",TA),He(t,"<",jA),He(t,">",RA),He(t,"(",PA),He(t,")",DA),He(t,"「",OA),He(t,"」",MA),He(t,"『",IA),He(t,"』",LA),He(t,"<",FA),He(t,">",BA),He(t,"&",zA),He(t,"*",UA),He(t,"@",qd),He(t,"`",HA),He(t,"^",WA),He(t,":",Jd),He(t,",",nB),He(t,"$",qA),He(t,".",oc),He(t,"=",GA),He(t,"!",rB),He(t,"-",mo),He(t,"%",Ow),He(t,"|",KA),He(t,"+",YA),He(t,"#",XA),He(t,"?",Mw),He(t,'"',sB),He(t,"/",lc),He(t,";",iB),He(t,"~",Iw),He(t,"_",ZA),He(t,"\\",VA),He(t,"・",wse);const r=br(t,ru,eB,{[AI]:!0});br(r,ru,r);const s=br(r,nu,xse,{[Rw]:!0}),i=br(r,cb,bse,{[Bb]:!0}),a=br(t,nu,lu,{[NI]:!0});br(a,ru,s),br(a,nu,a),br(s,ru,s),br(s,nu,s);const o=br(t,cb,RI,{[TI]:!0});br(o,nu),br(o,ru,i),br(o,cb,o),br(i,ru,i),br(i,nu),br(i,cb,i);const l=He(t,VP,tB,{[zP]:!0}),u=He(t,DH,OI,{[zP]:!0}),d=br(t,UP,OI,{[zP]:!0});He(t,HP,d),He(u,VP,l),He(u,HP,d),br(u,UP,d),He(d,DH),He(d,VP),br(d,UP,d),He(d,HP,d);const h=br(t,$P,_se,{[yse]:!0});He(h,"#"),br(h,$P,h),He(h,XFe,h);const f=He(h,ZFe);He(f,"#"),br(f,$P,h);const p=[[nu,a],[ru,s]],m=[[nu,null],[cb,o],[ru,i]];for(let g=0;g<yk.length;g++)Pd(t,yk[g],PI,lu,p);for(let g=0;g<xk.length;g++)Pd(t,xk[g],DI,RI,m);kp(PI,{tld:!0,ascii:!0},e),kp(DI,{utld:!0,alpha:!0},e),Pd(t,"file",fC,lu,p),Pd(t,"mailto",fC,lu,p),Pd(t,"http",pv,lu,p),Pd(t,"https",pv,lu,p),Pd(t,"ftp",pv,lu,p),Pd(t,"ftps",pv,lu,p),kp(fC,{scheme:!0,ascii:!0},e),kp(pv,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],x=n[g][1]?{[qFe]:!0}:{[GFe]:!0};y.indexOf("-")>=0?x[jI]=!0:nu.test(y)?ru.test(y)?x[Rw]=!0:x[NI]=!0:x[AI]=!0,PH(t,y,y,x)}return PH(t,"localhost",$1,{ascii:!0}),t.jd=new ga(JA),{start:t,tokens:Object.assign({groups:e},Sse)}}function Ese(n,e){const t=QFe(e.replace(/[A-Z]/g,o=>o.toLowerCase())),r=t.length,s=[];let i=0,a=0;for(;a<r;){let o=n,l=null,u=0,d=null,h=-1,f=-1;for(;a<r&&(l=o.go(t[a]));)o=l,o.accepts()?(h=0,f=0,d=o):h>=0&&(h+=t[a].length,f++),u+=t[a].length,i+=t[a].length,a++;i-=h,a-=f,u-=h,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function QFe(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,a=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Pd(n,e,t,r,s){let i;const a=e.length;for(let o=0;o<a-1;o++){const l=e[o];n.j[l]?i=n.j[l]:(i=new ga(r),i.jr=s.slice(),n.j[l]=i),n=i}return i=new ga(t),i.jr=s.slice(),n.j[e[a-1]]=i,i}function OH(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+i),10);a>0;a--)t.pop();r+=i}else t.push(n[r]),r++}return e}const U1={defaultProtocol:"http",events:null,format:MH,formatHref:MH,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function aB(n,e=null){let t=Object.assign({},U1);n&&(t=Object.assign(t,n instanceof aB?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}aB.prototype={o:U1,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:U1[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function MH(n){return n}function kse(n,e){this.t="token",this.v=n,this.tk=e}kse.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=U1.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),a={},o=n.get("className",t,e),l=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),h=n.getObj("events",t,e);return a.href=r,o&&(a.class=o),l&&(a.target=l),u&&(a.rel=u),d&&Object.assign(a,d),{tagName:s,attributes:a,content:i,eventListeners:h}}};function pj(n,e){class t extends kse{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const IH=pj("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),LH=pj("text"),e3e=pj("nl"),bk=pj("url",{isLink:!0,toHref(n=U1.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==$1&&n[1].t===Jd}}),uo=n=>new ga(n);function t3e({groups:n}){const e=n.domain.concat([zA,UA,qd,VA,HA,WA,qA,GA,mo,eB,Ow,KA,YA,XA,lc,JA,Iw,ZA]),t=[$A,Jd,nB,oc,rB,Ow,Mw,sB,iB,jA,RA,Pw,Dw,AA,CA,NA,TA,PA,DA,OA,MA,IA,LA,FA,BA],r=[zA,$A,UA,VA,HA,WA,qA,GA,mo,Pw,Dw,Ow,KA,YA,XA,Mw,lc,JA,Iw,ZA],s=uo(),i=He(s,Iw);Xt(i,r,i),Xt(i,n.domain,i);const a=uo(),o=uo(),l=uo();Xt(s,n.domain,a),Xt(s,n.scheme,o),Xt(s,n.slashscheme,l),Xt(a,r,i),Xt(a,n.domain,a);const u=He(a,qd);He(i,qd,u),He(o,qd,u),He(l,qd,u);const d=He(i,oc);Xt(d,r,i),Xt(d,n.domain,i);const h=uo();Xt(u,n.domain,h),Xt(h,n.domain,h);const f=He(h,oc);Xt(f,n.domain,h);const p=uo(IH);Xt(f,n.tld,p),Xt(f,n.utld,p),He(u,$1,p);const m=He(h,mo);He(m,mo,m),Xt(m,n.domain,h),Xt(p,n.domain,h),He(p,oc,f),He(p,mo,m);const g=He(p,Jd);Xt(g,n.numeric,IH);const y=He(a,mo),v=He(a,oc);He(y,mo,y),Xt(y,n.domain,a),Xt(v,r,i),Xt(v,n.domain,a);const x=uo(bk);Xt(v,n.tld,x),Xt(v,n.utld,x),Xt(x,n.domain,a),Xt(x,r,i),He(x,oc,v),He(x,mo,y),He(x,qd,u);const b=He(x,Jd),E=uo(bk);Xt(b,n.numeric,E);const S=uo(bk),k=uo();Xt(S,e,S),Xt(S,t,k),Xt(k,e,S),Xt(k,t,k),He(x,lc,S),He(E,lc,S);const C=He(o,Jd),A=He(l,Jd),T=He(A,lc),j=He(T,lc);Xt(o,n.domain,a),He(o,oc,v),He(o,mo,y),Xt(l,n.domain,a),He(l,oc,v),He(l,mo,y),Xt(C,n.domain,S),He(C,lc,S),He(C,Mw,S),Xt(j,n.domain,S),Xt(j,e,S),He(j,lc,S);const D=[[Pw,Dw],[CA,AA],[NA,TA],[jA,RA],[PA,DA],[OA,MA],[IA,LA],[FA,BA]];for(let R=0;R<D.length;R++){const[M,N]=D[R],U=He(S,M);He(k,M,U),He(U,N,S);const q=uo(bk);Xt(U,e,q);const I=uo();Xt(U,t),Xt(q,e,q),Xt(q,t,I),Xt(I,e,q),Xt(I,t,I),He(q,N,S),He(I,N,S)}return He(s,$1,x),He(s,tB,e3e),{start:s,tokens:Sse}}function n3e(n,e,t){let r=t.length,s=0,i=[],a=[];for(;s<r;){let o=n,l=null,u=null,d=0,h=null,f=-1;for(;s<r&&!(l=o.go(t[s].t));)a.push(t[s++]);for(;s<r&&(u=l||o.go(t[s].t));)l=null,o=u,o.accepts()?(f=0,h=o):f>=0&&f++,s++,d++;if(f<0)s-=d,s<r&&(a.push(t[s]),s++);else{a.length>0&&(i.push(WP(LH,e,a)),a=[]),s-=f,d-=f;const p=h.t,m=t.slice(s-d,s);i.push(WP(p,e,m))}}return a.length>0&&i.push(WP(LH,e,a)),i}function WP(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const r3e=typeof console<"u"&&console&&console.warn||(()=>{}),s3e="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Jn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function i3e(){return ga.groups={},Jn.scanner=null,Jn.parser=null,Jn.tokenQueue=[],Jn.pluginQueue=[],Jn.customSchemes=[],Jn.initialized=!1,Jn}function FH(n,e=!1){if(Jn.initialized&&r3e(`linkifyjs: already initialized - will not register custom scheme "${n}" ${s3e}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
9481. Must only contain digits, lowercase ASCII letters or "-"
9492. Cannot start or end with "-"
9503. "-" cannot repeat`);Jn.customSchemes.push([n,e])}function a3e(){Jn.scanner=JFe(Jn.customSchemes);for(let n=0;n<Jn.tokenQueue.length;n++)Jn.tokenQueue[n][1]({scanner:Jn.scanner});Jn.parser=t3e(Jn.scanner.tokens);for(let n=0;n<Jn.pluginQueue.length;n++)Jn.pluginQueue[n][1]({scanner:Jn.scanner,parser:Jn.parser});return Jn.initialized=!0,Jn}function oB(n){return Jn.initialized||a3e(),n3e(Jn.parser.start,n,Ese(Jn.scanner.start,n))}oB.scan=Ese;function Cse(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new aB(t),s=oB(n),i=[];for(let a=0;a<s.length;a++){const o=s[a];o.isLink&&(!e||o.t===e)&&r.check(o)&&i.push(o.toFormattedObject(r))}return i}var lB="[\0-   ᠎ -\u2029  ]",o3e=new RegExp(lB),l3e=new RegExp(`${lB}$`),c3e=new RegExp(lB,"g");function u3e(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function d3e(n){return new yr({key:new ws("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!s||i)return;const{tr:a}=r,o=Ure(t.doc,[...e]);if(Yre(o).forEach(({newRange:u})=>{const d=sLe(r.doc,u,p=>p.isTextblock);let h,f;if(d.length>1)h=d[0],f=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(u.from,u.to," "," ");if(!l3e.test(p))return;h=d[0],f=r.doc.textBetween(h.pos,u.to,void 0," ")}if(h&&f){const p=f.split(o3e).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=h.pos+f.lastIndexOf(m);if(!m)return!1;const y=oB(m).map(v=>v.toObject(n.defaultProtocol));if(!u3e(y))return!1;y.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>n.validate(v.value)).filter(v=>n.shouldAutoLink(v.value)).forEach(v=>{Y5(v.from,v.to,r.doc).some(x=>x.mark.type===n.type)||a.addMark(v.from,v.to,n.type.create({href:v.href}))})}}),!!a.steps.length)return a}})}function h3e(n){return new yr({key:new ws("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let h=r.target;const f=[];for(;h.nodeName!=="DIV";)f.push(h),h=h.parentNode;o=f.find(p=>p.nodeName==="A")}if(!o)return a;const l=Kre(e.state,n.type.name),u=(s=o==null?void 0:o.href)!=null?s:l.href,d=(i=o==null?void 0:o.target)!=null?i:l.target;o&&u&&(window.open(u,d),a=!0)}return a}}})}function f3e(n){return new yr({key:new ws("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:a}=i,{empty:o}=a;if(o)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const u=Cse(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!u||s!==void 0&&!s(u.href)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Yf(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(c3e,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var p3e=Rg.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `val
950idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){FH(n);return}FH(n.scheme,n.optionalSlashes)})},onDestroy(){i3e()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Yf(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Yf(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Yf(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",rs(this.options.HTMLAttributes,n),0]:["a",rs(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Yf(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ug({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=Cse(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!Yf(a,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e}
vendor: 19,342 bytes, lines 950-961
950,type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(d3e({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Yf(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(h3e({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(f3e({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),m3e=Object.defineProperty,g3e=(n,e)=>{for(var t in e)m3e(n,t,{get:e[t],enumerable:!0})},v3e="listItem",BH="textStyle",zH=/^\s*([-+*])\s$/,Ase=oo.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",rs(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
951`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(v3e,this.editor.getAttributes(BH)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=s0({find:zH,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=s0({find:zH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(BH),editor:this.editor})),[n]}}),Nse=oo.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",rs(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(s=>s.type==="paragraph"))t=e.parseChildren(n.tokens);else{const s=n.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(s.tokens)}],n.tokens.length>1){const a=n.tokens.slice(1),o=e.parseChildren(a);t.push(...o)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Q5(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),y3e={};g3e(y3e,{findListItemPos:()=>uE,getNextListDepth:()=>cB,handleBackspace:()=>MI,handleDelete:()=>II,hasListBefore:()=>Tse,hasListItemAfter:()=>x3e,hasListItemBefore:()=>jse,listItemHasSubList:()=>Rse,nextListIsDeeper:()=>Pse,nextListIsHigher:()=>Dse});var uE=(n,e)=>{const{$from:t}=e.selection,r=ns(n,e.schema);let s=null,i=t.depth,a=t.pos,o=null;for(;i>0&&o===null;)s=t.node(i),s.type===r?o=i:(i-=1,a-=1);return o===null?null:{$pos:e.doc.resolve(a),depth:o}},cB=(n,e)=>{const t=uE(n,e);if(!t)return!1;const[,r]=pLe(e,n,t.$pos.pos+4);return r},Tse=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},jse=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},Rse=(n,e,t)=>{if(!t)return!1;const r=ns(n,e.schema);let s=!1;return t.descendants(i=>{i.type===r&&(s=!0)}),s},MI=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!bf(n.state,e)&&Tse(n.state,e,t)){const{$anchor:o}=n.state.selection,l=n.state.doc.resolve(o.before()-1),u=[];l.node().descendants((f,p)=>{f.type.name===e&&u.push({node:f,pos:p})});const d=u.at(-1);if(!d)return!1;const h=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:o.start()-1,to:o.end()+1},h.end()).joinForward().run()}if(!bf(n.state,e)||!yLe(n.state))return!1;const r=uE(e,n.state);if(!r)return!1;const i=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=Rse(e,n.state,i);return jse(e,n.state)&&!a?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Pse=(n,e)=>{const t=cB(n,e),r=uE(n,e);return!r||!t?!1:t>r.depth},Dse=(n,e)=>{const t=cB(n,e),r=uE(n,e);return!r||!t?!1:t<r.depth},II=(n,e)=>{if(!bf(n.state,e)||!vLe(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:Pse(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Dse(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},x3e=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},Ose=Wr.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&II(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&II(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&MI(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&MI(n,t,r)&&(e=!0)}),e}}}}),$H=/^(\s*)(\d+)\.\s+(.*)$/,b3e=/^\s/;function w3e(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match($H);if(!i)break;const[,a,o,l]=i,u=a.length;let d=l,h=t+1;const f=[s];for(;h<n.length;){const p=n[h];if(p.match($H))break;if(p.trim()==="")f.push(p),d+=`
952`,h+=1;else if(p.match(b3e))f.push(p),d+=`
953${p.slice(u+2)}`,h+=1;else break}e.push({indent:u,number:parseInt(o,10),content:d.trim(),raw:f.join(`
954`)}),r=h,t=h}return[e,r]}function Mse(n,e,t){var r;const s=[];let i=0;for(;i<n.length;){const a=n[i];if(a.indent===e){const o=a.content.split(`
955`),l=((r=o[0])==null?void 0:r.trim())||"",u=[];l&&u.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=o.slice(1).join(`
956`).trim();if(d){const p=t.blockTokens(d);u.push(...p)}let h=i+1;const f=[];for(;h<n.length&&n[h].indent>e;)f.push(n[h]),h+=1;if(f.length>0){const p=Math.min(...f.map(g=>g.indent)),m=Mse(f,p,t);u.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(g=>g.raw).join(`
957`)})}s.push({type:"list_item",raw:a.raw,tokens:u}),i=h}else i+=1}return s}function _3e(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var S3e="listItem",UH="textStyle",VH=/^(\d+)\.\s$/,Ise=oo.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",rs(this.options.HTMLAttributes,t),0]:["ol",rs(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?_3e(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
958`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(`
959`),[i,a]=w3e(s);if(i.length===0)return;const o=Mse(i,0,t);return o.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:o,raw:s.slice(0,a).join(`
960`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(S3e,this.editor.getAttributes(UH)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=s0({find:VH,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=s0({find:VH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(UH)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),E3e=/^\s*(\[([( |x])?\])\s$/,Lse=oo.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",rs(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Q5(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),o=document.createElement("input"),l=document.createElement("div"),u=d=>{var h,f;o.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,d,o.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return u(n),i.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",d=>d.preventDefault()),o.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}const{checked:h}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=t();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{s.setAttribute(d,h)}),s.dataset.checked=n.attrs.checked,o.checked=n.attrs.checked,i.append(o,a),s.append(i,l),Object.entries(e).forEach(([d,h])=>{s.setAttribute(d,h)}),{dom:s,contentDOM:l,update:d=>d.type!==this.type?!1:(s.dataset.checked=d.attrs.checked,o.checked=d.attrs.checked,u(d),!0)}}},addInputRules(){return[s0({find:E3e,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Fse=oo.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",rs(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
961`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const a=kI(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:r},t);return a?[{type:"taskList",raw:a.raw,items:a.items}]:t.blockTokens(i)},s=kI(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,a)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:a}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Wr.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Ase.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Nse.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Ose.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Ise.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Lse.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Fse.configure(this.options.taskList)),n}});var k3e=oo.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",rs(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),C3e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,A3e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,N3e=Rg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",rs(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r0({find:C3e,type:this.type})]},addPasteRules(){return[ug({find:A3e,type:this.type})]}}),T3e=oo.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),j3e=Rg.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",rs(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function R3e(n={}){return new yr({view(e){return new P3e(e,n)}})}class P3e{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=a=>{this[s](a)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),a=i.width/s.offsetWidth,o=i.height/s.offsetHeight;if(t){let h=e.nodeBefore,f=e.nodeAfter;if(h||f){let p=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=h?m.bottom:m.top;h&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*o;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*a;
vendor: 3,762 bytes, line 961
961r={left:h.left-f,right:h.left+f,top:h.top,bottom:h.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,d=-pageYOffset;else{let h=l.getBoundingClientRect(),f=h.width/l.offsetWidth,p=h.height/l.offsetHeight;u=h.left-l.scrollLeft*f,d=h.top-l.scrollTop*p}this.element.style.left=(r.left-u)/a+"px",this.element.style.top=(r.top-d)/o+"px",this.element.style.width=(r.right-r.left)/a+"px",this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=Fne(this.editorView.state.doc,a,this.editorView.dragging.slice);o!=null&&(a=o)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Tr extends Jt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Tr.valid(r)?new Tr(r):Jt.near(r)}content(){return ut.empty}eq(e){return e instanceof Tr&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Tr(e.resolve(t.pos))}getBookmark(){return new uB(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!D3e(e)||!O3e(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Tr.valid(e))return e;let s=e.pos,i=null;for(let a=e.depth;;a--){let o=e.node(a);if(t>0?e.indexAfter(a)<o.childCount:e.index(a)>0){i=o.child(t>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;s+=t;let l=e.doc.resolve(s);if(Tr.valid(l))return l}for(;;){let a=t>0?i.firstChild:i.lastChild;if(!a){if(i.isAtom&&!i.isText&&!Tt.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=a,s+=t;let o=e.doc.resolve(s);if(Tr.valid(o))return o}return null}}}Tr.prototype.visible=!1;Tr.findFrom=Tr.findGapCursorFrom;Jt.jsonID("gapcursor",Tr);class uB{constructor(e){this.pos=e}map(e){return new uB(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Tr.valid(t)?new Tr(t):Jt.near(t)}}function Bse(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function D3e(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Bse(s.type))return!0;if(s.inlineContent)return!1}}return!0}function O3e(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Bse(s.type))return!0;if(s.inlineContent)return!1}}return!0}function M3e(){return new yr({props:{decorations:B3e,createSelectionBetween(n,e,t){return e.pos==t.pos&&Tr.valid(t)?new Tr(t):null}
vendor: 15,013 bytes, line 961
961,handleClick:L3e,handleKeyDown:I3e,handleDOMEvents:{beforeinput:F3e}}})}const I3e=Ore({ArrowLeft:wk("horiz",-1),ArrowRight:wk("horiz",1),ArrowUp:wk("vert",-1),ArrowDown:wk("vert",1)});function wk(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let a=r.selection,o=e>0?a.$to:a.$from,l=a.empty;if(a instanceof zt){if(!i.endOfTextblock(t)||o.depth==0)return!1;l=!1,o=r.doc.resolve(e>0?o.after():o.before())}let u=Tr.findGapCursorFrom(o,e,l);return u?(s&&s(r.tr.setSelection(new Tr(u))),!0):!1}}function L3e(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Tr.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&Tt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Tr(r))),!0)}function F3e(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Tr))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=Ue.empty;for(let a=r.length-1;a>=0;a--)s=Ue.from(r[a].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new ut(s,0,0));return i.setSelection(zt.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function B3e(n){if(!(n.selection instanceof Tr))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",dr.create(n.doc,[Wi.widget(n.selection.head,e,{key:"gapcursor"})])}var QA=200,Is=function(){};Is.prototype.append=function(e){return e.length?(e=Is.from(e),!this.length&&e||e.length<QA&&this.leafAppend(e)||this.length<QA&&e.leafPrepend(this)||this.appendInner(e)):this};Is.prototype.prepend=function(e){return e.length?Is.from(e).append(this):this};Is.prototype.appendInner=function(e){return new z3e(this,e)};Is.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Is.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Is.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Is.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};Is.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,a){return s.push(e(i,a))},t,r),s};Is.from=function(e){return e instanceof Is?e:e&&e.length?new zse(e):Is.empty};var zse=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,a,o){for(var l=i;l<a;l++)if(s(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,a,o){for(var l=i-1;l>=a;l--)if(s(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=QA)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=QA)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Is);Is.empty=new zse([]);var z3e=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,a){var o=this.left.length;if(s<o&&this.left.forEachInner(r,s,Math.min(i,o),a)===!1||i>o&&this.right.forEachInner(r,Math.max(s-o,0),Math.min(this.length,i)-o,a+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,a){var o=this.left.length;if(s>o&&this.right.forEachInvertedInner(r,s-o,Math.max(i,o)-o,a+o)===!1||i<o&&this.left.forEachInvertedInner(r,Math.min(s,o),i,a)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Is);const $3e=500;class Fl{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let a=e.tr,o,l,u=[],d=[];return this.items.forEach((h,f)=>{if(!h.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,d.push(h);return}if(s){d.push(new cc(h.map));let p=h.step.map(s.slice(i)),m;p&&a.maybeStep(p).doc&&(m=a.mapping.maps[a.mapping.maps.length-1],u.push(new cc(m,void 0,void 0,u.length+d.length))),i--,m&&s.appendMap(m,i)}else a.maybeStep(h.step);if(h.selection)return o=s?h.selection.map(s.slice(i)):h.selection,l=new Fl(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:a,selection:o}}addTransform(e,t,r,s){let i=[],a=this.eventCount,o=this.items,l=!s&&o.length?o.get(o.length-1):null;for(let d=0;d<e.steps.length;d++){let h=e.steps[d].invert(e.docs[d]),f=new cc(e.mapping.maps[d],h,t),p;(p=l&&l.merge(f))&&(f=p,d?i.pop():o=o.slice(0,o.length-1)),i.push(f),t&&(a++,t=void 0),s||(l=f)}let u=a-r.depth;return u>V3e&&(o=U3e(o,u),a-=u),new Fl(o.append(i),a)}remapping(e,t){let r=new One;return this.items.forEach((s,i)=>{let a=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new Fl(this.items.append(e.map(t=>new cc(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,a=e.steps.length,o=this.eventCount;this.items.forEach(f=>{f.selection&&o--},s);let l=t;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;a=Math.min(a,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(i.slice(l+1,p));y&&o++,r.push(new cc(m,g,y))}else r.push(new cc(m))},s);let u=[];for(let f=t;f<a;f++)u.push(new cc(i.maps[f]));let d=this.items.slice(0,s).append(u).append(r),h=new Fl(d,o);return h.emptyItemCount()>$3e&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((a,o)=>{if(o>=e)s.push(a),a.selection&&i++;else if(a.step){let l=a.step.map(t.slice(r)),u=l&&l.getMap();if(r--,u&&t.appendMap(u,r),l){let d=a.selection&&a.selection.map(t.slice(r));d&&i++;let h=new cc(u.invert(),l,d),f,p=s.length-1;(f=s.length&&s[p].merge(h))?s[p]=f:s.push(h)}}else a.map&&r--},this.items.length,0),new Fl(Is.from(s.reverse()),i)}}Fl.empty=new Fl(Is.empty,0);function U3e(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class cc{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new cc(t.getMap().invert(),t,this.selection)}}}class Gd{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const V3e=20;function H3e(n,e,t,r){let s=t.getMeta(zm),i;if(s)return s.historyState;t.getMeta(G3e)&&(n=new Gd(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(zm))return a.getMeta(zm).redo?new Gd(n.done.addTransform(t,void 0,r,pC(e)),n.undone,HH(t.mapping.maps),n.prevTime,n.prevComposition):new Gd(n.done,n.undone.addTransform(t,void 0,r,pC(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let o=t.getMeta("composition"),l=n.prevTime==0||!a&&n.prevComposition!=o&&(n.prevTime<(t.time||0)-r.newGroupDelay||!W3e(t,n.prevRanges)),u=a?qP(n.prevRanges,t.mapping):HH(t.mapping.maps);return new Gd(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,pC(e)),Fl.empty,u,t.time,o??n.prevComposition)}else return(i=t.getMeta("rebased"))?new Gd(n.done.rebased(t,i),n.undone.rebased(t,i),qP(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Gd(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),qP(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function W3e(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function HH(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,a)=>e.push(i,a));return e}function qP(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function q3e(n,e,t){let r=pC(e),s=zm.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let a=i.selection.resolve(i.transform.doc),o=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new Gd(t?o:i.remaining,t?i.remaining:o,null,0,-1);return i.transform.setSelection(a).setMeta(zm,{redo:t,historyState:l})}let GP=!1,WH=null;function pC(n){let e=n.plugins;if(WH!=e){GP=!1,WH=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){GP=!0;break}}return GP}const zm=new ws("history"),G3e=new ws("closeHistory");function K3e(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new yr({key:zm,state:{init(){return new Gd(Fl.empty,Fl.empty,null,0,-1)},apply(e,t,r){return H3e(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Use:r=="historyRedo"?Vse:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function $se(n,e){return(t,r)=>{let s=zm.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=q3e(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Use=$se(!1,!0),Vse=$se(!0,!0);Wr.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new yr({key:new ws("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const a=i-s,o=0,l=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(o,l);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=i-r,u=o-l,d=o;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)}})]}});var Y3e=Wr.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[R3e(this.options)]}});Wr.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new yr({key:new ws("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return dr.create(n,[]);let a=0;this.options.mode==="deepest"&&n.descendants((l,u)=>{if(l.isText)return;if(!(s>=u&&s<=u+l.nodeSize-1))return!1;a+=1});let o=0;return n.descendants((l,u)=>{if(l.isText||!(s>=u&&s<=u+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&a-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";i.push(Wi.node(u,u+l.nodeSize,{class:this.options.className}))}),dr.create(n,i)}}})]}});var X3e=Wr.create({name:"gapCursor",addProseMirrorPlugins(){return[M3e()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Dn(Et(n,"allowGapCursor",t)))!=null?e:null}}}),Z3e=Wr.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new yr({key:new ws("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const i=this.editor.isEmpty;return n.descendants((a,o)=>{const l=r>=o&&r<=o+a.nodeSize,u=!a.isLeaf&&uj(a);if((l||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const h=Wi.node(o,o+a.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:o,hasAnchor:l}):this.options.placeholder});s.push(h)}return this.options.includeChildren}),dr.create(n,s)}}})]}});Wr.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new yr({key:new ws("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Xre(t.selection)||n.view.dragging?null:dr.create(t.doc,[Wi.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function qH({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var J3e=Wr.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ws(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new yr({key:e,appendTransaction:(s,i,a)=>{const{doc:o,tr:l,schema:u}
961=a,d=e.getState(a),h=o.content.size,f=u.nodes[t];if(d)return l.insert(h,f.create())},state:{init:(s,i)=>{const a=i.tr.doc.lastChild;return!qH({node:a,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const a=s.doc.lastChild;return!qH({node:a,types:r})}}})]}}),Q3e=Wr.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Use(n,e),redo:()=>({state:n,dispatch:e})=>Vse(n,e)}},addProseMirrorPlugins(){return[K3e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),e5e=Wr.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(NFe.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(SFe.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Ase.configure(this.options.bulletList)),this.options.code!==!1&&s.push(RFe.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(OFe.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(MFe.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(Y3e.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(X3e.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(IFe.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(LFe.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(Q3e.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(FFe.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(VFe.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Nse.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Ose.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(p3e.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Ise.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(k3e.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(N3e.configure(this.options.strike)),this.options.text!==!1&&s.push(T3e.configure(this.options.text)),this.options.underline!==!1&&s.push(j3e.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(J3e.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),t5e=e5e,n5e=Z3e,r5e=Fse,s5e=Lse,Hse="Toggle",Wse=_.forwardRef((n,e)=>{const{pressed:t,defaultPressed:r,onPressedChange:s,...i}=n,[a,o]=Zi({prop:t,onChange:s,defaultProp:r??!1,caller:Hse});return c.jsx(st.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":n.disabled?"":void 0,...i,ref:e,onClick:$e(n.onClick,()=>{n.disabled||o(!a)})})});Wse.displayName=Hse;var qse=Wse;const i5e=Sg("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"}}),ic=_.forwardRef(({className:n,variant:e,size:t,...r},s)=>c.jsx(qse,{ref:s,className:ke(i5e({variant:e,size:t,className:n})),...r}));ic.displayName=qse.displayName;function mj({content:n,onChange:e,placeholder:t="Start writing...",editable:r=!0,className:s}){const i=yFe({extensions:[t5e.configure({heading:{levels:[1,2]}}),n5e.configure({placeholder:t}),r5e,s5e.configure({nested:!0})],content:n,editable:r,onUpdate:({editor:a})=>{e(a.getHTML())},editorProps:{attributes:{class:ke("prose prose-sm max-w-none focus:outline-none min-h-[200px] px-3 py-2","prose-headings:font-serif prose-headings:text-foreground prose-headings:font-semibold","prose-h1:text-2xl prose-h1:mt-6 prose-h1:mb-4","prose-h2:text-xl prose-h2:mt-5 prose-h2:mb-3","prose-p:text-foreground prose-p:leading-relaxed","prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground","prose-ul:text-foreground prose-ol:text-foreground","prose-code:bg-muted prose-code:px-1 prose-code:rounded prose-code:text-sm","[&_ul[data-type='taskList']]:list-none [&_ul[data-type='taskList']]:pl-0","[&_ul[data-type='taskList']_li]:flex [&_ul[data-type='taskList']_li]:items-start [&_ul[data-type='taskList']_li]:gap-2")}}});return i?c.jsxs("div",{className:ke("border border-border rounded-md bg-card",s),children:[r&&c.jsx(a5e,{editor:i}),c.jsx(dFe,{editor:i})]}):null}function a5e({editor:n}){return c.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b border-border bg-muted/30",children:[c.jsx(ic,{size:"sm",pressed:n.isActive("bold"),onPressedCh
961ange:()=>n.chain().focus().toggleBold().run(),"aria-label":"Toggle bold",children:c.jsx(jfe,{className:"h-4 w-4"})}),c.jsx(ic,{size:"sm",pressed:n.isActive("italic"),onPressedChange:()=>n.chain().focus().toggleItalic().run(),"aria-label":"Toggle italic",children:c.jsx(Hfe,{className:"h-4 w-4"})}),c.jsx(nf,{orientation:"vertical",className:"h-6 mx-1"}),c.jsx(ic,{size:"sm",pressed:n.isActive("heading",{level:1}),onPressedChange:()=>n.chain().focus().toggleHeading({level:1}).run(),"aria-label":"Toggle heading 1",children:c.jsx(Ufe,{className:"h-4 w-4"})}),c.jsx(ic,{size:"sm",pressed:n.isActive("heading",{level:2}),onPressedChange:()=>n.chain().focus().toggleHeading({level:2}).run(),"aria-label":"Toggle heading 2",children:c.jsx(Vfe,{className:"h-4 w-4"})}),c.jsx(nf,{orientation:"vertical",className:"h-6 mx-1"}),c.jsx(ic,{size:"sm",pressed:n.isActive("bulletList"),onPressedChange:()=>n.chain().focus().toggleBulletList().run(),"aria-label":"Toggle bullet list",children:c.jsx(bF,{className:"h-4 w-4"})}),c.jsx(ic,{size:"sm",pressed:n.isActive("orderedList"),onPressedCh
961ange:()=>n.chain().focus().toggleOrderedList().run(),"aria-label":"Toggle ordered list",children:c.jsx(qfe,{className:"h-4 w-4"})}),c.jsx(ic,{size:"sm",pressed:n.isActive("taskList"),onPressedChange:()=>n.chain().focus().toggleTaskList().run(),"aria-label":"Toggle task list",children:c.jsx(UG,{className:"h-4 w-4"})}),c.jsx(nf,{orientation:"vertical",className:"h-6 mx-1"}),c.jsx(ic,{size:"sm",pressed:n.isActive("blockquote"),onPressedChange:()=>n.chain().focus().toggleBlockquote().run(),"aria-label":"Toggle blockquote",children:c.jsx(ud,{className:"h-4 w-4"})}),c.jsx(ic,{size:"sm",pressed:n.isActive("codeBlock"),onPressedChange:()=>n.chain().focus().toggleCodeBlock().run(),"aria-label":"Toggle code block",children:c.jsx(Dfe,{className:"h-4 w-4"})}),c.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setHorizontalRule().run(),className:"h-8 w-8 p-0",children:c.jsx(Xfe,{className:"h-4 w-4"})}),c.jsx("div",{className:"flex-1"}),c.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>n.chain().focus().undo().run(),disabled:!n.can().undo(),className:"h-8 w-8 p-0",children:c.jsx(ope,{className:"h-4 w-4"})}),c.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>n.chain().focus().redo().run(),disabled:!n.can().redo(),className:"h-8 w-8 p-0",children:c.jsx(epe,{className:"h-4 w-4"})})]})}function i0(n){const e=document.createElement("div");return e.innerHTML=n,e.textContent||e.innerText||""}function o5e(n){const{user:e}=Vt();return pt({queryKey:["generic-note-by-id",n],queryFn:async()=>{var s;if(!n)return null;const{data:t,error:r}=await pe.from("generic_notes").select(`
962          *,
963          folder:note_folders (*)
964        `).eq("id",n).single();if(r)throw r;return{id:t.id,title:t.title,content:t.content,folderId:t.folder_id,folderName:((s=t.folder)==null?void 0:s.name)||null,createdAt:t.created_at,updatedAt:t.updated_at,folder:t.folder?{id:t.folder.id,name:t.folder.name,icon:t.folder.icon,color:t.folder.color,parentFolderId:t.folder.parent_folder_id,createdAt:t.folder.created_at,updatedAt:t.folder.updated_at}:null}},enabled:!!e&&!!n})}function l5e(){const{user:n}=Vt(),e=$n();return kn({mutationFn:async({id:t,title:r,content:s,folderId:i})=>{if(!n)throw new Error("Not authenticated");if(t){const{error:a}=await pe.from("generic_notes").update({title:r,content:s,folder_id:i}).eq("id",t);if(a)throw a;return t}else{const{data:a,error:o}=await pe.from("generic_notes").insert({user_id:n.id,title:r,content:s,folder_id:i}).select().single();if(o)throw o;return a.id}},onSuccess:()=>{e.invalidateQueries({queryKey:["generic-notes"]}),e.invalidateQueries({queryKey:["generic-note-by-id"]}),e.invalidateQueries({queryKey:["all-notes-unified"]})}})}function dB(n){const{user:e}=Vt();return pt({queryKey:["templates",n,e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:r}=await pe.from("templates").select("*").or(`applies_to.eq.${n},applies_to.eq.both`).order("scope",{ascending:!1}).order("title");if(r)throw r;return t},enabled:!!e})}function c5e(){const{user:n}=Vt();return pt({queryKey:["templates","all",n==null?void 0:n.id],queryFn:async()=>{const{data:e,error:t}=await pe.from("templates").select("*").order("scope",{ascending:!1}).order("title");if(t)throw t;return e},enabled:!!n})}function gj(){const{user:n}=Vt();return pt({queryKey:["template-defaults",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:e,error:t}=await pe.from("user_template_defaults").select("*").eq("user_id",n.id);if(t)throw t;return e},enabled:!!n})}function u5e(){const n=$n(),{user:e}=Vt();return kn({mutationFn:async t=>{if(!e)throw new Error("Not authenticated");const{data:r,error:s}=await pe.from("templates").insert({...t,owner_user_id:t.scope==="personal"?e.id:null}).select().single();if(s)throw s;return r},onSuccess:()=>{n.invalidateQueries({queryKey:["templates"]}),Qr({title:"Template created"})},onError:t=>{console.error("Create template error:",t),Qr({title:"Failed to create template",variant:"destructive"})}})}function d5e(){const n=$n();return kn({mutationFn:async({id:e,...t})=>{const{data:r,error:s}=await pe.from("templates").update(t).eq("id",e).select().single();if(s)throw s;return r},onSuccess:()=>{n.invalidateQueries({queryKey:["templates"]}
964),Qr({title:"Template updated"})},onError:e=>{console.error("Update template error:",e),Qr({title:"Failed to update template",variant:"destructive"})}})}function h5e(){const n=$n();return kn({mutationFn:async e=>{const{error:t}=await pe.from("templates").delete().eq("id",e);if(t)throw t},onSuccess:()=>{n.invalidateQueries({queryKey:["templates"]}),Qr({title:"Template deleted"})},onError:e=>{console.error("Delete template error:",e),Qr({title:"Failed to delete template",description:"The template may be locked or you don't have permission.",variant:"destructive"})}})}function f5e(){const n=$n(),{user:e}=Vt();return kn({mutationFn:async({target:t,templateId:r})=>{if(!e)throw new Error("Not authenticated");if(r===null){const{error:s}=await pe.from("user_template_defaults").delete().eq("user_id",e.id).eq("target",t);if(s)throw s}else{const{error:s}=await pe.from("user_template_defaults").upsert({user_id:e.id,target:t,template_id:r},{onConflict:"user_id,target"});if(s)throw s}},onSuccess:()=>{n.invalidateQueries({queryKey:["template-defaults"]}),Qr({title:"Default template updated"})},onError:t=>{console.error("Set default template error:",t),Qr({title:"Failed to set default template",variant:"destructive"})}})}const p5e=[{key:"{{date}}",description:"Current date (e.g., January 2, 2026)"},{key:"{{dayOfWeek}}",description:"Day of the week (e.g., Thursday)"},{key:"{{time}}",description:"Current time (e.g., 2:30 PM)"},{key:"{{passageReference}}",description:"Bible passage reference (e.g., John 3:16)"},{key:"{{heroName}}",description:"Name of the current hero/persona"},{key:"{{prompt}}",description:"Custom prompt or focus for the entry"}];function vj(n,e){const t=e.date||new Date,r={"{{date}}":hr(t,"MMMM d, yyyy"),"{{dayOfWeek}}":hr(t,"EEEE"),"{{time}}":hr(t,"h:mm a"),"{{passageReference}}":e.passageReference||"","{{heroName}}":e.heroName||"","{{prompt}}":e.prompt||""};let s=n;for(const[i,a]of Object.entries(r))(a||i.includes("date")||i.includes("day")||i.includes("time"))&&(s=s.replace(new RegExp(m5e(i),"g"),a));return s}function m5e(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hB({open:n,onOpenChange:e,templates:t,defaultTemplateId:r,onSelect:s,target:i,passageReference:a}){const[o,l]=_.useState(null);_.useEffect(()=>{n&&l(null)},[n]);const u=t.filter(g=>g.scope==="personal"),d=t.filter(g=>g.scope==="global"),h=o?t.find(g=>g.id===o):null,f=h?vj(h.content_markdown||"",{date:new Date,passageReference:a||"John 3:16"}):null,p=()=>{if(o===null)s(null);else{const g=t.find(y=>y.id===o);s(g||null)}e(!1)},m=i==="journal"?"Journal Entry":"Passage Note";return c.jsx(ai,{open:n,onOpenChange:e,children:c.jsxs(Ls,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[c.jsxs(Fs,{children:[c.jsxs(Bs,{className:"font-serif",children:["New ",m]}),c.jsx(Df,{children:"Start with a blank entry or choose a template. Select a template to preview it."})]}),c.jsxs("div",{className:"flex-1 grid md:grid-cols-[280px_1fr] gap-4 min-h-0",children:[c.jsx(Or,{className:"max-h-[400px] pr-2",children:c.jsxs("div",{className:"space-y-3",children:[c.jsx(KP,{title:"Blank",description:"Start with an empty entry",icon:c.jsx(wi,{className:"h-5 w-5"}),selected:o===null,onClick:()=>l(null)}),u.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 flex items-center gap-1",children:[c.jsx(Js,{className:"h-3 w-3"}),"My Templates"]}),c.jsx("div",{className:"space-y-2",children:u.map(g=>c.jsx(KP,{title:g.title,description:g.description||void 0,icon:c.jsx(wi,{className:"h-5 w-5"}),selected:o===g.id,isDefault:g.id===r,isLocked:g.is_locked,onClick:()=>l(g.id)},g.id))})]}),d.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 flex items-center gap-1",children:[c.jsx(DG,{className:"h-3 w-3"}),"Global Templates"]}),c.jsx("div",{className:"space-y-2",children:d.map(g=>c.jsx(KP,{title:g.title,description:g.description||void 0,icon:c.jsx(wi,{className:"h-5 w-5"}),selected:o===g.id,isDefault:g.id===r,isLocked:g.is_locked,onClick:()=>l(g.id)},g.id))})]})]})}),c.jsxs("div",{className:"border border-border rounded-md bg-muted/30 flex flex-col min-h-[300px]",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2 text-muted-foreground",children:[c.jsx(aT,{className:"h-4 w-4"}),c.jsx("span",{className:"text-xs uppercase tracking-wider font-medium",children:"Preview"})]}),c.jsx(Or,{className:"flex-1",children:c.jsx("div",{className:"p-4",children:o===null?c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground py-12",children:[c.jsx(wi,{className:"h-10 w-10 mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:"Blank entry"}),c.jsx("p",{className:"text-xs mt-1",children:"Start fresh with no template"})]}):f?c.jsx("div",{className:"prose prose-sm max-w-none prose-headings:font-serif prose-headings:text-foreground prose-p:text-foreground prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground prose-ul:text-foreground prose-ol:text-foreground",dangerouslySetInnerHTML:{__html:f}}):c.jsx("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground py-12",children:c.jsx("p",{className:"text-sm",children:"No preview available"})})})})]})]}),c.jsx(nf,{className:"my-2"}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(xe,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),c.jsxs(xe,{onClick:p,children:["Create ",m]})]})]})})}function KP({title:n,description:e,icon:t,selected:r,isDefault:s,isLocked:i,onClick:a}){return c.jsxs("button",{onClick:a,className:ke("w-full flex items-start gap-3 p-2.5 rounded-md border text-left transition-colors",r?"border-primary bg-primary/5":"border-border hover:border-muted-foreground
964/30 hover:bg-muted/50"),children:[c.jsx("div",{className:"text-muted-foreground mt-0.5 flex-shrink-0",children:t}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx("span",{className:"font-medium text-sm",children:n}),s&&c.jsxs(jt,{variant:"secondary",className:"text-xs px-1 py-0 h-4",children:[c.jsx(Eb,{className:"h-2.5 w-2.5 mr-0.5"}),"Default"]}),i&&c.jsx(wF,{className:"h-3 w-3 text-muted-foreground"})]}),e&&c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e})]})]})}function GH({noteId:n,noteType:e,isNew:t=!1}){var H;const r=vr(),{registerSaveHandler:s}=une(),[i,a]=_.useState(""),[o,l]=_.useState(""),[u,d]=_.useState([]),[h,f]=_.useState(""),[p,m]=_.useState(!1),[g,y]=_.useState("idle"),[v,x]=_.useState(!1),[b,E]=_.useState(!1),[S,k]=_.useState(null),[C,A]=_.useState(!1),T=_.useRef(null),j=_.useRef(""),D=_.useRef(""),{data:R,isLoading:M}=VPe(e==="journal"&&!t?n:null),{data:N,isLoading:U}=HPe(e==="passage"&&!t?n:null),{data:q,isLoading:I}=o5e(e==="generic"&&!t?n:null),B=e==="journal"?"journal":"passage_note",{data:$=[]}=dB(e==="generic"?null:B),{data:ie=[]}=gj(),ne=(H=ie.find(se=>se.target===B))==null?void 0:H.template_id,L=WPe(),te=qPe(),ae=l5e(),de=sne(),ue=M||U||I,le=L.isPending||te.isPending||ae.isPending,ve=_.useCallback(se=>{if(!se)a(""),k(null);else{const z=se.content_markdown||"",Q=vj(z,{date:new Date,passageReference:(N==null?void 0:N.passage_reference)||""});a(Q),k(se.id)}A(!0),m(!0),y("idle")},[N==null?void 0:N.passage_reference]);_.useEffect(()=>{var se;if(t){if(e!=="generic"&&!C&&ne&&$.length>0){const z=$.find(Q=>Q.id===ne);if(z){ve(z);return}}C||(a(""),l(""),d([]),A(!0));return}e==="journal"&&R?(a(R.entry_content),l(R.title||""),j.current=R.entry_content,D.current=R.title||"",k(R.template_id),A(!0)):e==="passage"&&N?(a(N.note_content),l(N.passage_reference),d(((se=N.user_note_tags)==null?void 0:se.map(z=>z.tag_name))||[]),j.current=N.note_content,k(N.template_id),A(!0)):e==="generic"&&q&&(a(q.content),l(q.title),j.current=q.content,D.current=q.title,A(!0)),m(!1),y("idle")},[R,N,q,e,t,ne,$,C,ve]);const _e=_.useCallback(async()=>{if(!e)return!0;const se=i0(i);if(!se.trim()&&e!=="generic"||e==="generic"&&!o.trim()&&!se.trim())return!0;if(i===j.current&&o===D.current)return y("saved"),!0;y("saving");try{if(e==="journal"){const z=await L.mutateAsync({id:t?void 0:n||void 0,content:i,title:o||void 0,date:hr(new Date,"yyyy-MM-dd"),templateId:S});t&&z&&r(`/study/notes/${z}?tab=notes&type=journal`,{replace:!0})}else if(e==="passage")!t&&N&&await te.mutateAsync({id:n||void 0,content:i,passageReference:N.passage_reference,verseStartId:N.verse_start_id,verseEndId:N.verse_end_id,tags:u,templateId:S});else if(e==="generic"){const z=await ae.mutateAsync({id:t?void 0:n||void 0,title:o||"Untitled",content:i,folderId:q==null?void 0:q.folderId});t&&z&&r(`/study/notes/${z}?tab=notes&type=generic`,{replace:!0})}return j.current=i,D.current=o,m(!1),y("saved"),setTimeout(()=>y("idle"),2e3),!0}catch(z){return console.error("Save error:",z),y("error"),Qr({title:"Failed to save",description:"Please try again.",variant:"destructive"}),!1}},[e,n,t,i,o,u,S,N,q,L,te,ae,r]);_.useEffect(()=>{if(p)return T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{_e()},1500),()=>{T.current&&clearTimeout(T.current)}},[i,o,u,p,_e]),_.useEffect(()=>{const se=z=>{p&&(z.preventDefault(),z.returnValue="")};return window.addEventListener("beforeunload",se),()=>window.removeEventListener("beforeunload",se)},[p]),_.useEffect(()=>(s(async()=>p?await _e():!0),()=>{s(null)}),[s,p,_e]);const Ne=async()=>{if(!(!n||!e))try{await de.mutateAsync({id:n,type:e}),Qr({title:"Note deleted"}),r("/study/notes")}catch{Qr({title:"Failed to delete",variant:"destructive"})}},Pe=se=>{a(se),m(!0),y("idle")},Se=se=>{l(se),m(!0),y("idle")},Ce=()=>{const se=h.toLowerCase().trim();se&&!u.includes(se)&&(d([...u,se]),m(!0)),f("")},O=se=>{d(u.filter(z=>z!==se)),m(!0)},ee=i0(i).trim().split(/\s+/).filter(se=>se.length>0).length,V=()=>{switch(g){case"saving":return c.jsxs("span",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c.jsx(PG,{className:"h-4 w-4 animate-pulse"}),"Saving..."]});case"saved":return c.jsxs("span",{className:"flex items-center gap-1 text-sm text-green-600 dark:text-green-400",children:[c.jsx(Go,{className:"h-4 w-4"}),"Saved"]});case"error":return c.jsx("span",{className:"flex items-center gap-1 text-sm text-destructive",children:"Save failed"});default:return p?c.jsx("span",{className:"text-sm text-muted-foreground",children:"Unsaved changes"}):null}};return ue?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e==="journal"?c.jsx(En,{className:"h-5 w-5 text-muted-foreground shrink-0"}):e==="generic"?c.jsx(mw,{className:"h-5 w-5 text-muted-foreground shrink-0"}):c.jsx(Gm,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e==="journal"||e==="generic"?c.jsx(Lt,{value:o,onChange:se=>Se(se.target.value),placeholder:e==="journal"?`Journal Entry - ${hr(new Date,"MMMM d, yyyy")}`:"Untitled",className:"text-xl font-serif border-0 bg-transparent p-0 h-auto focus-visible:ring-0 placeholder:text-muted-foreground
964/50"}):c.jsx("span",{className:"text-xl font-serif",children:(N==null?void 0:N.passage_reference)||"Passage Note"})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[V(),c.jsxs("span",{className:"text-sm text-muted-foreground",children:[ee," words"]})]})]}),c.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(kS,{className:"h-3.5 w-3.5"}),hr(R?new Date(R.entry_date):N?new Date(N.created_at):q?new Date(q.createdAt):new Date,"MMMM d, yyyy")]}),e==="journal"&&t&&c.jsx(jt,{variant:"secondary",children:"New Entry"}),e==="generic"&&t&&c.jsx(jt,{variant:"secondary",children:"New Note"}),e==="generic"&&(q==null?void 0:q.folderName)&&c.jsx(jt,{variant:"outline",children:q.folderName})]}),e==="passage"&&c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx(VG,{className:"h-3.5 w-3.5 text-muted-foreground"}),u.map(se=>c.jsxs(jt,{variant:"secondary",className:"gap-1 pr-1",children:[se,c.jsx("button",{onClick:()=>O(se),className:"hover:text-destructive",children:c.jsx(Ho,{className:"h-3 w-3"})})]},se)),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Lt,{value:h,onChange:se=>f(se.target.value),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),Ce())},placeholder:"Add tag...",className:"h-6 w-24 text-xs"}),c.jsx(xe,{variant:"ghost",size:"sm",onClick:Ce,className:"h-6 w-6 p-0",children:c.jsx(ka,{className:"h-3 w-3"})})]})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-4",children:c.jsx(mj,{content:i,onChange:Pe,placeholder:e==="journal"?"Write your reflections, prayers, and insights...":e==="generic"?"Start writing your note...":"Write your notes about this passage...",className:"min-h-[400px] border-0 shadow-none"})}),c.jsxs("div",{className:"border-t border-border p-4 flex items-center justify-between gap-4",children:[c.jsx("div",{className:"flex items-center gap-2",children:t&&e!=="generic"&&$.length>0&&c.jsxs(xe,{variant:"outline",size:"sm",onClick:()=>x(!0),children:[c.jsx(wi,{className:"h-4 w-4 mr-2"}),"Use Template"]})}),c.jsxs("div",{className:"flex items-center gap-2",children:[!t&&n&&c.jsxs(xe,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[c.jsx(ao,{className:"h-4 w-4 mr-2"}),"Delete"]}),c.jsxs(xe,{size:"sm",onClick:()=>{_e()},disabled:le||!p,children:[le?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(NS,{className:"h-4 w-4 mr-2"}),"Save Now"]})]})]}),c.jsx(hB,{open:v,onOpenChange:x,templates:$,defaultTemplateId:ne,onSelect:ve,target:B,passageReference:N==null?void 0:N.passage_reference}),c.jsx(tE,{open:b,onOpenChange:E,children:c.jsxs(j0,{children:[c.jsxs(R0,{children:[c.jsx(D0,{children:"Delete this note?"}),c.jsx(O0,{children:"This action cannot be undone. The note will be permanently deleted."})]}),c.jsxs(P0,{children:[c.jsx(I0,{children:"Cancel"}),c.jsx(M0,{onClick:Ne,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function g5e({variant:n="no-selection"}){const e=vr();return n==="home"?c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-8 py-16",children:[c.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-6",children:c.jsx(Lfe,{className:"h-8 w-8 text-primary"})}),c.jsx("h2",{className:"font-serif text-2xl font-semibold mb-2",children:"Your Writing Space"}),c.jsx("p",{className:"text-muted-foreground max-w-md mb-8",children:"A calm, focused place for your reflections, journal entries, and Bible study notes. Everything you write is saved automatically."}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs(xe,{onClick:()=>e("/study/notes/new?type=journal&tab=notes"),className:"gap-2",children:[c.jsx(En,{className:"h-4 w-4"}),"New Journal Entry"]}),c.jsxs(xe,{variant:"outline",onClick:()=>e("/study?tab=read"),className:"gap-2",children:[c.jsx(Gm,{className:"h-4 w-4"}),"Read Scripture"]})]})]}):c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-8 py-16",children:[c.jsx("div",{className:"w-14 h-14 roun
964ded-full bg-muted flex items-center justify-center mb-4",children:c.jsx(ka,{className:"h-6 w-6 text-muted-foreground"})}),c.jsx("h3",{className:"font-serif text-xl font-semibold mb-2",children:"Select or Create a Note"}),c.jsx("p",{className:"text-muted-foreground max-w-sm mb-6",children:"Choose a note from the sidebar to view or edit it, or create a new one."}),c.jsx("div",{className:"flex flex-col gap-2",children:c.jsxs(xe,{variant:"outline",size:"sm",onClick:()=>e("/study/notes/new?type=journal"),className:"gap-2",children:[c.jsx(En,{className:"h-4 w-4"}),"New Journal Entry"]})})]})}function v5e({selectedNotes:n,allNotes:e,onClearSelection:t,onComplete:r}){const[s,i]=_.useState(!1),[a,o]=_.useState(!1),l=sne(),u=e.filter(f=>n.has(f.id)),d=()=>{const f=u.map(y=>({type:y.type,title:y.title,content:y.content,tags:y.tags||[],created:y.createdAt,updated:y.updatedAt,...y.type==="journal"&&{entryDate:y.entryDate},...y.type==="passage"&&{passageReference:y.passageReference}})),p=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),m=URL.createObjectURL(p),g=document.createElement("a");g.href=m,g.download=`notes-export-${hr(new Date,"yyyy-MM-dd")}.json`,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(m),Qr({title:`Exported ${n.size} note(s)`})},h=async()=>{o(!0);try{for(const f of u)await l.mutateAsync({id:f.id,type:f.type});Qr({title:`Deleted ${n.size} note(s)`}),t(),r()}catch{Qr({title:"Failed to delete some notes",variant:"destructive"})}finally{o(!1),i(!1)}};return n.size===0?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50",children:c.jsxs("div",{className:"bg-background border border-border rounded-lg shadow-lg p-3 flex items-center gap-3",children:[c.jsxs("span",{className:"text-sm font-medium px-2",children:[n.size," selected"]}),c.jsx("div",{className:"h-6 w-px bg-border"}),c.jsxs(xe,{variant:"outline",size:"sm",onClick:d,className:"gap-2",children:[c.jsx(yF,{className:"h-4 w-4"}),"Export"]}),c.jsxs(xe,{variant:"destructive",size:"sm",onClick:()=>i(!0),className:"gap-2",children:[c.jsx(ao,{className:"h-4 w-4"}),"Delete"]}),c.jsx(xe,{variant:"ghost",size:"sm",onClick:t,children:c.jsx(Ho,{className:"h-4 w-4"})})]})}),c.jsx(tE,{open:s,onOpenChange:i,children:c.jsxs(j0,{children:[c.jsxs(R0,{children:[c.jsxs(D0,{children:["Delete ",n.size," notes?"]}),c.jsx(O0,{children:"This action cannot be undone. These notes will be permanently deleted."})]}),c.jsxs(P0,{children:[c.jsx(I0,{disabled:a,children:"Cancel"}),c.jsx(M0,{onClick:h,disabled:a,className:"bg-destructive text-destructive-foreground",children:a?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),"Deleting..."]}):"Delete All"})]})]})})]})}function y5e({open:n,onOpenChange:e,template:t,isAdmin:r=!1}){const s=!!t,[i,a]=_.useState(""),[o,l]=_.useState(""),[u,d]=_.useState("personal"),[h,f]=_.useState("both"),[p,m]=_.useState(""),g=u5e(),y=d5e(),v=g.isPending||y.isPending;_.useEffect(()=>{t?(a(t.title),l(t.description||""),d(t.scope),f(t.applies_to),m(t.content_markdown||"")):(a(""),l(""),d("personal"),f("both"),m(""))},[t,n]);const x=async()=>{if(!i.trim()||!p.trim())return;const b={title:i.trim(),description:o.trim()||void 0,applies_to:h,content_json:{html:p},content_markdown:p};s&&t?await y.mutateAsync({id:t.id,...b}):await g.mutateAsync({...b,scope:u}),e(!1)};return c.jsx(ai,{open:n,onOpenChange:e,children:c.jsxs(Ls,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[c.jsxs(Fs,{children:[c.jsx(Bs,{className:"font-serif",children:s?"Edit Template":"Create Template"}),c.jsxs(Df,{children:["Create a reusable template for your entries. Use variables like"," ",c.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:"{{date}}"})," ","to auto-fill content."]})]}),c.jsx(Or,{className:"flex-1 pr-4",children:c.jsxs("div",{className:"space-y-4 pb-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"title",children:"Title"}),c.jsx(Lt,{id:"title",value:i,onChange:b=>a(b.target.value),placeholder:"e.g., Morning Devotion"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"description",children:"Description (optional)"}),c.jsx(Ca,{id:"description",value:o,onChange:b=>l(b.target.value),placeholder:"A brief description of this template",className:"resize-none h-16"})]}),!s&&r&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"scope",children:"Scope"}),c.jsxs(ki,{value:u,onValueChange:b=>d(b),children:[c.jsx(ti,{children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"personal",children:"Personal (only you)"}),c.jsx(xn,{value:"global",children:"Global (all users)"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"applies-to",children:"Use for"}),c.jsxs(ki,{value:h,onValueChange:b=>f(b),children:[c.jsx(ti,{children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"journal",children:"Journal entries only"}),c.jsx(xn,{value:"passage_note",children:"Passage notes only"}),c.jsx(xn,{value:"both",children:"Both"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Available Variables"}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:p5e.map(b=>c.jsx(jt,{variant:"outline",className:"font-mono text-xs cursor-help",title:b.de
964scription,children:b.key},b.key))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Template Content"}),c.jsx(mj,{content:p,onChange:m,placeholder:"Write your template content here. Use {{date}} for today's date, {{passageReference}} for the passage, etc."})]})]})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[c.jsx(xe,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),c.jsxs(xe,{onClick:x,disabled:v||!i.trim()||!p.trim(),children:[v&&c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}),s?"Save Changes":"Create Template"]})]})]})})}function x5e(){const{user:n}=Vt(),{isAdmin:e}=N3(),{data:t=[],isLoading:r}=c5e(),{data:s=[]}=gj(),i=h5e(),a=f5e(),[o,l]=_.useState(""),[u,d]=_.useState("all"),[h,f]=_.useState(!1),[p,m]=_.useState(null),[g,y]=_.useState(!1),[v,x]=_.useState(null),b=t.filter(D=>{var M;if(!(D.title.toLowerCase().includes(o.toLowerCase())||((M=D.description)==null?void 0:M.toLowerCase().includes(o.toLowerCase()))))return!1;switch(u){case"journal":return D.applies_to==="journal"||D.applies_to==="both";case"passage_note":return D.applies_to==="passage_note"||D.applies_to==="both";case"my":return D.scope==="personal"&&D.owner_user_id===(n==null?void 0:n.id);case"global":return D.scope==="global";default:return!0}}),E=D=>{var R;return(R=s.find(M=>M.target===D))==null?void 0:R.template_id},S=D=>{m(D),f(!0)},k=D=>{x(D),y(!0)},C=async()=>{v&&(await i.mutateAsync(v.id),y(!1),x(null))},A=async(D,R)=>{E(R)===D.id?await a.mutateAsync({target:R,templateId:null}):await a.mutateAsync({target:R,templateId:D.id})},T=D=>e?!0:D.scope==="personal"&&D.owner_user_id===(n==null?void 0:n.id),j=D=>D.is_locked?!1:e?!0:D.scope==="personal"&&D.owner_user_id===(n==null?void 0:n.id);return r?c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-primary"})}):c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"font-serif text-2xl font-bold",children:"Templates"}),c.jsx("p",{className:"text-muted-foreground text-sm",children:"Create and manage templates for your entries"})]}),c.jsxs(xe,{onClick:()=>{m(null),f(!0)},children:[c.jsx(ka,{className:"h-4 w-4 mr-2"}),"New Template"]})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Eg,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Lt,{placeholder:"Search templates...",value:o,onChange:D=>l(D.target.value),className:"pl-9"})]}),c.jsxs(N0,{value:u,onValueChange:d,children:[c.jsxs(Ng,{children:[c.jsx(Rr,{value:"all",children:"All"}),c.jsx(Rr,{value:"journal",children:"Journal"}),c.jsx(Rr,{value:"passage_note",children:"Notes"}),c.jsx(Rr,{value:"my",children:"My Templates"}),c.jsx(Rr,{value:"global",children:"Global"})]}),c.jsx(Ml,{value:u,className:"mt-4",children:b.length===0?c.jsx(mt,{children:c.jsxs(kt,{className:"py-12 text-center",children:[c.jsx(wi,{className:"h-10 w-10 mx-auto mb-3 text-muted-foreground opacity-50"}),c.jsx("p",{className:"text-muted-foreground",children:"No templates found"}),c.jsx(xe,{variant:"link",onClick:()=>{m(null),f(!0)},children:"Create your first template"})]})}):c.jsx(Or,{className:"h-[500px] pr-4",children:c.jsx("div",{className:"grid gap-3",children:b.map(D=>c.jsx(b5e,{template:D,isJournalDefault:E("journal")===D.id,isNoteDefault:E("passage_note")===D.id,canEdit:T(D),canDelete:j(D),onEdit:()=>S(D),onDelete:()=>k(D),onSetDefault:R=>A(D,R)},D.id))})})})]}),c.jsx(y5e,{open:h,onOpenChange:f,template:p,isAdmin:e}),c.jsx(tE,{open:g,onOpenChange:y,children:c.jsxs(j0,{children:[c.jsxs(R0,{children:[c.jsx(D0,{children:"Delete template?"}),c.jsxs(O0,{children:['This will permanently delete "',v==null?void 0:v.title,'". This action cannot be undone.']})]}),c.jsxs(P0,{children:[c.jsx(I0,{children:"Cancel"}),c.jsx(M0,{onClick:C,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function b5e({template:n,isJournalDefault:e,isNoteDefault:t,canEdit:r,canDelete:s,onEdit:i,onDelete:a,onSetDefault:o}){const l=n.applies_to==="journal"||n.applies_to==="both",u=n.applies_to==="passage_note"||n.applies_to==="both";return c.jsx(mt,{className:"hover:shadow-sm transition-shadow",children:c.jsx(kt,{className:"p-4",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"text-muted-foreground mt-0.5",children:c.jsx(wi,{className:"h-5 w-5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"font-medium",children:n.title}),n.scope==="global"?c.jsxs(jt,{variant:"outline",className:"text-xs",children:[c.jsx(DG,{className:"h-3 w-3 mr-1"}),"Global"]}):c.jsxs(jt,{variant:"outline",className:"text-xs",children:[c.jsx(Js,{className:"h-3 w-3 mr-1"}),"Personal"]}),n.is_locked&&c.jsx(wF,{className:"h-3 w-3 text-muted-foreground"})]}),n.description&&c.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-1",children:n.description}),c.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[l&&c.jsxs(jt,{variant:e?"default":"secondary",className:"text-xs",children:[e&&c.jsx(Eb,{className:"h-3 w-3 mr-1"}),"Journal"]}),u&&c.jsxs(jt,{variant:t?"default":"secondary",className:"text-xs",children:[t&&c.jsx(Eb,{className:"h-3 w-3 mr-1"}),"Notes"]})]})]}),c.jsxs(B3,{children:[c.jsx(z3,{asChild:!0,children:c.jsx(xe,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:c.jsx(Ofe,{className:"h-4 w-4"})})}),c.jsxs(PT,{align:"end",children:[r&&c.jsxs(Do,{onClick:i,children:[c.jsx(zG,{className:"h-4 w-4 mr-2"}),"Edit"]}),l&&c.jsxs(Do,{onClick:()=>o("journal"),children:[c.jsx(Eb,{className:"h-4 w-4 mr-2"}),e?"Remove as journal default":"Set as journal default"]}),u&&c.jsxs(Do,{onClick:()=>o("passage_note"),children:[c.jsx(Eb,{className:"h-4 w-4 mr-2"}),t?"Remove as note default":"Set as note default"]}),s&&c.jsxs(c.Fragment,{children:[c.jsx(G2,{}),c.jsxs(Do,{onClick:a,className:"text-destructive focus:text-destructive",children:[c.jsx(ao,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]})})})}function w5e({books:n,selectedBookId:e,selectedChapter:t,onBookChange:r,onChapterChange:s,onPrevChapter:i,onNextChapter:a,isLoading:o=!1}){const l=n.find(p=>p.id===e),u=(l==null?void 0:l.chapter_count)||1,d=Array.from({length:u},(p,m)=>m+1),h=n.filter(p=>p.testament==="OT"),f=n.filter(p=>p.testament==="NT");return c.jsxs("div",{className:"flex items-center gap-2 p-3 border-b border-border bg-card",children:[c.jsxs(ki,{value:e||"",onValueChange:r,disabled:o,children:[c.jsx(ti,{className:"w-[180px] bg-background",children:c.jsx(Ci,{placeholder:"Select Book"})}),c.jsxs(ni,{className:"max-h-[300px] bg-popover z-50",children:[h.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Old Testament"}),h.map(p=>c.jsx(xn,{value:p.id,children:p.book_name},p.id))]}),f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider mt-2",children:"New Testament"}),f.map(p=>c.jsx(xn,{value:p.id,children:p.book_name},p.id))]})]})]}),c.jsxs(ki,{value:String(t),onValueChange:p=>s(Number(p)),disabled:o||!e,children:[c.jsx(ti,{className:"w-[100px] bg-background",children:c.jsx(Ci,{placeholder:"Ch."})}),c.jsx(ni,{className:"max-h-[300px] bg-popover z-50",children:d.map(p=>c.jsxs(xn,{value:String(p),children:["Chapter ",p]},p))})]}),c.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:i,disabled:o,className:"h-8 w-8",children:c.jsx(_2,{className:"h-4 w-4 rotate-90"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:a,disabled:o,className:"h-8 w-8",children:c.jsx(_2,{className:"h-4 w-4 -rotate-90"})})]})]})}
964function _5e({verses:n,selectedVerseIds:e,onVerseClick:t,isLoading:r=!1}){return r?c.jsx("div",{className:"p-4 space-y-3",children:Array.from({length:10}).map((s,i)=>c.jsx("div",{className:"animate-pulse",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx("div",{className:"w-6 h-5 bg-muted rounded"}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsx("div",{className:"h-4 bg-muted rounded w-full"}),c.jsx("div",{className:"h-4 bg-muted rounded w-3/4"})]})]})},i))}):n.length===0?c.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground p-8",children:c.jsx("p",{className:"text-center",children:"Select a book and chapter to view verses."})}):c.jsx("div",{className:"p-4 space-y-1",children:n.map(s=>{const i=e.includes(s.id);return c.jsxs("div",{onClick:a=>t(s.id,a.shiftKey),className:ke("flex gap-3 p-2 rounded cursor-pointer transition-colors select-none",i?"bg-primary/20 border border-primary/30":"hover:bg-muted/50"),children:[c.jsx("span",{className:"text-xs font-semibold text-primary min-w-[1.5rem] pt-0.5",children:s.verse_number}),c.jsx("p",{className:"text-foreground leading-relaxed font-serif",children:s.verse_text})]},s.id)})})}function S5e({selectedVerseIds:n,onVerseSelectionChange:e,onPassageReferenceChange:t}){const[r,s]=_.useState(null),[i,a]=_.useState(1),[o,l]=_.useState(null),{data:u=[],isLoading:d}=pt({queryKey:["bible-books"],queryFn:async()=>{const{data:b,error:E}=await pe.from("bible_books").select("*").order("book_number");if(E)throw E;return b}});_.useEffect(()=>{u.length>0&&!r&&s(u[0].id)},[u,r]);const{data:h=[],isLoading:f}=pt({queryKey:["bible-verses",r,i],queryFn:async()=>{if(!r)return[];const{data:b,error:E}=await pe.from("bible_verses").select("id, verse_number, verse_text").eq("book_id",r).eq("chapter_number",i).order("verse_number");if(E)throw E;return b},enabled:!!r}),p=u.find(b=>b.id===r);_.useEffect(()=>{if(n.length===0||!p){t("");return}const b=h.filter(A=>n.includes(A.id));if(b.length===0)return;const E=b.map(A=>A.verse_number).sort((A,T)=>A-T),S=E[0],k=E[E.length-1],C=S===k?`${p.book_name} ${i}:${S}`:`${p.book_name} ${i}:${S}-${k}`;t(C)},[n,p,i,h,t]);const m=b=>{s(b),a(1),e([])},g=b=>{a(b),e([])},y=()=>{if(i>1)g(i-1);else if(p){const b=u.findIndex(E=>E.id===r);if(b>0){const E=u[b-1];s(E.id),a(E.chapter_count),e([])}}},v=()=>{if(p&&i<p.chapter_count)g(i+1);else if(p){const b=u.findIndex(E=>E.id===r);if(b<u.length-1){const E=u[b+1];s(E.id),a(1),e([])}}},x=_.useCallback((b,E)=>{if(E&&o&&h.length>0){const S=h.findIndex(j=>j.id===o),k=h.findIndex(j=>j.id===b),C=Math.min(S,k),A=Math.max(S,k),T=h.slice(C,A+1).map(j=>j.id);e(T)}else n.includes(b)?e(n.filter(S=>S!==b)):e([b]),l(b)},[o,h,n,e]);return c.jsxs("div",{className:"flex flex-col h-full bg-card border-r border-border",children:[c.jsx(w5e,{books:u,selectedBookId:r,selectedChapter:i,onBookChange:m,onChapterChange:g,onPrevChapter:y,onNextChapter:v,isLoading:d}),c.jsx(Or,{className:"flex-1",children:c.jsx(_5e,{verses:h,selectedVerseIds:n,onVerseClick:x,isLoading:f})})]})}const Gse=[{slug:"matthew-henry",name:"Matthew Henry"},{slug:"jfb",name:"Jamieson-Fausset-Brown"},{slug:"calvin",name:"John Calvin"},{slug:"luther",name:"Martin Luther"},{slug:"spurgeon",name:"Charles Spurgeon"},{slug:"wesley",name:"John Wesley"}];function E5e({commentaryType:n,onTypeChange:e,selectedCommentatorSlug:t,onCommentatorChange:r,selectedPersonaId:s,onPersonaChange:i,personas:a,isLoading:o=!1}){return c.jsxs("div",{className:"p-3 border-b border-border bg-card space-y-3",children:[c.jsx(N0,{value:n,onValueChange:l=>e(l),children:c.jsxs(Ng,{className:"grid w-full grid-cols-2",children:[c.jsx(Rr,{value:"historical",children:"Historical"}),c.jsx(Rr,{value:"ai",children:"AI Commentary"})]})}),n==="historical"?c.jsxs(ki,{value:t,onValueChange:r,disabled:o,children:[c.jsx(ti,{className:"w-full bg-background",children:c.jsx(Ci,{placeholder:"Select Commentator"})}),c.jsx(ni,{className:"bg-popover z-50",children:Gse.map(l=>c.jsx(xn,{value:l.slug,children:l.name},l.slug))})]}):c.jsxs(ki,{value:s||"ai-scholar",onValueChange:l=>i(l==="ai-scholar"?null:l),disabled:o,children:[c.jsx(ti,{className:"w-full bg-background",children:c.jsx(Ci,{placeholder:"Select Voice"})}),c.jsxs(ni,{className:"bg-popover z-50",children:[c.jsx(xn,{value:"ai-scholar",children:"AI Biblical Scholar"}),c.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider mt-1",children:"Historical Personas"}),a.map(l=>c.jsx(xn,{value:l.id,children:l.full_name},l.id))]})]})]})}function k5e({selectedVerseIds:n,passageReference:e}){var A,T;const[t,r]=_.useState("historical"),[s,i]=_.useState("matthew-henry"),[a,o]=_.useState(null),[l,u]=_.useState(""),[d,h]=_.useState(!1),[f,p]=_.useState(null),m=n[0]||null,{data:g=[]}=pt({queryKey:["personas-for-commentary"],queryFn:async()=>{const{data:j,error:D}=await pe.from("personas").select("id, full_name").eq("is_published",!0).order("full_name");if(D)throw D;return j}}),{data:y,isLoading:v}=pt({queryKey:["historical-commentary",m,s],queryFn:async()=>
964{if(!m)return null;const{data:j,error:D}=await pe.from("historical_commentaries").select("*").eq("verse_id",m).eq("commentator_slug",s).maybeSingle();if(D)throw D;return j},enabled:!!m&&t==="historical"}),{data:x,refetch:b}=pt({queryKey:["ai-commentary-cache",m,a],queryFn:async()=>{if(!m)return null;const j=`${m}_${a||"ai-scholar"}`,{data:D,error:R}=await pe.from("ai_commentary_cache").select("*").eq("cache_key",j).maybeSingle();if(R)throw R;return D},enabled:!!m&&t==="ai"});_.useEffect(()=>{x?(u(x.commentary_text),p(null)):u("")},[x]);const E=async()=>{if(!(!m||d)){h(!0),p(null),u("");try{const j=await pe.functions.invoke("generate-commentary",{body:{verseStartId:m,verseEndId:n.length>1?n[n.length-1]:null,personaId:a}});if(j.error)throw new Error(j.error.message||"Failed to generate commentary");const{commentary:D}=j.data;u(D),b()}catch(j){console.error("AI Commentary error:",j),p(j instanceof Error?j.message:"Failed to generate AI commentary. Please try again.")}finally{h(!1)}}},S=((A=Gse.find(j=>j.slug===s))==null?void 0:A.name)||s,k=a?(T=g.find(j=>j.id===a))==null?void 0:T.full_name:"AI Biblical Scholar",C=()=>n.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-8",children:[c.jsx(En,{className:"h-12 w-12 mb-4 opacity-50"}),c.jsx("p",{className:"text-center",children:"Select a verse to view commentary."})]}):t==="historical"?v?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-primary"})}):y?c.jsxs("div",{className:"p-6",children:[c.jsxs("div",{className:"mb-4 pb-3 border-b border-border",children:[c.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Historical Commentary"}),c.jsx("h3",{className:"font-serif text-lg font-semibold",children:S}),c.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),c.jsx("div",{className:"prose-archive font-serif text-foreground leading-relaxed whitespace-pre-wrap",children:y.commentary_text}),y.source_reference&&c.jsxs("p",{className:"mt-4 text-xs text-muted-foreground italic",children:["Source: ",y.source_reference]})]}):c.jsxs("div",{className:"p-6 text-center text-muted-foreground",children:[c.jsxs("p",{className:"mb-2",children:["No historical commentary available for ",e," from"," ",S,"."]}),c.jsx("p",{className:"text-sm",children:"Try another commentator or switch to AI Commentary."})]}):c.jsxs("div",{className:"p-6",children:[c.jsxs("div",{className:"mb-4 pb-3 border-b border-border",children:[c.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"AI Commentary"}),c.jsx("h3",{className:"font-serif text-lg font-semibold",children:k}),c.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),f&&c.jsx("div",{className:"p-4 mb-4 bg-destructive/10 border border-destructive/20 rounded text-destructive text-sm",children:f}),!l&&!d&&!f&&c.jsxs("div",{className:"text-center py-8",children:[c.jsxs("p",{className:"text-muted-foreground mb-4",children:["Generate AI commentary for ",e]}),c.jsx(xe,{onClick:E,children:"Generate Commentary"})]}),d&&c.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[c.jsx(et,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Generating commentary..."})]}),l&&!d&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"prose-archive font-serif text-foreground leading-relaxed whitespace-pre-wrap",children:l}),c.jsx("div",{className:"mt-6 pt-4 border-t border-border",children:c.jsxs(xe,{variant:"outline",size:"sm",onClick:E,disabled:d,children:[c.jsx(AS,{className:"h-4 w-4 mr-2"}),"Regenerate"]})})]})]});return c.jsxs("div",{className:"flex flex-col h-full bg-card",children:[c.jsx(E5e,{commentaryType:t,onTypeChange:r,selectedCommentatorSlug:s,onCommentatorChange:i,selectedPersonaId:a,onPersonaChange:o,personas:g}),c.jsx(Or,{className:"flex-1",children:C()})]})}function C5e({selectedVerseIds:n,passageReference:e}){var ne;const{user:t}=Vt(),r=$n(),[s,i]=_.useState(""),[a,o]=_.useState(""),[l,u]=_.useState([]),[d,h]=_.useState(!1),[f,p]=_.useState(null),[m,g]=_.useState(null),[y,v]=_.useState(!1),[x,b]=_.useState(!1),E=n[0]||null,S=n.length>1?n[n.length-1]:null,{data:k=[]}=dB("passage_note"),{data:C=[]}=gj(),A=(ne=C.find(L=>L.target==="passage_note"))==null?void 0:ne.template_id,{data:T,isLoading:j,isFetched:D}=pt({queryKey:["user-note",t==null?void 0:t.id,E,S],queryFn:async()=>
964{if(!t||!E)return null;let L=pe.from("user_notes").select(`
965          *,
966          user_note_tags (id, tag_name)
967        `).eq("user_id",t.id).eq("verse_start_id",E);S?L=L.eq("verse_end_id",S):L=L.is("verse_end_id",null);const{data:te,error:ae}=await L.maybeSingle();if(ae)throw ae;return te},enabled:!!t&&!!E}),R=_.useCallback(L=>{if(!L)i(""),g(null);else{const te=L.content_markdown||"",ae=vj(te,{date:new Date,passageReference:e});i(ae),g(L.id)}b(!0),h(!0)},[e]);_.useEffect(()=>{var L;if(!(!D||!E))if(T)i(T.note_content),u(((L=T.user_note_tags)==null?void 0:L.map(te=>te.tag_name))||[]),p(T.id),g(T.template_id),h(!1),b(!0);else{if(p(null),u([]),!x&&A&&k.length>0){const te=k.find(ae=>ae.id===A);if(te){R(te);return}}x||(i(""),g(null),b(!0)),h(!1)}},[T,D,E,A,k,x,R]),_.useEffect(()=>{b(!1)},[E,S]);const M=kn({mutationFn:async()=>{const L=i0(s);if(!(!t||!E||!L.trim()))if(f){const{error:te}=await pe.from("user_notes").update({note_content:s,passage_reference:e}).eq("id",f);if(te)throw te;if(await pe.from("user_note_tags").delete().eq("note_id",f),l.length>0){const ae=l.map(de=>({note_id:f,tag_name:de.toLowerCase().trim()}));await pe.from("user_note_tags").insert(ae)}}else{const{data:te,error:ae}=await pe.from("user_notes").insert({user_id:t.id,verse_start_id:E,verse_end_id:S,passage_reference:e,note_content:s,template_id:m}).select().single();if(ae)throw ae;if(l.length>0&&te){const de=l.map(ue=>({note_id:te.id,tag_name:ue.toLowerCase().trim()}));await pe.from("user_note_tags").insert(de)}p(te.id)}},onSuccess:()=>{Qr({title:"Note saved successfully"}),h(!1),r.invalidateQueries({queryKey:["user-note",t==null?void 0:t.id,E,S]})},onError:L=>{console.error("Save note error:",L),Qr({title:"Failed to save note",description:"Please try again.",variant:"destructive"})}}),N=kn({mutationFn:async()=>{if(!f)return;const{error:L}=await pe.from("user_notes").delete().eq("id",f);if(L)throw L},onSuccess:()=>{Qr({title:"Note deleted"}),i(""),u([]),p(null),g(null),b(!1),r.invalidateQueries({queryKey:["user-note",t==null?void 0:t.id,E,S]})},onError:L=>{console.error("Delete note error:",L),Qr({title:"Failed to delete note",variant:"destructive"})}}),U=_.useCallback(()=>{const L=a.toLowerCase().trim();L&&!l.includes(L)&&(u([...l,L]),h(!0)),o("")},[a,l]),q=L=>{u(l.filter(te=>te!==L)),h(!0)},I=L=>{R(L)},B=L=>{i(L),h(!0)},ie=i0(s).trim().length>0;return t?n.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-6 bg-card",children:[c.jsx(Gm,{className:"h-10 w-10 mb-3 opacity-50"}),c.jsx("p",{className:"text-center text-sm",children:"Select a verse to add notes."})]}):j?c.jsx("div",{className:"flex items-center justify-center h-full bg-card",children:c.jsx(et,{className:"h-5 w-5 animate-spin text-primary"})}):c.jsxs("div",{className:"flex flex-col h-full bg-card",children:[c.jsx("div",{className:"p-3 border-b border-border",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Passage Notes"}),c.jsx("p",{className:"text-sm font-medium",children:e})]}),!f&&k.length>0&&c.jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>v(!0),className:"text-muted-foreground h-8",children:[c.jsx(wi,{className:"h-3.5 w-3.5 mr-1"}),"Template"]})]})}),c.jsxs(Or,{className:"flex-1 p-3",children:[c.jsx(mj,{content:s,onChange:B,placeholder:"Write your notes here...",className:"min-h-[120px] mb-3"}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(L=>c.jsxs(jt,{variant:"secondary",className:"gap-1 pr-1",children:[L,c.jsx("button",{onClick:()=>q(L),className:"hover:text-destructive",children:c.jsx(Ho,{className:"h-3 w-3"})})]},L))}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Lt,{placeholder:"Add tag...",value:a,onChange:L=>o(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),U())},className:"h-8 text-sm"}),c.jsx(xe,{variant:"outline",size:"sm",onClick:U,className:"h-8",children:c.jsx(ka,{className:"h-3 w-3"})})]})]})]}),c.jsxs("div",{className:"p-3 border-t border-border flex gap-2",children:[c.jsxs(xe,{size:"sm",onClick:()=>M.mutate(),disabled:M.isPending||!ie,className:"flex-1",children:[M.isPending?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(NS,{className:"h-4 w-4 mr-2"}),"Save"]}),f&&c.jsx(xe,{variant:"outline",size:"sm",onClick:()=>N.mutate(),disabled:N.isPending,children:c.jsx(ao,{className:"h-4 w-4"})})]}),c.jsx(hB,{open:y,onOpenChange:v,templates:k,defaultTemplateId:A,onSelect:I,target:"passage_note",passageReference:e})]}):c.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-6 bg-card",children:[c.jsx(Gm,{className:"h-10 w-10 mb-3 opacity-50"}),c.jsx("p",{className:"text-center text-sm",children:"Sign in to save notes."})]})}const yj=_.createContext(null);yj.displayName="PanelGroupContext";const jr={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},fB=10,$m=_.useLayoutEffect,KH=BN.useId,A5e=typeof KH=="function"?KH:()=>null;let N5e=0;function pB(n=null){const e=A5e(),t=_.useRef(n||e||null);return t.current===null&&(t.current=""+N5e++),n??t.current}function Kse({children:n,className:e="",collapsedSize:t,collapsible:r,defaultSize:s,forwardedRef:i,id:a,maxSize:o,minSize:l,onCollapse:u,onExpand:d,onResize:h,order:f,style:p,tagName:m="div",...g}){const y=_.useContext(yj);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:x,getPanelSize:b,getPanelStyle:E,groupId:S,isPanelCollapsed:k,reevaluatePanelConstraints:C,registerPanel:A,resizePanel:T,unregisterPanel:j}=y,D=pB(a),R=_.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:h},constraints:{collapsedSize:t,collapsible:r,defaultSize:s,maxSize:o,minSize:l},id:D,idIsFromProps:a!==void 0,order:f});_.useRef({didLogMissingDefaultSizeWarning:!1}),$m(()=>{const{callbacks:N,constraints:U}=R.current,q={...U};R.current.id=D,R.current.idIsFromProps=a!==void 0,R.current.order=f,N.onCollapse=u,N.onExpand=d,N.onResize=h,U.collapsedSize=t,U.collapsible=r,U.defaultSize=s,U.maxSize=o,U.minSize=l,(q.collapsedSize!==U.
967collapsedSize||q.collapsible!==U.collapsible||q.maxSize!==U.maxSize||q.minSize!==U.minSize)&&C(R.current,q)}),$m(()=>{const N=R.current;return A(N),()=>{j(N)}},[f,D,A,j]),_.useImperativeHandle(i,()=>({collapse:()=>{v(R.current)},expand:N=>{x(R.current,N)},getId(){return D},getSize(){return b(R.current)},isCollapsed(){return k(R.current)},isExpanded(){return!k(R.current)},resize:N=>{T(R.current,N)}}),[v,x,b,k,D,T]);const M=E(R.current,s);return _.createElement(m,{...g,children:n,className:e,id:D,style:{...M,...p},[jr.groupId]:S,[jr.panel]:"",[jr.panelCollapsible]:r||void 0,[jr.panelId]:D,[jr.panelSize]:parseFloat(""+M.flexGrow).toFixed(1)})}const Yse=_.forwardRef((n,e)=>_.createElement(Kse,{...n,forwardedRef:e}));Kse.displayName="Panel";Yse.displayName="forwardRef(Panel)";let LI=null,mC=-1,Qd=null;function T5e(n,e){if(e){const t=(e&eie)!==0,r=(e&tie)!==0,s=(e&nie)!==0,i=(e&rie)!==0;if(t)return s?"se-resize":i?"ne-resize":"e-resize";if(r)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function j5e(){Qd!==null&&(document.head.removeChild(Qd),LI=null,Qd=null,mC=-1)}function YP(n,e){var t,r;const s=T5e(n,e);if(LI!==s){if(LI=s,Qd===null&&(Qd=document.createElement("style"),document.head.appendChild(Qd)),mC>=0){var i;(i=Qd.sheet)===null||i===void 0||i.removeRule(mC)}mC=(t=(r=Qd.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${s} !important;}`))!==null&&t!==void 0?t:-1}}function Xse(n){return n.type==="keydown"}function Zse(n){return n.type.startsWith("pointer")}function Jse(n){return n.type.startsWith("mouse")}function xj(n){if(Zse(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(Jse(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function R5e(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function P5e(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function D5e(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:ZH(n),b:ZH(e)};let r;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),r=n;Zt(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:XH(YH(t.a)),b:XH(YH(t.b))};if(s.a===s.b){const i=r.childNodes,a={a:t.a.at(-1),b:t.b.at(-1)};let o=i.length;for(;o--;){const l=i[o];if(l===a.a)return 1;if(l===a.b)return-1}}return Math.sign(s.a-s.b)}const O5e=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function M5e(n){var e;const t=getComputedStyle((e=Qse(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function I5e(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||M5e(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||O5e.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function YH(n){let e=n.length;for(;e--;){const t=n[e];if(Zt(t,"Missing node"),I5e(t))return t}return null}function XH(n){return n&&Number(getComputedStyle(n).zIndex)||0}function ZH(n){const e=[];for(;n;)e.push(n),n=Qse(n);return e}function Qse(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const eie=1,tie=2,nie=4,rie=8,L5e=R5e()==="coarse";let Wl=[],py=!1,dp=new Map,bj=new Map;const V1=new Set;function F5e(n,e,t,r,s){var i;const{ownerDocument:a}=e,o={direction:t,element:e,hitAreaMargins:r,setResizeHandlerState:s},l=(i=dp.get(a))!==null&&i!==void 0?i:0;return dp.set(a,l+1),V1.add(o),eN(),function(){var d;bj.delete(n),V1.delete(o);const h=(d=dp.get(a))!==null&&d!==void 0?d:1;if(dp.set(a,h-1),eN(),h===1&&dp.delete(a),Wl.includes(o)){const f=Wl.indexOf(o);f>=0&&Wl.splice(f,1),gB(),s("up",!0,null)}}}function B5e(n){const{target:e}=n,{x:t,y:r}=xj(n);py=!0,mB({target:e,x:t,y:r}),eN(),Wl.length>0&&(tN("down",n),n.preventDefault(),sie(e)||n.stopImmediatePropagation())}function XP(n){const{x:e,y:t}=xj(n);if(py&&n.buttons===0&&(py=!1,tN("up",n)),!py){const{target:r}=n;mB({target:r,x:e,y:t})}tN("move",n),gB(),Wl.length>0&&n.preventDefault()}function ZP(n){const{target:e}=n,{x:t,y:r}=xj(n);bj.clear(),py=!1,Wl.length>0&&(n.preventDefault(),sie(e)||n.stopImmediatePropagation()),tN("up",n),mB({target:e,x:t,y:r}),gB(),eN()}function sie(n){let e=n;for(;e;){if(e.hasAttribute(jr.resizeHandle))return!0;e=e.parentElement}return!1}function mB({target:n,x:e,y:t}){Wl.splice(0);let r=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(r=n),V1.forEach(s=>{const{element:i,hitAreaMargins:a}=s,o=i.getBoundingClientRect(),{bottom:l,left:u,right:d,top:h}=o,f=L5e?a.coarse:a.fine;if(e>=u-f&&e<=d+f&&t>=h-f&&t<=l+f){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&D5e(r,i)>0){let m=r,g=!1;for(;m&&!m.contains(i);){if(P5e(m.getBoundingClientRect(),o)){g=!0;break}m=m.parentElement}if(g)return}Wl.push(s)}})}function JP(n,e){bj.set(n,e)}function gB(){let n=!1,e=!1;Wl.forEach(r=>{const{direction:s}=r;s==="horizontal"?n=!0:e=!0});let t=0;
967bj.forEach(r=>{t|=r}),n&&e?YP("intersection",t):n?YP("horizontal",t):e?YP("vertical",t):j5e()}let QP=new AbortController;function eN(){QP.abort(),QP=new AbortController;const n={capture:!0,signal:QP.signal};V1.size&&(py?(Wl.length>0&&dp.forEach((e,t)=>{const{body:r}=t;e>0&&(r.addEventListener("contextmenu",ZP,n),r.addEventListener("pointerleave",XP,n),r.addEventListener("pointermove",XP,n))}),window.addEventListener("pointerup",ZP,n),window.addEventListener("pointercancel",ZP,n)):dp.forEach((e,t)=>{const{body:r}=t;e>0&&(r.addEventListener("pointerdown",B5e,n),r.addEventListener("pointermove",XP,n))}))}function tN(n,e){V1.forEach(t=>{const{setResizeHandlerState:r}=t,s=Wl.includes(t);r(n,s,e)})}function z5e(){const[n,e]=_.useState(0);return _.useCallback(()=>e(t=>t+1),[])}function Zt(n,e){if(!n)throw console.error(e),Error(e)}function dg(n,e,t=fB){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function Hu(n,e,t=fB){return dg(n,e,t)===0}function Va(n,e,t){return dg(n,e,t)===0}function $5e(n,e,t){if(n.length!==e.length)return!1;for(let r=0;r<n.length;r++){const s=n[r],i=e[r];if(!Va(s,i,t))return!1}return!0}function Gv({panelConstraints:n,panelIndex:e,size:t}){const r=n[e];Zt(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:i,maxSize:a=100,minSize:o=0}=r;if(dg(t,o)<0)if(i){const l=(s+o)/2;dg(t,l)<0?t=s:t=o}else t=o;return t=Math.min(a,t),t=parseFloat(t.toFixed(fB)),t}function zb({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:r,prevLayout:s,trigger:i}){if(Va(n,0))return e;const a=[...e],[o,l]=r;Zt(o!=null,"Invalid first pivot index"),Zt(l!=null,"Invalid second pivot index");let u=0;if(i==="keyboard"){{const h=n<0?l:o,f=t[h];Zt(f,`Panel constraints not found for index ${h}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const y=e[h];if(Zt(y!=null,`Previous layout not found for panel index ${h}`),Va(y,p)){const v=g-y;dg(v,Math.abs(n))>0&&(n=n<0?0-v:v)}}}{const h=n<0?o:l,f=t[h];Zt(f,`No panel constraints found for index ${h}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const y=e[h];if(Zt(y!=null,`Previous layout not found for panel index ${h}`),Va(y,g)){const v=y-p;dg(v,Math.abs(n))>0&&(n=n<0?0-v:v)}}}}{const h=n<0?1:-1;let f=n<0?l:o,p=0;for(;;){const g=e[f];Zt(g!=null,`Previous layout not found for panel index ${f}`);const v=Gv({panelConstraints:t,panelIndex:f,size:100})-g;if(p+=v,f+=h,f<0||f>=t.length)break}const m=Math.min(Math.abs(n),Math.abs(p));n=n<0?0-m:m}{let f=n<0?o:l;for(;f>=0&&f<t.length;){const p=Math.abs(n)-Math.abs(u),m=e[f];Zt(m!=null,`Previous layout not found for panel index ${f}`);const g=m-p,y=Gv({panelConstraints:t,panelIndex:f,size:g});if(!Va(m,y)&&(u+=m-y,a[f]=y,u.toPrecision(3).localeCompare(Math.abs(n).toPrecision(3),void 0,{numeric:!0})>=0))break;n<0?f--:f++}}if($5e(s,a))return s;{const h=n<0?l:o,f=e[h];Zt(f!=null,`Previous layout not found for panel index ${h}`);const p=f+u,m=Gv({panelConstraints:t,panelIndex:h,size:p});if(a[h]=m,!Va(m,p)){let g=p-m,v=n<0?l:o;for(;v>=0&&v<t.length;){const x=a[v];Zt(x!=null,`Previous layout not found for panel index ${v}`);const b=x+g,E=Gv({panelConstraints:t,panelIndex:v,size:b});if(Va(x,E)||(g-=E-x,a[v]=E),Va(g,0))break;n>0?v--:v++}}}const d=a.reduce((h,f)=>f+h,0);return Va(d,100)?a:s}function U5e({layout:n,panelsArray:e,pivotIndices:t}){let r=0,s=100,i=0,a=0;const o=t[0];Zt(o!=null,"No pivot index found"),e.forEach((h,f)=>{const{constraints:p}=h,{maxSize:m=100,minSize:g=0}=p;f===o?(r=g,s=m):(i+=g,a+=m)});const l=Math.min(s,100-i),u=Math.max(r,100-a),d=n[o];return{valueMax:l,valueMin:u,valueNow:d}}function H1(n,e=document){return Array.from(e.querySelectorAll(`[${jr.resizeHandleId}][data-panel-group-id="${n}"]`))}function iie(n,e,t=document){const s=H1(n,t).findIndex(i=>i.getAttribute(jr.resizeHandleId)===e);return s??null}function aie(n,e,t){const r=iie(n,e,t);return r!=null?[r,r+1]:[-1,-1]}function oie(n,e=document){var t;if(e instanceof HTMLElement&&(e==null||(t=e.dataset)===null||t===void 0?void 0:t.panelGroupId)==n)return e;
967const r=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return r||null}function wj(n,e=document){const t=e.querySelector(`[${jr.resizeHandleId}="${n}"]`);return t||null}function V5e(n,e,t,r=document){var s,i,a,o;const l=wj(e,r),u=H1(n,r),d=l?u.indexOf(l):-1,h=(s=(i=t[d])===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null,f=(a=(o=t[d+1])===null||o===void 0?void 0:o.id)!==null&&a!==void 0?a:null;return[h,f]}function H5e({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:r,panelDataArray:s,panelGroupElement:i,setLayout:a}){_.useRef({didWarnAboutMissingResizeHandle:!1}),$m(()=>{if(!i)return;const o=H1(t,i);for(let l=0;l<s.length-1;l++){const{valueMax:u,valueMin:d,valueNow:h}=U5e({layout:r,panelsArray:s,pivotIndices:[l,l+1]}),f=o[l];if(f!=null){const p=s[l];Zt(p,`No panel data found for index "${l}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(u)),f.setAttribute("aria-valuemin",""+Math.round(d)),f.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{o.forEach((l,u)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[t,r,s,i]),_.useEffect(()=>{if(!i)return;const o=e.current;Zt(o,"Eager values not found");const{panelDataArray:l}=o,u=oie(t,i);Zt(u!=null,`No group found for id "${t}"`);const d=H1(t,i);Zt(d,`No resize handles found for group id "${t}"`);const h=d.map(f=>{const p=f.getAttribute(jr.resizeHandleId);Zt(p,"Resize handle element has no handle id attribute");const[m,g]=V5e(t,p,l,i);if(m==null||g==null)return()=>{};const y=v=>{if(!v.defaultPrevented)switch(v.key){case"Enter":{v.preventDefault();const x=l.findIndex(b=>b.id===m);if(x>=0){const b=l[x];Zt(b,`No panel data found for index ${x}`);const E=r[x],{collapsedSize:S=0,collapsible:k,minSize:C=0}=b.constraints;if(E!=null&&k){const A=zb({delta:Va(E,S)?C-S:S-E,initialLayout:r,panelConstraints:l.map(T=>T.constraints),pivotIndices:aie(t,p,i),prevLayout:r,trigger:"keyboard"});r!==A&&a(A)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{h.forEach(f=>f())}},[i,n,e,t,r,s,a])}function JH(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function lie(n,e){const t=n==="horizontal",{x:r,y:s}=xj(e);return t?r:s}function W5e(n,e,t,r,s){const i=t==="horizontal",a=wj(e,s);Zt(a,`No resize handle element found for id "${e}"`);const o=a.getAttribute(jr.groupId);Zt(o,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const u=lie(t,n),d=oie(o,s);Zt(d,`No group element found for id "${o}"`);const h=d.getBoundingClientRect(),f=i?h.width:h.height;return(u-l)/f*100}function q5e(n,e,t,r,s,i){if(Xse(n)){const a=t==="horizontal";let o=0;n.shiftKey?o=100:s!=null?o=s:o=10;let l=0;switch(n.key){case"ArrowDown":l=a?0:o;break;case"ArrowLeft":l=a?-o:0;break;case"ArrowRight":l=a?o:0;break;case"ArrowUp":l=a?0:-o;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:W5e(n,e,t,r,i)}function G5e({panelDataArray:n}){const e=Array(n.length),t=n.map(i=>i.constraints);let r=0,s=100;for(let i=0;i<n.length;i++){const a=t[i];Zt(a,`Panel constraints not found for index ${i}`);const{defaultSize:o}=a;o!=null&&(r++,e[i]=o,s-=o)}for(let i=0;i<n.length;i++){const a=t[i];Zt(a,`Panel constraints not found for index ${i}`);const{defaultSize:o}=a;if(o!=null)continue;const l=n.length-r,u=s/l;r++,e[i]=u,s-=u}return e}function tv(n,e,t){e.forEach((r,s)=>{const i=n[s];Zt(i,`Panel data not found for index ${s}`);const{callbacks:a,constraints:o,id:l}=i,{collapsedSize:u=0,collapsible:d}=o,h=t[l];if(h==null||r!==h){t[l]=r;const{onCollapse:f,onExpand:p,onResize:m}=a;m&&m(r,h),d&&(f||p)&&(p&&(h==null||Hu(h,u))&&!Hu(r,u)&&p(),f&&(h==null||!Hu(h,u))&&Hu(r,u)&&f())}})}function _k(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function K5e({defaultSize:n,dragState:e,layout:t,panelData:r,panelIndex:s,precision:i=3}){const a=t[s];let o;return a==null?o=n!=null?n.toPrecision(i):"1":r.length===1?o="1":o=a.toPrecision(i),{flexBasis:0,flexGrow:o,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Y5e(n,e=10){let t=null;return(...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...s)},e)}}function QH(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>
967{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function cie(n){return`react-resizable-panels:${n}`}function uie(n){return n.map(e=>{const{constraints:t,id:r,idIsFromProps:s,order:i}=e;return s?r:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function die(n,e){try{const t=cie(n),r=e.getItem(t);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function X5e(n,e,t){var r,s;const i=(r=die(n,t))!==null&&r!==void 0?r:{},a=uie(e);return(s=i[a])!==null&&s!==void 0?s:null}function Z5e(n,e,t,r,s){var i;const a=cie(n),o=uie(e),l=(i=die(n,s))!==null&&i!==void 0?i:{};l[o]={expandToSizes:Object.fromEntries(t.entries()),layout:r};try{s.setItem(a,JSON.stringify(l))}catch(u){console.error(u)}}function eW({layout:n,panelConstraints:e}){const t=[...n],r=t.reduce((i,a)=>i+a,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(i=>`${i}%`).join(", ")}`);if(!Va(r,100)&&t.length>0)for(let i=0;i<e.length;i++){const a=t[i];Zt(a!=null,`No layout data found for index ${i}`);const o=100/r*a;t[i]=o}let s=0;for(let i=0;i<e.length;i++){const a=t[i];Zt(a!=null,`No layout data found for index ${i}`);const o=Gv({panelConstraints:e,panelIndex:i,size:a});a!=o&&(s+=a-o,t[i]=o)}if(!Va(s,0))for(let i=0;i<e.length;i++){const a=t[i];Zt(a!=null,`No layout data found for index ${i}`);const o=a+s,l=Gv({panelConstraints:e,panelIndex:i,size:o});if(a!==l&&(s-=l-a,t[i]=l,Va(s,0)))break}return t}const J5e=100,$b={getItem:n=>(QH($b),$b.getItem(n)),setItem:(n,e)=>{QH($b),$b.setItem(n,e)}},tW={};function hie({autoSaveId:n=null,children:e,className:t="",direction:r,forwardedRef:s,id:i=null,onLayout:a=null,keyboardResizeBy:o=null,storage:l=$b,style:u,tagName:d="div",...h}){const f=pB(i),p=_.useRef(null),[m,g]=_.useState(null),[y,v]=_.useState([]),x=z5e(),b=_.useRef({}),E=_.useRef(new Map),S=_.useRef(0),k=_.useRef({autoSaveId:n,direction:r,dragState:m,id:f,keyboardResizeBy:o,onLayout:a,storage:l}),C=_.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});_.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),_.useImperativeHandle(s,()=>({getId:()=>k.current.id,getLayout:()=>{const{layout:te}=C.current;return te},setLayout:te=>{const{onLayout:ae}=k.current,{layout:de,panelDataArray:ue}=C.current,le=eW({layout:te,panelConstraints:ue.map(ve=>ve.constraints)});JH(de,le)||(v(le),C.current.layout=le,ae&&ae(le),tv(ue,le,b.current))}}),[]),$m(()=>{k.current.autoSaveId=n,k.current.direction=r,k.current.dragState=m,k.current.id=f,k.current.onLayout=a,k.current.storage=l}),H5e({committedValuesRef:k,eagerValuesRef:C,groupId:f,layout:y,panelDataArray:C.current.panelDataArray,setLayout:v,panelGroupElement:p.current}),_.useEffect(()=>{const{panelDataArray:te}=C.current;if(n){if(y.length===0||y.length!==te.length)return;let ae=tW[n];ae==null&&(ae=Y5e(Z5e,J5e),tW[n]=ae);const de=[...te],ue=new Map(E.current);ae(n,de,ue,y,l)}},[n,y,l]),_.useEffect(()=>{});const A=_.useCallback(te=>{const{onLayout:ae}=k.current,{layout:de,panelDataArray:ue}=C.current;if(te.constraints.collapsible){const le=ue.map(Pe=>Pe.constraints),{collapsedSize:ve=0,panelSize:_e,pivotIndices:Ne}=Xf(ue,te,de);if(Zt(_e!=null,`Panel size not found for panel "${te.id}"`),!Hu(_e,ve)){E.current.set(te.id,_e);const Se=mv(ue,te)===ue.length-1?_e-ve:ve-_e,Ce=zb({delta:Se,initialLayout:de,panelConstraints:le,pivotIndices:Ne,prevLayout:de,trigger:"imperative-api"});_k(de,Ce)||(v(Ce),C.current.layout=Ce,ae&&ae(Ce),tv(ue,Ce,b.current))}}},[]),T=_.useCallback((te,ae)=>{const{onLayout:de}=k.current,{layout:ue,panelDataArray:le}=C.current;if(te.constraints.collapsible){const ve=le.map(O=>O.constraints),{collapsedSize:_e=0,panelSize:Ne=0,minSize:Pe=0,pivotIndices:Se}=Xf(le,te,ue),Ce=ae??Pe;if(Hu(Ne,_e)){const O=E.current.get(te.id),X=O!=null&&O>=Ce?O:Ce,V=mv(le,te)===le.length-1?Ne-X:X-Ne,H=zb({delta:V,initialLayout:ue,panelConstraints:ve,pivotIndices:Se,prevLayout:ue,trigger:"imperative-api"});_k(ue,H)||(v(H),C.current.layout=H,de&&de(H),tv(le,H,b.current))}}},[]),j=_.useCallback(te=>{const{layout:ae,panelDataArray:de}=C.current,{panelSize:ue}=Xf(de,te,ae);return Zt(ue!=null,`Panel size not found for panel "${te.id}"`),ue},[]),D=_.useCallback((te,ae)=>{const{panelDataArray:de}=C.current,ue=mv(de,te);return K5e({defaultSize:ae,dragState:m,layout:y,panelData:de,panelIndex:ue})},[m,y]),R=_.useCallback(te=>{const{layout:ae,panelDataArray:de}=C.current,{collapsedSize:ue=0,collapsible:le,panelSize:ve}=Xf(de,te,ae);return Zt(ve!=null,`Panel size not found for panel "${te.id}"`),le===!0&&Hu(ve,ue)},[]),M=_.useCallback(te=>{const{layout:ae,panelDataArray:de}=C.current,{collapsedSize:ue=0,collapsible:le,panelSize:ve}=Xf(de,te,ae);return Zt(ve!=null,`Panel size not found for panel "${te.id}"`),!le||dg(ve,ue)>0},[]),N=_.useCallback(te=>{const{panelDataArray:ae}=C.current;ae.push(te),ae.sort((de,ue)=>{const le=de.order,ve=ue.order;return le==null&&ve==null?0:le==null?-1:ve==null?1:le-ve}),C.current.panelDataArrayChanged=!0,x()},[x]);$m(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:te,onLayout:ae,storage:de}=k.current,{layout:ue,panelDataArray:le}=C.current;let ve=null;if(te){const Ne=X5e(te,le,de);
967Ne&&(E.current=new Map(Object.entries(Ne.expandToSizes)),ve=Ne.layout)}ve==null&&(ve=G5e({panelDataArray:le}));const _e=eW({layout:ve,panelConstraints:le.map(Ne=>Ne.constraints)});JH(ue,_e)||(v(_e),C.current.layout=_e,ae&&ae(_e),tv(le,_e,b.current))}}),$m(()=>{const te=C.current;return()=>{te.layout=[]}},[]);const U=_.useCallback(te=>{let ae=!1;const de=p.current;return de&&window.getComputedStyle(de,null).getPropertyValue("direction")==="rtl"&&(ae=!0),function(le){le.preventDefault();const ve=p.current;if(!ve)return()=>null;const{direction:_e,dragState:Ne,id:Pe,keyboardResizeBy:Se,onLayout:Ce}=k.current,{layout:O,panelDataArray:X}=C.current,{initialLayout:ee}=Ne??{},V=aie(Pe,te,ve);let H=q5e(le,te,_e,Ne,Se,ve);const se=_e==="horizontal";se&&ae&&(H=-H);const z=X.map(ce=>ce.constraints),Q=zb({delta:H,initialLayout:ee??O,panelConstraints:z,pivotIndices:V,prevLayout:O,trigger:Xse(le)?"keyboard":"mouse-or-touch"}),Y=!_k(O,Q);(Zse(le)||Jse(le))&&S.current!=H&&(S.current=H,!Y&&H!==0?se?JP(te,H<0?eie:tie):JP(te,H<0?nie:rie):JP(te,0)),Y&&(v(Q),C.current.layout=Q,Ce&&Ce(Q),tv(X,Q,b.current))}},[]),q=_.useCallback((te,ae)=>{const{onLayout:de}=k.current,{layout:ue,panelDataArray:le}=C.current,ve=le.map(O=>O.constraints),{panelSize:_e,pivotIndices:Ne}=Xf(le,te,ue);Zt(_e!=null,`Panel size not found for panel "${te.id}"`);const Se=mv(le,te)===le.length-1?_e-ae:ae-_e,Ce=zb({delta:Se,initialLayout:ue,panelConstraints:ve,pivotIndices:Ne,prevLayout:ue,trigger:"imperative-api"});_k(ue,Ce)||(v(Ce),C.current.layout=Ce,de&&de(Ce),tv(le,Ce,b.current))},[]),I=_.useCallback((te,ae)=>{const{layout:de,panelDataArray:ue}=C.current,{collapsedSize:le=0,collapsible:ve}=ae,{collapsedSize:_e=0,collapsible:Ne,maxSize:Pe=100,minSize:Se=0}=te.constraints,{panelSize:Ce}=Xf(ue,te,de);Ce!=null&&(ve&&Ne&&Hu(Ce,le)?Hu(le,_e)||q(te,_e):Ce<Se?q(te,Se):Ce>Pe&&q(te,Pe))},[q]),B=_.useCallback((te,ae)=>{const{direction:de}=k.current,{layout:ue}=C.current;if(!p.current)return;const le=wj(te,p.current);Zt(le,`Drag handle element not found for id "${te}"`);const ve=lie(de,ae);g({dragHandleId:te,dragHandleRect:le.getBoundingClientRect(),initialCursorPosition:ve,initialLayout:ue})},[]),$=_.useCallback(()=>{g(null)},[]),ie=_.useCallback(te=>{const{panelDataArray:ae}=C.current,de=mv(ae,te);de>=0&&(ae.splice(de,1),delete b.current[te.id],C.current.panelDataArrayChanged=!0,x())},[x]),ne=_.useMemo(()=>({collapsePanel:A,direction:r,dragState:m,expandPanel:T,getPanelSize:j,getPanelStyle:D,groupId:f,isPanelCollapsed:R,isPanelExpanded:M,reevaluatePanelConstraints:I,registerPanel:N,registerResizeHandle:U,resizePanel:q,startDragging:B,stopDragging:$,unregisterPanel:ie,panelGroupElement:p.current}),[A,m,r,T,j,D,f,R,M,I,N,U,q,B,$,ie]),L={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return _.createElement(yj.Provider,{value:ne},_.createElement(d,{...h,children:e,className:t,id:i,ref:p,style:{...L,...u},[jr.group]:"",[jr.groupDirection]:r,[jr.groupId]:f}))}const fie=_.forwardRef((n,e)=>_.createElement(hie,{...n,forwardedRef:e}));hie.displayName="PanelGroup";fie.displayName="forwardRef(PanelGroup)";function mv(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function Xf(n,e,t){const r=mv(n,e),i=r===n.length-1?[r-1,r]:[r,r+1],a=t[r];return{...e.constraints,panelSize:a,pivotIndices:i}}function Q5e({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:r}){_.useEffect(()=>{if(n||t==null||r==null)return;const s=wj(e,r);if(s==null)return;const i=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),t(a);break}case"F6":{a.preventDefault();const o=s.getAttribute(jr.groupId);Zt(o,`No group element found for id "${o}"`);const l=H1(o,r),u=iie(o,e,r);Zt(u!==null,`No resize element found for id "${e}"`);const d=a.shiftKey?u>0?u-1:l.length-1:u+1<l.length?u+1:0;l[d].focus();break}}};return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}},[r,n,e,t])}function pie({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:r,id:s,onBlur:i,onClick:a,onDragging:o,onFocus:l,onPointerDown:u,onPointerUp:d,style:h={},tabIndex:f=0,tagName:p="div",...m}){var g,y;const v=_.useRef(null),x=_.useRef({onClick:a,onDragging:o,onPointerDown:u,onPointerUp:d});_.useEffect(()=>{x.current.onClick=a,x.current.onDragging=o,x.current.onPointerDown=u,x.current.onPointerUp=d});const b=_.useContext(yj);if(b===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:S,registerResizeHandle:k,startDragging:C,stopDragging:A,panelGroupElement:T}=b,j=pB(s),[D,R]=_.useState("inactive"),[M,N]=_.useState(!1),[U,q]=_.useState(null),I=_.useRef({state:D});$m(()=>{I.current.state=D}),_.useEffect(()=>{if(t)q(null);else{const ne=k(j);q(()=>ne)}},[t,j,k]);const B=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,$=(y=r==null?void 0:r.fine)!==null&&y!==void 0?y:5;_.useEffect(()=>{if(t||U==null)return;const ne=v.current;Zt(ne,"Element ref not attached");let L=!1;return F5e(j,ne,E,{coarse:B,fine:$},(ae,de,ue)=>{if(!de){R("inactive");return}switch(ae){case"down":{R("drag"),L=!1,Zt(ue,'Expected event to be defined for "down" action'),C(j,ue);const{onDragging:le,onPointerDown:ve}=x.current;le==null||le(!0),ve==null||ve();break}case"move":{const{state:le}=I.current;L=!0,le!=="drag"&&R("hover"),Zt(ue,'Expected event to be defined for "move" action'),U(ue);break}case"up":{R("hover"),A();const{onClick:le,onDragging:ve,onPointerUp:_e}=x.current;ve==null||ve(!1),_e==null||_e(),L||le==null||le();break}}})},[B,E,t,$,k,j,U,C,A]),Q5e({disabled:t,handleId:j,resizeHandler:U,panelGroupElement:T});const ie={touchAction:"none",userSelect:"none"};return _.createElement(p,{...m,children:n,className:e,id:s,onBlur:()=>{N(!1),i==null||i()},onFocus:()=>{N(!0),l==null||l()},ref:v,role:"separator",style:{...ie,...h},tabIndex:f,[jr.groupDirection]:E,[jr.groupId]:S,[jr.resizeHandle]:"",[jr.resizeHandleActive]:D==="drag"?"pointer":M?"keyboard":void 0,[jr.resizeHandleEnabled]:!t,[jr.resizeHandleId]:j,[jr.resizeHandleState]:D})}pie.displayName="PanelResizeHandle";const eBe=({className:n,...e})=>c.jsx(fie,{className:ke("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...e}),eD=Yse,nW=({withHandle:n,className:e,...t})=>c.jsx(pie,{className:ke("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...t,children:n&&c.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:c.jsx($fe,{className:"h-2.5 w-2.5"})})});function rW(){const{user:n,isLoading:e}=Vt(),{noteId:t}=Xc(),[r,s]=OS();vr();const i=r.get("tab")||"read",a=r.get("type"),[o,l]=_.useState(!1),[u,d]=_.useState(new Set),[h,f]=_.useState(!1),[p,m]=_.useState([]),[g,y]=_.useState(""),{data:v=[],isLoading:x,refetch:b}=rne(),E=v.find(R=>R.id===t),S=(E==null?void 0:E.type)||a,k=t==="new";_.useEffect(()=>{o||d(new Set)},[o]);const C=R=>{const M=new URLSearchParams(r);M.set("tab",R),R==="read"&&M.delete("type"),s(M,{replace:!0})},A=R=>{const M=new Set(u);M.has(R)?M.delete(R):M.add(R),d(M)},T=()=>{d(new Set),l(!1)},j=R=>{m(R)},D=R=>{y(R)};return e?c.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):n?c.jsx(Jte,{defaultOpen:i==="notes",children:c.jsxs(QPe,{children:[c.jsxs("div",{className:"min-h-screen flex w-full bg-background",children:[i==="notes"&&c.jsx(eDe,{selectionMode:o,selectedNotes:u,onToggleSelection:A,onToggleSelectionMode:()=>l(!o)}),c.jsxs(ene,{className:"flex-1 flex flex-col",children:[c.jsx("header",{className:"border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky top-0 z-40",children:c.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Rt,{to:"/",className:"text-muted-foreground hover:text-foreground transition-colors",children:c.jsx(oT,{className:"h-5 w-5"})}),i==="notes"&&c.jsx(E5,{className:"md:hidden"}),c.jsx("h1",{className:"font-serif text-xl font-semibold",children:"Scripture Study"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(N0,{value:i,onValueChange:C,children:c.jsxs(Ng,{children:[c.jsxs(Rr,{value:"read",className:"gap-2",children:[c.jsx(En,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Read"})]}),c.jsxs(Rr,{value:"notes",className:"gap-2",children:[c.jsx(mw,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Notes"})]})]})}),c.jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"gap-2",children:[c.jsx(wi,{className:"h-4 w-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Templates"})]})]})]})}),c.jsx("main",{className:"flex-1 overflow-hidden",children:i==="read"?c.jsxs(eBe,{direction:"horizontal",className:"h-full",children:[c.jsx(eD,{defaultSize:40,minSize:25,children:c.jsx(S5e,{selectedVerseIds:p,onVerseSelectionChange:j,onPassageReferenceChange:D})}),c.jsx(nW,{withHandle:!0}),c.jsx(eD,{defaultSize:35,minSize:20,children:c.jsx(k5e,{selectedVerseIds:p,passageReference:g})}),c.jsx(nW,{withHandle:!0}),c.jsx(eD,{defaultSize:25,minSize:15,children:c.jsx(C5e,{selectedVerseIds:p,passageReference:g})})]}):c.jsx(c.Fragment,{children:x?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})}):k&&a?c.jsx(GH,{noteId:null,noteType:a,isNew:!0},`new:${a}`):t&&S?c.jsx(GH,{noteId:t,noteType:S},`${t}:${S}`):c.jsx(g5e,{variant:"home"})})})]}),i==="notes"&&c.jsx(v5e,{selectedNotes:u,allNotes:v,onClearSelection:T,onComplete:b})]}),c.jsx(ai,{open:h,onOpenChange:f,children:c.jsxs(Ls,{className:"max-w-4xl max-h-[85vh] overflow-y-auto",children:[c.jsx(Fs,{children:c.jsx(Bs,{className:"font-serif text-xl",children:"Manage Templates"})}),c.jsx(x5e,{})]})})]})}):c.jsx(yT,{to:"/auth",replace:!0})}var It=function(){return It=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},It.apply(this,arguments)};function tBe(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function mie(n,e,t){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}function dE(n){return n.mode==="multiple"}function hE(n){return n.mode==="range"}function _j(n){return n.mode==="single"}var nBe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rd
967p-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function rBe(n,e){return hr(n,"LLLL y",e)}function sBe(n,e){return hr(n,"d",e)}function iBe(n,e){return hr(n,"LLLL",e)}function aBe(n){return"".concat(n)}function oBe(n,e){return hr(n,"cccccc",e)}function lBe(n,e){return hr(n,"yyyy",e)}var cBe=Object.freeze({__proto__:null,formatCaption:rBe,formatDay:sBe,formatMonthCaption:iBe,formatWeekNumber:aBe,formatWeekdayName:oBe,formatYearCaption:lBe}),uBe=function(n,e,t){return hr(n,"do MMMM (EEEE)",t)},dBe=function(){return"Month: "},hBe=function(){return"Go to next month"},fBe=function(){return"Go to previous month"},pBe=function(n,e){return hr(n,"cccc",e)},mBe=function(n){return"Week n. ".concat(n)},gBe=function(){return"Year: "},vBe=Object.freeze({__proto__:null,labelDay:uBe,labelMonthDropdown:dBe,labelNext:hBe,labelPrevious:fBe,labelWeekNumber:mBe,labelWeekday:pBe,labelYearDropdown:gBe});function yBe(){var n="buttons",e=nBe,t=o5,r={},s={},i=1,a={},o=new Date;return{captionLayout:n,classNames:e,formatters:cBe,labels:vBe,locale:t,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:a,today:o,mode:"default"}}function xBe(n){var e=n.fromYear,t=n.toYear,r=n.fromMonth,s=n.toMonth,i=n.fromDate,a=n.toDate;return r?i=Gi(r):e&&(i=new Date(e,0,1)),s?a=QS(s):t&&(a=new Date(t,11,31)),{fromDate:i?Kx(i):void 0,toDate:a?Kx(a):void 0}}var gie=_.createContext(void 0);function bBe(n){var e,t=n.initialProps,r=yBe(),s=xBe(t),i=s.fromDate,a=s.toDate,o=(e=t.captionLayout)!==null&&e!==void 0?e:r.captionLayout;o!=="buttons"&&(!i||!a)&&(o="buttons");var l;(_j(t)||dE(t)||hE(t))&&(l=t.onSelect);var u=It(It(It({},r),t),{captionLayout:o,classNames:It(It({},r.classNames),t.classNames),components:It({},t.components),formatters:It(It({},r.formatters),t.formatters),fromDate:i,labels:It(It({},r.labels),t.labels),mode:t.mode||r.mode,modifiers:It(It({},r.modifiers),t.modifiers),modifiersClassNames:It(It({},r.modifiersClassNames),t.modifiersClassNames),onSelect:l,styles:It(It({},r.styles),t.styles),toDate:a});return c.jsx(gie.Provider,{value:u,children:n.children})}function Yn(){var n=_.useContext(gie);if(!n)throw new Error("useDayPicker must be used within a DayPickerProvider.");return n}function vie(n){var e=Yn(),t=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return c.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:n.id,children:i(n.displayMonth,{locale:t})})}function wBe(n){return c.jsx("svg",It({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},n,{children:c.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function yie(n){var e,t,r=n.onChange,s=n.value,i=n.children,a=n.caption,o=n.className,l=n.style,u=Yn(),d=(t=(e=u.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&t!==void 0?t:wBe;return c.jsxs("div",{className:o,style:l,children:[c.jsx("span",{className:u.classNames.vhidden,children:n["aria-label"]}),c.jsx("select",{name:n.name,"aria-label":n["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:s,onChange:r,children:i}),c.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[a,c.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function _Be(n){var e,t=Yn(),r=t.fromDate,s=t.toDate,i=t.styles,a=t.locale,o=t.formatters.formatMonthCaption,l=t.classNames,u=t.components,d=t.labels.labelMonthDropdown;if(!r)return c.jsx(c.Fragment,{});if(!s)return c.jsx(c.Fragment,{});var h=[];
967if(vTe(r,s))for(var f=Gi(r),p=r.getMonth();p<=s.getMonth();p++)h.push(gP(f,p));else for(var f=Gi(new Date),p=0;p<=11;p++)h.push(gP(f,p));var m=function(y){var v=Number(y.target.value),x=gP(Gi(n.displayMonth),v);n.onChange(x)},g=(e=u==null?void 0:u.Dropdown)!==null&&e!==void 0?e:yie;return c.jsx(g,{name:"months","aria-label":d(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:n.displayMonth.getMonth(),caption:o(n.displayMonth,{locale:a}),children:h.map(function(y){return c.jsx("option",{value:y.getMonth(),children:o(y,{locale:a})},y.getMonth())})})}function SBe(n){var e,t=n.displayMonth,r=Yn(),s=r.fromDate,i=r.toDate,a=r.locale,o=r.styles,l=r.classNames,u=r.components,d=r.formatters.formatYearCaption,h=r.labels.labelYearDropdown,f=[];if(!s)return c.jsx(c.Fragment,{});if(!i)return c.jsx(c.Fragment,{});for(var p=s.getFullYear(),m=i.getFullYear(),g=p;g<=m;g++)f.push(XU(yQ(new Date),g));var y=function(x){var b=XU(Gi(t),Number(x.target.value));n.onChange(b)},v=(e=u==null?void 0:u.Dropdown)!==null&&e!==void 0?e:yie;return c.jsx(v,{name:"years","aria-label":h(),className:l.dropdown_year,style:o.dropdown_year,onChange:y,value:t.getFullYear(),caption:d(t,{locale:a}),children:f.map(function(x){return c.jsx("option",{value:x.getFullYear(),children:d(x,{locale:a})},x.getFullYear())})})}function EBe(n,e){var t=_.useState(n),r=t[0],s=t[1],i=e===void 0?r:e;return[i,s]}function kBe(n){var e=n.month,t=n.defaultMonth,r=n.today,s=e||t||r||new Date,i=n.toDate,a=n.fromDate,o=n.numberOfMonths,l=o===void 0?1:o;if(i&&Xx(i,s)<0){var u=-1*(l-1);s=Xl(i,u)}return a&&Xx(s,a)<0&&(s=a),Gi(s)}function CBe(){var n=Yn(),e=kBe(n),t=EBe(e,n.month),r=t[0],s=t[1],i=function(a){var o;if(!n.disableNavigation){var l=Gi(a);s(l),(o=n.onMonthChange)===null||o===void 0||o.call(n,l)}};return[r,i]}function ABe(n,e){for(var t=e.reverseMonths,r=e.numberOfMonths,s=Gi(n),i=Gi(Xl(s,r)),a=Xx(i,s),o=[],l=0;l<a;l++){var u=Xl(s,l);o.push(u)}return t&&(o=o.reverse()),o}function NBe(n,e){if(!e.disableNavigation){var t=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,a=r?i:1,o=Gi(n);if(!t)return Xl(o,a);var l=Xx(t,n);if(!(l<i))return Xl(o,a)}}function TBe(n,e){if(!e.disableNavigation){var t=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,a=r?i:1,o=Gi(n);if(!t)return Xl(o,-a);var l=Xx(o,t);if(!(l<=0))return Xl(o,-a)}}var xie=_.createContext(void 0);function jBe(n){var e=Yn(),t=CBe(),r=t[0],s=t[1],i=ABe(r,e),a=NBe(r,e),o=TBe(r,e),l=function(h){return i.some(function(f){return zT(h,f)})},u=function(h,f){l(h)||(f&&kQ(h,f)?s(Xl(h,1+e.numberOfMonths*-1)):s(h))},d={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:u,previousMonth:o,nextMonth:a,isDateDisplayed:l};return c.jsx(xie.Provider,{value:d,children:n.children})}function fE(){var n=_.useContext(xie);if(!n)throw new Error("useNavigation must be used within a NavigationProvider");return n}function sW(n){var e,t=Yn(),r=t.classNames,s=t.styles,i=t.components,a=fE().goToMonth,o=function(d){a(Xl(d,n.displayIndex?-n.displayIndex:0))},l=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:vie,u=c.jsx(l,{id:n.id,displayMonth:n.displayMonth});return c.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[c.jsx("div",{className:r.vhidden,children:u}),c.jsx(_Be,{onChange:o,displayMonth:n.displayMonth}),c.jsx(SBe,{onChange:o,displayMonth:n.displayMonth})]})}function RBe(n){return c.jsx("svg",It({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:c.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function PBe(n){return c.jsx("svg",It({width:"16px",height:"16px",viewBox:"0 0 120 120"}
967,n,{children:c.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var nN=_.forwardRef(function(n,e){var t=Yn(),r=t.classNames,s=t.styles,i=[r.button_reset,r.button];n.className&&i.push(n.className);var a=i.join(" "),o=It(It({},s.button_reset),s.button);return n.style&&Object.assign(o,n.style),c.jsx("button",It({},n,{ref:e,type:"button",className:a,style:o}))});function DBe(n){var e,t,r=Yn(),s=r.dir,i=r.locale,a=r.classNames,o=r.styles,l=r.labels,u=l.labelPrevious,d=l.labelNext,h=r.components;if(!n.nextMonth&&!n.previousMonth)return c.jsx(c.Fragment,{});var f=u(n.previousMonth,{locale:i}),p=[a.nav_button,a.nav_button_previous].join(" "),m=d(n.nextMonth,{locale:i}),g=[a.nav_button,a.nav_button_next].join(" "),y=(e=h==null?void 0:h.IconRight)!==null&&e!==void 0?e:PBe,v=(t=h==null?void 0:h.IconLeft)!==null&&t!==void 0?t:RBe;return c.jsxs("div",{className:a.nav,style:o.nav,children:[!n.hidePrevious&&c.jsx(nN,{name:"previous-month","aria-label":f,className:p,style:o.nav_button_previous,disabled:!n.previousMonth,onClick:n.onPreviousClick,children:s==="rtl"?c.jsx(y,{className:a.nav_icon,style:o.nav_icon}):c.jsx(v,{className:a.nav_icon,style:o.nav_icon})}),!n.hideNext&&c.jsx(nN,{name:"next-month","aria-label":m,className:g,style:o.nav_button_next,disabled:!n.nextMonth,onClick:n.onNextClick,children:s==="rtl"?c.jsx(v,{className:a.nav_icon,style:o.nav_icon}):c.jsx(y,{className:a.nav_icon,style:o.nav_icon})})]})}function iW(n){var e=Yn().numberOfMonths,t=fE(),r=t.previousMonth,s=t.nextMonth,i=t.goToMonth,a=t.displayMonths,o=a.findIndex(function(m){return zT(n.displayMonth,m)}),l=o===0,u=o===a.length-1,d=e>1&&(l||!u),h=e>1&&(u||!l),f=function(){r&&i(r)},p=function(){s&&i(s)};return c.jsx(DBe,{displayMonth:n.displayMonth,hideNext:d,hidePrevious:h,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:p})}function OBe(n){var e,t=Yn(),r=t.classNames,s=t.disableNavigation,i=t.styles,a=t.captionLayout,o=t.components,l=(e=o==null?void 0:o.CaptionLabel)!==null&&e!==void 0?e:vie,u;return s?u=c.jsx(l,{id:n.id,displayMonth:n.displayMonth}):a==="dropdown"?u=c.jsx(sW,{displayMonth:n.displayMonth,id:n.id}):a==="dropdown-buttons"?u=c.jsxs(c.Fragment,{children:[c.jsx(sW,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id}),c.jsx(iW,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id})]}):u=c.jsxs(c.Fragment,{children:[c.jsx(l,{id:n.id,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),c.jsx(iW,{displayMonth:n.displayMonth,id:n.id})]}),c.jsx("div",{className:r.caption,style:i.caption,children:u})}function MBe(n){var e=Yn(),t=e.footer,r=e.styles,s=e.classNames.tfoot;return t?c.jsx("tfoot",{className:s,style:r.tfoot,children:c.jsx("tr",{children:c.jsx("td",{colSpan:8,children:t})})}):c.jsx(c.Fragment,{})}function IBe(n,e,t){for(var r=t?ng(new Date):Wo(new Date,{locale:n,weekStartsOn:e}),s=[],i=0;i<7;i++){var a=Li(r,i);s.push(a)}return s}function LBe(){var n=Yn(),e=n.classNames,t=n.styles,r=n.showWeekNumber,s=n.locale,i=n.weekStartsOn,a=n.ISOWeek,o=n.formatters.formatWeekdayName,l=n.labels.labelWeekday,u=IBe(s,i,a);return c.jsxs("tr",{style:t.head_row,className:e.head_row,children:[r&&c.jsx("td",{style:t.head_cell,className:e.head_cell}),u.map(function(d,h){return c.jsx("th",{scope:"col",className:e.head_cell,style:t.head_cell,"aria-label":l(d,{locale:s}),children:o(d,{locale:s})},h)})]})}function FBe(){var n,e=Yn(),t=e.classNames,r=e.styles,s=e.components,i=(n=s==null?void 0:s.HeadRow)!==null&&n!==void 0?n:LBe;return c.jsx("thead",{style:r.head,className:t.head,children:c.jsx(i,{})})}function BBe(n){var e=Yn(),t=e.locale,r=e.formatters.formatDay;return c.jsx(c.Fragment,{children:r(n.date,{locale:t})})}var vB=_.createContext(void 0);function zBe(n){if(!dE(n.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return c.jsx(vB.Provider,{value:e,children:n.children})}return c.jsx($Be,{initialProps:n.initialProps,children:n.children})}function $Be(n){var e=n.initialProps,t=n.children,r=e.selected,s=e.min,i=e.max,a=function(u,d,h){var f,p;(f=e.onDayClick)===null||f===void 0||f.call(e,u,d,h);var m=!!(d.selected&&s&&(r==null?void 0:r.length)===s);if(!m){var g=!!(!d.selected&&i&&(r==null?void 0:r.length)===i);if(!g){var y=r?mie([],r):[];if(d.selected){var v=y.findIndex(function(x){return Si(u,x)});y.splice(v,1)}else y.push(u);(p=e.onSelect)===null||p===void 0||p.call(e,y,u,d,h)}}},o={disabled:[]};r&&o.disabled.push(function(u){var d=i&&r.length>i-1,h=r.some(function(f){return Si(f,u)});return!!(d&&!h)});var l={selected:r,onDayClick:a,modifiers:o};return c.jsx(vB.Provider,{value:l,children:t})}function yB(){var n=_.useContext(vB);if(!n)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return n}function UBe(n,e){var t=e||{},r=t.from,s=t.to;return r&&s?Si(s,n)&&Si(r,n)?void 0:Si(s,n)?{from:s,to:void 0}:Si(r,n)?void 0:KM(r,n)?{from:n,to:s}:{from:r,to:n}:s?KM(n,s)?{from:s,to:n}:{from:n,to:s}:r?kQ(n,r)?{from:n,to:r}:{from:r,to:n}:{from:n,to:void 0}}var xB=_.createContext(void 0);function VBe(n){if(!hE(n.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return c.jsx(xB.Provider,{value:e,children:n.children})}return c.jsx(HBe,{initialProps:n.initialProps,children:n.children})}function HBe(n){var e=n.initialProps,t=n.children,r=e.selected,s=r||{},i=s.from,a=s.to,o=e.min,l=e.max,u=function(p,m,g){var y,v;(y=e.onDayClick)===null||y===void 0||y.call(e,p,m,g);var x=UBe(p,r);(v=e.onSelect)===null||v===void 0||v.call(e,x,p,m,g)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],a?(d.range_end=[a],Si(i,a)||(d.range_middle=[{after:i,before:a}])):d.range_end=[i]):a&&(d.range_start=[a],d.range_end=[a]),o&&(i&&!a&&d.disabled.push({after:aC(i,o-1),before:Li(i,o-1)}),i&&a&&d.disabled.push({after:i,before:Li(i,o-1)}),!i&&a&&d.disabled.push({after:aC(a,o-1),before:Li(a,o-1)})),l){if(i&&!a&&(d.disabled.push({before:Li(i,-l+1)}),d.disabled.push({after:Li(i,l-1)})),i&&a){var h=Mc(a,i)+1,f=l-h;d.disabled.push({before:aC(i,f)}),d.disabled.push({after:Li(a,f)})}!i&&a&&(d.disabled.push({before:Li(a,-l+1)}),d.disabled.push({after:Li(a,l-1)}))}return c.jsx(xB.Provider,{value:{selected:r,onDayClick:u,modifiers:d},children:t})}function bB(){var n=_.useContext(xB);if(!n)throw new Error("useSelectRange must be used within a SelectRangeProvider");return n}function gC(n){return Array.isArray(n)?mie([],n):n!==void 0?[n]:[]}function WBe(n){var e={};
967return Object.entries(n).forEach(function(t){var r=t[0],s=t[1];e[r]=gC(s)}),e}var Zl;(function(n){n.Outside="outside",n.Disabled="disabled",n.Selected="selected",n.Hidden="hidden",n.Today="today",n.RangeStart="range_start",n.RangeEnd="range_end",n.RangeMiddle="range_middle"})(Zl||(Zl={}));var qBe=Zl.Selected,su=Zl.Disabled,GBe=Zl.Hidden,KBe=Zl.Today,tD=Zl.RangeEnd,nD=Zl.RangeMiddle,rD=Zl.RangeStart,YBe=Zl.Outside;function XBe(n,e,t){var r,s=(r={},r[qBe]=gC(n.selected),r[su]=gC(n.disabled),r[GBe]=gC(n.hidden),r[KBe]=[n.today],r[tD]=[],r[nD]=[],r[rD]=[],r[YBe]=[],r);return n.fromDate&&s[su].push({before:n.fromDate}),n.toDate&&s[su].push({after:n.toDate}),dE(n)?s[su]=s[su].concat(e.modifiers[su]):hE(n)&&(s[su]=s[su].concat(t.modifiers[su]),s[rD]=t.modifiers[rD],s[nD]=t.modifiers[nD],s[tD]=t.modifiers[tD]),s}var bie=_.createContext(void 0);function ZBe(n){var e=Yn(),t=yB(),r=bB(),s=XBe(e,t,r),i=WBe(e.modifiers),a=It(It({},s),i);return c.jsx(bie.Provider,{value:a,children:n.children})}function wie(){var n=_.useContext(bie);if(!n)throw new Error("useModifiers must be used within a ModifiersProvider");return n}function JBe(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function QBe(n){return!!(n&&typeof n=="object"&&"from"in n)}function eze(n){return!!(n&&typeof n=="object"&&"after"in n)}function tze(n){return!!(n&&typeof n=="object"&&"before"in n)}function nze(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function rze(n,e){var t,r=e.from,s=e.to;if(r&&s){var i=Mc(s,r)<0;i&&(t=[s,r],r=t[0],s=t[1]);var a=Mc(n,r)>=0&&Mc(s,n)>=0;return a}return s?Si(s,n):r?Si(r,n):!1}function sze(n){return i5(n)}function ize(n){return Array.isArray(n)&&n.every(i5)}function aze(n,e){return e.some(function(t){if(typeof t=="boolean")return t;if(sze(t))return Si(n,t);if(ize(t))return t.includes(n);if(QBe(t))return rze(n,t);if(nze(t))return t.dayOfWeek.includes(n.getDay());if(JBe(t)){var r=Mc(t.before,n),s=Mc(t.after,n),i=r>0,a=s<0,o=KM(t.before,t.after);return o?a&&i:i||a}return eze(t)?Mc(n,t.after)>0:tze(t)?Mc(t.before,n)>0:typeof t=="function"?t(n):!1})}function wB(n,e,t){var r=Object.keys(e).reduce(function(i,a){var o=e[a];return aze(n,o)&&i.push(a),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),t&&!zT(n,t)&&(s.outside=!0),s}function oze(n,e){for(var t=Gi(n[0]),r=QS(n[n.length-1]),s,i,a=t;a<=r;){var o=wB(a,e),l=!o.disabled&&!o.hidden;if(!l){a=Li(a,1);continue}if(o.selected)return a;o.today&&!i&&(i=a),s||(s=a),a=Li(a,1)}return i||s}var lze=365;function _ie(n,e){var t=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,a=e.retry,o=a===void 0?{count:0,lastFocused:n}:a,l=s.weekStartsOn,u=s.fromDate,d=s.toDate,h=s.locale,f={day:Li,week:GM,month:Xl,year:iNe,startOfWeek:function(y){return s.ISOWeek?ng(y):Wo(y,{locale:h,weekStartsOn:l})},endOfWeek:function(y){return s.ISOWeek?xQ(y):a5(y,{locale:h,weekStartsOn:l})}},p=f[t](n,r==="after"?1:-1);r==="before"&&u?p=aNe([u,p]):r==="after"&&d&&(p=oNe([d,p]));var m=!0;if(i){var g=wB(p,i);m=!g.disabled&&!g.hidden}return m?p:o.count>lze?o.lastFocused:_ie(p,{moveBy:t,direction:r,context:s,modifiers:i,retry:It(It({},o),{count:o.count+1})})}var Sie=_.createContext(void 0);function cze(n){var e=fE(),t=wie(),r=_.useState(),s=r[0],i=r[1],a=_.useState(),o=a[0],l=a[1],u=oze(e.displayMonths,t),d=s??(o&&e.isDateDisplayed(o))?o:u,h=function(){l(s),i(void 0)},f=function(y){i(y)},p=Yn(),m=function(y,v){if(s){var x=_ie(s,{moveBy:y,direction:v,context:p,modifiers:t});Si(s,x)||(e.goToDate(x,s),f(x))}},g={focusedDay:s,focusTarget:d,blur:h,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return c.jsx(Sie.Provider,{value:g,children:n.children})}function _B(){var n=_.useContext(Sie);if(!n)throw new Error("useFocusContext must be used within a FocusProvider");return n}function uze(n,e){var t=wie(),r=wB(n,t,e);return r}var SB=_.createContext(void 0);function dze(n){if(!_j(n.initialProps)){var e={selected:void 0};return c.jsx(SB.Provider,{value:e,children:n.children})}return c.jsx(hze,{initialProps:n.initialProps,children:n.children})}function hze(n){var e=n.initialProps,t=n.children,r=function(i,a,o){var l,u,d;if((l=e.onDayClick)===null||l===void 0||l.call(e,i,a,o),a.selected&&!e.required){(u=e.onSelect)===null||u===void 0||u.call(e,void 0,i,a,o);return}(d=e.onSelect)===null||d===void 0||d.call(e,i,i,a,o)}
967,s={selected:e.selected,onDayClick:r};return c.jsx(SB.Provider,{value:s,children:t})}function Eie(){var n=_.useContext(SB);if(!n)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return n}function fze(n,e){var t=Yn(),r=Eie(),s=yB(),i=bB(),a=_B(),o=a.focusDayAfter,l=a.focusDayBefore,u=a.focusWeekAfter,d=a.focusWeekBefore,h=a.blur,f=a.focus,p=a.focusMonthBefore,m=a.focusMonthAfter,g=a.focusYearBefore,y=a.focusYearAfter,v=a.focusStartOfWeek,x=a.focusEndOfWeek,b=function(I){var B,$,ie,ne;_j(t)?(B=r.onDayClick)===null||B===void 0||B.call(r,n,e,I):dE(t)?($=s.onDayClick)===null||$===void 0||$.call(s,n,e,I):hE(t)?(ie=i.onDayClick)===null||ie===void 0||ie.call(i,n,e,I):(ne=t.onDayClick)===null||ne===void 0||ne.call(t,n,e,I)},E=function(I){var B;f(n),(B=t.onDayFocus)===null||B===void 0||B.call(t,n,e,I)},S=function(I){var B;h(),(B=t.onDayBlur)===null||B===void 0||B.call(t,n,e,I)},k=function(I){var B;(B=t.onDayMouseEnter)===null||B===void 0||B.call(t,n,e,I)},C=function(I){var B;(B=t.onDayMouseLeave)===null||B===void 0||B.call(t,n,e,I)},A=function(I){var B;(B=t.onDayPointerEnter)===null||B===void 0||B.call(t,n,e,I)},T=function(I){var B;(B=t.onDayPointerLeave)===null||B===void 0||B.call(t,n,e,I)},j=function(I){var B;(B=t.onDayTouchCancel)===null||B===void 0||B.call(t,n,e,I)},D=function(I){var B;(B=t.onDayTouchEnd)===null||B===void 0||B.call(t,n,e,I)},R=function(I){var B;(B=t.onDayTouchMove)===null||B===void 0||B.call(t,n,e,I)},M=function(I){var B;(B=t.onDayTouchStart)===null||B===void 0||B.call(t,n,e,I)},N=function(I){var B;(B=t.onDayKeyUp)===null||B===void 0||B.call(t,n,e,I)},U=function(I){var B;switch(I.key){case"ArrowLeft":I.preventDefault(),I.stopPropagation(),t.dir==="rtl"?o():l();break;case"ArrowRight":I.preventDefault(),I.stopPropagation(),t.dir==="rtl"?l():o();break;case"ArrowDown":I.preventDefault(),I.stopPropagation(),u();break;case"ArrowUp":I.preventDefault(),I.stopPropagation(),d();break;case"PageUp":I.preventDefault(),I.stopPropagation(),I.shiftKey?g():p();break;case"PageDown":I.preventDefault(),I.stopPropagation(),I.shiftKey?y():m();break;case"Home":I.preventDefault(),I.stopPropagation(),v();break;case"End":I.preventDefault(),I.stopPropagation(),x();break}(B=t.onDayKeyDown)===null||B===void 0||B.call(t,n,e,I)},q={onClick:b,onFocus:E,onBlur:S,onKeyDown:U,onKeyUp:N,onMouseEnter:k,onMouseLeave:C,onPointerEnter:A,onPointerLeave:T,onTouchCancel:j,onTouchEnd:D,onTouchMove:R,onTouchStart:M};return q}function pze(){var n=Yn(),e=Eie(),t=yB(),r=bB(),s=_j(n)?e.selected:dE(n)?t.selected:hE(n)?r.selected:void 0;return s}function mze(n){return Object.values(Zl).includes(n)}function gze(n,e){var t=[n.classNames.day];return Object.keys(e).forEach(function(r){var s=n.modifiersClassNames[r];if(s)t.push(s);else if(mze(r)){var i=n.classNames["day_".concat(r)];i&&t.push(i)}}),t}function vze(n,e){var t=It({},n.styles.day);return Object.keys(e).forEach(function(r){var s;t=It(It({},t),(s=n.modifiersStyles)===null||s===void 0?void 0:s[r])}),t}function yze(n,e,t){var r,s,i,a=Yn(),o=_B(),l=uze(n,e),u=fze(n,l),d=pze(),h=!!(a.onDayCl
967ick||a.mode!=="default");_.useEffect(function(){var k;l.outside||o.focusedDay&&h&&Si(o.focusedDay,n)&&((k=t.current)===null||k===void 0||k.focus())},[o.focusedDay,n,t,h,l.outside]);var f=gze(a,l).join(" "),p=vze(a,l),m=!!(l.outside&&!a.showOutsideDays||l.hidden),g=(i=(s=a.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:BBe,y=c.jsx(g,{date:n,displayMonth:e,activeModifiers:l}),v={style:p,className:f,children:y,role:"gridcell"},x=o.focusTarget&&Si(o.focusTarget,n)&&!l.outside,b=o.focusedDay&&Si(o.focusedDay,n),E=It(It(It({},v),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=b||x?0:-1,r)),u),S={isButton:h,isHidden:m,activeModifiers:l,selectedDays:d,buttonProps:E,divProps:v};return S}function xze(n){var e=_.useRef(null),t=yze(n.date,n.displayMonth,e);return t.isHidden?c.jsx("div",{role:"gridcell"}):t.isButton?c.jsx(nN,It({name:"day",ref:e},t.buttonProps)):c.jsx("div",It({},t.divProps))}function bze(n){var e=n.number,t=n.dates,r=Yn(),s=r.onWeekNumberClick,i=r.styles,a=r.classNames,o=r.locale,l=r.labels.labelWeekNumber,u=r.formatters.formatWeekNumber,d=u(Number(e),{locale:o});if(!s)return c.jsx("span",{className:a.weeknumber,style:i.weeknumber,children:d});var h=l(Number(e),{locale:o}),f=function(p){s(e,t,p)};return c.jsx(nN,{name:"week-number","aria-label":h,className:a.weeknumber,style:i.weeknumber,onClick:f,children:d})}function wze(n){var e,t,r=Yn(),s=r.styles,i=r.classNames,a=r.showWeekNumber,o=r.components,l=(e=o==null?void 0:o.Day)!==null&&e!==void 0?e:xze,u=(t=o==null?void 0:o.WeekNumber)!==null&&t!==void 0?t:bze,d;return a&&(d=c.jsx("td",{className:i.cell,style:s.cell,children:c.jsx(u,{number:n.weekNumber,dates:n.dates})})),c.jsxs("tr",{className:i.row,style:s.row,children:[d,n.dates.map(function(h){return c.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:c.jsx(l,{displayMonth:n.displayMonth,date:h})},fTe(h))})]})}function aW(n,e,t){for(var r=t!=null&&t.ISOWeek?xQ(e):a5(e,t),s=t!=null&&t.ISOWeek?ng(n):Wo(n,t),i=Mc(r,s),a=[],o=0;o<=i;o++)a.push(Li(s,o));var l=a.reduce(function(u,d){var h=t!=null&&t.ISOWeek?bQ(d):_Q(d,t),f=u.find(function(p){return p.weekNumber===h});return f?(f.dates.push(d),u):(u.push({weekNumber:h,dates:[d]}),u)},[]);return l}function _ze(n,e){var t=aW(Gi(n),QS(n),e);if(e!=null&&e.useFixedWeeks){var r=mTe(n,e);if(r<6){var s=t[t.length-1],i=s.dates[s.dates.length-1],a=GM(i,6-r),o=aW(GM(i,1),a,e);t.push.apply(t,o)}}return t}function Sze(n){var e,t,r,s=Yn(),i=s.locale,a=s.classNames,o=s.styles,l=s.hideHead,u=s.fixedWeeks,d=s.components,h=s.weekStartsOn,f=s.firstWeekContainsDate,p=s.ISOWeek,m=_ze(n.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:i,weekStartsOn:h,firstWeekContainsDate:f}),g=(e=d==null?void 0:d.Head)!==null&&e!==void 0?e:FBe,y=(t=d==null?void 0:d.Row)!==null&&t!==void 0?t:wze,v=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:MBe;return c.jsxs("table",{id:n.id,className:a.table,style:o.table,role:"grid","aria-labelledby":n["aria-labelledby"],children:[!l&&c.jsx(g,{}),c.jsx("tbody",{className:a.tbody,style:o.tbody,children:m.map(function(x){return c.jsx(y,{displayMonth:n.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),c.jsx(v,{displayMonth:n.displayMonth})]})}function Eze(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var kze=Eze()?_.useLayoutEffect:_.useEffect,sD=!1,Cze=0;function oW(){return"react-day-picker-".concat(++Cze)}function Aze(n){var e,t=n??(sD?oW():null),r=_.useState(t),s=r[0],i=r[1];return kze(function(){s===null&&i(oW())},[]),_.useEffect(function(){sD===!1&&(sD=!0)},[]),(e=n??s)!==null&&e!==void 0?e:void 0}function Nze(n){var e,t,r=Yn(),s=r.dir,i=r.classNames,a=r.styles,o=r.components,l=fE().displayMonths,u=Aze(r.id?"".concat(r.id,"-").concat(n.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(n.displayIndex):void 0,h=[i.month],f=a.month,p=n.displayIndex===0,m=n.displayIndex===l.length-1,g=!p&&!m;s==="rtl"&&(e=[p,m],m=e[0],p=e[1]),p&&(h.push(i.caption_start),f=It(It({},f),a.caption_start)),m&&(h.push(i.caption_end),f=It(It({},f),a.caption_end)),g&&(h.push(i.caption_between),f=It(It({},f),a.caption_between));var y=(t=o==null?void 0:o.Caption)!==null&&t!==void 0?t:OBe;return c.jsxs("div",{className:h.join(" "),style:f,children:[c.jsx(y,{id:u,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),c.jsx(Sze,{id:d,"aria-labelledby":u,displayMonth:n.displayMonth})]},n.displayIndex)}function Tze(n){var e=Yn(),t=e.classNames,r=e.styles;return c.jsx("div",{className:t.months,style:r.months,children:n.children})}function jze(n){var e,t,r=n.initialProps,s=Yn(),i=_B(),a=fE(),o=_.useState(!1),l=o[0],u=o[1];_.useEffect(function(){s.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),u(!0)))},[s.initialFocus,l,i.focus,i.focusTarget,i]);var d=[s.classNames.root,s.className];s.numberOfMonths>1&&d.push(s.classNames.multiple_months),s.showWeekNumber&&d.push(s.classNames.with_weeknumber);var h=It(It({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,g){var y;return It(It({},m),(y={},y[g]=r[g],y))},{}),p=(t=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&t!==void 0?t:Tze;return c.jsx("div",It({className:d.join(" "),style:h,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:c.jsx(p,{children:a.displayMonths.map(function(m,g){return c.jsx(Nze,{displayIndex:g,displayMonth:m},g)})})}))}function Rze(n){var e=n.children,t=tBe(n,["children"]);return c.jsx(bBe,{initialProps:t,children:c.jsx(jBe,{children:c.jsx(dze,{initialProps:t,children:c.jsx(zBe,{initialProps:t,children:c.jsx(VBe,{initialProps:t,children:c.jsx(ZBe,{children:c.jsx(cze,{children:e})})})})})})})}function Pze(n){return c.jsx(Rze,It({},n,{children:c.jsx(jze,{initialProps:n})}))}function FI({className:n,classNames:e,showOutsideDays:t=!0,...r}){return c.jsx(Pze,{showOutsideDays:t,className:ke("p-3",n),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
967ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:ke(C1({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:ke(C1({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...s})=>c.jsx(CS,{className:"h-4 w-4"}),IconRight:({...s})=>c.jsx(cd,{className:"h-4 w-4"})},...r})}FI.displayName="Calendar";var Sj="Popover",[kie,a9e]=Hr(Sj,[jf]),pE=jf(),[Dze,Uf]=kie(Sj),Cie=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=n,o=pE(e),l=_.useRef(null),[u,d]=_.useState(!1),[h,f]=Zi({prop:r,defaultProp:s??!1,onChange:i,caller:Sj});return c.jsx(dT,{...o,children:c.jsx(Dze,{scope:e,contentId:Ja(),triggerRef:l,open:h,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:u,onCustomAnchorAdd:_.useCallback(()=>d(!0),[]),onCustomAnchorRemove:_.useCallback(()=>d(!1),[]),modal:a,children:t})})};Cie.displayName=Sj;var Aie="PopoverAnchor",Oze=_.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Uf(Aie,t),i=pE(t),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return _.useEffect(()=>(a(),()=>o()),[a,o]),c.jsx(DS,{...i,...r,ref:e})});Oze.displayName=Aie;var Nie="PopoverTrigger",Tie=_.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Uf(Nie,t),i=pE(t),a=Ct(e,s.triggerRef),o=c.jsx(st.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Oie(s.open),...r,ref:a,onClick:$e(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:c.jsx(DS,{asChild:!0,...i,children:o})});Tie.displayName=Nie;var EB="PopoverPortal",[Mze,Ize]=kie(EB,{forceMount:void 0}),jie=n=>{const{__scopePopover:e,forceMount:t,children:r,container:s}=n,i=Uf(EB,e);return c.jsx(Mze,{scope:e,forceMount:t,children:c.jsx(ss,{present:t||i.open,children:c.jsx(m0,{asChild:!0,container:s,children:r})})})};jie.displayName=EB;var a0="PopoverContent",Rie=_.forwardRef((n,e)=>{const t=Ize(a0,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=Uf(a0,n.__scopePopover);return c.jsx(ss,{present:r||i.open,children:i.modal?c.jsx(Fze,{...s,ref:e}):c.jsx(Bze,{...s,ref:e})})});Rie.displayName=a0;var Lze=df("PopoverContent.RemoveScroll"),Fze=_.forwardRef((n,e)=>{const t=Uf(a0,n.__scopePopover),r=_.useRef(null),s=Ct(e,r),i=_.useRef(!1);return _.useEffect(()=>{const a=r.current;if(a)return AT(a)},[]),c.jsx(HS,{as:Lze,allowPinchZoom:!0,children:c.jsx(Pie,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(n.onCloseAutoFocus,a=>{var o;a.preventDefault(),i.current||(o=t.triggerRef.current)==null||o.focus()}),onPointerDownOutside:$e(n.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,u=o.button===2||l;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:$e(n.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Bze=_.forwardRef((n,e)=>{const t=Uf(a0,n.__scopePopover),r=_.useRef(!1),s=_.useRef(!1);return c.jsx(Pie,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,o;(a=n.onCloseAutoFocus)==null||a.call(n,i),i.defaultPrevented||(r.current||(o=t.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,u;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((u=t.triggerRef.current)==null?void 0:u.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Pie=_.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...h}=n,f=Uf(a0,t),p=pE(t);return CT(),c.jsx(US,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(_g,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(hT,{"data-state":Oie(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)"}})})})}),Die="PopoverClose",zze=_.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Uf(Die,t);return c.jsx(st.button,{type:"button",...r,ref:e,onClick:$e(n.onClick,()=>s.onOpenChange(!1))})});zze.displayName=Die;var $ze="PopoverArrow",Uze=_.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=pE(t);return c.jsx(fT,{...s,...r,ref:e})});Uze.displayName=$ze;function Oie(n){return n?"open":"closed"}var Vze=Cie,Hze=Tie,Wze=jie,Mie=Rie;const qze=Vze,Gze=Hze,Iie=_.forwardRef(({className:n,align:e="center",sideOffset:t=4,...r},s)=>c.jsx(Wze,{children:c.jsx(Mie,{ref:s,align:e,sideOffset:t,className:ke("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]:sli
967de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));Iie.displayName=Mie.displayName;function Kze(){var de;const{user:n,isLoading:e}=Vt(),t=$n(),[r,s]=_.useState(new Date),[i,a]=_.useState(""),[o,l]=_.useState(null),[u,d]=_.useState(null),[h,f]=_.useState(!1),[p,m]=_.useState("idle"),[g,y]=_.useState(!1),[v,x]=_.useState(!1),b=_.useRef(null),E=_.useRef(""),S=hr(r,"yyyy-MM-dd"),{data:k=[]}=dB("journal"),{data:C=[]}=gj(),A=(de=C.find(ue=>ue.target==="journal"))==null?void 0:de.template_id,{data:T,isLoading:j,isFetched:D}=pt({queryKey:["journal-entry",n==null?void 0:n.id,S],queryFn:async()=>{if(!n)return null;const{data:ue,error:le}=await pe.from("journal_entries").select("*").eq("user_id",n.id).eq("entry_date",S).maybeSingle();if(le)throw le;return ue},enabled:!!n}),{data:R=[]}=pt({queryKey:["journal-dates",n==null?void 0:n.id,hr(r,"yyyy-MM")],queryFn:async()=>{if(!n)return[];const ue=hr(Gi(r),"yyyy-MM-dd"),le=hr(QS(r),"yyyy-MM-dd"),{data:ve,error:_e}=await pe.from("journal_entries").select("entry_date").eq("user_id",n.id).gte("entry_date",ue).lte("entry_date",le);if(_e)throw _e;return ve.map(Ne=>Ne.entry_date)},enabled:!!n}),M=_.useCallback(ue=>{if(!ue)a(""),d(null);else{const le=ue.content_markdown||"",ve=vj(le,{date:r});a(ve),d(ue.id)}x(!0),f(!0),m("idle")},[r]);_.useEffect(()=>{if(D){if(T)a(T.entry_content),l(T.id),d(T.template_id),E.current=T.entry_content,x(!0);else{if(l(null),E.current="",!v&&A&&k.length>0){const ue=k.find(le=>le.id===A);if(ue){M(ue);return}}v||(a(""),d(null),x(!0))}f(!1),m("idle")}},[T,D,A,k,v,M]),_.useEffect(()=>{x(!1)},[S]);const N=_.useCallback(async(ue,le,ve,_e)=>{if(!n)return;if(ue===E.current){m("saved");return}m("saving");const Ne=i0(ue),Pe=Ne.trim().split(/\s+/).filter(Se=>Se.length>0).length;try{if(le){const{error:Se}=await pe.from("journal_entries").update({entry_content:ue,word_count:Pe}).eq("id",le);if(Se)throw Se}else if(Ne.trim().length>0){const{data:Se,error:Ce}=await pe.from("journal_entries").insert({user_id:n.id,entry_date:ve,entry_content:ue,word_count:Pe,template_id:_e}).select().single();if(Ce)throw Ce;l(Se.id)}E.current=ue,f(!1),m("saved"),t.invalidateQueries({queryKey:["journal-dates",n==null?void 0:n.id]}),setTimeout(()=>m("idle"),2e3)}catch(Se){console.error("Save journal error:",Se),m("error"),Qr({title:"Failed to save entry",description:"Please try again.",variant:"destructive"})}},[n,t]);_.useEffect(()=>{if(!(!h||!n))return b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{N(i,o,S,u)},1500),()=>{b.current&&clearTimeout(b.current)}},[i,h,o,u,S,N,n]),_.useEffect(()=>{const ue=le=>{h&&(le.preventDefault(),le.returnValue="")};return window.addEventListener("beforeunload",ue),()=>window.removeEventListener("beforeunload",ue)},[h]);const U=kn({mutationFn:async()=>{await N(i,o,S,u)}}),q=async ue=>{ue&&(h&&await N(i,o,S,u),s(ue))},I=()=>{const ue=new Date(r);ue.setDate(ue.getDate()-1),q(ue)},B=()=>{const ue=new Date(r);ue.setDate(ue.getDate()+1),q(ue)},$=()=>{q(new Date)},ie=ue=>{M(ue)},ne=ue=>{a(ue),f(!0),m("idle")},te=i0(i).trim().split(/\s+/).filter(ue=>ue.length>0).length,ae=()=>{switch(p){case"saving":return c.jsxs("span",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c.jsx(PG,{className:"h-4 w-4 animate-pulse"}),"Saving..."]});case"saved":return c.jsxs("span",{className:"flex items-center gap-1 text-sm text-green-600 dark:text-green-400",children:[c.jsx(Go,{className:"h-4 w-4"}),"Saved"]});case"error":return c.jsx("span",{className:"flex items-center gap-1 text-sm text-destructive",children:"Save failed"});default:return h?c.jsx("span",{className:"text-sm text-muted-foreground",children:"Unsaved changes"}):null}};return e?c.jsx(cn,{children:c.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-primary"})})}):n?c.jsxs(cn,{children:[c.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[c.jsxs("div",{className:"mb-8",children:[c.jsx("h1",{className:"font-serif text-3xl md:text-4xl font-bold mb-2",children:"Daily Journal"}),c.jsx("p",{className:"text-muted-foreground",children:"Record your reflections, prayers, and insights. Your entries auto-save as you type."})]}),c.jsxs("div",{className:"grid md:grid-cols-[280px_1fr] gap-6",children:[c.jsxs(mt,{children:[c.jsx(Ln,{className:"pb-2",children:c.jsx(Wn,{className:"text-lg font-serif",children:"Calendar"})}),c.jsxs(kt,{children:[c.jsx(FI,{mode:"single",selected:r,onSelect:q,className:"rounded-md pointer-events-auto",modifiers:{hasEntry:ue=>R.includes(hr(ue,"yyyy-MM-dd"))},modifiersStyles:{hasEntry:{fontWeight:"bold",textDecoration:"underline",textDecorationColor:"hsl(var(--primary))"}}}),c.jsx(xe,{variant:"outline",size:"sm",onClick:$,className:"w-full mt-3",children:"Today"})]})]}),c.jsxs(mt,{children:[c.jsx(Ln,{children:c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:I,className:"h-8 w-8",children:c.jsx(CS,{className:"h-4 w-4"})}),c.jsxs(qze,{children:[c.jsx(Gze,{asChild:!0,children:c.jsxs(xe,{variant:"outline",className:ke("justify-start text-left font-normal",!r&&"text-muted-foreground"),children:[c.jsx(kS,{className:"mr-2 h-4 w-4"}),hr(r,"EEEE, MMMM d, yyyy")]})}),c.jsx(Iie,{className:"w-auto p-0",align:"start",children:c.jsx(FI,{mode:"single",selected:r,onSelect:q,initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:B,className:"h-8 w-8",children:c.jsx(cd,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[ae(),c.jsxs("span",{className:"text-sm text-muted-foreground",children:[te," words"]})]})]})}),c.jsx(kt,{children:j?c.jsx("div",{className:"flex items-center justify-center h-64",children:c.jsx(et,{className:"h-6 w-6 animate-spin text-primary"})}):c.jsxs(c.Fragment,{children:[c.jsx(mj,{content:i,onChange:ne,placeholder:"Write your journal entry for today...",className:"min-h-[300px]"}),c.jsxs("div",{className:"flex justify-between items-center mt-4",children:[!
967o&&k.length>0&&c.jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>y(!0),className:"text-muted-foreground",children:[c.jsx(wi,{className:"h-4 w-4 mr-2"}),"Use Template"]}),o&&c.jsx("div",{}),c.jsxs(xe,{onClick:()=>U.mutate(),disabled:U.isPending||!h,variant:"outline",children:[U.isPending?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(NS,{className:"h-4 w-4 mr-2"}),"Save Now"]})]})]})})]})]})]}),c.jsx(hB,{open:g,onOpenChange:y,templates:k,defaultTemplateId:A,onSelect:ie,target:"journal"})]}):c.jsx(yT,{to:"/auth",replace:!0})}function $0(n){return new Promise((e,t)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>t(n.error)})}function Yze(n,e){let t;const r=()=>{if(t)return t;const s=indexedDB.open(n);return s.onupgradeneeded=()=>s.result.createObjectStore(e),t=$0(s),t.then(i=>{i.onclose=()=>t=void 0},()=>{}),t};return(s,i)=>r().then(a=>i(a.transaction(e,s).objectStore(e)))}let iD;function Ej(){return iD||(iD=Yze("keyval-store","keyval")),iD}function kB(n,e=Ej()){return e("readonly",t=>$0(t.get(n)))}function lW(n,e,t=Ej()){return t("readwrite",r=>(r.put(e,n),$0(r.transaction)))}function cW(n,e=Ej()){return e("readwrite",t=>(t.delete(n),$0(t.transaction)))}function Xze(n,e){return n.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},$0(n.transaction)}function Zze(n=Ej()){return n("readonly",e=>{if(e.getAllKeys)return $0(e.getAllKeys());const t=[];return Xze(e,r=>t.push(r.key)).then(()=>t)})}const kj="book_",CB="meta_";async function Jze(n,e,t){try{await lW(`${kj}${n}`,e);const r={...t,downloadedAt:new Date().toISOString(),fileSize:e.size};await lW(`${CB}${n}`,r),console.log(`Book ${n} saved for offline reading (${(e.size/1024/1024).toFixed(2)} MB)`)}catch(r){throw console.error("Failed to save book offline:",r),new Error("Failed to save book for offline reading")}}async function Qze(n){try{return await kB(`${kj}${n}`)||null}catch(e){return console.error("Failed to get offline book:",e),null}}async function Lie(n){try{return!!await kB(`${kj}${n}`)}catch{return!1}}async function e$e(n){try{await cW(`${kj}${n}`),await cW(`${CB}${n}`),console.log(`Book ${n} removed from offline storage`)}catch(e){throw console.error("Failed to delete offline book:",e),new Error("Failed to remove book from offline storage")}}async function Fie(){try{const e=(await Zze()).filter(r=>typeof r=="string"&&r.startsWith(CB)),t=[];for(const r of e){const s=await kB(r);s&&t.push(s)}return t}catch(n){return console.error("Failed to get offline books:",n),[]}}async function t$e(){try{return(await Fie()).reduce((e,t)=>e+t.fileSize,0)}catch{return 0}}async function Bie(n){const e=await Qze(n);return e?URL.createObjectURL(e):null}function n$e(){const[n,e]=_.useState(new Map),[t,r]=_.useState(0),{toast:s}=Jl(),i=_.useCallback(async()=>{try{const d=await Fie(),h=new Map;for(const p of d)h.set(p.id,{id:p.id,isOffline:!0,isDownloading:!1,downloadProgress:100});e(h);const f=await t$e();r(f)}catch(d){console.error("Failed to refresh offline books:",d)}},[]);_.useEffect(()=>{i()},[i]);const a=_.useCallback(d=>{var h;return((h=n.get(d))==null?void 0:h.isOffline)??!1},[n]),o=_.useCallback(async d=>{e(h=>{const f=new Map(h);return f.set(d.id,{id:d.id,isOffline:!1,isDownloading:!0,downloadProgress:0}),f});try{let h;if(d.external_url){const f=await fetch(d.external_url);if(!f.ok)throw new Error("Failed to download book");h=await f.blob()}else if(d.file_path){const{data:f,error:p}=await pe.storage.from("books").download(d.file_path);if(p)throw p;h=f}else throw new Error("No book file available");await Jze(d.id,h,{id:d.id,title:d.title,author:d.author,format:d.format,cover_url:d.cover_url}),e(f=>{const p=new Map(f);return p.set(d.id,{id:d.id,isOffline:!0,isDownloading:!1,downloadProgress:100}),p}),s({title:"Downloaded for offline",description:`"${d.title}" is now available offline.`}),await i()}catch(h){console.error("Failed to download book:",h),e(f=>{const p=new Map(f);return p.delete(d.id),p}),s({title:"Download failed",description:"Could not download the book for offline reading.",variant:"destructive"})}},[s,i]),l=_.useCallback(async d=>{try{await e$e(d),e(h=>{const f=new Map(h);return f.delete(d),f}),await i(),s({title:"Removed from offline",description:"Book removed from offline storage."})}catch(h){console.error("Failed to remove offline book:",h),s({title:"Failed to remove",description:"Could not remove the book from offline storage.",variant:"destructive"})}},[s,i]),u=_.useCallback(async d=>await Lie(d)?Bie(d):null,[]);return{offlineBooks:n,isBookAvailableOffline:a,downloadBook:o,removeOfflineBook:l,getBookUrl:u,storageUsed:t,refreshOfflineBooks:i}}var Lw;(function(n){n.Heavy="HEAVY",n.Medium="MEDIUM",n.Light="LIGHT"})(Lw||(Lw={}));var Fw;(function(n){n.Success="SUCCESS",n.Warning="WARNING",n.Error="ERROR"})(Fw||(Fw={}));const ub=zS("Haptics",{web:()=>Wv(()=>import("./web-D-jIEUEA.js"),[]).then(n=>new n.HapticsWeb)});function zie(){const n=_.useCallback(async(s="light")=>{if(Nb.isNative())try{const i={light:Lw.Light,medium:Lw.Medium,heavy:Lw.Heavy}[s];await ub.impact({style:i})}catch(i){console.debug("Haptics not available:",i)}},[]),e=_.useCallback(async(s="success")=>{if(Nb.isNative())try{const i={success:Fw.Success,warning:Fw.Warning,error:Fw.Error}[s];await ub.notification({type:i})}catch(i){console.debug("Haptics not available:",i)}},[]),t=_.useCallback(async()=>
967{if(Nb.isNative())try{await ub.selectionStart(),await ub.selectionEnd()}catch(s){console.debug("Haptics not available:",s)}},[]),r=_.useCallback(async(s=300)=>{if(Nb.isNative())try{await ub.vibrate({duration:s})}catch(i){console.debug("Haptics not available:",i)}},[]);return{impact:n,notification:e,selection:t,vibrate:r}}function r$e({book:n,progress:e,className:t,showOfflineControls:r=!0}){const s=typeof e=="number"&&e>0,{offlineBooks:i,downloadBook:a,removeOfflineBook:o,isBookAvailableOffline:l}=n$e(),{impact:u,notification:d}=zie(),h=i.get(n.id),f=l(n.id),p=(h==null?void 0:h.isDownloading)??!1,m=async y=>{y.preventDefault(),y.stopPropagation(),await u("medium"),await a({id:n.id,title:n.title,author:n.author,format:n.format,cover_url:n.cover_url,file_path:n.file_path??null,external_url:n.external_url??null}),await d("success")},g=async y=>{y.preventDefault(),y.stopPropagation(),await u("light"),await o(n.id)};return c.jsx(Rt,{to:`/reader/${n.id}`,children:c.jsxs(mt,{className:ke("group overflow-hidden transition-all duration-300 hover:shadow-lg hover:-translate-y-1","border-border/50 bg-card",t),children:[c.jsxs("div",{className:"relative aspect-[2/3] bg-muted overflow-hidden",children:[n.cover_url?c.jsx("img",{src:n.cover_url,alt:n.title,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/10 to-primary/5",children:c.jsx(Kk,{className:"w-16 h-16 text-primary/30"})}),c.jsx(jt,{variant:"secondary",className:"absolute top-2 right-2 uppercase text-[10px] font-semibold",children:n.format}),f&&c.jsxs(jt,{variant:"default",className:"absolute top-2 left-2 text-[10px] font-semibold bg-green-600",children:[c.jsx(Go,{className:"w-3 h-3 mr-1"}),"Offline"]}),n.persona&&c.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-black/70 to-transparent",children:c.jsxs("div",{className:"flex items-center gap-2",children:[n.persona.portrait_image_url?c.jsx("img",{src:n.persona.portrait_image_url,alt:n.persona.full_name,className:"w-6 h-6 rounded-full object-cover border border-white/30"}):c.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/20 flex items-center justify-center",children:c.jsx(Js,{className:"w-3 h-3 text-primary"})}),c.jsx("span",{className:"text-xs text-white/90 font-medium truncate",children:n.persona.full_name})]})})]}),c.jsxs(kt,{className:"p-3",children:[c.jsx("h3",{className:"font-semibold text-sm line-clamp-2 leading-tight mb-1 group-hover:text-primary transition-colors",children:n.title}),n.author&&c.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-1 mb-2",children:["by ",n.author]}),s&&c.jsxs("div",{className:"mt-2",children:[c.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground mb-1",children:[c.jsx("span",{children:"Reading progress"}),c.jsxs("span",{children:[Math.round(e),"%"]})]}),c.jsx(yf,{value:e,className:"h-1"})]}),s&&c.jsxs("div",{className:"mt-2 text-xs font-medium text-primary flex items-center gap-1",children:[c.jsx(wi,{className:"w-3 h-3"}),"Continue reading"]}),r&&(n.file_path||n.external_url)&&c.jsx("div",{className:"mt-2 flex gap-1",children:f?c.jsxs(xe,{variant:"ghost",size:"sm",className:"h-8 w-full text-xs text-muted-foreground hover:text-destructive",onClick:g,children:[c.jsx(ao,{className:"w-3 h-3 mr-1"}),"Remove offline"]}):c.jsx(xe,{variant:"secondary",size:"sm",className:"h-8 w-full text-xs",onClick:m,disabled:p,children:p?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"w-3 h-3 mr-1 animate-spin"}),"Downloading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(yF,{className:"w-3 h-3 mr-1"}),"Download offline"]})})})]})]})})}function s$e({searchQuery:n,onSearchChange:e,personaFilter:t,onPersonaFilterChange:r}){const{data:s}=pt({queryKey:["personas-for-filter"],queryFn:async()=>{const{data:o,error:l}=await pe.from("personas").select("id, full_name").eq("is_published",!0).order("full_name");if(l)throw l;return o}}),i=n||t,a=()=>{e(""),r("")};return c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(Eg,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),c.jsx(Lt,{placeholder:"Search books by title or author...",value:n,onChange:o=>e(o.target.value),className:"pl-9"})]}),c.jsxs(ki,{value:t||"all",onValueChange:o=>r(o==="all"?"":o),children:[c.jsxs(ti,{className:"w-full sm:w-[200px]",children:[c.jsx(Bfe,{className:"w-4 h-4 mr-2 text-muted-foreground"}),c.jsx(Ci,{placeholder:"Filter by author"})]}),c.jsxs(ni,{children:[c.jsx(xn,{value:"all",children:"All authors"}),s==null?void 0:s.map(o=>c.jsx(xn,{value:o.id,children:o.full_name},o.id))]})]}),i&&c.jsx(xe,{variant:"ghost",size:"icon",onClick:a,children:c.jsx(Ho,{className:"w-4 h-4"})})]})}function i$e({book:n,readingState:e}){const t=e.progress_pct||0;return c.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-card",children:[c.jsxs("div",{className:"flex flex-col md:flex-row gap-4 p-4 md:p-6",children:[c.jsx("div",{className:"flex-shrink-0",children:c.jsx("div",{className:"w-20 h-28 md:w-24 md:h-36 rounded overflow-hidden bg-muted",children:n.cover_url?c.jsx("img",{src:n.cover_url,alt:n.title,className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/10 to-primary/5",children:c.jsx(En,{className:"w-8 h-8 text-primary/30"})})})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1",children:"Continue Reading"}),c.jsx("h3",{className:"font-semibold text-lg line-clamp-1 mb-1",children:n.title}),n.author&&c.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["by ",n.author]}),c.jsxs("div",{className:"mb-4",children:[c.jsx("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:c.jsxs("span",{children:[Math.round(t),"% complete"]})}),c.jsx(yf,{value:t,className:"h-2"})]}),n.persona&&c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.persona.portrait_image_url&&c.jsx("img",{src:n.persona.portrait_image_url,alt:n.persona.full_name,className:"w-6 h-6 rounded-full object-cover"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Chat with ",n.persona.full_name," as you read"]})]}),c.jsx(xe,{asChild:!0,children:c.jsxs(Rt,{to:`/reader/${n.id}`,children:["Continue Reading",c.jsx(a1,{className:"w-4 h-4 ml-2"})]})})]})]}),c.jsx("div",{className:"absolute inset-0 pointer-events-none bg-gradient-to-r from-primary/5 to-transparent opacity-50"})]})}function a$e(n,e){return pt({queryKey:["books",n,e],queryFn:async()=>{let t=pe.from("books").select(`
968          *,
969          persona:personas(id, full_name, slug, portrait_image_url)
970        `).order("created_at",{ascending:!1});n&&(t=t.or(`title.ilike.%${n}%,author.ilike.%${n}%`)),e&&(t=t.eq("persona_id",e));const{data:r,error:s}=await t;if(s)throw s;return r}})}function o$e(n){return pt({queryKey:["book",n],queryFn:async()=>
970{if(!n)return null;const{data:e,error:t}=await pe.from("books").select(`
971          *,
972          persona:personas(id, full_name, slug, portrait_image_url, short_biography)
973        `).eq("id",n).single();if(t)throw t;return e},enabled:!!n})}function l$e(n){const{user:e}=Vt();return pt({queryKey:["reading-state",n,e==null?void 0:e.id],queryFn:async()=>{if(!n||!e)return null;const{data:t,error:r}=await pe.from("reading_state").select("*").eq("book_id",n).eq("user_id",e.id).maybeSingle();if(r)throw r;return t},enabled:!!n&&!!e})}function c$e(){const{user:n}=Vt();return pt({queryKey:["reading-states",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:e,error:t}=await pe.from("reading_state").select("*").eq("user_id",n.id).order("updated_at",{ascending:!1});if(t)throw t;return e},enabled:!!n})}function u$e(){const n=$n(),{user:e}=Vt();return kn({mutationFn:async({bookId:t,location:r,progressPct:s})=>{if(!e)throw new Error("Must be logged in");const{data:i,error:a}=await pe.from("reading_state").upsert({user_id:e.id,book_id:t,location:r,progress_pct:s,updated_at:new Date().toISOString()},{onConflict:"user_id,book_id"}).select().single();if(a)throw a;return i},onSuccess:(t,r)=>{n.invalidateQueries({queryKey:["reading-state",r.bookId]}),n.invalidateQueries({queryKey:["reading-states"]})}})}function d$e(n){const{user:e}=Vt();return pt({queryKey:["highlights",n,e==null?void 0:e.id],queryFn:async()=>{if(!n||!e)return[];const{data:t,error:r}=await pe.from("highlights").select("*").eq("book_id",n).eq("user_id",e.id).order("created_at",{ascending:!1});if(r)throw r;return t},enabled:!!n&&!!e})}function h$e(){const n=$n(),{user:e}=Vt();return kn({mutationFn:async({bookId:t,locationRange:r,selectedText:s,color:i="yellow",note:a})=>
973{if(!e)throw new Error("Must be logged in");const{data:o,error:l}=await pe.from("highlights").insert({user_id:e.id,book_id:t,location_range:r,selected_text:s,color:i,note:a}).select().single();if(l)throw l;return o},onSuccess:(t,r)=>{n.invalidateQueries({queryKey:["highlights",r.bookId]})}})}function f$e(){const n=$n();return kn({mutationFn:async({highlightId:e,bookId:t})=>{const{error:r}=await pe.from("highlights").delete().eq("id",e);if(r)throw r;return{bookId:t}},onSuccess:e=>{n.invalidateQueries({queryKey:["highlights",e.bookId]})}})}function p$e(){const[n,e]=_.useState(""),[t,r]=_.useState(""),{user:s}=Vt(),{data:i,isLoading:a}=a$e(n,t),{data:o}=c$e(),l=_.useMemo(()=>{if(!i||!o||o.length===0)return null;const d=o[0],h=i.find(f=>f.id===d.book_id);return h&&d.progress_pct&&d.progress_pct<100?{book:h,state:d}:null},[i,o]),u=_.useMemo(()=>o?o.reduce((d,h)=>(d[h.book_id]=h.progress_pct,d),{}):{},[o]);return c.jsxs(cn,{children:[c.jsx(kd,{title:"Library | Heroes of the Faith",description:"Browse and read books by the great heroes of the Christian faith. Engage with AI companions as you read."}),c.jsxs("div",{className:"container mx-auto px-4 py-8",children:[c.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4 mb-8",children:[c.jsxs("div",{children:[c.jsxs("h1",{className:"text-3xl md:text-4xl font-bold flex items-center gap-3",children:[c.jsx(xF,{className:"w-8 h-8 text-primary"}),"Library"]}),c.jsx("p",{className:"text-muted-foreground mt-1",children:"Read books by the heroes of the faith with AI companions"})]}),!s&&c.jsx(xe,{asChild:!0,variant:"outline",children:c.jsx(Rt,{to:"/auth",children:"Sign in to track progress"})})]}),l&&c.jsx("section",{className:"mb-8",children:c.jsx(i$e,{book:l.book,readingState:l.state})}),c.jsx("div",{className:"mb-6",children:c.jsx(s$e,{searchQuery:n,onSearchChange:e,personaFilter:t,onPersonaFilterChange:r})}),a?c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:Array.from({length:12}).map((d,h)=>c.jsxs("div",{className:"space-y-2",children:[c.jsx(qt,{className:"aspect-[2/3] w-full rounded-lg"}),c.jsx(qt,{className:"h-4 w-3/4"}),c.jsx(qt,{className:"h-3 w-1/2"})]},h))}):i&&i.length>0?c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:i.map(d=>c.jsx(r$e,{book:d,progress:u[d.id]},d.id))}):c.jsxs("div",{className:"text-center py-16",children:[c.jsx(En,{className:"w-16 h-16 mx-auto text-muted-foreground/30 mb-4"}),c.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No books found"}),c.jsx("p",{className:"text-muted-foreground",children:n||t?"Try adjusting your search or filters":"Books will appear here once added by an administrator"})]})]})]})}function m$e({title:n,chapterTitle:e,onBack:t,onToggleToc:r,onToggleSettings:s,onToggleHighlights:i,className:a}){const{isIOS:o,isNative:l}=$S();return c.jsxs("header",{className:ke("fixed top-0 left-0 right-0 z-50","bg-background/95 backdrop-blur-sm border-b border-border","px-2 py-2 md:px-4 md:py-3","flex items-center justify-between gap-2",l&&o&&"pt-safe-top",a),children:[c.jsxs("div",{className:"flex items-center gap-1 md:gap-2 min-w-0 flex-1",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:t,className:"flex-shrink-0",children:c.jsx(Ji,{className:"w-5 h-5"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:r,className:"flex-shrink-0 md:hidden",children:c.jsx(LG,{className:"w-5 h-5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("h1",{className:"text-sm font-medium truncate",children:n}),e&&c.jsx("p",{className:"text-xs text-muted-foreground truncate hidden sm:block",children:e})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:r,className:"hidden md:flex",title:"Table of Contents",children:c.jsx(bF,{className:"w-5 h-5"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:i,title:"Highlights & Notes",children:c.jsx(E2,{className:"w-5 h-5"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:s,title:"Reading Settings",children:c.jsx($G,{className:"w-5 h-5"})})]})]})}
973var BI={exports:{}},$ie={exports:{}},g$e=void 0,Uie=function(n){return n!==g$e&&n!==null},v$e=Uie,y$e={object:!0,function:!0,undefined:!0},x$e=function(n){return v$e(n)?hasOwnProperty.call(y$e,typeof n):!1},b$e=x$e,w$e=function(n){if(!b$e(n))return!1;try{return n.constructor?n.constructor.prototype===n:!1}catch{return!1}},_$e=w$e,S$e=function(n){if(typeof n!="function"||!hasOwnProperty.call(n,"length"))return!1;try{if(typeof n.length!="number"||typeof n.call!="function"||typeof n.apply!="function")return!1}catch{return!1}return!_$e(n)},E$e=S$e,k$e=/^\s*class[\s{/}]/,C$e=Function.prototype.toString,A$e=function(n){return!(!E$e(n)||k$e.test(C$e.call(n)))},N$e=function(){var n=Object.assign,e;return typeof n!="function"?!1:(e={foo:"raz"},n(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")},aD,uW;function T$e(){return uW||(uW=1,aD=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),aD}var j$e=function(){},R$e=j$e(),AB=function(n){return n!==R$e&&n!==null},oD,dW;function P$e(){if(dW)return oD;dW=1;var n=AB,e=Object.keys;return oD=function(t){return e(n(t)?Object(t):t)},oD}var lD,hW;function D$e(){return hW||(hW=1,lD=T$e()()?Object.keys:P$e()),lD}var cD,fW;function O$e(){if(fW)return cD;fW=1;var n=AB;return cD=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e},cD}var uD,pW;function M$e(){if(pW)return uD;pW=1;var n=D$e(),e=O$e(),t=Math.max;return uD=function(r,s){var i,a,o=t(arguments.length,2),l;for(r=Object(e(r)),l=function(u){try{r[u]=s[u]}catch(d){i||(i=d)}},a=1;a<o;++a)s=arguments[a],n(s).forEach(l);if(i!==void 0)throw i;return r},uD}var I$e=N$e()?Object.assign:M$e(),L$e=AB,F$e=Array.prototype.forEach,B$e=Object.create,z$e=function(n,e){var t;for(t in n)e[t]=n[t]},$$e=function(n){var e=B$e(null);return F$e.call(arguments,function(t){L$e(t)&&z$e(Object(t),e)}),e},dD="razdwatrzy",U$e=function(){return typeof dD.contains!="function"?!1:dD.contains("dwa")===!0&&dD.contains("foo")===!1},hD,mW;function V$e(){if(mW)return hD;mW=1;var n=String.prototype.indexOf;return hD=function(e){return n.call(this,e,arguments[1])>-1},hD}var H$e=U$e()?String.prototype.contains:V$e(),vC=Uie,gW=A$e,Vie=I$e,Hie=$$e,Bw=H$e,W$e=$ie.exports=function(n,e){var t,r,s,i,a;return arguments.length<2||typeof n!="string"?(i=e,e=n,n=null):i=arguments[2],vC(n)?(t=Bw.call(n,"c"),r=Bw.call(n,"e"),s=Bw.call(n,"w")):(t=s=!0,r=!1),a={value:e,configurable:t,enumerable:r,writable:s},i?Vie(Hie(i),a):a};W$e.gs=function(n,e,t){var r,s,i,a;return typeof n!="string"?(i=t,t=e,e=n,n=null):i=arguments[3],vC(e)?gW(e)?vC(t)?gW(t)||(i=t,t=void 0):t=void 0:(i=e,e=t=void 0):e=void 0,vC(n)?(r=Bw.call(n,"c"),s=Bw.call(n,"e")):(r=!0,s=!1),a={get:e,set:t,configurable:r,enumerable:s},i?Vie(Hie(i),a):a};var q$e=$ie.exports,G$e=function(n){if(typeof n!="function")throw new TypeError(n+" is not a function");return n};(function(n,e){var t=q$e,r=G$e,s=Function.prototype.apply,i=Function.prototype.call,a=Object.create,o=Object.defineProperty,l=Object.defineProperties,u=Object.prototype.hasOwnProperty,d={configurable:!0,enumerable:!1,writable:!0},h,f,p,m,g,y,v;h=function(x,b){var E;return r(b),u.call(this,"__ee__")?E=this.__ee__:(E=d.value=a(null),o(this,"__ee__",d),d.value=null),E[x]?typeof E[x]=="object"?E[x].push(b):E[x]=[E[x],b]:E[x]=b,this},f=function(x,b){var E,S;return r(b),S=this,h.call(this,x,E=function(){p.call(S,x,E),s.call(b,this,arguments)}),E.__eeOnceListener__=b,this},p=function(x,b){var E,S,k,C;if(r(b),!u.call(this,"__ee__"))return this;if(E=this.__ee__,!E[x])return this;if(S=E[x],typeof S=="object")for(C=0;k=S[C];++C)(k===b||k.__eeOnceListener__===b)&&(S.length===2?E[x]=S[C?0:1]:S.splice(C,1));else(S===b||S.__eeOnceListener__===b)&&delete E[x];return this},m=function(x){var b,E,S,k,C;if(u.call(this,"__ee__")&&(k=this.__ee__[x],!!k))if(typeof k=="object"){for(E=arguments.length,C=new Array(E-1),b=1;b<E;++b)C[b-1]=arguments[b];for(k=k.slice(),b=0;S=k[b];++b)s.call(S,this,C)}else switch(arguments.length){case 1:i.call(k,this);break;case 2:i.call(k,this,arguments[1]);break;case 3:i.call(k,this,arguments[1],arguments[2]);break;default:for(E=arguments.length,C=new Array(E-1),b=1;b<E;++b)C[b-1]=arguments[b];s.call(k,this,C)}},g={on:h,once:f,off:p,emit:m},y={on:t(h),once:t(f),off:t(p),emit:t(m)},v=l({},y),n.exports=e=function(x){return x==null?a(v):l(Object(x),y)},e.methods=g}
vendor: 20,188 bytes, line 973
973)(BI,BI.exports);var K$e=BI.exports;const Jc=ro(K$e);var Vf={},Hf={};function Y$e(n,e,t){if(t===void 0&&(t=Array.prototype),n&&typeof t.find=="function")return t.find.call(n,e);for(var r=0;r<n.length;r++)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];if(e.call(void 0,s,r,n))return s}}function NB(n,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(n):n}var Wie=NB({HTML:"text/html",isHTML:function(n){return n===Wie.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),qie=NB({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===qie.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Hf.find=Y$e;Hf.freeze=NB;Hf.MIME_TYPE=Wie;Hf.NAMESPACE=qie;var Gie=Hf,Vc=Gie.find,W1=Gie.NAMESPACE;function X$e(n){return n!==""}function Z$e(n){return n?n.split(/[\t\n\f\r ]+/).filter(X$e):[]}function J$e(n,e){return n.hasOwnProperty(e)||(n[e]=!0),n}function vW(n){if(!n)return[];var e=Z$e(n);return Object.keys(e.reduce(J$e,{}))}function Q$e(n){return function(e){return n&&n.indexOf(e)!==-1}}function mE(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}function Na(n,e){var t=n.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,mE(t,r),n.prototype=t=r}t.constructor!=n&&(typeof n!="function"&&console.error("unknown Class:"+n),t.constructor=n)}var Ta={},ql=Ta.ELEMENT_NODE=1,o0=Ta.ATTRIBUTE_NODE=2,rN=Ta.TEXT_NODE=3,Kie=Ta.CDATA_SECTION_NODE=4,Yie=Ta.ENTITY_REFERENCE_NODE=5,e6e=Ta.ENTITY_NODE=6,Xie=Ta.PROCESSING_INSTRUCTION_NODE=7,Zie=Ta.COMMENT_NODE=8,Jie=Ta.DOCUMENT_NODE=9,Qie=Ta.DOCUMENT_TYPE_NODE=10,gd=Ta.DOCUMENT_FRAGMENT_NODE=11,t6e=Ta.NOTATION_NODE=12,ji={},zs={};ji.INDEX_SIZE_ERR=(zs[1]="Index size error",1);ji.DOMSTRING_SIZE_ERR=(zs[2]="DOMString size error",2);var va=ji.HIERARCHY_REQUEST_ERR=(zs[3]="Hierarchy request error",3);ji.WRONG_DOCUMENT_ERR=(zs[4]="Wrong document",4);ji.INVALID_CHARACTER_ERR=(zs[5]="Invalid character",5);ji.NO_DATA_ALLOWED_ERR=(zs[6]="No data allowed",6);ji.NO_MODIFICATION_ALLOWED_ERR=(zs[7]="No modification allowed",7);var eae=ji.NOT_FOUND_ERR=(zs[8]="Not found",8);ji.NOT_SUPPORTED_ERR=(zs[9]="Not supported",9);var yW=ji.INUSE_ATTRIBUTE_ERR=(zs[10]="Attribute in use",10);ji.INVALID_STATE_ERR=(zs[11]="Invalid state",11);ji.SYNTAX_ERR=(zs[12]="Syntax error",12);ji.INVALID_MODIFICATION_ERR=(zs[13]="Invalid modification",13);ji.NAMESPACE_ERR=(zs[14]="Invalid namespace",14);ji.INVALID_ACCESS_ERR=(zs[15]="Invalid access",15);function zr(n,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,zs[n]),this.message=zs[n],Error.captureStackTrace&&Error.captureStackTrace(this,zr);return t.code=n,e&&(this.message=this.message+": "+e),t}zr.prototype=Error.prototype;mE(ji,zr);function ed(){}ed.prototype={length:0,item:function(n){return n>=0&&n<this.length?this[n]:null},toString:function(n,e){for(var t=[],r=0;r<this.length;r++)Kv(this[r],t,n,e);return t.join("")},filter:function(n){return Array.prototype.filter.call(this,n)},indexOf:function(n){return Array.prototype.indexOf.call(this,n)}};function l0(n,e){this._node=n,this._refresh=e,TB(this)}function TB(n){var e=n._node._inc||n._node.ownerDocument._inc;if(n._inc!==e){var t=n._refresh(n._node);if(hae(n,"length",t.length),!n.$$length||t.length<n.$$length)for(var r=t.length;r in n;r++)Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];mE(t,n),n._inc=e}}l0.prototype.item=function(n){return TB(this),this[n]||null};Na(l0,ed);function sN(){}function tae(n,e){for(var t=n.length;t--;)if(n[t]===e)return t}function xW(n,e,t,r){if(r?e[tae(e,r)]=t:e[e.length++]=t,n){t.ownerElement=n;var s=n.ownerDocument;s&&(r&&sae(s,n,r),n6e(s,n,t))}}function bW(n,e,t){var r=tae(e,t);if(r>=0){for(var s=e.length-1;r<s;)e[r]=e[++r];if(e.length=s,n){var i=n.ownerDocument;i&&(sae(i,n,t),t.ownerElement=null)}}else throw new zr(eae,new Error(n.tagName+"@"+t))}sN.prototype={length:0,item:ed.prototype.item,getNamedItem:function(n){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==n)return t}},setNamedItem:function(n){var e=n.ownerElement;if(e&&e!=this._ownerElement)throw new zr(yW);var t=this.getNamedItem(n.nodeName);return xW(this._ownerElement,this,n,t),t},setNamedItemNS:function(n){var e=n.ownerElement,t;if(e&&e!=this._ownerElement)throw new zr(yW);return t=this.getNamedItemNS(n.namespaceURI,n.localName),xW(this._ownerElement,this,n,t),t},removeNamedItem:function(n){var e=this.getNamedItem(n);return bW(this._ownerElement,this,e),e},removeNamedItemNS:function(n,e){var t=this.getNamedItemNS(n,e);return bW(this._ownerElement,this,t),t},getNamedItemNS:function(n,e){for(var t=this.length;t--;){var r=this[t];if(r.localName==e&&r.namespaceURI==n)return r}return null}};function nae(){}nae.prototype={hasFeature:function(n,e){return!0},createDocument:function(n,e,t){var r=new gE;if(r.implementation=this,r.childNodes=new ed,r.doctype=t||null,t&&r.appendChild(t),e){var s=r.createElementNS(n,e);r.appendChild(s)}return r},createDocumentType:function(n,e,t){var r=new Cj;return r.name=n,r.nodeName=n,r.publicId=e||"",r.systemId=t||"",r}};function Fn(){}Fn.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(n,e){return iN(this,n,e)},replaceChild:function(n,e){iN(this,n,e,aae),e&&this.removeChild(e)},removeChild:function(n){return iae(this,n)},appendChild:function(n){return this.insertBefore(n,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(n){return zI(this.ownerDocument||this,this,n)},normalize:function(){for(var n=this.firstChild;n;){var e=n.nextSibling;e&&e.nodeType==rN&&n.nodeType==rN?(this.removeChild(e),n.appendData(e.data)):(n.normalize(),n=e)}},isSupported:function(n,e){return this.ownerDocument.implementation.hasFeature(n,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(n){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r]===n)return r}e=e.nodeType==o0?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(n){for(var e=this;e;){var t=e._nsMap;if(t&&n in t&&Object.prototype.hasOwnProperty.call(t,n))return t[n];e=e.nodeType==o0?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(n){var e=this.lookupPrefix(n);return e==null}};function rae(n){return n=="<"&&"&lt;"||n==">"&&"&gt;"||n=="&"&&"&amp;"||n=='"'&&"&quot;"||"&#"+n.charCodeAt()+";"}mE(Ta,Fn);mE(Ta,Fn.prototype);function q1(n,e){if(e(n))return!0;if(n=n.firstChild)do if(q1(n,e))return!0;while(n=n.nextSibling)}function gE(){this.ownerDocument=this}function n6e(n,e,t){n&&n._inc++;var r=t.namespaceURI;r===W1.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function sae(n,e,t,r){n&&n._inc++;var s=t.namespaceURI;s===W1.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function jB(n,e,t){if(n&&n._inc){n._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var s=e.firstChild,i=0;s;)r[i++]=s,s=s.nextSibling;r.length=i,delete r[r.length]}}}function iae(n,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:n.firstChild=r,r?r.previousSibling=t:n.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,jB(n.ownerDocument,n),e}function r6e(n){return n&&(n.nodeType===Fn.DOCUMENT_NODE||n.nodeType===Fn.DOCUMENT_FRAGMENT_NODE||n.nodeType===Fn.ELEMENT_NODE)}function s6e(n){return n&&(Hc(n)||RB(n)||vd(n)||n.nodeType===Fn.DOCUMENT_FRAGMENT_NODE||n.nodeType===Fn.COMMENT_NODE||n.nodeType===Fn.PROCESSING_INSTRUCTION_NODE)}function vd(n){return n&&n.nodeType===Fn.DOCUMENT_TYPE_NODE}function Hc(n){return n&&n.nodeType===Fn.ELEMENT_NODE}function RB(n){return n&&n.nodeType===Fn.TEXT_NODE}function wW(n,e){var t=n.childNodes||[];if(Vc(t,Hc)||vd(e))return!1;var r=Vc(t,vd);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function _W(n,e){var t=n.childNodes||[];function r(i){return Hc(i)&&i!==e}if(Vc(t,r))return!1;var s=Vc(t,vd);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function i6e(n,e,t){if(!r6e(n))throw new zr(va,"Unexpected parent node type "+n.nodeType);if(t&&t.parentNode!==n)throw new zr(eae,"child not in parent");if(!s6e(e)||vd(e)&&n.nodeType!==Fn.DOCUMENT_NODE)throw new zr(va,"Unexpected node type "+e.nodeType+" for parent node type "+n.nodeType)}function a6e(n,e,t){var r=n.childNodes||[],s=e.childNodes||[];if(e.nodeType===Fn.DOCUMENT_FRAGMENT_NODE){var i=s.filter(Hc);if(i.length>1||Vc(s,RB))throw new zr(va,"More than one element or text in fragment");if(i.length===1&&!wW(n,t))throw new zr(va,"Element in fragment can not be inserted before doctype")}if(Hc(e)&&!wW(n,t))throw new zr(va,"Only one element can be added and only after doctype");if(vd(e)){if(Vc(r,vd))throw new zr(va,"Only one doctype is allowed");var a=Vc(r,Hc);if(t&&r.indexOf(a)<r.indexOf(t))throw new zr(va,"Doctype can only be inserted before an element");if(!t&&a)throw new zr(va,"Doctype can not be appended since element is present")}}function aae(n,e,t){var r=n.childNodes||[],s=e.childNodes||[];if(e.nodeType===Fn.DOCUMENT_FRAGMENT_NODE){var i=s.filter(Hc);if(i.length>1||Vc(s,RB))throw new zr(va,"More than one element or text in fragment");if(i.length===1&&!_W(n,t))throw new zr(va,"Element in fragment can not be inserted before doctype")}if(Hc(e)&&!_W(n,t))throw new zr(va,"Only one element can be added and only after doctype");if(vd(e)){if(Vc(r,function(l){return vd(l)&&l!==t}))throw new zr(va,"Only one doctype is allowed");var a=Vc(r,Hc);if(t&&r.indexOf(a)<r.indexOf(t))throw new zr(va,"Doctype can only be inserted before an element")}}function iN(n,e,t,r){i6e(n,e,t),n.nodeType===Fn.DOCUMENT_NODE&&(r||a6e)(n,e,t);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===gd){var i=e.firstChild;if(i==null)return e;var a=e.lastChild}else i=a=e;var o=t?t.previousSibling:n.lastChild;i.previousSibling=o,a.nextSibling=t,o?o.nextSibling=i:n.firstChild=i,t==null?n.lastChild=a:t.previousSibling=a;do i.parentNode=n;while(i!==a&&(i=i.nextSibling));return jB(n.ownerDocument||n,n),e.nodeType==gd&&(e.firstChild=e.lastChild=null),e}function o6e(n,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=n,e.previousSibling=n.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:n.firstChild=e,n.lastChild=e,jB(n.ownerDocument,n,e),e}gE.prototype={nodeName:"#document",nodeType:Jie,doctype:null,documentElement:null,_inc:1,insertBefore:function(n,e){if(n.nodeType==gd){for(var t=n.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return n}return iN(this,n,e),n.ownerDocument=this,this.documentElement===null&&n.nodeType===ql&&(this.documentElement=n),n},removeChild:function(n){return this.documentElement==n&&(this.documentElement=null),iae(this,n)},replaceChild:function(n,e){iN(this,n,e,aae),n.ownerDocument=this,e&&this.removeChild(e),Hc(n)&&(this.documentElement=n)},importNode:function(n,e){return dae(this,n,e)},getElementById:function(n){var e=null;return q1(this.documentElement,function(t){if(t.nodeType==ql&&t.getAttribute("id")==n)return e=t,!0}),e},getElementsByClassName:function(n){var e=vW(n);return new l0(this,function(t){var r=[];return e.length>0&&q1(t.documentElement,function(s){if(s!==t&&s.nodeType===ql){var i=s.getAttribute("class");if(i){var a=n===i;if(!a){var o=vW(i);a=e.every(Q$e(o))}a&&r.push(s)}}}),r})},createElement:function(n){var e=new hg;e.ownerDocument=this,e.nodeName=n,e.tagName=n,e.localName=n,e.childNodes=new ed;var t=e.attributes=new sN;return t._ownerElement=e,e},createDocumentFragment:function(){var n=new Aj;return n.ownerDocument=this,n.childNodes=new ed,n},createTextNode:function(n){var e=new PB;return e.ownerDocument=this,e.appendData(n),e},createComment:function(n){var e=new DB;return e.ownerDocument=this,e.appendData(n),e},createCDATASection:function(n){var e=new OB;return e.ownerDocument=this,e.appendData(n),e},createProcessingInstruction:function(n,e){var t=new IB;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=n,t.nodeValue=t.data=e,t},createAttribute:function(n){var e=new aN;return e.ownerDocument=this,e.name=n,e.nodeName=n,e.localName=n,e.specified=!0,e},createEntityReference:function(n){var e=new MB;return e.ownerDocument=this,e.nodeName=n,e},createElementNS:function(n,e){var t=new hg,r=e.split(":"),s=t.attributes=new sN;return t.childNodes=new ed,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=n,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(n,e){var t=new aN,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=n,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};Na(gE,Fn);function hg(){this._nsMap={}}hg.prototype={nodeType:ql,hasAttribute:function(n){return this.getAttributeNode(n)!=null},getAttribute:function(n){var e=this.getAttributeNode(n);return e&&e.value||""},getAttributeNode:function(n){return this.attributes.getNamedItem(n)},setAttribute:function(n,e){var t=this.ownerDocument.createAttribute(n);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(n){var e=this.getAttributeNode(n);e&&this.removeAttributeNode(e)},appendChild:function(n){return n.nodeType===gd?this.insertBefore(n,null):o6e(this,n)},setAttributeNode:function(n){return this.attributes.setNamedItem(n)},setAttributeNodeNS:function(n){return this.attributes.setNamedItemNS(n)},removeAttributeNode:function(n){return this.attributes.removeNamedItem(n.nodeName)},removeAttributeNS:function(n,e){var t=this.getAttributeNodeNS(n,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(n,e){return this.getAttributeNodeNS(n,e)!=null},getAttributeNS:function(n,e){var t=this.getAttributeNodeNS(n,e);return t&&t.value||""},setAttributeNS:function(n,e,t){var r=this.ownerDocument.createAttributeNS(n,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(n,e){return this.attributes.getNamedItemNS(n,e)},getElementsByTagName:function(n){return new l0(this,function(e){var t=[];return q1(e,function(r){r!==e&&r.nodeType==ql&&(n==="*"||r.tagName==n)&&t.push(r)}),t})},getElementsByTagNameNS:function(n,e){return new l0(this,function(t){var r=[];return q1(t,function(s){s!==t&&s.nodeType===ql&&(n==="*"||s.namespaceURI===n)&&(e==="*"||s.localName==e)&&r.push(s)}),r})}};gE.prototype.getElementsByTagName=hg.prototype.getElementsByTagName;gE.prototype.getElementsByTagNameNS=hg.prototype.getElementsByTagNameNS;Na(hg,Fn);function aN(){}aN.prototype.nodeType=o0;Na(aN,Fn);function vE(){}vE.prototype={data:"",substringData:function(n,e){return this.data.substring(n,n+e)},appendData:function(n){n=this.data+n,this.nodeValue=this.data=n,this.length=n.length},insertData:function(n,e){this.replaceData(n,0,e)},appendChild:function(n){throw new Error(zs[va])},deleteData:function(n,e){this.replaceData(n,e,"")},replaceData:function(n,e,t){var r=this.data.substring(0,n),s=this.data.substring(n+e);t=r+t+s,this.nodeValue=this.data=t,this.length=t.length}};Na(vE,Fn);function PB(){}PB.prototype={nodeName:"#text",nodeType:rN,splitText:function(n){var e=this.data,t=e.substring(n);e=e.substring(0,n),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Na(PB,vE);function DB(){}DB.prototype={nodeName:"#comment",nodeType:Zie};Na(DB,vE);function OB(){}OB.prototype={nodeName:"#cdata-section",nodeType:Kie};Na(OB,vE);function Cj(){}Cj.prototype.nodeType=Qie;Na(Cj,Fn);function oae(){}oae.prototype.nodeType=t6e;Na(oae,Fn);function lae(){}lae.prototype.nodeType=e6e;Na(lae,Fn);function MB(){}MB.prototype.nodeType=Yie;Na(MB,Fn);function Aj(){}Aj.prototype.nodeName="#document-fragment";Aj.prototype.nodeType=gd;Na(Aj,Fn);function IB(){}IB.prototype.nodeType=Xie;Na(IB,Fn);function cae(){}cae.prototype.serializeToString=function(n,e,t){return uae.call(n,e,t)};Fn.prototype.toString=uae;function uae(n,e){var t=[],r=this.nodeType==9&&this.documentElement||this,s=r.prefix,i=r.namespaceURI;if(i&&s==null){var s=r.lookupPrefix(i);if(s==null)var a=[{namespace:i,prefix:null}]}return Kv(this,t,n,e,a),t.join("")}function SW(n,e,t){var r=n.prefix||"",s=n.namespaceURI;if(!s||r==="xml"&&s===W1.XML||s===W1.XMLNS)return!1;for(var i=t.length;i--;){var a=t[i];if(a.prefix===r)return a.namespace!==s}return!0}function fD(n,e,t){n.push(" ",e,'="',t.replace(/[<&"]/g,rae),'"')}function Kv(n,e,t,r,s){if(s||(s=[]),r)if(n=r(n),n){if(typeof n=="string"){e.push(n);return}}else return;switch(n.nodeType){case ql:var i=n.attributes,a=i.length,v=n.firstChild,o=n.tagName;t=W1.isHTML(n.namespaceURI)||t;var l=o;if(!t&&!n.prefix&&n.namespaceURI){for(var u,d=0;d<i.length;d++)if(i.item(d).name==="xmlns"){u=i.item(d).value;break}if(!u)for(var h=s.length-1;h>=0;h--){var f=s[h];if(f.prefix===""&&f.namespace===n.namespaceURI){u=f.namespace;break}}if(u!==n.namespaceURI)for(var h=s.length-1;h>=0;h--){var f=s[h];if(f.namespace===n.namespaceURI){f.prefix&&(l=f.prefix+":"+o);break}}}e.push("<",l);for(var p=0;p<a;p++){var m=i.item(p);m.prefix=="xmlns"?s.push({prefix:m.localName,namespace:m.value}):m.nodeName=="xmlns"&&s.push({prefix:"",namespace:m.value})}for(var p=0;p<a;p++){var m=i.item(p);if(SW(m,t,s)){var g=m.prefix||"",y=m.namespaceURI;fD(e,g?"xmlns:"+g:"xmlns",y),s.push({prefix:g,namespace:y})}Kv(m,e,t,r,s)}if(o===l&&SW(n,t,s)){var g=n.prefix||"",y=n.namespaceURI;fD(e,g?"xmlns:"+g:"xmlns",y),s.push({prefix:g,namespace:y})}if(v||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(o)){if(e.push(">"),t&&/^script$/i.test(o))for(;v;)v.data?e.push(v.data):Kv(v,e,t,r,s.slice()),v=v.nextSibling;else for(;v;)Kv(v,e,t,r,s.slice()),v=v.nextSibling;e.push("</",l,">")}else e.push("/>");return;case Jie:case gd:for(var v=n.firstChild;v;)Kv(v,e,t,r,s.slice()),v=v.nextSibling;return;case o0:return fD(e,n.name,n.value);case rN:return e.push(n.data.replace(/[<&]/g,rae).replace(/]]>/g,"]]&gt;"));case Kie:return e.push("<![CDATA[",n.data,"]]>");case Zie:return e.push("<!--",n.data,"-->");case Qie:var x=n.publicId,b=n.systemId;if(e.push("<!DOCTYPE ",n.name),x)e.push(" PUBLIC ",x),b&&b!="."&&e.push(" ",b),e.push(">");else if(b&&b!=".")e.push(" SYSTEM ",b,">");else{var E=n.internalSubset;E&&e.push(" [",E,"]"),e.push(">")}return;case Xie:return e.push("<?",n.target," ",n.data,"?>");case Yie:return e.push("&",n.nodeName,";");default:e.push("??",n.nodeName)}}function dae(n,e,t){var r;switch(e.nodeType){case ql:r=e.cloneNode(!1),r.ownerDocument=n;case gd:break;case o0:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=n,r.parentNode=null,t)for(var s=e.firstChild;s;)r.appendChild(dae(n,s,t)),s=s.nextSibling;return r}function zI(n,e,t){var r=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=e[s];typeof i!="object"&&i!=r[s]&&(r[s]=i)}switch(e.childNodes&&(r.childNodes=new ed),r.ownerDocument=n,r.nodeType){case ql:var a=e.attributes,o=r.attributes=new sN,l=a.length;o._ownerElement=r;for(var u=0;u<l;u++)r.setAttributeNode(zI(n,a.item(u),!0));break;case o0:t=!0}if(t)for(var d=e.firstChild;d;)r.appendChild(zI(n,d,t)),d=d.nextSibling;return r}function hae(n,e,t){n[e]=t}try{if(Object.defineProperty){let n=function(e){switch(e.nodeType){case ql:case gd:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(n(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(l0.prototype,"length",{get:function(){return TB(this),this.$$length}}),Object.defineProperty(Fn.prototype,"textContent",{get:function(){return n(this)},set:function(e){switch(this.nodeType){case ql:case gd:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),hae=function(e,t,r){e["$$"+t]=r}}}catch{}Vf.DocumentType=Cj;Vf.DOMException=zr;Vf.DOMImplementation=nae;Vf.Element=hg;Vf.Node=Fn;Vf.NodeList=ed;Vf.XMLSerializer=cae;var yE={},fae={};(function(n){var e=Hf.freeze;n.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),n.HTML_ENTITIES=e
vendor: 14,815 bytes, line 973
973({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:
973`
974`
vendor: 9,925 bytes, line 974
974,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"
974	",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),n.entityMap=n.HTML_ENTITIES})(fae);var LB={},G1=Hf.NAMESPACE,$I=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,EW=new RegExp("[\\-\\.0-9"+$I.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),kW=new RegExp("^"+$I.source+EW.source+"*(?::"+$I.source+EW.source+"*)?$"),db=0,Dd=1,nv=2,hb=3,rv=4,sv=5,fb=6,Sk=7;function c0(n,e){this.message=n,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,c0)}c0.prototype=new Error;c0.prototype.name=c0.name;function pae(){}pae.prototype={parse:function(n,e,t){var r=this.domBuilder;r.startDocument(),mae(e,e={}),l6e(n,e,t,r,this.errorHandler),r.endDocument()}};function l6e(n,e,t,r,s){function i(q){if(q>65535){q-=65536;var I=55296+(q>>10),B=56320+(q&1023);return String.fromCharCode(I,B)}else return String.fromCharCode(q)}function a(q){var I=q.slice(1,-1);return I in t?t[I]:I.charAt(0)==="#"?i(parseInt(I.substr(1).replace("x","0x"))):(s.error("entity n
974ot found:"+q),q)}function o(q){if(q>g){var I=n.substring(g,q).replace(/&#?\w+;/g,a);f&&l(g),r.characters(I,0,q-g),g=q}}function l(q,I){for(;q>=d&&(I=h.exec(n));)u=I.index,d=u+I[0].length,f.lineNumber++;f.columnNumber=q-u+1}for(var u=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,f=r.locator,p=[{currentNSMap:e}],m={},g=0;;){try{var y=n.indexOf("<",g);if(y<0){if(!n.substr(g).match(/^\s*$/)){var v=r.doc,x=v.createTextNode(n.substr(g));v.appendChild(x),r.currentElement=x}return}switch(y>g&&o(y),n.charAt(y+1)){case"/":var D=n.indexOf(">",y+3),b=n.substring(y+2,D).replace(/[ \t\n\r]+$/g,""),E=p.pop();D<0?(b=n.substring(y+2).replace(/[\s<].*/,""),s.error("end tag name: "+b+" is not complete:"+E.tagName),D=y+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),s.error("end tag name: "+b+" maybe not complete"),D=y+1+b.length);var S=E.localNSMap,k=E.tagName==b,C=k||E.tagName&&E.tagName.toLowerCase()==b.toLowerCase();if(C){if(r.endElement(E.uri,E.localName,b),S)for(var A in S)Object.prototype.hasOwnProperty.call(S,A)&&r.endPrefixMapping(A);k||s.fatalError("end tag name: "+b+" is not match the current start tagName:"+E.tagName)}else p.push(E);D++;break;case"?":f&&l(y),D=f6e(n,y,r);break;case"!":f&&l(y),D=h6e(n,y,r,s);break;default:f&&l(y);var T=new gae,j=p[p.length-1].currentNSMap,D=c6e(n,y,T,j,a,s),R=T.length;if(!T.closed&&d6e(n,D,T.tagName,m)&&(T.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),f&&R){for(var M=CW(f,{}),N=0;N<R;N++){var U=T[N];l(U.offset),U.locator=CW(f,{})}r.locator=M,AW(T,r,j)&&p.push(T),r.locator=f}else AW(T,r,j)&&p.push(T);G1.isHTML(T.uri)&&!T.closed?D=u6e(n,D,T.tagName,a,r):D++}}catch(q){if(q instanceof c0)throw q;s.error("element parse error: "+q),D=-1}D>g?g=D:o(Math.max(y,g)+1)}}function CW(n,e){return e.lineNumber=n.lineNumber,e.columnNumber=n.columnNumber,e}function c6e(n,e,t,r,s,i){function a(f,p,m){t.attributeNames.hasOwnProperty(f)&&i.fatalError("Attribute "+f+" redefined"),t.addValue(f,p,m)}for(var o,l,u=++e,d=db;;){var h=n.charAt(u);switch(h){case"=":if(d===Dd)o=n.slice(e,u),d=hb;else if(d===nv)d=hb;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===hb||d===Dd)if(d===Dd&&(i.warning('attribute value must after "="'),o=n.slice(e,u)),e=u+1,u=n.indexOf(h,e),u>0)l=n.slice(e,u).replace(/&#?\w+;/g,s),a(o,l,e-1),d=sv;else throw new Error("attribute value no end '"+h+"' match");else if(d==rv)l=n.slice(e,u).replace(/&#?\w+;/g,s),a(o,l,e),i.warning('attribute "'+o+'" missed start quot('+h+")!!"),e=u+1,d=sv;else throw new Error('attribute value must after "="');break;case"/":switch(d){case db:t.setTagName(n.slice(e,u));case sv:case fb:case Sk:d=Sk,t.closed=!0;case rv:case Dd:break;case nv:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),d==db&&t.setTagName(n.slice(e,u)),u;case">":switch(d){case db:t.setTagName(n.slice(e,u));case sv:case fb:case Sk:break;case rv:case Dd:l=n.slice(e,u),l.slice(-1)==="/"&&(t.closed=!0,l=l.slice(0,-1));case nv:d===nv&&(l=o),d==rv?(i.warning('attribute "'+l+'" missed quot(")!'),a(o,l.replace(/&#?\w+;/g,s),e)):((!G1.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case hb:throw new Error("attribute value missed!!")}return u;case"€":h=" ";default:if(h<=" ")switch(d){case db:t.setTagName(n.slice(e,u)),d=fb;break;case Dd:o=n.slice(e,u),d=nv;break;case rv:var l=n.slice(e,u).replace(/&#?\w+;/g,s);i.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case sv:d=fb;break}else switch(d){case nv:t.tagName,(!G1.isHTML(r[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=u,d=Dd;break;case sv:i.warning('attribute space is required"'+o+'"!!');case fb:d=Dd,e=u;break;case hb:d=rv,e=u;break;case Sk:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function AW(n,e,t){for(var r=n.tagName,s=null,h=n.length;h--;){var i=n[h],a=i.qName,o=i.value,f=a.indexOf(":");if(f>0)var l=i.prefix=a.slice(0,f),u=a.slice(f+1),d=l==="xmlns"&&u;else u=a,l=null,d=a==="xmlns"&&"";i.localName=u,d!==!1&&(s==null&&(s={},mae(t,t={})),t[d]=s[d]=o,i.uri=G1.XMLNS,e.startPrefixMapping(d,o))}for(var h=n.length;h--;){i=n[h];var l=i.prefix;l&&(l==="xml"&&(i.uri=G1.XML),l!=="xmlns"&&(i.uri=t[l||""]))}var f=r.indexOf(":");f>0?(l=n.prefix=r.slice(0,f),u=n.localName=r.slice(f+1)):(l=null,u=n.localName=r);var p=n.uri=t[l||""];if(e.startElement(p,u,r,n),n.closed){if(e.endElement(p,u,r),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}else return n.currentNSMap=t,n.localNSMap=s,!0}function u6e(n,e,t,r,s){if(/^(?:script|textarea)$/i.test(t)){var i=n.indexOf("</"+t+">",e),a=n.substring(e+1,i);if(/[&<]/.test(a))return/^script$/i.test(t)?(s.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),s.characters(a,0,a.length),i)}return e+1}function d6e(n,e,t,r){var s=r[t];return s==null&&(s=n.lastIndexOf("</"+t+">"),s<e&&(s=n.lastIndexOf("</"+t)),r[t]=s),s<e}function mae(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}function h6e(n,e,t,r){var s=n.charAt(e+2);switch(s){case"-":if(n.charAt(e+3)==="-"){var i=n.indexOf("-->",e+4);return i>e?(t.comment(n,e+4,i-e-4),i+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(n.substr(e+3,6)=="CDATA["){var i=n.indexOf("]]>",e+9);return t.startCDATA(),t.characters(n,e+9,i-e-9),t.endCDATA(),i+3}var a=p6e(n,e),o=a.length;if(o>
vendor: 4,499 bytes, lines 974-975
9741&&/!doctype/i.test(a[0][0])){var l=a[1][0],u=!1,d=!1;o>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],d=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(d=a[3][0]));var h=a[o-1];return t.startDTD(l,u,d),t.endDTD(),h.index+h[0].length}}return-1}function f6e(n,e,t){var r=n.indexOf("?>",e);if(r){var s=n.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),r+2):-1}return-1}function gae(){this.attributeNames={}}gae.prototype={setTagName:function(n){if(!kW.test(n))throw new Error("invalid tagName:"+n);this.tagName=n},addValue:function(n,e,t){if(!kW.test(n))throw new Error("invalid attribute:"+n);this.attributeNames[n]=this.length,this[this.length++]={qName:n,value:e,offset:t}},length:0,getLocalName:function(n){return this[n].localName},getLocator:function(n){return this[n].locator},getQName:function(n){return this[n].qName},getURI:function(n){return this[n].uri},getValue:function(n){return this[n].value}};function p6e(n,e){var t,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(n);t=s.exec(n);)if(r.push(t),t[1])return r}LB.XMLReader=pae;LB.ParseError=c0;var m6e=Hf,FB=Vf,NW=fae,vae=LB,g6e=FB.DOMImplementation,TW=m6e.NAMESPACE,v6e=vae.ParseError,y6e=vae.XMLReader;function yae(n){this.options=n||{locator:{}}}yae.prototype.parseFromString=function(n,e){var t=this.options,r=new y6e,s=t.domBuilder||new xE,i=t.errorHandler,a=t.locator,o=t.xmlns||{},l=/\/x?html?$/.test(e),u=l?NW.HTML_ENTITIES:NW.XML_ENTITIES;return a&&s.setDocumentLocator(a),r.errorHandler=x6e(i,s,a),r.domBuilder=t.domBuilder||s,l&&(o[""]=TW.HTML),o.xml=o.xml||TW.XML,n&&typeof n=="string"?r.parse(n,o,u):r.errorHandler.error("invalid doc source"),s.doc};function x6e(n,e,t){if(!n){if(e instanceof xE)return e;n=e}var r={},s=n instanceof Function;t=t||{};function i(a){var o=n[a];!o&&s&&(o=n.length==2?function(l){n(a,l)}:n),r[a]=o&&function(l){o("[xmldom "+a+"]	"+l+UI(t))}||function(){}}return i("warning"),i("error"),i("fatalError"),r}function xE(){this.cdata=!1}function iv(n,e){e.lineNumber=n.lineNumber,e.columnNumber=n.columnNumber}xE.prototype={startDocument:function(){this.doc=new g6e().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(n,e,t,r){var s=this.doc,i=s.createElementNS(n,t||e),a=r.length;Ek(this,i),this.currentElement=i,this.locator&&iv(this.locator,i);for(var o=0;o<a;o++){var n=r.getURI(o),l=r.getValue(o),t=r.getQName(o),u=s.createAttributeNS(n,t);this.locator&&iv(r.getLocator(o),u),u.value=u.nodeValue=l,i.setAttributeNode(u)}},endElement:function(n,e,t){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(n,e){},endPrefixMapping:function(n){},processingInstruction:function(n,e){var t=this.doc.createProcessingInstruction(n,e);this.locator&&iv(this.locator,t),Ek(this,t)},ignorableWhitespace:function(n,e,t){},characters:function(n,e,t){if(n=jW.apply(this,arguments),n){if(this.cdata)var r=this.doc.createCDATASection(n);else var r=this.doc.createTextNode(n);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(n)&&this.doc.appendChild(r),this.locator&&iv(this.locator,r)}},skippedEntity:function(n){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(n){(this.locator=n)&&(n.lineNumber=0)},comment:function(n,e,t){n=jW.apply(this,arguments);var r=this.doc.createComment(n);this.locator&&iv(this.locator,r),Ek(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(n,e,t){var r=this.doc.implementation;if(r&&r.createDocumentType){var s=r.createDocumentType(n,e,t);this.locator&&iv(this.locator,s),Ek(this,s),this.doc.doctype=s}},warning:function(n){console.warn("[xmldom warning]	"+n,UI(this.locator))},error:function(n){console.error("[xmldom error]	"+n,UI(this.locator))},fatalError:function(n){throw new v6e(n,this.locator)}};function UI(n){if(n)return`
975@`+(n.systemId||"")+"#[line:"+n.lineNumber+",col:"+n.columnNumber+"]"}function jW(n,e,t){return typeof n=="string"?n.substr(e,t):n.length>=e+t||e?new java.lang.String(n,e,t)+"":n}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(n){xE.prototype[n]=function(){return null}});function Ek(n,e){n.currentElement?n.currentElement.appendChild(e):n.doc.appendChild(e)}yE.__DOMHandler=xE;yE.DOMParser=yae;yE.DOMImplementation=FB.DOMImplementation;
vendor: 11,542 bytes, line 975
975yE.XMLSerializer=FB.XMLSerializer;var xae=yE.DOMParser;const BB=typeof window<"u"?window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame:!1,b6e=1,w6e=3,bae=typeof URL<"u"?URL:typeof window<"u"?window.URL||window.webkitURL||window.mozURL:void 0;function Nj(){var n=new Date().getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(t=="x"?r:r&7|8).toString(16)});return e}function _6e(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function wae(n){return!!(n&&n.nodeType==1)}function Nr(n){return!isNaN(parseFloat(n))&&isFinite(n)}function _ae(n){let e=parseFloat(n);return Nr(n)===!1?!1:typeof n=="string"&&n.indexOf(".")>-1?!0:Math.floor(e)!==e}function gv(n){var e=["Webkit","webkit","Moz","O","ms"],t=["-webkit-","-webkit-","-moz-","-o-","-ms-"],r=n.toLowerCase(),s=e.length;if(typeof document>"u"||typeof document.body.style[r]<"u")return n;for(var i=0;i<s;i++)if(typeof document.body.style[t[i]+r]<"u")return t[i]+r;return n}function Sae(n){for(var e=1,t=arguments.length;e<t;e++){var r=arguments[e];for(var s in r)n[s]===void 0&&(n[s]=r[s])}return n}function ri(n){var e=[].slice.call(arguments,1);return e.forEach(function(t){t&&Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}),n}function S6e(n,e,t){var r=u0(n,e,t);return e.splice(r,0,n),r}function u0(n,e,t,r,s){var i=r||0,a=s||e.length,o=parseInt(i+(a-i)/2),l;return t||(t=function(u,d){if(u>d)return 1;if(u<d)return-1;if(u==d)return 0}),a-i<=0?o:(l=t(e[o],n),a-i===1?l>=0?o:o+1:l===0?o:l===-1?u0(n,e,t,o,a):u0(n,e,t,i,o))}function oN(n,e,t,r,s){var i=r||0,a=s||e.length,o=parseInt(i+(a-i)/2),l;return t||(t=function(u,d){if(u>d)return 1;if(u<d)return-1;if(u==d)return 0}),a-i<=0?-1:(l=t(e[o],n),a-i===1?l===0?o:-1:l===0?o:l===-1?oN(n,e,t,o,a):oN(n,e,t,i,o))}function yC(n){var e=window.getComputedStyle(n),t=["width","paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],r=["height","paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],s=0,i=0;return t.forEach(function(a){s+=parseFloat(e[a])||0}),r.forEach(function(a){i+=parseFloat(e[a])||0}),{height:i,width:s}}function lN(n){var e=window.getComputedStyle(n),t=["paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],r=["paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],s=0,i=0;return t.forEach(function(a){s+=parseFloat(e[a])||0}),r.forEach(function(a){i+=parseFloat(e[a])||0}),{height:i,width:s}}function VI(n){let e,t=n.ownerDocument;if(n.nodeType==Node.TEXT_NODE){let r=t.createRange();r.selectNodeContents(n),e=r.getBoundingClientRect()}else e=n.getBoundingClientRect();return e}function cN(){var n=window.innerWidth,e=window.innerHeight;return{top:0,left:0,right:n,bottom:e,width:n,height:e}}function zB(n,e){for(var t=n.parentNode,r=t.childNodes,s,i=-1,a=0;a<r.length&&(s=r[a],s.nodeType===e&&i++,s!=n);a++);return i}function E6e(n){return zB(n,w6e)}function Eae(n){return zB(n,b6e)}function K1(n){return["xml","opf","ncx"].indexOf(n)>-1}function kae(n,e){return new Blob([n],{type:e})}function uN(n,e){var t,r=kae(n,e);return t=bae.createObjectURL(r),t}function Cae(n){return bae.revokeObjectURL(n)}function HI(n,e){var t,r;if(typeof n=="string")return t=btoa(n),r="data:"+e+";base64,"+t,r}function Aae(n){return Object.prototype.toString.call(n).slice(8,-1)}function Wc(n,e,t){var r,s;return typeof DOMParser>"u"||t?s=xae:s=DOMParser,n.charCodeAt(0)===65279&&(n=n.slice(1)),r=new s().parseFromString(n,e),r}function Vn(n,e){var t;if(!n)throw new Error("No Element Provided");if(typeof n.querySelector<"u")return n.querySelector(e);if(t=n.getElementsByTagName(e),t.length)return t[0]}function yd(n,e){return typeof n.querySelector<"u"?n.querySelectorAll(e):n.getElementsByTagName(e)}function vv(n,e,t){var r,s;if(typeof n.querySelector<"u"){e+="[";for(var i in t)e+=i+"~='"+t[i]+"'";return e+="]",n.querySelector(e)}else if(r=n.getElementsByTagName(e),s=Array.prototype.slice.call(r,0).filter(function(a){for(var o in t)if(a.getAttribute(o)===t[o])return!0;return!1}),s)return s[0]}function dN(n,e){var t=n.ownerDocument||n;typeof t.createTreeWalker<"u"?Nae(n,e,NodeFilter.SHOW_TEXT):$B(n,function(r){r&&r.nodeType===3&&e(r)})}function Nae(n,e,t){var r=document.createTreeWalker(n,t,null,!1);let s;for(;s=r.nextNode();)e(s)}function $B(n,e){if(e(n))return!0;if(n=n.firstChild,n)do{if($B(n,e))return!0;n=n.nextSibling}while(n)}function Tae(n){return new Promise(function(e,t){var r=new FileReader;r.readAsDataURL(n),r.onloadend=function(){e(r.result)}})}function fn(){this.resolve=null,this.reject=null,this.id=Nj(),this.promise=new Promise((n,e)=>{this.resolve=n,this.reject=e}),Object.freeze(this)}function hN(n,e,t){var r;if(typeof n.querySelector<"u"&&(r=n.querySelector(`${e}[*|type="${t}"]`)),!r||r.length===0){r=yd(n,e);for(var s=0;s<r.length;s++)if(r[s].getAttributeNS("http://www.idpf.org/2007/ops","type")===t||r[s].getAttribute("epub:type")===t)return r[s]}else return r}function WI(n){for(var e=[],t=n.childNodes,r=0;r<t.length;r++){let s=t[r];s.nodeType===1&&e.push(s)}return e}function qI(n){for(var e=[n];n;n=n.parentNode)e.unshift(n);return e}function yv(n,e,t){for(var r=[],s=n.childNodes,i=0;i<s.length;i++){let a=s[i];if(a.nodeType===1&&a.nodeName.toLowerCase()===e){if(t)return a;r.push(a)}}if(!t)return r}function k6e(n,e){let t;if(!(n===null||e===""))for(t=n.parentNode;t.nodeType===1;){if(t.tagName.toLowerCase()===e)return t;t=t.parentNode}}class jae{constructor(){this.collapsed=!1,this.commonAncestorContainer=void 0,this.endContainer=void 0,this.endOffset=void 0,this.startContainer=void 0,this.startOffset=void 0}setStart(e,t){this.startContainer=e,this.startOffset=t,this.endContainer?this.commonAncestorContainer=this._commonAncestorContainer():this.collapse(!0),this._checkCollapsed()}setEnd(e,t){this.endContainer=e,this.endOffset=t,this.startContainer?(this.collapsed=!1,this.commonAncestorContainer=this._commonAncestorContainer()):this.collapse(!1),this._checkCollapsed()}collapse(e){this.collapsed=!0,e?(this.endContainer=this.startContainer,this.endOffset=this.startOffset,this.commonAncestorContainer=this.startContainer.parentNode):(this.startContainer=this.endContainer,this.startOffset=this.endOffset,this.commonAncestorContainer=this.endOffset.parentNode)}selectNode(e){let t=e.parentNode,r=Array.prototype.indexOf.call(t.childNodes,e);this.setStart(t,r),this.setEnd(t,r+1)}selectNodeContents(e){e.childNodes[e.childNodes-1];let t=e.nodeType===3?e.textContent.length:parent.childNodes.length;this.setStart(e,0),this.setEnd(e,t)}_commonAncestorContainer(e,t){var r=qI(e||this.startContainer),s=qI(t||this.endContainer);if(r[0]==s[0]){for(var i=0;i<r.length;i++)if(r[i]!=s[i])return r[i-1]}}_checkCollapsed(){this.startContainer===this.endContainer&&this.startOffset===this.endOffset?this.collapsed=!0:this.collapsed=!1}toString(){}}const C6e=Object.freeze(Object.defineProperty({__proto__:null,RangeObject:jae,blob2base64:Tae,borders:lN,bounds:yC,createBase64Url:HI,createBlob:kae,createBlobUrl:uN,defaults:Sae,defer:fn,documentHeight:_6e,extend:ri,filterChildren:yv,findChildren:WI,getParentByTagName:k6e,indexOfElementNode:Eae,indexOfNode:zB,indexOfSorted:oN,indexOfTextNode:E6e,insert:S6e,isElement:wae,isFloat:_ae,isNumber:Nr,isXml:K1,locationOf:u0,nodeBounds:VI,parents:qI,parse:Wc,prefixed:gv,qs:Vn,qsa:yd,qsp:vv,querySelectorByType:hN,requestAnimationFrame:BB,revokeBlobUrl:Cae,sprint:dN,treeWalker:Nae,type:Aae,uuid:Nj,walk:$B,windowBounds:cN},Symbol.toStringTag,{value:"Module"}));if(!Rae)var Rae={cwd:function(){return"/"}};function rc(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+n)}function RW(n,e){for(var t="",r=-1,s=0,i,a=0;a<=n.length;++a){if(a<n.length)i=n.charCodeAt(a);else{if(i===47)break;i=47}if(i===47){if(!(r===a-1||s===1))if(r!==a-1&&s===2){if(t.length<2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){for(var o=t.length-1,l=o;l>=0&&t.charCodeAt(l)!==47;--l);if(l!==o){l===-1?t="":t=t.slice(0,l),r=a,s=0;continue}}else if(t.length===2||t.length===1){t="",r=a,s=0;continue}}e&&(t.length>0?t+="/..":t="..")}else t.length>0?t+="/"+n.slice(r+1,a):t=n.slice(r+1,a);r=a,s=0}else i===46&&s!==-1?++s:s=-1}return t}function A6e(n,e){var t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+r:t+n+r:r}var xC={resolve:function(){for(var e="",t=!1,r,s=arguments.length-1;s>=-1&&!t;s--){var i;s>=0?i=arguments[s]:(r===void 0&&(r=Rae.cwd()),i=r),rc(i),i.length!==0&&(e=i+"/"+e,t=i.charCodeAt(0)===47)}return e=RW(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(rc(e),e.length===0)return".";var t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;return e=RW(e,!t),e.length===0&&!t&&(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return rc(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];rc(r),r.length>0&&(e===void 0?e=r:e+="/"+r)}return e===void 0?".":xC.normalize(e)},relative:function(e,t){if(rc(e),rc(t),e===t||(e=xC.resolve(e),t=xC.resolve(t),e===t))return"";for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var s=e.length,i=s-r,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,l=o-a,u=i<l?i:l,d=-1,h=0;h<=u;++h){if(h===u){if(l>u){if(t.charCodeAt(a+h)===47)return t.slice(a+h+1);if(h===0)return t.slice(a+h)}else i>u&&(e.charCodeAt(r+h)===47?d=h:h===0&&(d=0));break}var f=e.charCodeAt(r+h),p=t.charCodeAt(a+h);if(f!==p)break;f===47&&(d=h)}var m="";for(h=r+d+1;h<=s;++h)(h===s||e.charCodeAt(h)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(rc(e),e.length===0)return".";for(var t=e.charCodeAt(0),r=t===47,s=-1,i=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!i){s=a;break}}else i=!1;return s===-1?r?"/":".":r&&s===1?"//":e.slice(0,s)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rc(e);var r=0,s=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,l=-1;for(a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(u===47){if(!i){r=a+1;break}}else l===-1&&(i=!1,l=a+1),o>=0&&(u===t.charCodeAt(o)?--o===-1&&(s=a):(o=-1,s=l))}return r===s?s=l:s===-1&&(s=e.length),e.slice(r,s)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){r=a+1;break}}else s===-1&&(i=!1,s=a+1);return s===-1?"":e.slice(r,s)}},extname:function(e){rc(e);for(var t=-1,r=0,s=-1,i=!0,a=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!i){r=o+1;break}continue}s===-1&&(i=!1,s=o+1),l===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===r+1?"":e.slice(t,s)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('Parameter "pathObject" must be an object, not '+typeof e);return A6e("/",e)},parse:function(e){rc(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var r=e.charCodeAt(0),s=r===47,i;s?(t.root="/",i=1):i=0;for(var a=-1,o=0,l=-1,u=!0,d=e.length-1,h=0;d>=i;
975--d){if(r=e.charCodeAt(d),r===47){if(!u){o=d+1;break}continue}l===-1&&(u=!1,l=d+1),r===46?a===-1?a=d:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||l===-1||h===0||h===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&s?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&s?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",posix:null},N6e=xC;const Hh=ro(N6e);class xd{constructor(e){var t,r;t=e.indexOf("://"),t>-1&&(e=new URL(e).pathname),r=this.parse(e),this.path=e,this.isDirectory(e)?this.directory=e:this.directory=r.dir+"/",this.filename=r.base,this.extension=r.ext.slice(1)}parse(e){return Hh.parse(e)}isAbsolute(e){return Hh.isAbsolute(e||this.path)}isDirectory(e){return e.charAt(e.length-1)==="/"}resolve(e){return Hh.resolve(this.directory,e)}relative(e){var t=e&&e.indexOf("://")>-1;return t?e:Hh.relative(this.directory,e)}splitPath(e){return this.splitPathRe.exec(e).slice(1)}toString(){return this.path}}class pl{constructor(e,t){var r=e.indexOf("://")>-1,s=e,i;if(this.Url=void 0,this.href=e,this.protocol="",this.origin="",this.hash="",this.hash="",this.search="",this.base=t,!r&&t!==!1&&typeof t!="string"&&window&&window.location&&(this.base=window.location.href),r||this.base)try{this.base?this.Url=new URL(e,this.base):this.Url=new URL(e),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,s=this.Url.pathname+(this.Url.search?this.Url.search:"")}catch{this.Url=void 0,this.base&&(i=new xd(this.base),s=i.resolve(s))}this.Path=new xd(s),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}path(){return this.Path}resolve(e){var t=e.indexOf("://")>-1,r;return t?e:(r=Hh.resolve(this.directory,e),this.origin+r)}relative(e){return Hh.relative(e,this.directory)}toString(){return this.href}}const av=1,ho=3,T6e=9;class pn{constructor(e,t,r){var s;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof pn))return new pn(e,t,r);if(typeof t=="string"?this.base=this.parseComponent(t):typeof t=="object"&&t.steps&&(this.base=t),s=this.checkType(e),s==="string")return this.str=e,ri(this,this.parse(e));if(s==="range")return ri(this,this.fromRange(e,this.base,r));if(s==="node")return ri(this,this.fromNode(e,this.base,r));if(s==="EpubCFI"&&e.path)return e;if(e)throw new TypeError("not a valid argument for EpubCFI");return this}checkType(e){return this.isCfiString(e)?"string":e&&typeof e=="object"&&(Aae(e)==="Range"||typeof e.startContainer<"u")?"range":e&&typeof e=="object"&&typeof e.nodeType<"u"?"node":e&&typeof e=="object"&&e instanceof pn?"EpubCFI":!1}parse(e){var t={spinePos:-1,range:!1,base:{},path:{},start:null,end:null},r,s,i;return typeof e!="string"?{spinePos:-1}:(e.indexOf("epubcfi(")===0&&e[e.length-1]===")"&&(e=e.slice(8,e.length-1)),r=this.getChapterComponent(e),r?(t.base=this.parseComponent(r),s=this.getPathComponent(e),t.path=this.parseComponent(s),i=this.getRange(e),i&&(t.range=!0,t.start=this.parseComponent(i[0]),t.end=this.parseComponent(i[1])),t.spinePos=t.base.steps[1].index,t):{spinePos:-1})}parseComponent(e){var t={steps:[],terminal:{offset:null,assertion:null}},r=e.split(":"),s=r[0].split("/"),i;return r.length>1&&(i=r[1],t.terminal=this.parseTerminal(i)),s[0]===""&&s.shift(),t.steps=s.map((function(a){return this.parseStep(a)}).bind(this)),t}parseStep(e){var t,r,s,i,a;if(i=e.match(/\[(.*)\]/),i&&i[1]&&(a=i[1]),r=parseInt(e),!isNaN(r))return r%2===0?(t="element",s=r/2-1):(t="text",s=(r-1)/2),{type:t,index:s,id:a||null}}parseTerminal(e){var t,r,s=e.match(/\[(.*)\]/);return s&&s[1]?(t=parseInt(e.split("[")[0]),r=s[1]):t=parseInt(e),Nr(t)||(t=null),{offset:t,assertion:r}}getChapterComponent(e){var t=e.split("!");return t[0]}getPathComponent(e){var t=e.split("!");if(t[1])return t[1].split(",")[0]}getRange(e){var t=e.split(",");return t.length===3?[t[1],t[2]]:!1}getCharecterOffsetComponent(e){var t=e.split(":");return t[1]||""}joinSteps(e){return e?e.map(function(t){var r="";
vendor: 4,772 bytes, line 975
975return t.type==="element"&&(r+=(t.index+1)*2),t.type==="text"&&(r+=1+2*t.index),t.id&&(r+="["+t.id+"]"),r}).join("/"):""}segmentString(e){var t="/";return t+=this.joinSteps(e.steps),e.terminal&&e.terminal.offset!=null&&(t+=":"+e.terminal.offset),e.terminal&&e.terminal.assertion!=null&&(t+="["+e.terminal.assertion+"]"),t}toString(){var e="epubcfi(";return e+=this.segmentString(this.base),e+="!",e+=this.segmentString(this.path),this.range&&this.start&&(e+=",",e+=this.segmentString(this.start)),this.range&&this.end&&(e+=",",e+=this.segmentString(this.end)),e+=")",e}compare(e,t){var r,s,i,a;if(typeof e=="string"&&(e=new pn(e)),typeof t=="string"&&(t=new pn(t)),e.spinePos>t.spinePos)return 1;if(e.spinePos<t.spinePos)return-1;e.range?(r=e.path.steps.concat(e.start.steps),i=e.start.terminal):(r=e.path.steps,i=e.path.terminal),t.range?(s=t.path.steps.concat(t.start.steps),a=t.start.terminal):(s=t.path.steps,a=t.path.terminal);for(var o=0;o<r.length;o++){if(!r[o])return-1;if(!s[o]||r[o].index>s[o].index)return 1;if(r[o].index<s[o].index)return-1}return r.length<s.length?-1:i.offset>a.offset?1:i.offset<a.offset?-1:0}step(e){var t=e.nodeType===ho?"text":"element";return{id:e.id,tagName:e.tagName,type:t,index:this.position(e)}}filteredStep(e,t){var r=this.filter(e,t),s;if(r)return s=r.nodeType===ho?"text":"element",{id:r.id,tagName:r.tagName,type:s,index:this.filteredPosition(r,t)}}pathTo(e,t,r){for(var s={steps:[],terminal:{offset:null,assertion:null}},i=e,a;i&&i.parentNode&&i.parentNode.nodeType!=T6e;)r?a=this.filteredStep(i,r):a=this.step(i),a&&s.steps.unshift(a),i=i.parentNode;return t!=null&&t>=0&&(s.terminal.offset=t,s.steps[s.steps.length-1].type!="text"&&s.steps.push({type:"text",index:0})),s}equalStep(e,t){return!e||!t?!1:e.index===t.index&&e.id===t.id&&e.type===t.type}fromRange(e,t,r){var s={range:!1,base:{},path:{},start:null,end:null},i=e.startContainer,a=e.endContainer,o=e.startOffset,l=e.endOffset,u=!1;if(r&&(u=i.ownerDocument.querySelector("."+r)!=null),typeof t=="string"?(s.base=this.parseComponent(t),s.spinePos=s.base.steps[1].index):typeof t=="object"&&(s.base=t),e.collapsed)u&&(o=this.patchOffset(i,o,r)),s.path=this.pathTo(i,o,r);else{s.range=!0,u&&(o=this.patchOffset(i,o,r)),s.start=this.pathTo(i,o,r),u&&(l=this.patchOffset(a,l,r)),s.end=this.pathTo(a,l,r),s.path={steps:[],terminal:null};var d=s.start.steps.length,h;for(h=0;h<d&&this.equalStep(s.start.steps[h],s.end.steps[h]);h++)h===d-1?s.start.terminal===s.end.terminal&&(s.path.steps.push(s.start.steps[h]),s.range=!1):s.path.steps.push(s.start.steps[h]);s.start.steps=s.start.steps.slice(s.path.steps.length),s.end.steps=s.end.steps.slice(s.path.steps.length)}return s}fromNode(e,t,r){var s={range:!1,base:{},path:{},start:null,end:null};return typeof t=="string"?(s.base=this.parseComponent(t),s.spinePos=s.base.steps[1].index):typeof t=="object"&&(s.base=t),s.path=this.pathTo(e,null,r),s}filter(e,t){var r,s,i,a,o,l=!1;return e.nodeType===ho?(l=!0,i=e.parentNode,r=e.parentNode.classList.contains(t)):(l=!1,r=e.classList.contains(t)),r&&l?(a=i.previousSibling,o=i.nextSibling,a&&a.nodeType===ho?s=a:o&&o.nodeType===ho&&(s=o),s||e):r&&!l?!1:e}patchOffset(e,t,r){if(e.nodeType!=ho)throw new Error("Anchor must be a text node");var s=e,i=t;for(e.parentNode.classList.contains(r)&&(s=e.parentNode);s.previousSibling;){if(s.previousSibling.nodeType===av)if(s.previousSibling.classList.contains(r))i+=s.previousSibling.textContent.length;else break;else i+=s.previousSibling.textContent.length;s=s.previousSibling}return i}normalizedMap(e,t,r){var s={},i=-1,a,o=e.length,l,u;for(a=0;a<o;a++)l=e[a].nodeType,l===av&&e[a].classList.contains(r)&&(l=ho),a>0&&l===ho&&u===ho?s[a]=i:t===l&&(i=i+1,s[a]=i),u=l;return s}position(e){var t,r;return e.nodeType===av?(t=e.parentNode.children,t||(t=WI(e.parentNode)),r=Array.prototype.indexOf.call(t,e)):(t=this.textNodes(e.parentNode),r=t.indexOf(e)),r}filteredPosition(e,t){var r,s,i;return e.nodeType===av?(r=e.parentNode.children,i=this.normalizedMap(r,av,t)):(r=e.parentNode.childNodes,e.parentNode.classList.contains(t)&&(e=e.parentNode,r=e.parentNode.childNodes),i=this.normalizedMap(r,ho,t)),s=Array.prototype.indexOf.call(r,e),i[s]}stepsToXpath(e){var t=[".","*"];return e.forEach(function(r){var s=r.index+1;r.id?t.push("*[position()="+s+" and @id='"+r.id+"']"):r.type==="text"?t.push("text()["+s+"]"):t.push("*["+s+"]")}),t.join("/")}stepsToQuerySelector(e){var t=["html"];return e.forEach(function(r){var s=r.index+1;r.id?t.push("#"+r.id):r.type==="text"||t.push("*:nth-child("+s+")")}),t.join(">")}textNodes(e,t){return Array.prototype.slice.call(e.childNodes).filter(function(r){return r.nodeType===ho?!0:!!(t&&r.classList.contains(t))})}walkToNode(e,t,r){var s=t||document,i=s.documentElement,a,o,l=e.length,u;for(u=0;
975u<l&&(o=e[u],o.type==="element"?o.id?i=s.getElementById(o.id):(a=i.children||WI(i),i=a[o.index]):o.type==="text"&&(i=this.textNodes(i,r)[o.index]),!!i);u++);return i}findNode(e,t,r){var s=t||document,i,a;return!r&&typeof s.evaluate<"u"?(a=this.stepsToXpath(e),i=s.evaluate(a,s,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue):r?i=this.walkToNode(e,s,r):i=this.walkToNode(e,s),i}fixMiss(e,t,r,s){var i=this.findNode(e.slice(0,-1),r,s),a=i.childNodes,o=this.normalizedMap(a,ho,s),l,u,d=e[e.length-1].index;for(let h in o){if(!o.hasOwnProperty(h))return;if(o[h]===d)if(l=a[h],u=l.textContent.length,t>u)t=t-u;else{l.nodeType===av?i=l.childNodes[0]:i=l;break}}return{container:i,offset:t}}toRange(e,t){var r=e||document,s,i,a,o,l,u=this,d,h,f=t?r.querySelector("."+t)!=null:!1,p;if(typeof r.createRange<"u"?s=r.createRange():s=new jae,u.range?(i=u.start,d=u.path.steps.concat(i.steps),o=this.findNode(d,r,f?t:null),a=u.end,h=u.path.steps.concat(a.steps),l=this.findNode(h,r,f?t:null)):(i=u.path,d=u.path.steps,o=this.findNode(u.path.steps,r,f?t:null)),o)try{i.terminal.offset!=null?s.setStart(o,i.terminal.offset):s.setStart(o,0)}catch{p=this.fixMiss(d,i.terminal.offset,r,f?t:null),s.setStart(p.container,p.offset)}else return console.log("No startContainer found for",this.toString()),null;if(l)try{a.terminal.offset!=null?s.setEnd(l,a.terminal.offset):s.setEnd(l,0)}catch{p=this.fixMiss(h,u.end.terminal.offset,r,f?t:null),s.setEnd(p.container,p.offset)}return s}isCfiString(e){return typeof e=="string"&&e.indexOf("epubcfi(")===0&&e[e.length-1]===")"}generateChapterComponent(e,t,r){var s=parseInt(t),i=(e+1)*2,a="/"+i+"/";return a+=(s+1)*2,r&&(a+="["+r+"]"),a}collapse(e){this.range&&(this.range=!1,e?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}}class Dl{constructor(e){this.context=e||this,this.hooks=[]}register(){for(var e=0;e<arguments.length;++e)if(typeof arguments[e]=="function")this.hooks.push(arguments[e]);else for(var t=0;t<arguments[e].length;++t)this.hooks.push(arguments[e][t])}deregister(e){let t;for(let r=0;r<this.hooks.length;r++)if(t=this.hooks[r],t===e){this.hooks.splice(r,1);break}}trigger(){var e=arguments,t=this.context,r=[];return this.hooks.forEach(function(s){try{var i=s.apply(t,e)}catch(a){console.log(a)}i&&typeof i.then=="function"&&r.push(i)}),Promise.all(r)}list(){return this.hooks}clear(){return this.hooks=[]}}function Pae(n,e){var t,r,s=e.url,i=s.indexOf("://")>-1;n&&(r=Vn(n,"head"),t=Vn(r,"base"),t||(t=n.createElement("base"),r.insertBefore(t,r.firstChild)),!i&&window&&window.location&&(s=window.location.origin+s),t.setAttribute("href",s))}function j6e(n,e){var t,r,s=e.canonical;n&&(t=Vn(n,"head"),r=Vn(t,"link[rel='canonical']"),r?r.setAttribute("href",s):(r=n.createElement("link"),r.setAttribute("rel","canonical"),r.setAttribute("href",s),t.appendChild(r)))}function R6e(n,e){var t,r,s=e.idref;n&&(t=Vn(n,"head"),r=Vn(t,"link[property='dc.identifier']"),r?r.setAttribute("content",s):(r=n.createElement("meta"),r.setAttribute("name","dc.identifier"),r.setAttribute("content",s),t.appendChild(r)))}function P6e(n,e){var t=n.querySelectorAll("a[href]");if(t.length)for(var r=Vn(n.ownerDocument,"base"),s=r?r.getAttribute("href"):void 0,i=(function(o){var l=o.getAttribute("href");if(l.indexOf("mailto:")!==0){var u=l.indexOf("://")>-1;if(u)o.setAttribute("target","_blank");else{var d;try{d=new pl(l,s)}catch{}o.onclick=function(){return d&&d.hash?e(d.Path.path+d.hash):e(d?d.Path.path:l),!1}}}}).bind(this),a=0;a<t.length;a++)i(t[a])}function PW(n,e,t){return e.forEach(function(r,s){r&&t[s]&&(r=r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),n=n.replace(new RegExp(r,"g"),t[s]))}),n}function Y1(n,e,t,r){var s=typeof window<"u"?window.URL:!1,i=s?"blob":"arraybuffer",a=new fn,o=new XMLHttpRequest,l=XMLHttpRequest.prototype,u;"overrideMimeType"in l||Object.defineProperty(l,"overrideMimeType",{value:function(){}}),t&&(o.withCredentials=!0),o.onreadystatechange=h,o.onerror=d,o.open("GET",n,!0);for(u in r)o.setRequestHeader(u,r[u]);e=="json"&&o.setRequestHeader("Accept","application/json"),e||(e=new xd(n).extension),e=="blob"&&(o.responseType=i),K1(e)&&o.overrideMimeType("text/xml"),e=="binary"&&(o.responseType="arraybuffer"),o.send();function d(f){a.reject(f)}function h(){if(this.readyState===XMLHttpRequest.DONE){var f=!1;if((this.responseType===""||this.responseType==="document")&&(f=this.responseXML),this.status===200||this.status===0||f){var p;if(!this.response&&!f)return a.reject({status:this.status,message:"Empty Response",stack:new Error().stack}),a.promise;if(this.status===403)return a.reject({status:this.status,response:this.response,message:"Forbidden",stack:new Error().stack}),a.promise;f?p=this.responseXML:K1(e)?p=Wc(this.response,"text/xml"):e=="xhtml"?p=Wc(this.response,"application/xhtml+xml"):e=="html"||e=="htm"?p=Wc(this.response,"text/html"):e=="json"?p=JSON.parse(this.response):e=="blob"?s?p=this.response:p=new Blob([this.response]):p=this.response,a.resolve(p)}else a.reject({status:this.status,message:this.response,stack:new Error().stack})}}return a.promise}class D6e{constructor(e,t){this.idref=e.idref,this.linear=e.linear==="yes",this.properties=e.properties,this.index=e.index,this.href=e.href,this.url=e.url,this.canonical=e.canonical,this.next=e.next,this.prev=e.prev,this.cfiBase=e.cfiBase,t?this.hooks=t:(this.hooks={},this.hooks.serialize=new Dl(this),this.hooks.content=new Dl(this)),this.document=void 0,this.contents=void 0,this.output=void 0}load(e){var t=e||this.request||Y1,r=new fn,s=r.promise;return this.contents?r.resolve(this.contents):t(this.url).then((function(i){return this.document=i,this.contents=i.documentElement,this.hooks.content.trigger(this.document,this)}).bind(this)).then((function(){r.resolve(this.contents)}).bind(this)).catch(function(i){r.reject(i)}),s}base(){return Pae(this.document,this)}render(e){var t=new fn,r=t.promise;return this.output,this.load(e).then((function(s){var i=typeof navigator<"u"&&navigator.userAgent||"",a=i.indexOf("Trident")>=0,o;typeof XMLSerializer>"u"||a?o=xae:o=XMLSerializer;var l=new o;return this.output=l.serializeToString(s),this.output}).bind(this)).then((function(){return this.hooks.serialize.trigger(this.output,this)}).bind(this)).then((function(){t.resolve(this.output)}).bind(this)).catch(function(s){t.reject(s)}),r}find(e){var t=this,r=[],s=e.toLowerCase(),i=function(a){for(var o=a.textContent.toLowerCase(),l=t.document.createRange(),u,d,h=-1,f,p=150;d!=-1;)d=o.indexOf(s,h+1),d!=-1&&(l=t.document.createRange(),l.setStart(a,d),l.setEnd(a,d+s.length),u=t.cfiFromRange(l),a.textContent.length<p?f=a.textContent:(f=a.textContent.substring(d-p/2,d+p/2),f="..."+f+"..."),r.push({cfi:u,excerpt:f})),h=d};return dN(t.document,function(a){i(a)}),r}search(e,t=5){if(typeof document.createTreeWalker>"u")return this.find(e);let r=[];const s=150,i=this,a=e.toLowerCase(),o=function(h){const m=h.reduce((g,y)=>g+y.textContent,"").toLowerCase().indexOf(a);if(m!=-1){const y=m+a.length;let v=0,x=0;if(m<h[0].length){let b;for(;v<h.length-1&&(x+=h[v].length,!(y<=x));)v+=1;let E=h[0],S=h[v],k=i.document.createRange();k.setStart(E,m);let C=h.slice(0,v).reduce((T,j)=>T+j.textContent.length,0);k.setEnd(S,C>y?y:y-C),b=i.cfiFromRange(k);let A=h.slice(0,v+1).reduce((T,j)=>T+j.textContent,"");A.length>s&&(A=A.substring(m-s/2,m+s/2),A="..."+A+"..."),r.push({cfi:b,excerpt:A})}}},l=document.createTreeWalker(i.document,NodeFilter.SHOW_TEXT,null,!1);let u,d=[];for(;u=l.nextNode();)d.push(u),d.length==t&&(o(d.slice(0,t)),d=d.slice(1,t));return d.length>0&&o(d),r}reconcileLayoutSettings(e){var t={layout:e.layout,spread:e.spread,orientation:e.orientation};
975return this.properties.forEach(function(r){var s=r.replace("rendition:",""),i=s.indexOf("-"),a,o;i!=-1&&(a=s.slice(0,i),o=s.slice(i+1),t[a]=o)}),t}cfiFromRange(e){return new pn(e,this.cfiBase).toString()}cfiFromElement(e){return new pn(e,this.cfiBase).toString()}unload(){this.document=void 0,this.contents=void 0,this.output=void 0}destroy(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}}class O6e{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new Dl,this.hooks.content=new Dl,this.hooks.content.register(Pae),this.hooks.content.register(j6e),this.hooks.content.register(R6e),this.epubcfi=new pn,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}unpack(e,t,r){this.items=e.spine,this.manifest=e.manifest,this.spineNodeIndex=e.spineNodeIndex,this.baseUrl=e.baseUrl||e.basePath||"",this.length=this.items.length,this.items.forEach((s,i)=>{var a=this.manifest[s.idref],o;s.index=i,s.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,s.index,s.id),s.href&&(s.url=t(s.href,!0),s.canonical=r(s.href)),a&&(s.href=a.href,s.url=t(s.href,!0),s.canonical=r(s.href),a.properties.length&&s.properties.push.apply(s.properties,a.properties)),s.linear==="yes"?(s.prev=(function(){let l=s.index;for(;l>0;){let u=this.get(l-1);if(u&&u.linear)return u;l-=1}}).bind(this),s.next=(function(){let l=s.index;for(;l<this.spineItems.length-1;){let u=this.get(l+1);if(u&&u.linear)return u;l+=1}}).bind(this)):(s.prev=function(){},s.next=function(){}),o=new D6e(s,this.hooks),this.append(o)}),this.loaded=!0}get(e){var t=0;if(typeof e>"u")for(;t<this.spineItems.length;){let r=this.spineItems[t];if(r&&r.linear)break;t+=1}else this.epubcfi.isCfiString(e)?t=new pn(e).spinePos:typeof e=="number"||isNaN(e)===!1?t=e:typeof e=="string"&&e.indexOf("#")===0?t=this.spineById[e.substring(1)]:typeof e=="string"&&(e=e.split("#")[0],t=this.spineByHref[e]||this.spineByHref[encodeURI(e)]);return this.spineItems[t]||null}append(e){var t=this.spineItems.length;return e.index=t,this.spineItems.push(e),this.spineByHref[decodeURI(e.href)]=t,this.spineByHref[encodeURI(e.href)]=t,this.spineByHref[e.href]=t,this.spineById[e.idref]=t,t}prepend(e){return this.spineByHref[e.href]=0,this.spineById[e.idref]=0,this.spineItems.forEach(function(t,r){t.index=r}),0}remove(e){var t=this.spineItems.indexOf(e);if(t>-1)return delete this.spineByHref[e.href],delete this.spineById[e.idref],this.spineItems.splice(t,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}first(){let e=0;do{let t=this.get(e);if(t&&t.linear)return t;e+=1}while(e<this.spineItems.length)}last(){let e=this.spineItems.length-1;do{let t=this.get(e);if(t&&t.linear)return t;e-=1}while(e>=0)}destroy(){this.each(e=>e.destroy()),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}}class UB{constructor(e){this._q=[],this.context=e,this.tick=BB,this.running=!1,this.paused=!1}enqueue(){var e,t,r,s=[].shift.call(arguments),i=arguments;if(!s)throw new Error("No Task Provided");return typeof s=="function"?(e=new fn,t=e.promise,r={task:s,args:i,deferred:e,promise:t}):r={promise:s},this._q.push(r),this.paused==!1&&!this.running&&this.run(),r.promise}dequeue(){var e,t,r;if(this._q.length&&!this.paused){if(e=this._q.shift(),t=e.task,t)return r=t.apply(this.context,e.args),r&&typeof r.then=="function"?r.then((function(){e.deferred.resolve.apply(this.context,arguments)}).bind(this),(function(){e.deferred.reject.apply(this.context,arguments)}).bind(this)):(e.deferred.resolve.apply(this.context,r),e.promise);if(e.promise)return e.promise}else return e=new fn,e.deferred.resolve(),e.promise}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new fn),this.tick.call(window,()=>{this._q.length?this.dequeue().then((function(){this.run()}).bind(this)):(this.defered.resolve(),this.running=void 0)}),this.paused==!0&&(this.paused=!1),this.defered.promise}flush(){if(this.running)return this.running;if(this._q.length)return this.running=this.dequeue().then((function(){return this.running=void 0,this.flush()}).bind(this)),this.running}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}}
975const Tj="0.3",bC=["keydown","keyup","keypressed","mouseup","mousedown","mousemove","click","touchend","touchstart","touchmove"],ot={BOOK:{OPEN_FAILED:"openFailed"},CONTENTS:{EXPAND:"expand",RESIZE:"resize",SELECTED:"selected",SELECTED_RANGE:"selectedRange",LINK_CLICKED:"linkClicked"},LOCATIONS:{CHANGED:"changed"},MANAGERS:{RESIZE:"resize",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",ADDED:"added",SCROLL:"scroll",SCROLLED:"scrolled",REMOVED:"removed"},VIEWS:{AXIS:"axis",WRITING_MODE:"writingMode",LOAD_ERROR:"loaderror",RENDERED:"rendered",RESIZED:"resized",DISPLAYED:"displayed",SHOWN:"shown",HIDDEN:"hidden",MARK_CLICKED:"markClicked"},RENDITION:{STARTED:"started",ATTACHED:"attached",DISPLAYED:"displayed",DISPLAY_ERROR:"displayerror",RENDERED:"rendered",REMOVED:"removed",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",LOCATION_CHANGED:"locationChanged",RELOCATED:"relocated",MARK_CLICKED:"markClicked",SELECTED:"selected",LAYOUT:"layout"},LAYOUT:{UPDATED:"updated"},ANNOTATION:{ATTACH:"attach",DETACH:"detach"}};class Dae{constructor(e,t,r){this.spine=e,this.request=t,this.pause=r||100,this.q=new UB(this),this.epubcfi=new pn,this._locations=[],this._locationsWords=[],this.total=0,this.break=150,this._current=0,this._wordCounter=0,this.currentLocation="",this._currentCfi="",this.processingTimeout=void 0}generate(e){return e&&(this.break=e),this.q.pause(),this.spine.each((function(t){t.linear&&this.q.enqueue(this.process.bind(this),t)}).bind(this)),this.q.run().then((function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}).bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(e){return e.load(this.request).then((function(t){var r=new fn,s=this.parse(t,e.cfiBase);return this._locations=this._locations.concat(s),e.unload(),this.processingTimeout=setTimeout(()=>r.resolve(s),this.pause),r.promise}).bind(this))}parse(e,t,r){var s=[],i,a=e.ownerDocument,o=Vn(a,"body"),l=0,u,d=r||this.break,h=function(f){var p=f.length,m,g=0;if(f.textContent.trim().length===0)return!1;for(l==0&&(i=this.createRange(),i.startContainer=f,i.startOffset=0),m=d-l,m>p&&(l+=p,g=p);g<p;)if(m=d-l,l===0&&(g+=1,i=this.createRange(),i.startContainer=f,i.startOffset=g),g+m>=p)l+=p-g,g=p;else{g+=m,i.endContainer=f,i.endOffset=g;let y=new pn(i,t).toString();s.push(y),l=0}u=f};if(dN(o,h.bind(this)),i&&i.startContainer&&u){i.endContainer=u,i.endOffset=u.length;let f=new pn(i,t).toString();s.push(f),l=0}return s}generateFromWords(e,t,r){var s=e?new pn(e):void 0;return this.q.pause(),this._locationsWords=[],this._wordCounter=0,this.spine.each((function(i){i.linear&&(s?i.index>=s.spinePos&&this.q.enqueue(this.processWords.bind(this),i,t,s,r):this.q.enqueue(this.processWords.bind(this),i,t,s,r))}).bind(this)),this.q.run().then((function(){return this._currentCfi&&(this.currentLocation=this._currentCfi),this._locationsWords}).bind(this))}processWords(e,t,r,s){return s&&this._locationsWords.length>=s?Promise.resolve():e.load(this.request).then((function(i){var a=new fn,o=this.parseWords(i,e,t,r),l=s-this._locationsWords.length;return this._locationsWords=this._locationsWords.concat(o.length>=s?o.slice(0,l):o),e.unload(),this.processingTimeout=setTimeout(()=>a.resolve(o),this.pause),a.promise}).bind(this))}countWords(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,`
976`),e.split(" ").length}parseWords(e,t,r,s){var i=t.cfiBase,a=[],o=e.ownerDocument,l=Vn(o,"body"),u=r,d=s?s.spinePos!==t.index:!0,h;s&&t.index===s.spinePos&&(h=s.findNode(s.range?s.path.steps.concat(s.start.steps):s.path.steps,e.ownerDocument));var f=function(p){if(!d)if(p===h)d=!0;else return!1;if(p.textContent.length<10&&p.textContent.trim().length===0)return!1;var m=this.countWords(p.textContent),g,y=0;if(m===0)return!1;for(g=u-this._wordCounter,g>m&&(this._wordCounter+=m,y=m);y<m;)if(g=u-this._wordCounter,y+g>=m)this._wordCounter+=m-y,y=m;else{y+=g;let v=new pn(p,i);a.push({cfi:v.toString(),wordCount:this._wordCounter}),this._wordCounter=0}};return dN(l,f.bind(this)),a}locationFromCfi(e){let t;return pn.prototype.isCfiString(e)&&(e=new pn(e)),this._locations.length===0?-1:(t=u0(e,this._locations,this.epubcfi.compare),t>this.total?this.total:t)}percentageFromCfi(e){if(this._locations.length===0)return null;var t=this.locationFromCfi(e);return this.percentageFromLocation(t)}percentageFromLocation(e){return!e||!this.total?0:e/this.total}cfiFromLocation(e){var t=-1;return typeof e!="number"&&(e=parseInt(e)),e>=0&&e<this._locations.length&&(t=this._locations[e]),t}cfiFromPercentage(e){let t;if(e>1&&console.warn("Normalize cfiFromPercentage value to between 0 - 1"),e>=1){let r=new pn(this._locations[this.total]);return r.collapse(),r.toString()}return t=Math.ceil(this.total*e),this.cfiFromLocation(t)}load(e){return typeof e=="string"?this._locations=JSON.parse(e):this._locations=e,this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(e){var t;if(typeof e=="string")this._currentCfi=e;else if(typeof e=="number")this._current=e;else return;this._locations.length!==0&&(typeof e=="string"?(t=this.locationFromCfi(e),this._current=t):t=e,this.emit
976(ot.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(t)}))}get currentLocation(){return this._current}set currentLocation(e){this.setCurrent(e)}length(){return this._locations.length}destroy(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}}Jc(Dae.prototype);class M6e{constructor(e){this.packagePath="",this.directory="",this.encoding="",e&&this.parse(e)}parse(e){var t;if(!e)throw new Error("Container File Not Found");if(t=Vn(e,"rootfile"),!t)throw new Error("No RootFile Found");this.packagePath=t.getAttribute("full-path"),this.directory=Hh.dirname(this.packagePath),this.encoding=e.xmlEncoding}destroy(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}}class DW{constructor(e){this.manifest={},this.navPath="",this.ncxPath="",this.coverPath="",this.spineNodeIndex=0,this.spine=[],this.metadata={},e&&this.parse(e)}parse(e){var t,r,s;if(!e)throw new Error("Package File Not Found");if(t=Vn(e,"metadata"),!t)throw new Error("No Metadata Found");if(r=Vn(e,"manifest"),!r)throw new Error("No Manifest Found");if(s=Vn(e,"spine"),!s)throw new Error("No Spine Found");return this.manifest=this.parseManifest(r),this.navPath=this.findNavPath(r),this.ncxPath=this.findNcxPath(r,s),this.coverPath=this.findCoverPath(e),this.spineNodeIndex=Eae(s),this.spine=this.parseSpine(s,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(e),this.metadata=this.parseMetadata(t),this.metadata.direction=s.getAttribute("page-progression-direction"),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}}parseMetadata(e){var t={};return t.title=this.getElementText(e,"title"),t.creator=this.getElementText(e,"creator"),t.description=this.getElementText(e,"description"),t.pubdate=this.getElementText(e,"date"),t.publisher=this.getElementText(e,"publisher"),t.identifier=this.getElementText(e,"identifier"),t.language=this.getElementText(e,"language"),t.rights=this.getElementText(e,"rights"),t.modified_date=this.getPropertyText(e,"dcterms:modified"),t.layout=this.getPropertyText(e,"rendition:layout"),t.orientation=this.getPropertyText(e,"rendition:orientation"),t.flow=this.getPropertyText(e,"rendition:flow"),t.viewport=this.getPropertyText(e,"rendition:viewport"),t.media_active_class=this.getPropertyText(e,"media:active-class"),t.spread=this.getPropertyText(e,"rendition:spread"),t}parseManifest(e){var t={},r=yd(e,"item"),s=Array.prototype.slice.call(r);return s.forEach(function(i){var a=i.getAttribute("id"),o=i.getAttribute("href")||"",l=i.getAttribute("media-type")||"",u=i.getAttribute("media-overlay")||"",d=i.getAttribute("properties")||"";t[a]={href:o,type:l,overlay:u,properties:d.length?d.split(" "):[]}}),t}parseSpine(e,t){var r=[],s=yd(e,"itemref"),i=Array.prototype.slice.call(s);return i.forEach(function(a,o){var l=a.getAttribute("idref"),u=a.getAttribute("properties")||"",d=u.length?u.split(" "):[],h={id:a.getAttribute("id"),idref:l,linear:a.getAttribute("linear")||"yes",properties:d,index:o};r.push(h)}),r}findUniqueIdentifier(e){var t=e.documentElement.getAttribute("unique-identifier");if(!t)return"";var r=e.getElementById(t);return r&&r.localName==="identifier"&&r.namespaceURI==="http://purl.org/dc/elements/1.1/"&&r.childNodes.length>0?r.childNodes[0].nodeValue.trim():""}findNavPath(e){var t=vv(e,"item",{properties:"nav"});return t?t.getAttribute("href"):!1}findNcxPath(e,t){var r=vv(e,"item",{"media-type":"application/x-dtbncx+xml"}),s;return r||(s=t.getAttribute("toc"),s&&(r=e.querySelector(`#${s}`))),r?r.getAttribute("href"):!1}findCoverPath(e){var t=Vn(e,"package");t.getAttribute("version");var r=vv(e,"item",{properties:"cover-image"});if(r)return r.getAttribute("href");var s=vv(e,"meta",{name:"cover"});if(s){var i=s.getAttribute("content"),a=e.getElementById(i);return a?a.getAttribute("href"):""}else return!1}getElementText(e,t){var r=e.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",t),s;return!r||r.length===0?"":(s=r[0],s.childNodes.length?s.childNodes[0].nodeValue:"")}getPropertyText(e,t){var r=vv(e,"meta",{property:t});return r&&r.childNodes.length?r.childNodes[0].nodeValue:""}load(e){this.metadata=e.metadata;let t=e.readingOrder||e.spine;return this.spine=t.map((r,s)=>
976(r.index=s,r.linear=r.linear||"yes",r)),e.resources.forEach((r,s)=>{this.manifest[s]=r,r.rel&&r.rel[0]==="cover"&&(this.coverPath=r.href)}),this.spineNodeIndex=0,this.toc=e.toc.map((r,s)=>(r.label=r.title,r)),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}destroy(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}}class pD{constructor(e){this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,e&&this.parse(e)}parse(e){let t=e.nodeType,r,s;t&&(r=Vn(e,"html"),s=Vn(e,"ncx")),t?r?(this.toc=this.parseNav(e),this.landmarks=this.parseLandmarks(e)):s&&(this.toc=this.parseNcx(e)):this.toc=this.load(e),this.length=0,this.unpack(this.toc)}unpack(e){for(var t,r=0;r<e.length;r++)t=e[r],t.href&&(this.tocByHref[t.href]=r),t.id&&(this.tocById[t.id]=r),this.length++,t.subitems.length&&this.unpack(t.subitems)}get(e){var t;return e?(e.indexOf("#")===0?t=this.tocById[e.substring(1)]:e in this.tocByHref&&(t=this.tocByHref[e]),this.getByIndex(e,t,this.toc)):this.toc}getByIndex(e,t,r){if(r.length===0)return;const s=r[t];if(s&&(e===s.id||e===s.href))return s;{let i;for(let a=0;a<r.length&&(i=this.getByIndex(e,t,r[a].subitems),!i);++a);return i}}landmark(e){var t;return e?(t=this.landmarksByType[e],this.landmarks[t]):this.landmarks}parseNav(e){var t=hN(e,"nav","toc"),r=[];if(!t)return r;let s=yv(t,"ol",!0);return s&&(r=this.parseNavList(s)),r}parseNavList(e,t){const r=[];if(!e||!e.children)return r;for(let s=0;s<e.children.length;s++){const i=this.navItem(e.children[s],t);i&&r.push(i)}return r}navItem(e,t){let r=e.getAttribute("id")||void 0,s=yv(e,"a",!0)||yv(e,"span",!0);if(!s)return;let i=s.getAttribute("href")||"";r||(r=i);let a=s.textContent||"",o=[],l=yv(e,"ol",!0);return l&&(o=this.parseNavList(l,r)),{id:r,href:i,label:a,subitems:o,parent:t}}parseLandmarks(e){var t=hN(e,"nav","landmarks"),r=t?yd(t,"li"):[],s=r.length,i,a=[],o;if(!r||s===0)return a;for(i=0;i<s;++i)o=this.landmarkItem(r[i]),o&&(a.push(o),this.landmarksByType[o.type]=i);return a}landmarkItem(e){let t=yv(e,"a",!0);if(!t)return;let r=t.getAttributeNS("http://www.idpf.org/2007/ops","type")||void 0,s=t.getAttribute("href")||"",i=t.textContent||"";return{href:s,label:i,type:r}}parseNcx(e){var t=yd(e,"navPoint"),r=t.length,s,i={},a=[],o,l;if(!t||r===0)return a;for(s=0;s<r;++s)o=this.ncxItem(t[s]),i[o.id]=o,o.parent?(l=i[o.parent],l.subitems.push(o)):a.push(o);return a}ncxItem(e){var t=e.getAttribute("id")||!1,r=Vn(e,"content"),s=r.getAttribute("src"),i=Vn(e,"navLabel"),a=i.textContent?i.textContent:"",o=[],l=e.parentNode,u;return l&&(l.nodeName==="navPoint"||l.nodeName.split(":").slice(-1)[0]==="navPoint")&&(u=l.getAttribute("id")),{id:t,href:s,label:a,subitems:o,parent:u}}load(e){return e.map(t=>(t.label=t.title,t.subitems=t.children?this.load(t.children):[],t))}forEach(e){return this.toc.forEach(e)}}var pb={application:{ecmascript:["es","ecma"],javascript:"js",ogg:"ogx",pdf:"pdf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],"rdf+xml":"rdf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","opf","ncx"],zip:"zip","x-httpd-eruby":"rhtml","x-latex":"latex","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-object":"o","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","epub+zip":"epub","font-tdpfr":"pfr","inkml+xml":["ink","inkml"],json:"json","jsonml+json":"jsonml","mathml+xml":"mathml","metalink+xml":"metalink",mp4:"mp4s","omdoc+xml":"omdoc",oxps:"oxps","vnd.amazon.ebook":"azw",widget:"wgt","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-mobipocket-ebook":["prc","mobi"],"x-mspublisher":"pub","x-nzb":"nzb","x-tgif":"obj","xaml+xml":"xaml","xml-dtd":"dtd","xproc+xml":"xpl","xslt+xml":"xslt","internet-property-stream":"acx","x-compress":"z","x-compressed":"tgz","x-gzip":"gz"},audio:{flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"x-aiff":["aif","aiff","aifc"],"x-ms-wma":"wma","x-wav":"wav",adpcm:"adp",mp4:"mp4a",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"x-icon":"ico",bmp:"bmp",webp:"webp","x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod"},text:{"cache-manifest":["manifest","appcache"],css:"css",csv:"csv",html:["html","htm","shtml","stm"],mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx","tab-separated-values":"tsv","x-bibtex":"bib"},video:{mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"}},I6e=function(){var n,e,t,r,s={};for(n in pb)if(pb.hasOwnProperty(n)){for(e in pb[n])if(pb[n].hasOwnProperty(e))if(t=pb[n][e],typeof t=="string")s[t]=n+"/"+e;else for(r=0;r<t.length;r++)s[t[r]]=n+"/"+e}return s}(),L6e="text/plain";function F6e(n){return n&&I6e[n.split(".").pop().toLowerCase()]||L6e}const my={lookup:F6e};class B6e{constructor(e,t){this.settings={replacements:t&&t.replacements||"base64",archive:t&&t.archive,resolver:t&&t.resolver,request:t&&t.request},this.process(e)}process(e){this.manifest=e,this.resources=Object.keys(e).map(function(t){return e[t]}),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter(function(e){if(e.type==="application/xhtml+xml"||e.type==="text/html")return!0}),this.assets=this.resources.filter(function(e){if(e.type!=="application/xhtml+xml"&&e.type!=="text/html")return!0}),this.css=this.resources.filter(function(e){if(e.type==="text/css")return!0})}splitUrls(){this.urls=this.assets.map((function(e){return e.href}).bind(this)),this.cssUrls=this.css.map(function(e){return e.href})}createUrl(e){var t=new pl(e),r=my.lookup(t.filename);return this.settings.archive?this.settings.archive.createUrl(e,{base64:this.settings.replacements==="base64"}):this.settings.replacements==="base64"?this.settings.request(e,"blob").then(s=>Tae(s)).then(s=>HI(s,r)):this.settings.request(e,"blob").then(s=>uN(s,r))}replacements(){if(this.settings.replacements==="none")return new Promise((function(t){t(this.urls)}).bind(this));var e=this.urls.map(t=>{var r=this.settings.resolver(t);
976return this.createUrl(r).catch(s=>(console.error(s),null))});return Promise.all(e).then(t=>(this.replacementUrls=t.filter(r=>typeof r=="string"),t))}replaceCss(e,t){var r=[];return e=e||this.settings.archive,t=t||this.settings.resolver,this.cssUrls.forEach((function(s){var i=this.createCssFile(s,e,t).then((function(a){var o=this.urls.indexOf(s);o>-1&&(this.replacementUrls[o]=a)}).bind(this));r.push(i)}).bind(this)),Promise.all(r)}createCssFile(e){var t;if(Hh.isAbsolute(e))return new Promise(function(a){a()});var r=this.settings.resolver(e),s;this.settings.archive?s=this.settings.archive.getText(r):s=this.settings.request(r,"text");var i=this.urls.map(a=>{var o=this.settings.resolver(a),l=new xd(r).relative(o);return l});return s?s.then(a=>(a=PW(a,i,this.replacementUrls),this.settings.replacements==="base64"?t=HI(a,"text/css"):t=uN(a,"text/css"),t),a=>new Promise(function(o){o()})):new Promise(function(a){a()})}relativeTo(e,t){return t=t||this.settings.resolver,this.urls.map((function(r){var s=t(r),i=new xd(e).relative(s);return i}).bind(this))}get(e){var t=this.urls.indexOf(e);if(t!==-1)return this.replacementUrls.length?new Promise((function(r,s){r(this.replacementUrls[t])}).bind(this)):this.createUrl(e)}substitute(e,t){var r;return t?r=this.relativeTo(t):r=this.urls,PW(e,r,this.replacementUrls)}destroy(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}}class mD{constructor(e){this.pages=[],this.locations=[],this.epubcfi=new pn,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,e&&(this.pageList=this.parse(e)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(e){var t=Vn(e,"html"),r=Vn(e,"ncx");if(t)return this.parseNav(e);if(r)return this.parseNcx(e)}parseNav(e){var t=hN(e,"nav","page-list"),r=t?yd(t,"li"):[],s=r.length,i,a=[],o;if(!r||s===0)return a;for(i=0;i<s;++i)o=this.item(r[i]),a.push(o);return a}parseNcx(e){var t=[],r=0,s,i,a,o=0;if(i=Vn(e,"pageList"),!i||(a=yd(i,"pageTarget"),o=a.length,!a||a.length===0))return t;for(r=0;r<o;++r)s=this.ncxItem(a[r]),t.push(s);return t}ncxItem(e){var t=Vn(e,"navLabel"),r=Vn(t,"text"),s=r.textContent,i=Vn(e,"content"),a=i.getAttribute("src"),o=parseInt(s,10);return{href:a,page:o}}item(e){var t=Vn(e,"a"),r=t.getAttribute("href")||"",s=t.textContent||"",i=parseInt(s),a=r.indexOf("epubcfi"),o,l,u;return a!=-1?(o=r.split("#"),l=o[0],u=o.length>1?o[1]:!1,{cfi:u,href:r,packageUrl:l,page:i}):{href:r,page:i}}process(e){e.forEach(function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}pageFromCfi(e){var t=-1;if(this.locations.length===0)return-1;var r=oN(e,this.locations,this.epubcfi.compare);return r!=-1?t=this.pages[r]:(r=u0(e,this.locations,this.epubcfi.compare),t=r-1>=0?this.pages[r-1]:this.pages[0],t!==void 0||(t=-1)),t}cfiFromPage(e){var t=-1;typeof e!="number"&&(e=parseInt(e));var r=this.pages.indexOf(e);return r!=-1&&(t=this.locations[r]),t}pageFromPercentage(e){var t=Math.round(this.totalPages*e);return t}percentageFromPage(e){var t=(e-this.firstPage)/this.totalPages;return Math.round(t*1e3)/1e3}percentageFromCfi(e){var t=this.pageFromCfi(e),r=this.percentageFromPage(t);return r}destroy(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}}class Oae{constructor(e){this.settings=e,this.name=e.layout||"reflowable",this._spread=e.spread!=="none",this._minSpreadWidth=e.minSpreadWidth||800,this._evenSpreads=e.evenSpreads||!1,e.flow==="scrolled"||e.flow==="scrolled-continuous"||e.flow==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}flow(e){return typeof e<"u"&&(e==="scrolled"||e==="scrolled-continuous"||e==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.update({flow:this._flow})),this._flow}spread(e,t){return e&&(this._spread=e!=="none",this.update({spread:this._spread})),t>=0&&(this._minSpreadWidth=t),this._spread}calculate(e,t,r){var s=1,i=r||0,a=e,o=t,l=Math.floor(a/12),u,d,h,f;this._spread&&a>=this._minSpreadWidth?s=2:s=1,this.name==="reflowable"&&this._flow==="paginated"&&!(r>=0)&&(i=l%2===0?l:l-1),this.name==="pre-paginated"&&(i=0),s>1?(u=a/s-i,h=u+i):(u=a,h=a),this.name==="pre-paginated"&&s>1&&(a=u),d=u*s+i,f=a,this.width=a,this.height=o,this.spreadWidth=d,this.pageWidth=h,this.delta=f,this.columnWidth=u,this.gap=i,this.divisor=s,this.update({width:a,height:o,spreadWidth:d,pageWidth:h,delta:f,columnWidth:u,gap:i,divisor:s})}format(e,t,r){var s;return this.name==="pre-paginated"?s=e.fit(this.columnWidth,this.height,t):this._flow==="paginated"?s=e.columns(this.width,this.height,this.columnWidth,this.gap,this.settings.direction):r&&r==="horizontal"?s=e.size(null,this.height):s=e.size(this.width,null),s}count(e,t){let r,s;return this.name==="pre-paginated"?(r=1,s=1):this._flow==="paginated"?(t=t||this.delta,r=Math.ceil(e/t),s=r*this.divisor):(t=t||this.height,r=Math.ceil(e/t),s=r),{spreads:r,pages:s}}update(e){if(Object.keys(e).forEach(t=>{this.props[t]===e[t]&&delete e[t]}),Object.keys(e).length>0){let t=ri(this.props,e);
976this.emit(ot.LAYOUT.UPDATED,t,e)}}}Jc(Oae.prototype);class z6e{constructor(e){this.rendition=e,this._themes={default:{rules:{},url:"",serialized:""}},this._overrides={},this._current="default",this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){if(arguments.length!==0){if(arguments.length===1&&typeof arguments[0]=="object")return this.registerThemes(arguments[0]);if(arguments.length===1&&typeof arguments[0]=="string")return this.default(arguments[0]);if(arguments.length===2&&typeof arguments[1]=="string")return this.registerUrl(arguments[0],arguments[1]);if(arguments.length===2&&typeof arguments[1]=="object")return this.registerRules(arguments[0],arguments[1])}}default(e){if(e){if(typeof e=="string")return this.registerUrl("default",e);if(typeof e=="object")return this.registerRules("default",e)}}registerThemes(e){for(var t in e)e.hasOwnProperty(t)&&(typeof e[t]=="string"?this.registerUrl(t,e[t]):this.registerRules(t,e[t]))}registerCss(e,t){this._themes[e]={serialized:t},(this._injected[e]||e=="default")&&this.update(e)}registerUrl(e,t){var r=new pl(t);this._themes[e]={url:r.toString()},(this._injected[e]||e=="default")&&this.update(e)}registerRules(e,t){this._themes[e]={rules:t},(this._injected[e]||e=="default")&&this.update(e)}select(e){var t=this._current,r;this._current=e,this.update(e),r=this.rendition.getContents(),r.forEach(s=>{s.removeClass(t),s.addClass(e)})}update(e){var t=this.rendition.getContents();t.forEach(r=>{this.add(e,r)})}inject(e){var t=[],r=this._themes,s;for(var i in r)r.hasOwnProperty(i)&&(i===this._current||i==="default")&&(s=r[i],(s.rules&&Object.keys(s.rules).length>0||s.url&&t.indexOf(s.url)===-1)&&this.add(i,e),this._injected.push(i));this._current!="default"&&e.addClass(this._current)}add(e,t){var r=this._themes[e];!r||!t||(r.url?t.addStylesheet(r.url):r.serialized?(t.addStylesheetCss(r.serialized,e),r.injected=!0):r.rules&&(t.addStylesheetRules(r.rules,e),r.injected=!0))}override(e,t,r){var s=this.rendition.getContents();this._overrides[e]={value:t,priority:r===!0},s.forEach(i=>{i.css(e,this._overrides[e].value,this._overrides[e].priority)})}removeOverride(e){var t=this.rendition.getContents();delete this._overrides[e],t.forEach(r=>{r.css(e)})}overrides(e){var t=this._overrides;for(var r in t)t.hasOwnProperty(r)&&e.css(r,t[r].value,t[r].priority)}fontSize(e){this.override("font-size",e)}font(e){this.override("font-family",e,!0)}destroy(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}}class fN{constructor(e,t,r,s=!1){this.layout=e,this.horizontal=r==="horizontal",this.direction=t||"ltr",this._dev=s}section(e){var t=this.findRanges(e),r=this.rangeListToCfiList(e.section.cfiBase,t);return r}page(e,t,r,s){var i=e&&e.document?e.document.body:!1,a;if(i){if(a=this.rangePairToCfiPair(t,{start:this.findStart(i,r,s),end:this.findEnd(i,r,s)}),this._dev===!0){let o=e.document,l=new pn(a.start).toRange(o),u=new pn(a.end).toRange(o),d=o.defaultView.getSelection(),h=o.createRange();d.removeAllRanges(),h.setStart(l.startContainer,l.startOffset),h.setEnd(u.endContainer,u.endOffset),d.addRange(h)}return a}}walk(e,t){if(!(e&&e.nodeType===Node.TEXT_NODE)){var r={acceptNode:function(l){return l.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},s=r.acceptNode;s.acceptNode=r.acceptNode;for(var i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,s,!1),a,o;(a=i.nextNode())&&(o=t(a),!o););return o}}findRanges(e){for(var t=[],r=e.contents.scrollWidth(),s=Math.ceil(r/this.layout.spreadWidth),i=s*this.layout.divisor,a=this.layout.columnWidth,o=this.layout.gap,l,u,d=0;d<i.pages;d++)l=(a+o)*d,u=a*(d+1)+o*d,t.push({start:this.findStart(e.document.body,l,u),end:this.findEnd(e.document.body,l,u)});return t}findStart(e,t,r){for(var s=[e],i,a,o=e;s.length;)if(i=s.shift(),a=this.walk(i,l=>{var u,d,h,f,p;if(p=VI(l),this.horizontal&&this.direction==="ltr"){if(u=this.horizontal?p.left:p.top,d=this.horizontal?p.right:p.bottom,u>=t&&u<=r)return l;if(d>t)return l;o=l,s.push(l)}else if(this.horizontal&&this.direction==="rtl"){if(u=p.left,d=p.right,d<=r&&d>=t)return l;if(u<r)return l;o=l,s.push(l)}else{if(h=p.top,f=p.bottom,h>=t&&h<=r)return l;if(f>t)return l;o=l,s.push(l)}}),a)return this.findTextStartRange(a,t,r);return this.findTextStartRange(o,t,r)}findEnd(e,t,r){for(var s=[e],i,a=e,o;s.length;)if(i=s.shift(),o=this.walk(i,l=>{var u,d,h,f,p;if(p=VI(l),this.horizontal&&this.direction==="ltr"){if(u=Math.round(p.left),d=Math.round(p.right),u>r&&a)return a;
976if(d>r)return l;a=l,s.push(l)}else if(this.horizontal&&this.direction==="rtl"){if(u=Math.round(this.horizontal?p.left:p.top),d=Math.round(this.horizontal?p.right:p.bottom),d<t&&a)return a;if(u<t)return l;a=l,s.push(l)}else{if(h=Math.round(p.top),f=Math.round(p.bottom),h>r&&a)return a;if(f>r)return l;a=l,s.push(l)}}),o)return this.findTextEndRange(o,t,r);return this.findTextEndRange(a,t,r)}findTextStartRange(e,t,r){for(var s=this.splitTextNodeIntoRanges(e),i,a,o,l,u,d=0;d<s.length;d++)if(i=s[d],a=i.getBoundingClientRect(),this.horizontal&&this.direction==="ltr"){if(o=a.left,o>=t)return i}else if(this.horizontal&&this.direction==="rtl"){if(u=a.right,u<=r)return i}else if(l=a.top,l>=t)return i;return s[0]}findTextEndRange(e,t,r){for(var s=this.splitTextNodeIntoRanges(e),i,a,o,l,u,d,h,f=0;f<s.length;f++){if(a=s[f],o=a.getBoundingClientRect(),this.horizontal&&this.direction==="ltr"){if(l=o.left,u=o.right,l>r&&i)return i;if(u>r)return a}else if(this.horizontal&&this.direction==="rtl"){if(l=o.left,u=o.right,u<t&&i)return i;if(l<t)return a}else{if(d=o.top,h=o.bottom,d>r&&i)return i;if(h>r)return a}i=a}return s[s.length-1]}splitTextNodeIntoRanges(e,t){var r=[],s=e.textContent||"",i=s.trim(),a,o=e.ownerDocument,l=t||" ",u=i.indexOf(l);if(u===-1||e.nodeType!=Node.TEXT_NODE)return a=o.createRange(),a.selectNodeContents(e),[a];for(a=o.createRange(),a.setStart(e,0),a.setEnd(e,u),r.push(a),a=!1;u!=-1;)u=i.indexOf(l,u+1),u>0&&(a&&(a.setEnd(e,u),r.push(a)),a=o.createRange(),a.setStart(e,u+1));return a&&(a.setEnd(e,i.length),r.push(a)),r}rangePairToCfiPair(e,t){var r=t.start,s=t.end;r.collapse(!0),s.collapse(!1);let i=new pn(r,e).toString(),a=new pn(s,e).toString();return{start:i,end:a}}rangeListToCfiList(e,t){for(var r=[],s,i=0;i<t.length;i++)s=this.rangePairToCfiPair(e,t[i]),r.push(s);return r}axis(e){return e&&(this.horizontal=e==="horizontal"),this.horizontal}}const Mae=typeof navigator<"u",$6e=Mae&&/Chrome/.test(navigator.userAgent),OW=Mae&&!$6e&&/AppleWebKit/.test(navigator.userAgent),U6e=1;class VB{constructor(e,t,r,s){this.epubcfi=new pn,this.document=e,this.documentElement=this.document.documentElement,this.content=t||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=s||0,this.cfiBase=r||"",this.epubReadingSystem("epub.js",Tj),this.called=0,this.active=!0,this.listeners()}static get listenedEvents(){return bC}width(e){var t=this.content;return e&&Nr(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}height(e){var t=this.content;return e&&Nr(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}contentWidth(e){var t=this.content||this.document.body;return e&&Nr(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}contentHeight(e){var t=this.content||this.document.body;return e&&Nr(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}textWidth(){let e,t,r=this.document.createRange(),s=this.content||this.document.body,i=lN(s);return r.selectNodeContents(s),e=r.getBoundingClientRect(),t=e.width,i&&i.width&&(t+=i.width),Math.round(t)}textHeight(){let e,t,r=this.document.createRange(),s=this.content||this.document.body;return r.selectNodeContents(s),e=r.getBoundingClientRect(),t=e.bottom,Math.round(t)}scrollWidth(){var e=this.documentElement.scrollWidth;return e}scrollHeight(){var e=this.documentElement.scrollHeight;return e}overflow(e){return e&&(this.documentElement.style.overflow=e),this.window.getComputedStyle(this.documentElement).overflow}overflowX(e){return e&&(this.documentElement.style.overflowX=e),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(e){return e&&(this.documentElement.style.overflowY=e),this.window.getComputedStyle(this.documentElement).overflowY}css(e,t,r){var s=this.content||this.document.body;return t?s.style.setProperty(e,t,r?"important":""):s.style.removeProperty(e),this.window.getComputedStyle(s)[e]}viewport(e){var t=this.document.querySelector("meta[name='viewport']"),r={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},s=[],i={};if(t&&t.hasAttribute("content")){let a=t.getAttribute("content"),o=a.match(/width\s*=\s*([^,]*)/),l=a.match(/height\s*=\s*([^,]*)/),u=a.match(/initial-scale\s*=\s*([^,]*)/),d=a.match(/minimum-scale\s*=\s*([^,]*)/),h=a.match(/maximum-scale\s*=\s*([^,]*)/),f=a.match(/user-scalable\s*=\s*([^,]*)/);o&&o.length&&typeof o[1]<"u"&&(r.width=o[1]),l&&l.length&&typeof l[1]<"u"&&(r.height=l[1]),u&&u.length&&typeof u[1]<"u"&&(r.scale=u[1]),d&&d.length&&typeof d[1]<"u"&&(r.minimum=d[1]),h&&h.length&&typeof h[1]<"u"&&(r.maximum=h[1]),f&&f.length&&typeof f[1]<"u"&&(r.scalable=f[1])}return i=Sae(e||{},r),e&&(i.width&&s.push("width="+i.width),i.height&&s.push("height="+i.height),i.scale&&s.push("initial-scale="+i.scale),i.scalable==="no"?(s.push("minimum-scale="+i.scale),s.push("maximum-scale="+i.scale),s.push("user-scalable="+i.scalable)):(i.scalable&&s.push("user-scalable="+i.scalable),i.minimum&&s.push("minimum-scale="+i.minimum),i.maximum&&s.push("minimum-scale="+i.maximum)),t||(t=this.document.createElement("meta"),t.setAttribute("name","viewport"),this.document.querySelector("head").appendChild(t)),t.setAttribute("content",s.join(", ")),this.window.scrollTo(0,0)),i}
976expand(){this.emit(ot.CONTENTS.EXPAND)}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),typeof ResizeObserver>"u"?(this.resizeListeners(),this.visibilityListeners()):this.resizeObservers(),this.linksHandler()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners(),this.observer&&this.observer.disconnect(),clearTimeout(this.expanding)}resizeCheck(){let e=this.textWidth(),t=this.textHeight();(e!=this._size.width||t!=this._size.height)&&(this._size={width:e,height:t},this.onResize&&this.onResize(this._size),this.emit(ot.CONTENTS.RESIZE,this._size))}resizeListeners(){clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}visibilityListeners(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.active===!1?(this.active=!0,this.resizeListeners()):(this.active=!1,clearTimeout(this.expanding))})}transitionListeners(){let e=this.content;e.style.transitionProperty="font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height",e.style.transitionDuration="0.001ms",e.style.transitionTimingFunction="linear",e.style.transitionDelay="0",this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener("transitionend",this._resizeCheck)}mediaQueryListeners(){for(var e=this.document.styleSheets,t=(function(o){o.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}).bind(this),r=0;r<e.length;r+=1){var s;try{s=e[r].cssRules}catch{return}if(!s)return;for(var i=0;i<s.length;i+=1)if(s[i].media){var a=this.window.matchMedia(s[i].media.mediaText);a.addListener(t)}}}resizeObservers(){this.observer=new ResizeObserver(e=>{requestAnimationFrame(this.resizeCheck.bind(this))}),this.observer.observe(this.document.documentElement)}mutationObservers(){this.observer=new MutationObserver(t=>{this.resizeCheck()});let e={attributes:!0,childList:!0,characterData:!0,subtree:!0};this.observer.observe(this.document,e)}imageLoadListeners(){for(var e=this.document.querySelectorAll("img"),t,r=0;r<e.length;r++)t=e[r],typeof t.naturalWidth<"u"&&t.naturalWidth===0&&(t.onload=this.expand.bind(this))}fontLoadListeners(){!this.document||!this.document.fonts||this.document.fonts.ready.then((function(){this.resizeCheck()}).bind(this))}root(){return this.document?this.document.documentElement:null}locationOf(e,t){var r,s={left:0,top:0};if(!this.document)return s;if(this.epubcfi.isCfiString(e)){let i=new pn(e).toRange(this.document,t);if(i){try{if(!i.endContainer||i.startContainer==i.endContainer&&i.startOffset==i.endOffset){let a=i.startContainer.textContent.indexOf(" ",i.startOffset);a==-1&&(a=i.startContainer.textContent.length),i.setEnd(i.startContainer,a)}}catch(a){console.error("setting end offset to start container length failed",a)}if(i.startContainer.nodeType===Node.ELEMENT_NODE)r=i.startContainer.getBoundingClientRect(),s.left=r.left,s.top=r.top;else if(OW){let a=i.startContainer,o=new Range;try{a.nodeType===U6e?r=a.getBoundingClientRect():i.startOffset+2<a.length?(o.setStart(a,i.startOffset),o.setEnd(a,i.startOffset+2),r=o.getBoundingClientRect()):i.startOffset-2>0?(o.setStart(a,i.startOffset-2),o.setEnd(a,i.startOffset),r=o.getBoundingClientRect()):r=a.parentNode.getBoundingClientRect()}catch(l){console.error(l,l.stack)}}else r=i.getBoundingClientRect()}}else if(typeof e=="string"&&e.indexOf("#")>-1){let i=e.substring(e.indexOf("#")+1),a=this.document.getElementById(i);if(a)if(OW){let o=new Range;o.selectNode(a),r=o.getBoundingClientRect()}else r=a.getBoundingClientRect()}return r&&(s.left=r.left,s.top=r.top),s}addStylesheet(e){return new Promise((function(t,r){var s,i=!1;if(!this.document){t(!1);return}if(s=this.document.querySelector("link[href='"+e+"']"),s){t(!0);return}s=this.document.createElement("link"),s.type="text/css",s.rel="stylesheet",s.href=e,s.onload=s.onreadystatechange=function(){!i&&(!this.readyState||this.readyState=="complete")&&(i=!0,setTimeout(()=>{t(!0)},1))},this.document.head.appendChild(s)}).bind(this))}_getStylesheetNode(e){var t;return e="epubjs-inserted-css-"+(e||""),this.document?(t=this.document.getElementById(e),t||(t=this.document.createElement("style"),t.id=e,this.document.head.appendChild(t)),t):!1}addStylesheetCss(e,t){if(!this.document||!e)return!1;var r;return r=this._getStylesheetNode(t),r.innerHTML=e,!0}addStylesheetRules(e,t){var r;if(!(!this.document||!e||e.length===0))if(r=this._getStylesheetNode(t).sheet,Object.prototype.toString.call(e)==="[object Array]")for(var s=0,i=e.length;s<i;s++){var a=1,o=e[s],l=e[s][0],u="";Object.prototype.toString.call(o[1][0])==="[object Array]"&&(o=o[1],a=0);for(var d=o.length;a<d;a++){var h=o[a];u+=h[0]+":"+h[1]+(h[2]?" !important":"")+`;
977`}r.insertRule(l+"{"+u+"}",r.cssRules.length)}else Object.keys(e).forEach(p=>{const m=e[p];if(Array.isArray(m))m.forEach(g=>{const v=Object.keys(g).map(x=>`${x}:${g[x]}`).join(";");r.insertRule(`${p}{${v}}`,r.cssRules.length)});else{const y=Object.keys(m).map(v=>`${v}:${m[v]}`).join(";");r.insertRule(`${p}{${y}}`,r.cssRules.length)}})}addScript(e){return new Promise((function(t,r){var s,i=!1;if(!this.document){t(!1);return}s=this.document.createElement("script"),s.type="text/javascript",s.async=!0,s.src=e,s.onload=s.onreadystatechange=function(){!i&&(!this.readyState||this.readyState=="complete")&&(i=!0,setTimeout(function(){t(!0)}
977,1))},this.document.head.appendChild(s)}).bind(this))}addClass(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.add(e))}removeClass(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.remove(e))}addEventListeners(){this.document&&(this._triggerEvent=this.triggerEvent.bind(this),bC.forEach(function(e){this.document.addEventListener(e,this._triggerEvent,{passive:!0})},this))}removeEventListeners(){this.document&&(bC.forEach(function(e){this.document.removeEventListener(e,this._triggerEvent,{passive:!0})},this),this._triggerEvent=void 0)}triggerEvent(e){this.emit(e.type,e)}addSelectionListeners(){this.document&&(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener("selectionchange",this._onSelectionChange,{passive:!0}))}removeSelectionListeners(){this.document&&(this.document.removeEventListener("selectionchange",this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}onSelectionChange(e){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout((function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}).bind(this),250)}triggerSelectedEvent(e){var t,r;e&&e.rangeCount>0&&(t=e.getRangeAt(0),t.collapsed||(r=new pn(t,this.cfiBase).toString(),this.emit(ot.CONTENTS.SELECTED,r),this.emit(ot.CONTENTS.SELECTED_RANGE,t)))}range(e,t){var r=new pn(e);return r.toRange(this.document,t)}cfiFromRange(e,t){return new pn(e,this.cfiBase,t).toString()}cfiFromNode(e,t){return new pn(e,this.cfiBase,t).toString()}map(e){var t=new fN(e);return t.section()}size(e,t){var r={scale:1,scalable:"no"};this.layoutStyle("scrolling"),e>=0&&(this.width(e),r.width=e,this.css("padding","0 "+e/12+"px")),t>=0&&(this.height(t),r.height=t),this.css("margin","0"),this.css("box-sizing","border-box"),this.viewport(r)}columns(e,t,r,s,i){let a=gv("column-axis"),o=gv("column-gap"),l=gv("column-width"),u=gv("column-fill"),h=this.writingMode().indexOf("vertical")===0?"vertical":"horizontal";this.layoutStyle("paginated"),i==="rtl"&&h==="horizontal"&&this.direction(i),this.width(e),this.height(t),this.viewport({width:e,height:t,scale:1,scalable:"no"}),this.css("overflow-y","hidden"),this.css("margin","0",!0),h==="vertical"?(this.css("padding-top",s/2+"px",!0),this.css("padding-bottom",s/2+"px",!0),this.css("padding-left","20px"),this.css("padding-right","20px"),this.css(a,"vertical")):(this.css("padding-top","20px"),this.css("padding-bottom","20px"),this.css("padding-left",s/2+"px",!0),this.css("padding-right",s/2+"px",!0),this.css(a,"horizontal")),this.css("box-sizing","border-box"),this.css("max-width","inherit"),this.css(u,"auto"),this.css(o,s+"px"),this.css(l,r+"px"),this.css("-webkit-line-box-contain","block glyphs replaced")}scaler(e,t,r){var s="scale("+e+")",i="";this.css("transform-origin","top left"),(t>=0||r>=0)&&(i=" translate("+(t||0)+"px, "+(r||0)+"px )"),this.css("transform",s+i)}fit(e,t,r){var s=this.viewport(),i=parseInt(s.width),a=parseInt(s.height),o=e/i,l=t/a,u=o<l?o:l;if(this.layoutStyle("paginated"),this.width(i),this.height(a),this.overflow("hidden"),this.scaler(u,0,0),this.css("background-size",i*u+"px "+a*u+"px"),this.css("background-color","transparent"),r&&r.properties.includes("page-spread-left")){var d=e-i*u;this.css("margin-left",d+"px")}}direction(e){this.documentElement&&(this.documentElement.style.direction=e)}mapPage(e,t,r,s,i){var a=new fN(t,i);return a.page(this,e,r,s)}linksHandler(){P6e(this.content,e=>{this.emit(ot.CONTENTS.LINK_CLICKED,e)})}writingMode(e){let t=gv("writing-mode");return e&&this.documentElement&&(this.documentElement.style[t]=e),this.window.getComputedStyle(this.documentElement)[t]||""}layoutStyle(e){return e&&(this._layoutStyle=e,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||"paginated"}epubReadingSystem(e,t){return navigator.epubReadingSystem={name:e,version:t,layoutStyle:this.layoutStyle(),hasFeature:function(r){switch(r){case"dom-manipulation":return!0;case"layout-changes":return!0;case"touch-events":return!0;case"mouse-events":return!0;case"keyboard-events":return!0;case"spine-scripting":return!1;default:return!1}}},navigator.epubReadingSystem}destroy(){this.removeListeners()}}Jc(VB.prototype);class V6e{constructor(e){this.rendition=e,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}add(e,t,r,s,i,a){let o=encodeURI(t+e),u=new pn(t).spinePos,d=new Iae({type:e,cfiRange:t,data:r,sectionIndex:u,cb:s,className:i,styles:a});return this._annotations[o]=d,u in this._annotationsBySectionIndex?this._annotationsBySectionIndex[u].push(o):this._annotationsBySectionIndex[u]=[o],this.rendition.views().forEac
977h(f=>{d.sectionIndex===f.index&&d.attach(f)}),d}remove(e,t){let r=encodeURI(e+t);if(r in this._annotations){let s=this._annotations[r];if(t&&s.type!==t)return;this.rendition.views().forEach(a=>{this._removeFromAnnotationBySectionIndex(s.sectionIndex,r),s.sectionIndex===a.index&&s.detach(a)}),delete this._annotations[r]}}_removeFromAnnotationBySectionIndex(e,t){this._annotationsBySectionIndex[e]=this._annotationsAt(e).filter(r=>r!==t)}_annotationsAt(e){return this._annotationsBySectionIndex[e]}highlight(e,t,r,s,i){return this.add("highlight",e,t,r,s,i)}underline(e,t,r,s,i){return this.add("underline",e,t,r,s,i)}mark(e,t,r){return this.add("mark",e,t,r)}each(){return this._annotations.forEach.apply(this._annotations,arguments)}inject(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(s=>{this._annotations[s].attach(e)})}clear(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(s=>{this._annotations[s].detach(e)})}show(){}hide(){}}class Iae{constructor({type:e,cfiRange:t,data:r,sectionIndex:s,cb:i,className:a,styles:o}){this.type=e,this.cfiRange=t,this.data=r,this.sectionIndex=s,this.mark=void 0,this.cb=i,this.className=a,this.styles=o}update(e){this.data=e}attach(e){let{cfiRange:t,data:r,type:s,mark:i,cb:a,className:o,styles:l}=this,u;return s==="highlight"?u=e.highlight(t,r,a,o,l):s==="underline"?u=e.underline(t,r,a,o,l):s==="mark"&&(u=e.mark(t,r,a)),this.mark=u,this.emit(ot.ANNOTATION.ATTACH,u),u}detach(e){let{cfiRange:t,type:r}=this,s;return e&&(r==="highlight"?s=e.unhighlight(t):r==="underline"?s=e.ununderline(t):r==="mark"&&(s=e.unmark(t))),this.mark=void 0,this.emit(ot.ANNOTATION.DETACH,s),s}text(){}}Jc(Iae.prototype);var Zu={},jj={};Object.defineProperty(jj,"__esModule",{value:!0});jj.createElement=Lae;function Lae(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}jj.default={createElement:Lae};var bE={};Object.defineProperty(bE,"__esModule",{value:!0});bE.proxyMouse=Fae;bE.clone=Bae;bE.default={proxyMouse:Fae};function Fae(n,e){function t(a){for(var o=e.length-1;o>=0;o--){var l=e[o],u=a.clientX,d=a.clientY;if(a.touches&&a.touches.length&&(u=a.touches[0].clientX,d=a.touches[0].clientY),!!H6e(l,n,u,d)){l.dispatchEvent(Bae(a));break}}}if(n.nodeName==="iframe"||n.nodeName==="IFRAME")try{this.target=n.contentDocument}catch{this.target=n}else this.target=n;for(var r=["mouseup","mousedown","click","touchstart"],s=0;s<r.length;s++){var i=r[s];this.target.addEventListener(i,function(a){return t(a)},!1)}}function Bae(n){var e=Object.assign({},n,{bubbles:!1});try{return new MouseEvent(n.type,e)}catch{var t=document.createEvent("MouseEvents");return t.initMouseEvent(n.type,!1,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),t}}function H6e(n,e,t,r){var s=e.getBoundingClientRect();function i(d,h,f){var p=d.top-s.top,m=d.left-s.left,g=p+d.height,y=m+d.width;return p<=f&&m<=h&&g>f&&y>h}var a=n.getBoundingClientRect();if(!i(a,t,r))return!1;for(var o=n.getClientRects(),l=0,u=o.length;l<u;l++)if(i(o[l],t,r))return!0;return!1}var pN,HB;Object.defineProperty(Zu,"__esModule",{value:!0});var zae=Zu.Underline=HB=Zu.Highlight=Zu.Mark=pN=Zu.Pane=void 0,W6e=function n(e,t,r){e===null&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,t);if(s===void 0){var i=Object.getPrototypeOf(e);return i===null?void 0:n(i,t,r)}else{if("value"in s)return s.value;var a=s.get;return a===void 0?void 0:a.call(r)}},Rj=function(){function n(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),q6e=jj,X1=$ae(q6e),G6e=bE,K6e=$ae(G6e);function $ae(n){return n&&n.__esModule?n:{default:n}}function Uae(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:n}function Vae(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function Pj(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}pN=Zu.Pane=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document.body;Pj(this,n),this.target=e,this.element=X1.default.createElement("svg"),this.marks=[],this.element.style.position="absolute",this.element.setAttribute("pointer-events","none"),K6e.default.proxyMouse(this.target,this.marks),this.container=t,this.container.appendChild(this.element),this.render()}return Rj(n,[{key:"addMark",value:function(t){var r=X1.default.createElement("g");return this.element.appendChild(r),t.bind(r,this.container),this.marks.push(t),t.render(),t}},{key:"removeMark",value:function(t){var r=this.marks.indexOf(t);if(r!==-1){var s=t.unbind();this.element.removeChild(s),this.marks.splice(r,1)}}},{key:"render",value:function(){J6e(this.element,Z6e(this.target,this.container));var t=!0,r=!1,s=void 0;try{for(var i=this.marks[Symbol.iterator](),a;!(t=(a=i.next()).done);t=!0){var o=a.value;o.render()}}catch(l){r=!0,s=l}finally{try{!t&&i.return&&i.return()}finally{if(r)throw s}}}}]),n}();var Y6e=Zu.Mark=function(){function n(){Pj(this,n),this.element=null}return Rj(n,[{key:"bind",value:function(t,r){this.element=t,this.container=r}},{key:"unbind",value:function(){var t=this.element;return this.element=null,t}},{key:"render",value:function(){}},{key:"dispatchEvent",value:function(t){this.element&&this.element.dispatchEvent(t)}},{key:"getBoundingClientRect",value:function(){return this.element.getBoundingClientRect()}},{key:"getClientRects",value:function(){for(var t=[],r=this.element.firstChild;r;)t.push(r.getBoundingClientRect()),r=r.nextSibling;return t}},{key:"filteredRanges",value:function(){var t=Array.from(this.range.getClientRects());return t.filter(function(r){for(var s=0;s<t.length;s++){if(t[s]===r)return!0;var i=Q6e(t[s],r);if(i)return!1}return!0})}}]),n}(),X6e=HB=Zu.Highlight=function(n){Vae(e,n);function e(t,r,s,i){Pj(this,e);var a=Uae(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a.range=t,a.className=r,a.data=s||{},a.attributes=i||{},a}return Rj(e,[{key:"bind",value:function(r,s){W6e(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"bind",this).call(this,r,s);for(var i in this.data)this.data.hasOwnProperty(i)&&(this.element.dataset[i]=this.data[i]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&this.element.setAttribute(i,this.attributes[i]);this.className&&this.element.classList.add(this.className)}},{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var r=this.element.ownerDocument.createDocumentFragment(),s=this.filteredRanges(),i=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,l=s.length;o<l;o++){var u=s[o],d=X1.default.createElement("rect");d.setAttribute("x",u.left-i.left+a.left),d.setAttribute("y",u.top-i.top+a.top),d.setAttribute("height",u.height),d.setAttribute("width",u.width),r.appendChild(d)}this.element.appendChild(r)}}]),e}(Y6e);zae=Zu.Underline=function(n){Vae(e,n);function e(t,r,s,i){return Pj(this,e),Uae(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,s,i)
977)}return Rj(e,[{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var r=this.element.ownerDocument.createDocumentFragment(),s=this.filteredRanges(),i=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,l=s.length;o<l;o++){var u=s[o],d=X1.default.createElement("rect");d.setAttribute("x",u.left-i.left+a.left),d.setAttribute("y",u.top-i.top+a.top),d.setAttribute("height",u.height),d.setAttribute("width",u.width),d.setAttribute("fill","none");var h=X1.default.createElement("line");h.setAttribute("x1",u.left-i.left+a.left),h.setAttribute("x2",u.left-i.left+a.left+u.width),h.setAttribute("y1",u.top-i.top+a.top+u.height-1),h.setAttribute("y2",u.top-i.top+a.top+u.height-1),h.setAttribute("stroke-width",1),h.setAttribute("stroke","black"),h.setAttribute("stroke-linecap","square"),r.appendChild(d),r.appendChild(h)}this.element.appendChild(r)}}]),e}(X6e);function Z6e(n,e){var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return{top:r.top-t.top,left:r.left-t.left,height:n.scrollHeight,width:n.scrollWidth}}function J6e(n,e){n.style.setProperty("top",e.top+"px","important"),n.style.setProperty("left",e.left+"px","important"),n.style.setProperty("height",e.height+"px","important"),n.style.setProperty("width",e.width+"px","important")}function Q6e(n,e){return e.right<=n.right&&e.left>=n.left&&e.top>=n.top&&e.bottom<=n.bottom}class Hae{constructor(e,t){this.settings=ri({ignoreClass:"",axis:void 0,direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0,forceRight:!1,allowScriptedContent:!1,allowPopups:!1},t||{}),this.id="epubjs-view-"+Nj(),this.section=e,this.index=e.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new pn,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}container(e){var t=document.createElement("div");return t.classList.add("epub-view"),t.style.height="0px",t.style.width="0px",t.style.overflow="hidden",t.style.position="relative",t.style.display="block",e&&e=="horizontal"?t.style.flex="none":t.style.flex="initial",t}create(){return this.iframe?this.iframe:(this.element||(this.element=this.createContainer()),this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.style.overflow="hidden",this.iframe.seamless="seamless",this.iframe.style.border="none",this.iframe.sandbox="allow-same-origin",this.settings.allowScriptedContent&&(this.iframe.sandbox+=" allow-scripts"),this.settings.allowPopups&&(this.iframe.sandbox+=" allow-popups"),this.iframe.setAttribute("enable-annotation","true"),this.resizing=!0,this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this.element.setAttribute("ref",this.index),this.added=!0,this.elementBounds=yC(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.settings.method||(this.settings.method=this.supportsSrcdoc?"srcdoc":"write"),this.iframe)}render(e,t){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(e)),this.sectionRender.then((function(r){return this.load(r)}).bind(this)).then((function(){let r=this.contents.writingMode(),s;return this.settings.flow==="scrolled"?s=r.indexOf("vertical")===0?"horizontal":"vertical":s=r.indexOf("vertical")===0?"vertical":"horizontal",r.indexOf("vertical")===0&&this.settings.flow==="paginated"&&(this.layout.delta=this.layout.height),this.setAxis(s),this.emit(ot.VIEWS.AXIS,s),this.setWritingMode(r),this.emit(ot.VIEWS.WRITING_MODE,r),this.layout.format(this.contents,this.section,this.axis),this.addListeners(),new Promise((i,a)=>{this.expand(),this.settings.forceRight&&(this.element.style.marginLeft=this.width()+"px"),i()})}).bind(this),(function(r){return this.emit(ot.VIEWS.LOAD_ERROR,r),new Promise((s,i)=>{i(r)})}
977).bind(this)).then((function(){this.emit(ot.VIEWS.RENDERED,this.section)}).bind(this))}reset(){this.iframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}size(e,t){var r=e||this.settings.width,s=t||this.settings.height;this.layout.name==="pre-paginated"?this.lock("both",r,s):this.settings.axis==="horizontal"?this.lock("height",r,s):this.lock("width",r,s),this.settings.width=r,this.settings.height=s}lock(e,t,r){var s=lN(this.element),i;this.iframe?i=lN(this.iframe):i={width:0,height:0},e=="width"&&Nr(t)&&(this.lockedWidth=t-s.width-i.width),e=="height"&&Nr(r)&&(this.lockedHeight=r-s.height-i.height),e==="both"&&Nr(t)&&Nr(r)&&(this.lockedWidth=t-s.width-i.width,this.lockedHeight=r-s.height-i.height),this.displayed&&this.iframe&&this.expand()}expand(e){var t=this.lockedWidth,r=this.lockedHeight,s;!this.iframe||this._expanding||(this._expanding=!0,this.layout.name==="pre-paginated"?(t=this.layout.columnWidth,r=this.layout.height):this.settings.axis==="horizontal"?(t=this.contents.textWidth(),t%this.layout.pageWidth>0&&(t=Math.ceil(t/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(s=t/this.layout.pageWidth,this.layout.divisor>1&&this.layout.name==="reflowable"&&s%2>0&&(t+=this.layout.pageWidth))):this.settings.axis==="vertical"&&(r=this.contents.textHeight(),this.settings.flow==="paginated"&&r%this.layout.height>0&&(r=Math.ceil(r/this.layout.height)*this.layout.height)),(this._needsReframe||t!=this._width||r!=this._height)&&this.reframe(t,r),this._expanding=!1)}reframe(e,t){var r;Nr(e)&&(this.element.style.width=e+"px",this.iframe.style.width=e+"px",this._width=e),Nr(t)&&(this.element.style.height=t+"px",this.iframe.style.height=t+"px",this._height=t);let s=this.prevBounds?e-this.prevBounds.width:e,i=this.prevBounds?t-this.prevBounds.height:t;r={width:e,height:t,widthDelta:s,heightDelta:i},this.pane&&this.pane.render(),requestAnimationFrame(()=>{let a;for(let o in this.marks)this.marks.hasOwnProperty(o)&&(a=this.marks[o],this.placeMark(a.element,a.range))}),this.onResize(this,r),this.emit(ot.VIEWS.RESIZED,r),this.prevBounds=r,this.elementBounds=yC(this.element)}load(e){var t=new fn,r=t.promise;if(!this.iframe)return t.reject(new Error("No Iframe Available")),r;if(this.iframe.onload=(function(i){this.onLoad(i,t)}).bind(this),this.settings.method==="blobUrl")this.blobUrl=uN(e,"application/xhtml+xml"),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if(this.settings.method==="srcdoc")this.iframe.srcdoc=e,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return t.reject(new Error("No Document Available")),r;if(this.iframe.contentDocument.open(),window.MSApp&&MSApp.execUnsafeLocalFunction){var s=this;MSApp.execUnsafeLocalFunction(function(){s.iframe.contentDocument.write(e)})}else this.iframe.contentDocument.write(e);this.iframe.contentDocument.close()}return r}onLoad(e,t){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new VB(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var r=this.document.querySelector("link[rel='canonical']");r?r.setAttribute("href",this.section.canonical):(r=this.document.createElement("link"),r.setAttribute("rel","canonical"),r.setAttribute("href",this.section.canonical),this.document.querySelector("head").appendChild(r)),this.contents.on(ot.CONTENTS.EXPAND,()=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),this.contents.on(ot.CONTENTS.RESIZE,s=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),t.resolve(this.contents)}setLayout(e){this.layout=e,this.contents&&(this.layout.format(this.contents),this.expand())}setAxis(e){this.settings.axis=e,e=="horizontal"?this.element.style.flex="none":this.element.style.flex="initial",this.size()}setWritingMode(e){this.writingMode=e}addListeners(){}removeListeners(e){}display(e){var t=new fn;return this.displayed?t.resolve(this):this.render(e).then((function(){this.emit
977(ot.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,t.resolve(this)}).bind(this),function(r){t.reject(r,this)}),t.promise}show(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible",this.iframe.style.transform="translateZ(0)",this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(ot.VIEWS.SHOWN,this)}hide(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit(ot.VIEWS.HIDDEN,this)}offset(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}width(){return this._width}height(){return this._height}position(){return this.element.getBoundingClientRect()}locationOf(e){this.iframe.getBoundingClientRect();var t=this.contents.locationOf(e,this.settings.ignoreClass);return{left:t.left,top:t.top}}onDisplayed(e){}onResize(e,t){}bounds(e){return(e||!this.elementBounds)&&(this.elementBounds=yC(this.element)),this.elementBounds}highlight(e,t={},r,s="epubjs-hl",i={}){if(!this.contents)return;const a=Object.assign({fill:"yellow","fill-opacity":"0.3","mix-blend-mode":"multiply"},i);let o=this.contents.range(e),l=()=>{this.emit(ot.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new pN(this.iframe,this.element));let u=new HB(o,s,t,a),d=this.pane.addMark(u);return this.highlights[e]={mark:d,element:d.element,listeners:[l,r]},d.element.setAttribute("ref",s),d.element.addEventListener("click",l),d.element.addEventListener("touchstart",l),r&&(d.element.addEventListener("click",r),d.element.addEventListener("touchstart",r)),d}underline(e,t={},r,s="epubjs-ul",i={}){if(!this.contents)return;const a=Object.assign({stroke:"black","stroke-opacity":"0.3","mix-blend-mode":"multiply"},i);let o=this.contents.range(e),l=()=>{this.emit(ot.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new pN(this.iframe,this.element));let u=new zae(o,s,t,a),d=this.pane.addMark(u);return this.underlines[e]={mark:d,element:d.element,listeners:[l,r]},d.element.setAttribute("ref",s),d.element.addEventListener("click",l),d.element.addEventListener("touchstart",l),r&&(d.element.addEventListener("click",r),d.element.addEventListener("touchstart",r)),d}mark(e,t={},r){if(!this.contents)return;if(e in this.marks)return this.marks[e];let s=this.contents.range(e);if(!s)return;let i=s.commonAncestorContainer,a=i.nodeType===1?i:i.parentNode,o=u=>{this.emit(ot.VIEWS.MARK_CLICKED,e,t)};s.collapsed&&i.nodeType===1?(s=new Range,s.selectNodeContents(i)):s.collapsed&&(s=new Range,s.selectNodeContents(a));let l=this.document.createElement("a");return l.setAttribute("ref","epubjs-mk"),l.style.position="absolute",l.dataset.epubcfi=e,t&&Object.keys(t).forEach(u=>{l.dataset[u]=t[u]}),r&&(l.addEventListener("click",r),l.addEventListener("touchstart",r)),l.addEventListener("click",o),l.addEventListener("touchstart",o),this.placeMark(l,s),this.element.appendChild(l),this.marks[e]={element:l,range:s,listeners:[o,r]},a}placeMark(e,t){let r,s,i;if(this.layout.name==="pre-paginated"||this.settings.axis!=="horizontal"){let o=t.getBoundingClientRect();r=o.top,s=o.right}else{let o=t.getClientRects(),l;for(var a=0;a!=o.length;a++)l=o[a],(!i||l.left<i)&&(i=l.left,s=Math.ceil(i/this.layout.props.pageWidth)*this.layout.props.pageWidth-this.layout.gap/2,r=l.top)}e.style.top=`${r}px`,e.style.left=`${s}px`}unhighlight(e){let t;e in this.highlights&&(t=this.highlights[e],this.pane.removeMark(t.mark),t.listeners.forEach(r=>{r&&(t.element.removeEventListener("click",r),t.element.removeEventListener("touchstart",r))}),delete this.highlights[e])}ununderline(e){let t;e in this.underlines&&(t=this.underlines[e],this.pane.removeMark(t.mark),t.listeners.forEach(r=>{r&&(t.element.removeEventListener("click",r),t.element.removeEventListener("touchstart",r))}),delete this.underlines[e])}unmark(e){let t;e in this.marks&&(t=this.marks[e],this.element.removeChild(t.element),t.listeners.forEach(r=>{r&&(t.element.removeEventListener("click",r),t.element.removeEventListener("touchstart",r))}),delete this.marks[e])}destroy(){for(let e in this.highlights)this.unhighlight(e);for(let e in this.underlines)this.ununderline(e);for(let e in this.marks)this.unmark(e);this.blobUrl&&Cae(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.pane&&(this.pane.element.remove(),this.pane=void 0),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}Jc(Hae.prototype);function e8e(){var n="reverse",e=t8e();return document.body.appendChild(e),e.scrollLeft>0?n="default":typeof Element<"u"&&Element.prototype.scrollIntoView?(e.children[0].children[1].scrollIntoView(),e.scrollLeft<0&&(n="negative")):(e.scrollLeft=1,e.scrollLeft===0&&(n="negative")),document.body.removeChild(e),n}function t8e(){var n=document.createElement("div");n.dir="rtl",n.style.position="fixed",n.style.width="1px",n.style.height="1px",n.style.top="0px",n.style.left="0px",n.style.overflow="hidden";var e=document.createElement("div");e.style.width="2px";var t=document.createElement("span");t.style.width="1px",t.style.display="inline-block";var r=document.createElement("span");return r.style.width="1px",r.style.display="inline-block",e.appendChild(t),e.appendChild(r),n.appendChild(e),n}function n8e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}
977var WB=n8e,r8e=typeof bi=="object"&&bi&&bi.Object===Object&&bi,s8e=r8e,i8e=s8e,a8e=typeof self=="object"&&self&&self.Object===Object&&self,o8e=i8e||a8e||Function("return this")(),Wae=o8e,l8e=Wae,c8e=function(){return l8e.Date.now()},u8e=c8e,d8e=/\s/;function h8e(n){for(var e=n.length;e--&&d8e.test(n.charAt(e)););return e}var f8e=h8e,p8e=f8e,m8e=/^\s+/;function g8e(n){return n&&n.slice(0,p8e(n)+1).replace(m8e,"")}var v8e=g8e,y8e=Wae,x8e=y8e.Symbol,qae=x8e,MW=qae,Gae=Object.prototype,b8e=Gae.hasOwnProperty,w8e=Gae.toString,mb=MW?MW.toStringTag:void 0;function _8e(n){var e=b8e.call(n,mb),t=n[mb];try{n[mb]=void 0;var r=!0}catch{}var s=w8e.call(n);return r&&(e?n[mb]=t:delete n[mb]),s}var S8e=_8e,E8e=Object.prototype,k8e=E8e.toString;function C8e(n){return k8e.call(n)}var A8e=C8e,IW=qae,N8e=S8e,T8e=A8e,j8e="[object Null]",R8e="[object Undefined]",LW=IW?IW.toStringTag:void 0;function P8e(n){return n==null?n===void 0?R8e:j8e:LW&&LW in Object(n)?N8e(n):T8e(n)}var D8e=P8e;function O8e(n){return n!=null&&typeof n=="object"}var M8e=O8e,I8e=D8e,L8e=M8e,F8e="[object Symbol]";function B8e(n){return typeof n=="symbol"||L8e(n)&&I8e(n)==F8e}var z8e=B8e,$8e=v8e,FW=WB,U8e=z8e,BW=NaN,V8e=/^[-+]0x[0-9a-f]+$/i,H8e=/^0b[01]+$/i,W8e=/^0o[0-7]+$/i,q8e=parseInt;function G8e(n){if(typeof n=="number")return n;if(U8e(n))return BW;if(FW(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=FW(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=$8e(n);var t=H8e.test(n);return t||W8e.test(n)?q8e(n.slice(2),t?2:8):V8e.test(n)?BW:+n}var K8e=G8e,Y8e=WB,gD=u8e,zW=K8e,X8e="Expected a function",Z8e=Math.max,J8e=Math.min;function Q8e(n,e,t){var r,s,i,a,o,l,u=0,d=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(X8e);e=zW(e)||0,Y8e(t)&&(d=!!t.leading,h="maxWait"in t,i=h?Z8e(zW(t.maxWait)||0,e):i,f="trailing"in t?!!t.trailing:f);function p(k){var C=r,A=s;return r=s=void 0,u=k,a=n.apply(A,C),a}function m(k){return u=k,o=setTimeout(v,e),d?p(k):a}function g(k){var C=k-l,A=k-u,T=e-C;return h?J8e(T,i-A):T}function y(k){var C=k-l,A=k-u;return l===void 0||C>=e||C<0||h&&A>=i}function v(){var k=gD();if(y(k))return x(k);o=setTimeout(v,g(k))}function x(k){return o=void 0,f&&r?p(k):(r=s=void 0,a)}function b(){o!==void 0&&clearTimeout(o),u=0,r=l=s=o=void 0}function E(){return o===void 0?a:x(gD())}function S(){var k=gD(),C=y(k);if(r=arguments,s=this,l=k,C){if(o===void 0)return m(l);if(h)return clearTimeout(o),o=setTimeout(v,e),p(l)}return o===void 0&&(o=setTimeout(v,e)),a}return S.cancel=b,S.flush=E,S}var Kae=Q8e;const eUe=ro(Kae);var tUe=Kae,nUe=WB,rUe="Expected a function";function sUe(n,e,t){var r=!0,s=!0;if(typeof n!="function")throw new TypeError(rUe);return nUe(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),tUe(n,e,{leading:r,maxWait:e,trailing:s})}var iUe=sUe;const aUe=ro(iUe);class oUe{constructor(e){this.settings=e||{},this.id="epubjs-container-"+Nj(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(e){let t=e.height,r=e.width,s=e.overflow||!1,i=e.axis||"vertical",a=e.direction;ri(this.settings,e),e.height&&Nr(e.height)&&(t=e.height+"px"),e.width&&Nr(e.width)&&(r=e.width+"px");let o=document.createElement("div");return o.id=this.id,o.classList.add("epub-container"),o.style.wordSpacing="0",o.style.lineHeight="0",o.style.verticalAlign="top",o.style.position="relative",i==="horizontal"&&(o.style.display="flex",o.style.flexDirection="row",o.style.flexWrap="nowrap"),r&&(o.style.width=r),t&&(o.style.height=t),s&&(s==="scroll"&&i==="vertical"?(o.style["overflow-y"]=s,o.style["overflow-x"]="hidden"):s==="scroll"&&i==="horizontal"?(o.style["overflow-y"]="hidden",o.style["overflow-x"]=s):o.style.overflow=s),a&&(o.dir=a,o.style.direction=a),a&&this.settings.fullsize&&(document.body.style.direction=a),o}wrap(e){var t=document.createElement("div");return t.style.visibility="hidden",t.style.overflow="hidden",t.style.width="0",t.style.height="0",t.appendChild(e),t}getElement(e){var t;if(wae(e)?t=e:typeof e=="string"&&(t=document.getElementById(e)),!t)throw new Error("Not an Element");return t}attachTo(e){var t=this.getElement(e),r;if(t)return this.settings.hidden?r=this.wrapper:r=this.container,t.appendChild(r),this.element=t,t}getContainer(){return this.container}onResize(e){(!Nr(this.settings.width)||!Nr(this.settings.height))&&(this.resizeFunc=aUe(e,50),window.addEventListener("resize",this.resizeFunc,!1))}onOrientationChange(e){this.orientationChangeFunc=e,window.addEventListener("orientationchange",this.orientationChangeFunc,!1)}size(e,t){var r;let s=e||this.settings.width,i=t||this.settings.height;e===null?(r=this.element.getBoundingClientRect(),r.width&&(e=Math.floor(r.width),this.container.style.width=e+"px")):Nr(e)?this.container.style.width=e+"px":this.container.style.width=e,t===null?(r=r||this.element.getBoundingClientRect(),r.height&&(t=r.height,this.container.style.height=t+"px")):Nr(t)?this.container.style.height=t+"px":this.container.style.height=t,Nr(e)||(e=this.container.clientWidth),Nr(t)||(t=this.container.clientHeight),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0};let a=cN(),o=window.getComputedStyle(document.body),l={left:parseFloat(o["padding-left"])||0,right:parseFloat(o["padding-right"])||0,top:parseFloat(o["padding-top"])||0,bottom:parseFloat(o["padding-bottom"])||0};return s||(e=a.width-l.left-l.right),(this.settings.fullsize&&!i||!i)&&(t=a.height-l.top-l.bottom),{width:e-this.containerPadding.left-this.containerPadding.right,height:t-this.containerPadding.top-this.containerPadding.bottom}}bounds(){let e;return this.container.style.overflow!=="visible"&&(e=this.container&&this.container.getBoundingClientRect()),!e||!e.width||!e.height?cN():e}getSheet(){var e=document.createElement("style");return e.appendChild(document.createTextNode("")),document.head.appendChild(e),e.sheet}addStyleRules(e,t){var r="#"+this.id+" ",s="";this.sheet||(this.sheet=this.getSheet()),t.forEach(function(i){for(var a in i)i.hasOwnProperty(a)&&(s+=a+":"+i[a]+";")}),this.sheet.insertRule(r+e+" {"+s+"}",0)}axis(e){e==="horizontal"?(this.container.style.display="flex",this.container.style.flexDirection="row",this.container.style.flexWrap="nowrap"):this.container.style.display="block",this.settings.axis=e}direction(e){this.container&&(this.container.dir=e,this.container.style.direction=e),this.settings.fullsize&&(document.body.style.direction=e),this.settings.dir=e}overflow(e){this.container&&(e==="scroll"&&this.settings.axis==="vertical"?(this.container.style["overflow-y"]=e,this.container.style["overflow-x"]="hidden"):e==="scroll"&&this.settings.axis==="horizontal"?(this.container.style["overflow-y"]="hidden",this.container.style["overflow-x"]=e):this.container.style.overflow=e),this.settings.overflow=e}destroy(){this.element&&(this.settings.hidden?this.wrapper:this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener("resize",this.resizeFunc),window.removeEventListener("orientationChange",this.orientationChangeFunc))}}class lUe{constructor(e){this.container=e,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(e){return this._views.indexOf(e)}slice(){return this._views.slice.apply(this._views,arguments)}get(e){return this._views[e]}append(e){return this._views.push(e),this.container&&this.container.appendChild(e.element),this.length++,e}prepend(e){return this._views.unshift(e),this.container&&this.container.insertBefore(e.element,this.container.firstChild),this.length++,e}insert(e,t){return this._views.splice(t,0,e),this.container&&(t<this.container.children.length?this.container.insertBefore(e.element,this.container.children[t]):this.container.appendChild(e.element)),this.length++,e}remove(e){var t=this._views.indexOf(e);t>-1&&this._views.splice(t,1),this.destroy(e),this.length--}destroy(e){e.displayed&&e.destroy(),this.container&&this.container.removeChild(e.element),e=null}forEach(){return this._views.forEach.apply(this._views,arguments)}clear(){var e,t=this.length;if(this.length){for(var r=0;r<t;r++)e=this._views[r],this.destroy(e);this._views=[],this.length=0}}find(e){for(var t,r=this.length,s=0;s<r;s++)if(t=this._views[s],t.displayed&&t.section.index==e.index)return t}displayed(){for(var e=[],t,r=this.length,s=0;s<r;s++)t=this._views[s],t.displayed&&e.push(t);return e}show(){for(var e,t=this.length,r=0;r<t;r++)e=this._views[r],e.displayed&&e.show();this.hidden=!1}hide(){for(var e,t=this.length,r=0;r<t;r++)e=this._views[r],e.displayed&&e.hide();this.hidden=!0}}
977class mN{constructor(e){this.name="default",this.optsSettings=e.settings,this.View=e.view,this.request=e.request,this.renditionQueue=e.queue,this.q=new UB(this),this.settings=ri(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",ignoreClass:"",fullsize:void 0,allowScriptedContent:!1,allowPopups:!1}),ri(this.settings,e.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.rendered=!1}render(e,t){let r=e.tagName;typeof this.settings.fullsize>"u"&&r&&(r.toLowerCase()=="body"||r.toLowerCase()=="html")&&(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow="visible",this.overflow=this.settings.overflow),this.settings.size=t,this.settings.rtlScrollType=e8e(),this.stage=new oUe({width:t.width,height:t.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(e),this.container=this.stage.getContainer(),this.views=new lUe(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}addEventListeners(){var e;window.addEventListener("unload",(function(t){this.destroy()}).bind(this)),this.settings.fullsize?e=window:e=this.container,this._onScroll=this.onScroll.bind(this),e.addEventListener("scroll",this._onScroll)}removeEventListeners(){var e;this.settings.fullsize?e=window:e=this.container,e.removeEventListener("scroll",this._onScroll),this._onScroll=void 0}destroy(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}onOrientationChange(e){let{orientation:t}=window;
977this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout((function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(ot.MANAGERS.ORIENTATION_CHANGE,t)}).bind(this),500)}onResized(e){this.resize()}resize(e,t,r){let s=this.stage.size(e,t);if(this.winBounds=cN(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height){this._stageSize=void 0;return}this._stageSize&&this._stageSize.width===s.width&&this._stageSize.height===s.height||(this._stageSize=s,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(ot.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height},r))}createView(e,t){return new this.View(e,ri(this.viewSettings,{forceRight:t}))}handleNextPrePaginated(e,t,r){let s;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1){if(e||t.index===0)return;if(s=t.next(),s&&!s.properties.includes("page-spread-left"))return r.call(this,s)}}display(e,t){var r=new fn,s=r.promise;(t===e.href||Nr(t))&&(t=void 0);var i=this.views.find(e);if(i&&e&&this.layout.name!=="pre-paginated"){let o=i.offset();if(this.settings.direction==="ltr")this.scrollTo(o.left,o.top,!0);else{let l=i.width();this.scrollTo(o.left+l,o.top,!0)}if(t){let l=i.locationOf(t),u=i.width();this.moveTo(l,u)}return r.resolve(),s}this.clear();let a=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&e.properties.includes("page-spread-right")&&(a=!0),this.add(e,a).then((function(o){if(t){let l=o.locationOf(t),u=o.width();this.moveTo(l,u)}}).bind(this),o=>{r.reject(o)}).then((function(){return this.handleNextPrePaginated(a,e,this.add)}).bind(this)).then((function(){this.views.show(),r.resolve()}).bind(this)),s}afterDisplayed(e){this.emit(ot.MANAGERS.ADDED,e)}afterResized(e){this.emit(ot.MANAGERS.RESIZE,e.section)}moveTo(e,t){var r=0,s=0;this.isPaginated?(r=Math.floor(e.left/this.layout.delta)*this.layout.delta,r+this.layout.delta>this.container.scrollWidth&&(r=this.container.scrollWidth-this.layout.delta),s=Math.floor(e.top/this.layout.delta)*this.layout.delta,s+this.layout.delta>this.container.scrollHeight&&(s=this.container.scrollHeight-this.layout.delta)):s=e.top,this.settings.direction==="rtl"&&(r=r+this.layout.delta,r=r-t),this.scrollTo(r,s,!0)}add(e,t){var r=this.createView(e,t);return this.views.append(r),r.onDisplayed=this.afterDisplayed.bind(this),r.onResize=this.afterResized.bind(this),r.on(ot.VIEWS.AXIS,s=>{this.updateAxis(s)}),r.on(ot.VIEWS.WRITING_MODE,s=>{this.updateWritingMode(s)}),r.display(this.request)}append(e,t){var r=this.createView(e,t);return this.views.append(r),r.onDisplayed=this.afterDisplayed.bind(this),r.onResize=this.afterResized.bind(this),r.on(ot.VIEWS.AXIS,s=>{this.updateAxis(s)}),r.on(ot.VIEWS.WRITING_MODE,s=>{this.updateWritingMode(s)}),r.display(this.request)}prepend(e,t){var r=this.createView(e,t);return r.on(ot.VIEWS.RESIZED,s=>{this.counter(s)}),this.views.prepend(r),r.onDisplayed=this.afterDisplayed.bind(this),r.onResize=this.afterResized.bind(this),r.on(ot.VIEWS.AXIS,s=>{this.updateAxis(s)}),r.on(ot.VIEWS.WRITING_MODE,s=>{this.updateWritingMode(s)}),r.display(this.request)}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}next(){var e,t;let r=this.settings.direction;if(this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!r||r==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,t<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):this.isPaginated&&this.settings.axis==="horizontal"&&r==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft,t>0?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):(t=this.container.scrollLeft+this.layout.delta*-1,t>this.container.scrollWidth*-1?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next())):this.isPaginated&&this.settings.axis==="vertical"?(this.scrollTop=this.container.scrollTop,this.container.scrollTop+this.container.offsetHeight<this.container.scrollHeight?this.scrollBy(0,this.layout.height,!0):e=this.views.last().section.next()):e=this.views.last().section.next(),e)){this.clear(),this.updateLayout();let s=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&e.properties.includes("page-spread-right")&&(s=!0),this.append(e,s
977).then((function(){return this.handleNextPrePaginated(s,e,this.append)}).bind(this),i=>i).then((function(){!this.isPaginated&&this.settings.axis==="horizontal"&&this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"&&this.scrollTo(this.container.scrollWidth,0,!0),this.views.show()}).bind(this))}}prev(){var e,t;let r=this.settings.direction;if(this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!r||r==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft,t>0?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev()):this.isPaginated&&this.settings.axis==="horizontal"&&r==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft+this.container.offsetWidth,t<this.container.scrollWidth?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev()):(t=this.container.scrollLeft,t<0?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev())):this.isPaginated&&this.settings.axis==="vertical"?(this.scrollTop=this.container.scrollTop,this.container.scrollTop>0?this.scrollBy(0,-this.layout.height,!0):e=this.views.first().section.prev()):e=this.views.first().section.prev(),e)){this.clear(),this.updateLayout();let s=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&typeof e.prev()!="object"&&(s=!0),this.prepend(e,s).then((function(){var i;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1&&(i=e.prev(),i))return this.prepend(i)}).bind(this),i=>i).then((function(){this.isPaginated&&this.settings.axis==="horizontal"&&(this.settings.direction==="rtl"?this.settings.rtlScrollType==="default"?this.scrollTo(0,0,!0):this.scrollTo(this.container.scrollWidth*-1+this.layout.delta,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}).bind(this))}}current(){var e=this.visible();return e.length?e[e.length-1]:null}clear(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}currentLocation(){return this.updateLayout(),this.isPaginated&&this.settings.axis==="horizontal"?this.location=this.paginatedLocation():this.location=this.scrolledLocation(),this.location}scrolledLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),r=t.height<window.innerHeight?t.height:window.innerHeight,s=t.width<window.innerWidth?t.width:window.innerWidth,i=this.settings.axis==="vertical";this.settings.direction;let a=0,o=0;return this.settings.fullsize&&(a=i?window.scrollY:window.scrollX),e.map(u=>{let{index:d,href:h}=u.section,f=u.position(),p=u.width(),m=u.height(),g,y,v,x;i?(g=a+t.top-f.top+o,y=g+r-o,x=this.layout.count(m,r).pages,v=r):(g=a+t.left-f.left+o,y=g+s-o,x=this.layout.count(p,s).pages,v=s);let b=Math.ceil(g/v),E=[],S=Math.ceil(y/v);if(this.settings.direction==="rtl"&&!i){let A=b;b=x-S,S=x-A}E=[];for(var k=b;k<=S;k++){let A=k+1;E.push(A)}let C=this.mapping.page(u.contents,u.section.cfiBase,g,y);return{index:d,href:h,pages:E,totalPages:x,mapping:C}})}paginatedLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),r=0,s=0;return this.settings.fullsize&&(r=window.scrollX),e.map(a=>{let{index:o,href:l}=a.section,u,d=a.position(),h=a.width(),f,p,m;this.settings.direction==="rtl"?(u=t.right-r,m=Math.min(Math.abs(u-d.left),this.layout.width)-s,p=d.width-(d.right-u)-s,f=p-m):(u=t.left+r,m=Math.min(d.right-u,this.layout.width)-s,f=u-d.left+s,p=f+m),s+=m;let g=this.mapping.page(a.contents,a.section.cfiBase,f,p),y=this.layout.count(h).pages,v=Math.floor(f/this.layout.pageWidth),x=[],b=Math.floor(p/this.layout.pageWidth);if(v<0&&(v=0,b=b+1),this.settings.direction==="rtl"){let S=v;v=y-b,b=y-S}for(var E=v+1;E<=b;E++){let S=E;x.push(S)}return{index:o,href:l,pages:x,totalPages:y,mapping:g}})}isVisible(e,t,r,s){var i=e.position(),a=s||this.bounds();return this.settings.axis==="horizontal"&&i.right>a.left-t&&i.left<a.right+r?!0:this.settings.axis==="vertical"&&i.bottom>a.top-t&&i.top<a.bottom+r}visible(){for(var e=this.bounds(),t=this.views.displayed(),r=t.length,s=[],i,a,o=0;o<r;o++)a=t[o],i=this.isVisible(a,0,0,e),i===!0&&s.push(a);return s}scrollBy(e,t,r){let s=this.settings.direction==="rtl"?-1:1;r&&(this.ignore=!0),this.settings.fullsize?window.scrollBy(e*s,t*s):(e&&(this.container.scrollLeft+=e*s),t&&(this.container.scrollTop+=t)),this.scrolled=!0}scrollTo(e,t,r){r&&(this.ignore=!0),this.settings.fullsize?window.scrollTo(e,t):(this.container.scrollLeft=e,this.container.scrollTop=t),this.scrolled=!0}onScroll(){let e,t;this.settings.fullsize?(e=window.scrollY,t=window.scrollX):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:(this.emit
977(ot.MANAGERS.SCROLL,{top:e,left:t}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout((function(){this.emit(ot.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}).bind(this),20))}bounds(){var e;return e=this.stage.bounds(),e}applyLayout(e){this.layout=e,this.updateLayout(),this.views&&this.views.length>0&&this.layout.name==="pre-paginated"&&this.display(this.views.first().section)}updateLayout(){this.stage&&(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta/this.layout.divisor):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(e){this.viewSettings.layout=e,this.mapping=new fN(e.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach(function(t){t&&t.setLayout(e)})}updateWritingMode(e){this.writingMode=e}updateAxis(e,t){!t&&e===this.settings.axis||(this.settings.axis=e,this.stage&&this.stage.axis(e),this.viewSettings.axis=e,this.mapping&&(this.mapping=new fN(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&(e==="vertical"?this.layout.spread("none"):this.layout.spread(this.layout.settings.spread)))}updateFlow(e,t="auto"){let r=e==="paginated"||e==="auto";this.isPaginated=r,e==="scrolled-doc"||e==="scrolled-continuous"||e==="scrolled"?this.updateAxis("vertical"):this.updateAxis("horizontal"),this.viewSettings.flow=e,this.settings.overflow?this.overflow=this.settings.overflow:this.overflow=r?"hidden":t,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}getContents(){var e=[];return this.views&&this.views.forEach(function(t){const r=t&&t.contents;r&&e.push(r)}),e}direction(e="ltr"){this.settings.direction=e,this.stage&&this.stage.direction(e),this.viewSettings.direction=e,this.updateLayout()}isRendered(){return this.rendered}}Jc(mN.prototype);const cUe=Math.PI/2,uUe={easeOutSine:function(n){return Math.sin(n*cUe)},easeInOutSine:function(n){return-.5*(Math.cos(Math.PI*n)-1)},easeInOutQuint:function(n){return(n/=.5)<1?.5*Math.pow(n,5):.5*(Math.pow(n-2,5)+2)},easeInCubic:function(n){return Math.pow(n,3)}};class GI{constructor(e,t){this.settings=ri({duration:80,minVelocity:.2,minDistance:10,easing:uUe.easeInCubic},t||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(e)}setup(e){this.manager=e,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling="touch"),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=this.settings.duration*2,this.isVertical=this.manager.settings.axis==="vertical",!(!this.manager.isPaginated||this.isVertical)&&(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}supportsTouch(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}disableScroll(){this.element.style.overflow="hidden"}enableScroll(){this.element.style.overflow=""}addListeners(){this._onResize=this.onResize.bind(this),window.addEventListener("resize",this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener("scroll",this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener("touchstart",this._onTouchStart,{passive:!0}),this.on("touchstart",this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.on("touchmove",this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener("touchend",this._onTouchEnd,{passive:!0}
977),this.on("touchend",this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(ot.MANAGERS.ADDED,this._afterDisplayed)}removeListeners(){window.removeEventListener("resize",this._onResize),this._onResize=void 0,this.scroller.removeEventListener("scroll",this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener("touchstart",this._onTouchStart,{passive:!0}),this.off("touchstart",this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener("touchmove",this._onTouchMove,{passive:!0}),this.off("touchmove",this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener("touchend",this._onTouchEnd,{passive:!0}),this.off("touchend",this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(ot.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}afterDisplayed(e){let t=e.contents;["touchstart","touchmove","touchend"].forEach(r=>{t.on(r,s=>this.triggerViewEvent(s,t))})}triggerViewEvent(e,t){this.emit(e.type,e,t)}onScroll(e){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}onResize(e){this.resizeCanceler=!0}onTouchStart(e){let{screenX:t,screenY:r}=e.touches[0];this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=t,this.startTouchY=r,this.startTime=this.now()),this.endTouchX=t,this.endTouchY=r,this.endTime=this.now()}onTouchMove(e){let{screenX:t,screenY:r}=e.touches[0],s=Math.abs(r-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&s<10&&(this.element.scrollLeft-=t-this.endTouchX),this.endTouchX=t,this.endTouchY=r,this.endTime=this.now()}onTouchEnd(e){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;let t=this.wasSwiped();t!==0?this.snap(t):this.snap(),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}wasSwiped(){let e=this.layout.pageWidth*this.layout.divisor,t=this.endTouchX-this.startTouchX,r=Math.abs(t),s=this.endTime-this.startTime,i=t/s,a=this.settings.minVelocity;if(r<=this.settings.minDistance||r>=e)return 0;if(i>a)return-1;if(i<-a)return 1}needsSnap(){let e=this.scrollLeft,t=this.layout.pageWidth*this.layout.divisor;return e%t!==0}snap(e=0){let t=this.scrollLeft,r=this.layout.pageWidth*this.layout.divisor,s=Math.round(t/r)*r;return e&&(s+=e*r),this.smoothScrollTo(s)}smoothScrollTo(e){const t=new fn,r=this.scrollLeft,s=this.now(),i=this.settings.duration,a=this.settings.easing;this.snapping=!0;function o(){const l=this.now(),u=Math.min(1,(l-s)/i);if(a(u),this.touchCanceler||this.resizeCanceler){this.resizeCanceler=!1,this.snapping=!1,t.resolve();return}u<1?(window.requestAnimationFrame(o.bind(this)),this.scrollTo(r+(e-r)*u,0)):(this.scrollTo(e,0),this.snapping=!1,t.resolve())}return o.call(this),t.promise}scrollTo(e=0,t=0){this.fullsize?window.scroll(e,t):(this.scroller.scrollLeft=e,this.scroller.scrollTop=t)}now(){return"now"in window.performance?performance.now():new Date().getTime()}destroy(){this.scroller&&(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}}Jc(GI.prototype);class dUe extends mN{constructor(e){super(e),this.name="continuous",this.settings=ri(this.settings||{},{infinite:!0,overflow:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10,allowScriptedContent:!1,allowPopups:!1}),ri(this.settings,e.settings||{}),e.settings.gap!="undefined"&&e.settings.gap===0&&(this.settings.gap=e.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,width:0,height:0,forceEvenPages:!1,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.scrollTop=0,this.scrollLeft=0}display(e,t){return mN.prototype.display.call(this,e,t).then((function(){return this.fill()}).bind(this))}fill(e){var t=e||new fn;return this.q.enqueue(()=>this.check()).then(r=>{r?this.fill(t):t.resolve()}),t.promise}moveTo(e){var t=0,r=0;this.isPaginated?(t=Math.floor(e.left/this.layout.delta)*this.layout.delta,t+this.settings.offsetDelta):(r=e.top,e.top+this.settings.offsetDelta),(t>0||r>0)&&this.scrollBy(t,r,!0)}
977afterResized(e){this.emit(ot.MANAGERS.RESIZE,e.section)}removeShownListeners(e){e.onDisplayed=function(){}}add(e){var t=this.createView(e);return this.views.append(t),t.on(ot.VIEWS.RESIZED,r=>{t.expanded=!0}),t.on(ot.VIEWS.AXIS,r=>{this.updateAxis(r)}),t.on(ot.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),t.onDisplayed=this.afterDisplayed.bind(this),t.onResize=this.afterResized.bind(this),t.display(this.request)}append(e){var t=this.createView(e);return t.on(ot.VIEWS.RESIZED,r=>{t.expanded=!0}),t.on(ot.VIEWS.AXIS,r=>{this.updateAxis(r)}),t.on(ot.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),this.views.append(t),t.onDisplayed=this.afterDisplayed.bind(this),t}prepend(e){var t=this.createView(e);return t.on(ot.VIEWS.RESIZED,r=>{this.counter(r),t.expanded=!0}),t.on(ot.VIEWS.AXIS,r=>{this.updateAxis(r)}),t.on(ot.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),this.views.prepend(t),t.onDisplayed=this.afterDisplayed.bind(this),t}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}update(e){for(var t=this.bounds(),r=this.views.all(),s=r.length,i=typeof e<"u"?e:this.settings.offset||0,a,o,l=new fn,u=[],d=0;d<s;d++)if(o=r[d],a=this.isVisible(o,i,i,t),a===!0)if(o.displayed)o.show();else{let h=o.display(this.request).then(function(f){f.show()},f=>{o.hide()});u.push(h)}else this.q.enqueue(o.destroy.bind(o)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout((function(){this.q.enqueue(this.trim.bind(this))}).bind(this),250);return u.length?Promise.all(u).catch(h=>{l.reject(h)}):(l.resolve(),l.promise)}check(e,t){var r=new fn,s=[],i=this.settings.axis==="horizontal",a=this.settings.offset||0;e&&i&&(a=e),t&&!i&&(a=t);var o=this._bounds;let l=i?this.scrollLeft:this.scrollTop,u=i?Math.floor(o.width):o.height,d=i?this.container.scrollWidth:this.container.scrollHeight,h=this.writingMode&&this.writingMode.indexOf("vertical")===0?"vertical":"horizontal",f=this.settings.rtlScrollType,p=this.settings.direction==="rtl";this.settings.fullsize?(i&&p&&f==="negative"||!i&&p&&f==="default")&&(l=l*-1):(p&&f==="default"&&h==="horizontal"&&(l=d-u-l),p&&f==="negative"&&h==="horizontal"&&(l=l*-1));let m=()=>{let b=this.views.first(),E=b&&b.section.prev();E&&s.push(this.prepend(E))},g=()=>{let b=this.views.last(),E=b&&b.section.next();E&&s.push(this.append(E))},y=l+u+a,v=l-a;y>=d&&g(),v<0&&m();let x=s.map(b=>b.display(this.request));return s.length?Promise.all(x).then(()=>this.check()).then(()=>this.update(a),b=>b):(this.q.enqueue((function(){this.update()}).bind(this)),r.resolve(!1),r.promise)}trim(){for(var e=new fn,t=this.views.displayed(),r=t[0],s=t[t.length-1],i=this.views.indexOf(r),a=this.views.indexOf(s),o=this.views.slice(0,i),l=this.views.slice(a+1),u=0;u<o.length-1;u++)this.erase(o[u],o);for(var d=1;d<l.length;d++)this.erase(l[d]);return e.resolve(),e.promise}erase(e,t){var r,s;this.settings.fullsize?(r=window.scrollY,s=window.scrollX):(r=this.container.scrollTop,s=this.container.scrollLeft);var i=e.bounds();this.views.remove(e),t&&(this.settings.axis==="vertical"?this.scrollTo(0,r-i.height,!0):this.settings.direction==="rtl"?this.settings.fullsize?this.scrollTo(s+Math.floor(i.width),0,!0):this.scrollTo(s,0,!0):this.scrollTo(s-Math.floor(i.width),0,!0))}addEventListeners(e){window.addEventListener("unload",(function(t){this.ignore=!0,this.destroy()}).bind(this)),this.addScrollListeners(),this.isPaginated&&this.settings.snap&&(this.snapper=new GI(this,this.settings.snap&&typeof this.settings.snap=="object"&&this.settings.snap))}addScrollListeners(){var e;this.tick=BB;let t=this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"?-1:1;this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.fullsize?(e=window,this.scrollTop=window.scrollY*t,this.scrollLeft=window.scrollX*t):(e=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft),this._onScroll=this.onScroll.bind(this),e.addEventListener("scroll",this._onScroll),this._scrolled=eUe(this.scrolled.bind(this),30),this.didScroll=!1}removeEventListeners(){var e;this.settings.fullsize?e=window:e=this.container,e.removeEventListener("scroll",this._onScroll),this._onScroll=void 0}onScroll(){let e,t,r=this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"?-1:1;this.settings.fullsize?(e=window.scrollY*r,t=window.scrollX*r):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:this._scrolled(),this.scrollDeltaVert+=Math.abs(e-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(t-this.prevScrollLeft),this.prevScrollTop=e,this.prevScrollLeft=t,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout((function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}).bind(this),150),clearTimeout(this.afterScrolled),this.didScroll=!1}scrolled(){this.q.enqueue((function(){return this.check()}
977).bind(this)),this.emit(ot.MANAGERS.SCROLL,{top:this.scrollTop,left:this.scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout((function(){this.snapper&&this.snapper.supportsTouch&&this.snapper.needsSnap()||this.emit(ot.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}).bind(this),this.settings.afterScrolledTimeout)}next(){let e=this.layout.props.name==="pre-paginated"&&this.layout.props.spread?this.layout.props.delta*2:this.layout.props.delta;this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"?this.scrollBy(e,0,!0):this.scrollBy(0,this.layout.height,!0),this.q.enqueue((function(){return this.check()}).bind(this)))}prev(){let e=this.layout.props.name==="pre-paginated"&&this.layout.props.spread?this.layout.props.delta*2:this.layout.props.delta;this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"?this.scrollBy(-e,0,!0):this.scrollBy(0,-this.layout.height,!0),this.q.enqueue((function(){return this.check()}).bind(this)))}updateFlow(e){this.rendered&&this.snapper&&(this.snapper.destroy(),this.snapper=void 0),super.updateFlow(e,"scroll"),this.rendered&&this.isPaginated&&this.settings.snap&&(this.snapper=new GI(this,this.settings.snap&&typeof this.settings.snap=="object"&&this.settings.snap))}destroy(){super.destroy(),this.snapper&&this.snapper.destroy()}}class qB{constructor(e,t){this.settings=ri(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1,defaultDirection:"ltr",allowScriptedContent:!1,allowPopups:!1}),ri(this.settings,t),typeof this.settings.manager=="object"&&(this.manager=this.settings.manager),this.book=e,this.hooks={},this.hooks.display=new Dl(this),this.hooks.serialize=new Dl(this),this.hooks.content=new Dl(this),this.hooks.unloaded=new Dl(this),this.hooks.layout=new Dl(this),this.hooks.render=new Dl(this),this.hooks.show=new Dl(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new z6e(this),this.annotations=new V6e(this),this.epubcfi=new pn,this.q=new UB(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new fn,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(e){this.manager=e}requireManager(e){var t;return typeof e=="string"&&e==="default"?t=mN:typeof e=="string"&&e==="continuous"?t=dUe:t=e,t}requireView(e){var t;return typeof e=="string"&&e==="iframe"?t=Hae:t=e,t}start(){switch(!this.settings.layout&&(this.book.package.metadata.layout==="pre-paginated"||this.book.displayOptions.fixedLayout==="true")&&(this.settings.layout="pre-paginated"),this.book.package.metadata.spread){case"none":this.settings.spread="none";break;case"both":this.settings.spread=!0;break}this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.direction(this.book.package.metadata.direction||this.settings.defaultDirection),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(ot.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(ot.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(ot.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(ot.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(ot.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(ot.RENDITION.STARTED),this.starting.resolve()}attachTo(e){return this.q.enqueue((function(){this.manager.render(e,{width:this.settings.width,height:this.settings.height}
977),this.emit(ot.RENDITION.ATTACHED)}).bind(this))}display(e){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,e)}_display(e){if(this.book){this.epubcfi.isCfiString(e);var t=new fn,r=t.promise,s;return this.displaying=t,this.book.locations.length()&&_ae(e)&&(e=this.book.locations.cfiFromPercentage(parseFloat(e))),s=this.book.spine.get(e),s?(this.manager.display(s,e).then(()=>{t.resolve(s),this.displaying=void 0,this.emit(ot.RENDITION.DISPLAYED,s),this.reportLocation()},i=>{this.emit(ot.RENDITION.DISPLAY_ERROR,i)}),r):(t.reject(new Error("No Section Found")),r)}}afterDisplayed(e){e.on(ot.VIEWS.MARK_CLICKED,(t,r)=>this.triggerMarkEvent(t,r,e.contents)),this.hooks.render.trigger(e,this).then(()=>{e.contents?this.hooks.content.trigger(e.contents,this).then(()=>{this.emit(ot.RENDITION.RENDERED,e.section,e)}):this.emit(ot.RENDITION.RENDERED,e.section,e)})}afterRemoved(e){this.hooks.unloaded.trigger(e,this).then(()=>{this.emit(ot.RENDITION.REMOVED,e.section,e)})}onResized(e,t){this.emit(ot.RENDITION.RESIZED,{width:e.width,height:e.height},t),this.location&&this.location.start&&this.display(t||this.location.start.cfi)}onOrientationChange(e){this.emit(ot.RENDITION.ORIENTATION_CHANGE,e)}moveTo(e){this.manager.moveTo(e)}resize(e,t,r){e&&(this.settings.width=e),t&&(this.settings.height=t),this.manager.resize(e,t,r)}clear(){this.manager.clear()}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(e){var t,r=this.settings.layout||e.layout||"reflowable",s=this.settings.spread||e.spread||"auto",i=this.settings.orientation||e.orientation||"auto",a=this.settings.flow||e.flow||"auto",o=e.viewport||"",l=this.settings.minSpreadWidth||e.minSpreadWidth||800,u=this.settings.direction||e.direction||"ltr";return(this.settings.width===0||this.settings.width>0)&&(this.settings.height===0||this.settings.height>0),t={layout:r,spread:s,orientation:i,flow:a,viewport:o,minSpreadWidth:l,direction:u},t}flow(e){var t=e;(e==="scrolled"||e==="scrolled-doc"||e==="scrolled-continuous")&&(t="scrolled"),(e==="auto"||e==="paginated")&&(t="paginated"),this.settings.flow=e,this._layout&&this._layout.flow(t),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(t),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}layout(e){return e&&(this._layout=new Oae(e),this._layout.spread(e.spread,this.settings.minSpreadWidth),this._layout.on(ot.LAYOUT.UPDATED,(t,r)=>{this.emit(ot.RENDITION.LAYOUT,t,r)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(e,t){this.settings.spread=e,t&&(this.settings.minSpreadWidth=t),this._layout&&this._layout.spread(e,t),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}direction(e){this.settings.direction=e||"ltr",this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}reportLocation(){return this.q.enqueue((function(){requestAnimationFrame((function(){var r=this.manager.currentLocation();if(r&&r.then&&typeof r.then=="function")r.then((function(s){let i=this.located(s);!i||!i.start||!i.end||(this.location=i,this.emit(ot.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(ot.RENDITION.RELOCATED,this.location))}).bind(this));else if(r){let s=this.located(r);if(!s||!s.start||!s.end)return;this.location=s,this.emit(ot.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(ot.RENDITION.RELOCATED,this.location)}}).bind(this))}).bind(this))}currentLocation(){var e=this.manager.currentLocation();if(e&&e.then&&typeof e.then=="function")e.then((function(t){return this.located(t)}).bind(this));else if(e)return this.located(e)}located(e){if(!e.length)return{};let t=e[0],r=e[e.length-1],s={start:{index:t.index,href:t.href,cfi:t.mapping.start,displayed:{page:t.pages[0]||1,total:t.totalPages}},end:{index:r.index,href:r.href,cfi:r.mapping.end,displayed:{page:r.pages[r.pages.length-1]||1,total:r.totalPages}}},i=this.book.locations.locationFromCfi(t.mapping.start),a=this.book.locations.locationFromCfi(r.mapping.end);i!=null&&(s.start.location=i,s.start.percentage=this.book.locations.percentageFromLocation(i)),a!=null&&(s.end.location=a,s.end.percentage=this.book.locations.percentageFromLocation(a));let o=this.book.pageList.pageFromCfi(t.mapping.start),l=this.book.pageList.pageFromCfi(r.mapping.end);
vendor: 14,403 bytes, lines 977-988
977return o!=-1&&(s.start.page=o),l!=-1&&(s.end.page=l),r.index===this.book.spine.last().index&&s.end.displayed.page>=s.end.displayed.total&&(s.atEnd=!0),t.index===this.book.spine.first().index&&s.start.displayed.page===1&&(s.atStart=!0),s}destroy(){this.manager&&this.manager.destroy(),this.book=void 0}passEvents(e){bC.forEach(t=>{e.on(t,r=>this.triggerViewEvent(r,e))}),e.on(ot.CONTENTS.SELECTED,t=>this.triggerSelectedEvent(t,e))}triggerViewEvent(e,t){this.emit(e.type,e,t)}triggerSelectedEvent(e,t){this.emit(ot.RENDITION.SELECTED,e,t)}triggerMarkEvent(e,t,r){this.emit(ot.RENDITION.MARK_CLICKED,e,t,r)}getRange(e,t){var r=new pn(e),s=this.manager.visible().filter(function(i){if(r.spinePos===i.index)return!0});if(s.length)return s[0].contents.range(r,t)}adjustImages(e){if(this._layout.name==="pre-paginated")return new Promise(function(i){i()});let t=e.window.getComputedStyle(e.content,null),r=(e.content.offsetHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)))*.95,s=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight);return e.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-s+"px":"100%")+"!important","max-height":r+"px!important","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-s+"px":"100%")+"!important","max-height":r+"px!important","page-break-inside":"avoid","break-inside":"avoid"}}),new Promise(function(i,a){setTimeout(function(){i()},1)})}getContents(){return this.manager?this.manager.getContents():[]}views(){return(this.manager?this.manager.views:void 0)||[]}handleLinks(e){e&&e.on(ot.CONTENTS.LINK_CLICKED,t=>{let r=this.book.path.relative(t);this.display(r)})}injectStylesheet(e,t){let r=e.createElement("link");r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",this.settings.stylesheet),e.getElementsByTagName("head")[0].appendChild(r)}injectScript(e,t){let r=e.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("src",this.settings.script),r.textContent=" ",e.getElementsByTagName("head")[0].appendChild(r)}injectIdentifier(e,t){let r=this.book.packaging.metadata.identifier,s=e.createElement("meta");s.setAttribute("name","dc.relation.ispartof"),r&&s.setAttribute("content",r),e.getElementsByTagName("head")[0].appendChild(s)}}Jc(qB.prototype);function Oo(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Yae={exports:{}};/*!
978
979JSZip v3.10.1 - A JavaScript class for generating and reading zip files
980<http://stuartk.com/jszip>
981
982(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
983Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
984
985JSZip uses the library pako released under the MIT license :
986https://github.com/nodeca/pako/blob/main/LICENSE
987*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,s,i){function a(u,d){if(!s[u]){if(!r[u]){var h=typeof Oo=="function"&&Oo;if(!d&&h)return h(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};r[u][0].call(p.exports,function(m){var g=r[u][1][m];return a(g||m)},p,p.exports,t,r,s,i)}return s[u].exports}for(var o=typeof Oo=="function"&&Oo,l=0;l<i.length;l++)a(i[l]);return a}({1:[function(t,r,s){var i=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var u=[],d,h,f,p,m,g,y,v=0,x=l.length,b=x,E=i.getTypeOf(l)!=="string";v<l.length;)b=x-v,E?(d=l[v++],h=v<x?l[v++]:0,f=v<x?l[v++]:0):(d=l.charCodeAt(v++),h=v<x?l.charCodeAt(v++):0,f=v<x?l.charCodeAt(v++):0),p=d>>2,m=(d&3)<<4|h>>4,g=b>1?(h&15)<<2|f>>6:64,y=b>2?f&63:64,u.push(o.charAt(p)+o.charAt(m)+o.charAt(g)+o.charAt(y));return u.join("")},s.decode=function(l){var u,d,h,f,p,m,g,y=0,v=0,x="data:";if(l.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");l=l.replace(/[^A-Za-z0-9+/=]/g,"");var b=l.length*3/4;if(l.charAt(l.length-1)===o.charAt(64)&&b--,l.charAt(l.length-2)===o.charAt(64)&&b--,b%1!==0)throw new Error("Invalid base64 input, bad content length.");var E;for(a.uint8array?E=new Uint8Array(b|0):E=new Array(b|0);y<l.length;)f=o.indexOf(l.charAt(y++)),p=o.indexOf(l.charAt(y++)),m=o.indexOf(l.charAt(y++)),g=o.indexOf(l.charAt(y++)),u=f<<2|p>>4,d=(p&15)<<4|m>>2,h=(m&3)<<6|g,E[v++]=u,m!==64&&(E[v++]=d),g!==64&&(E[v++]=h);return E}},{"./support":30,"./utils":32}],2:[function(t,r,s){var i=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function u(d,h,f,p,m){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("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 a(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 o).pipe(new l("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,s){var i=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,s){var i=t("./utils");function a(){for(var d,h=[],f=0;f<256;f++){d=f;for(var p=0;p<8;p++)d=d&1?3988292384^d>>>1:d>>>1;h[f]=d}return h}var o=a();function l(d,h,f,p){var m=o,g=p+f;d=d^-1;for(var y=p;y<g;y++)d=d>>>8^m[(d^h[y])&255];return d^-1}function u(d,h,f,p){var m=o,g=p+f;d=d^-1;for(var y=p;y<g;y++)d=d>>>8^m[(d^h.charCodeAt(y))&255];return d^-1}r.exports=function(h,f){if(typeof h>"u"||!h.length)return 0;var p=i.getTypeOf(h)!=="string";return p?l(f|0,h,h.length,0):u(f|0,h,h.length,0)}},{"./utils":32}],5:[function(t,r,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(t,r,s){var i=null;typeof Promise<"u"?i=Promise:i=t("lie"),r.exports={Promise:i}},{lie:37}],7:[function(t,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),u=i?"uint8array":"array";s.magic="\b\0";function d(h,f){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}o.inherits(d,l),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,h.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[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(t,r,s){var i=t("../utils"),a=t("../stream/GenericWorker"),o=t("../utf8"),l=t("../crc32"),u=t("../signature"),d=function(v,x){var b="",E;for(E=0;E<x;E++)b+=String.fromCharCode(v&255),v=v>>>8;return b},h=function(v,x){var b=v;return v||(b=x?16893:33204),(b&65535)<<16},f=function(v){return(v||0)&63},p=function(v,x,b,E,S,k){var C=v.file,A=v.compression,T=k!==o.utf8encode,j=i.transformTo("string",k(C.name)),D=i.transformTo("string",o.utf8encode(C.name)),R=C.comment,M=i.transformTo("string",k(R)),N=i.transformTo("string",o.utf8encode(R)),U=D.length!==C.name.length,q=N.length!==R.length,I,B,$="",ie="",ne="",L=C.dir,te=C.date,ae={crc32:0,compressedSize:0,uncompressedSize:0};(!x||b)&&(ae.crc32=v.crc32,ae.compressedSize=v.compressedSize,ae.uncompressedSize=v.uncompressedSize);var de=0;x&&(de|=8),!T&&(U||q)&&(de|=2048);var ue=0,le=0;L&&(ue|=16),S==="UNIX"?(le=798,ue|=h(C.unixPermissions,L)):(le=20,ue|=f(C.dosPermissions)),I=te.getUTCHours(),I=I<<6,I=I|te.getUTCMinutes(),I=I<<5,I=I|te.getUTCSeconds()/2,B=te.getUTCFullYear()-1980,B=B<<4,B=B|te.getUTCMonth()+1,B=B<<5,B=B|te.getUTCDate(),U&&(ie=d(1,1)+d(l(j),4)+D,$+="up"+d(ie.length,2)+ie),q&&(ne=d(1,1)+d(l(M),4)+N,$+="uc"+d(ne.length,2)+ne);var ve="";ve+=`
988\0`,ve+=d(de,2),ve+=A.magic,ve+=d(I,2),ve+=d(B,2),ve+=d(ae.crc32,4),ve+=d(ae.compressedSize,4),ve+=d(ae.uncompressedSize,4),ve+=d(j.length,2),ve+=d($.length,2);var _e=u.LOCAL_FILE_HEADER+ve+j+$,Ne=u.CENTRAL_FILE_HEADER+d(le,2)+ve+d(M.length,2)+"\0\0\0\0"+d(ue,4)+d(E,4)+j+$+M;return{fileRecord:_e,dirRecord:Ne}},m=function(v,x,b,E,S){var k="",C=i.transformTo("string",S(E));return k=u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+d(v,2)+d(v,2)+d(x,4)+d(b,4)+d(C.length,2)+C,k},g=function(v){var x="";return x=u.DATA_DESCRIPTOR+d(v.crc32,4)+d(v.compressedSize,4)+d(v.uncompressedSize,4),x};function y(v,x,b,E){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=b,this.encodeFileName=E,this.streamFiles=v,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(y,a),y.prototype.push=function(v){var x=v.meta.percent||0,b=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(v):(this.bytesWritten+=v.data.length,a.prototype.push.call(this,{data:v.data,meta:{currentFile:this.currentFile,percent:b?(x+100*(b-E-1))/b:100}}))},y.prototype.openedSource=function(v){this.currentSourceOffset=this.bytesWritten,this.currentFile=v.file.name;var x=this.streamFiles&&!v.file.dir;if(x){var b=p(v,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:b.fileRecord,meta:{percent:0}})}else this.accumulate=!0},y.prototype.closedSource=function(v){this.accumulate=!1;var x=this.streamFiles&&!v.file.dir,b=p(v,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(b.dirRecord),x)this.push({data:g(v),meta:{percent:100}});else for(this.push({data:b.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},y.prototype.flush=function(){for(var v=this.bytesWritten,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var b=this.bytesWritten-v,E=m(this.dirRecords.length,b,v,this.zipComment,this.encodeFileName);this.push({data:E,meta:{percent:100}})},y.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},y.prototype.registerPrevious=function(v){this._sources.push(v);var x=this;return v.on("data",function(b){x.processChunk(b)}),v.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),v.on("error",function(b){x.error(b)}),this},y.prototype.resume=function(){if(!a.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0},y.prototype.error=function(v){var x=this._sources;if(!a.prototype.error.call(this,v))return!1;for(var b=0;b<x.length;b++)try{x[b].error(v)}catch{}return!0},y.prototype.lock=function(){a.prototype.lock.call(this);for(var v=this._sources,x=0;x<v.length;x++)v[x].lock()},r.exports=y},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,r,s){var i=t("../compressions"),a=t("./ZipFileWorker"),o=function(l,u){var d=l||u,h=i[d];if(!h)throw new Error(d+" is not a valid compression method !");return h};s.generateWorker=function(l,u,d){var h=new a(u.streamFiles,d,u.platform,u.encodeFileName),f=0;try{l.forEach(function(p,m){f++;var g=o(m.options.compression,u.compression),y=m.options.compressionOptions||u.compressionOptions||{},v=m.dir,x=m.date;m._compressWorker(g,y).withStreamInfo("file",{name:p,dir:v,date:x,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(h)}),h.entriesCount=f}catch(p){h.error(p)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,r,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 a=new i;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}i.prototype=t("./object"),i.prototype.loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.10.1",i.loadAsync=function(a,o){return new i().loadAsync(a,o)},i.external=t("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,r,s){var i=t("./utils"),a=t("./external"),o=t("./utf8"),l=t("./zipEntries"),u=t("./stream/Crc32Probe"),d=t("./nodejsUtils");function h(f){return new a.Promise(function(p,m){var g=f.decompressed.getContentWorker().pipe(new u);g.on("error",function(y){m(y)}).on("end",function(){g.streamInfo.crc32!==f.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(f,p){var m=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),d.isNode&&d.isStream(f)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip f
988ile",f,!0,p.optimizedBinaryString,p.base64).then(function(g){var y=new l(p);return y.load(g),y}).then(function(y){var v=[a.Promise.resolve(y)],x=y.files;if(p.checkCRC32)for(var b=0;b<x.length;b++)v.push(h(x[b]));return a.Promise.all(v)}).then(function(y){for(var v=y.shift(),x=v.files,b=0;b<x.length;b++){var E=x[b],S=E.fileNameStr,k=i.resolve(E.fileNameStr);m.file(k,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:p.createFolders}),E.dir||(m.file(k).unsafeOriginalName=S)}return v.zipComment.length&&(m.comment=v.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,r,s){var i=t("../utils"),a=t("../stream/GenericWorker");function o(l,u){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(o,a),o.prototype._bindStream=function(l){var u=this;this._stream=l,l.pause(),l.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()})},o.prototype.pause=function(){return a.prototype.pause.call(this)?(this._stream.pause(),!0):!1},o.prototype.resume=function(){return a.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,r,s){var i=t("readable-stream").Readable,a=t("../utils");a.inherits(o,i);function o(l,u,d){i.call(this,u),this._helper=l;var h=this;l.on("data",function(f,p){h.push(f)||h._helper.pause(),d&&d(p)}).on("error",function(f){h.emit("error",f)}).on("end",function(){h.push(null)})}o.prototype._read=function(){this._helper.resume()},r.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,r,s){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,a);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,a)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var a=new Buffer(i);return a.fill(0),a},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(t,r,s){var i=t("./utf8"),a=t("./utils"),o=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),u=t("./defaults"),d=t("./compressedObject"),h=t("./zipObject"),f=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),g=function(S,k,C){var A=a.getTypeOf(k),T,j=a.extend(C||{},u);j.date=j.date||new Date,j.compression!==null&&(j.compression=j.compression.toUpperCase()),typeof j.unixPermissions=="string"&&(j.unixPermissions=parseInt(j.unixPermissions,8)),j.unixPermissions&&j.unixPermissions&16384&&(j.dir=!0),j.dosPermissions&&j.dosPermissions&16&&(j.dir=!0),j.dir&&(S=v(S)),j.createFolders&&(T=y(S))&&x.call(this,T,!0);var D=A==="string"&&j.binary===!1&&j.base64===!1;(!C||typeof C.binary>"u")&&(j.binary=!D);var R=k instanceof d&&k.uncompressedSize===0;(R||j.dir||!k||k.length===0)&&(j.base64=!1,j.binary=!0,k="",j.compression="STORE",A="string");var M=null;k instanceof d||k instanceof o?M=k:p.isNode&&p.isStream(k)?M=new m(S,k):M=a.prepareContent(S,k,j.binary,j.optimizedBinaryString,j.base64);var N=new h(S,M,j);this.files[S]=N},y=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var k=S.lastIndexOf("/");return k>0?S.substring(0,k):""},v=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},x=function(S,k){return k=typeof k<"u"?k:u.createFolders,S=v(S),this.files[S]||g.call(this,S,null,{dir:!0,createFolders:k}),this.files[S]};function b(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var k,C,A;for(k in this.files)A=this.files[k],C=k.slice(this.root.length,k.length),C&&k.slice(0,this.root.length)===this.root&&S(C,A)},filter:function(S){var k=[];return this.forEach(function(C,A){S(C,A)&&k.push(A)}),k},file:function(S,k,C){if(arguments.length===1)if(b(S)){var A=S;return this.filter(function(j,D){return!D.dir&&A.test(j)})}else{var T=this.files[this.root+S];return T&&!T.dir?T:null}else S=this.root+S,g.call(this,S,k,C);return this},folder:function(S){if(!S)return this;if(b(S))return this.filter(function(T,j){return j.dir&&S.test(T)});var k=this.root+S,C=x.call(this,k),A=this.clone();return A.root=C.name,A},remove:function(S){S=this.root+S;var k=this.files[S];if(k||(S.slice(-1)!=="/"&&(S+="/"),k=this.files[S]),k&&!k.dir)delete this.files[S];else for(var C=this.filter(function(T,j){return j.name.slice(0,S.length)===S}),A=0;A<C.length;A++)delete this.files[C[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")}
vendor: 22,240 bytes, line 988
988,generateInternalStream:function(S){var k,C={};try{if(C=a.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode}),C.type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");a.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 A=C.comment||this.comment||"";k=f.generateWorker(this,C,A)}catch(T){k=new o("error"),k.error(T)}return new l(k,C.type||"string",C.mimeType)},generateAsync:function(S,k){return this.generateInternalStream(S).accumulate(k)},generateNodeStream:function(S,k){return S=S||{},S.type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(k)}};r.exports=E},{"./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(t,r,s){r.exports=t("stream")},{stream:void 0}],17:[function(t,r,s){var i=t("./DataReader"),a=t("../utils");function o(l){i.call(this,l);for(var u=0;u<this.data.length;u++)l[u]=l[u]&255}a.inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var u=l.charCodeAt(0),d=l.charCodeAt(1),h=l.charCodeAt(2),f=l.charCodeAt(3),p=this.length-4;p>=0;--p)if(this.data[p]===u&&this.data[p+1]===d&&this.data[p+2]===h&&this.data[p+3]===f)return p-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var u=l.charCodeAt(0),d=l.charCodeAt(1),h=l.charCodeAt(2),f=l.charCodeAt(3),p=this.readData(4);return u===p[0]&&d===p[1]&&h===p[2]&&f===p[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,u},r.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,r,s){var i=t("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l=0,u;for(this.checkOffset(o),u=this.index+o-1;u>=this.index;u--)l=(l<<8)+this.byteAt(u);return this.index+=o,l},readString:function(o){return i.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC((o>>25&127)+1980,(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(o&31)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,s){var i=t("./Uint8ArrayReader"),a=t("../utils");function o(l){i.call(this,l)}a.inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var u=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,u},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,s){var i=t("./DataReader"),a=t("../utils");function o(l){i.call(this,l)}a.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){var u=this.readData(4);return l===u},o.prototype.readData=function(l){this.checkOffset(l);var u=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,u},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,s){var i=t("./ArrayReader"),a=t("../utils");function o(l){i.call(this,l)}a.inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,u},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,s){var i=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),u=t("./NodeBufferReader"),d=t("./Uint8ArrayReader");r.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f==="string"&&!a.uint8array?new l(h):f==="nodebuffer"?new u(h):a.uint8array?new d(i.transformTo("uint8array",h)):new o(i.transformTo("array",h))}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,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(t,r,s){var i=t("./GenericWorker"),a=t("../utils");function o(l){i.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,i),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,s){var i=t("./GenericWorker"),a=t("../crc32"),o=t("../utils");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o.inherits(l,i),l.prototype.processChunk=function(u){this.streamInfo.crc32=a(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,s){var i=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(o,a),o.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,s){var i=t("../utils"),a=t("./GenericWorker"),o=16*1024;function l(u){a.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(h){d.dataIsReady=!0,d.data=h,d.max=h&&h.length||0,d.type=i.getTypeOf(h),d.isPaused||d._tickAndRepeat()},function(h){d.error(h)})}i.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return a.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0):!1},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 u=o,d=null,h=Math.min(this.max,this.index+u);if(this.index>=this.max)return this.end();switch(this.type){case"string":d=this.data.substring(this.index,h);break;case"uint8array":d=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":d=this.data.slice(this.index,h);break}return this.index=h,this.push({data:d,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,s){function i(a){this.name=a||"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(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return this.isFinished?!1:(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(l){o.processChunk(l)}),a.on("end",function(){o.end()}),a.on("error",function(l){o.error(l)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var a=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},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 a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=i},{}],29:[function(t,r,s){var i=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),u=t("../support"),d=t("../external"),h=null;if(u.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(y,v,x){switch(y){case"blob":return i.newBlob(i.transformTo("arraybuffer",v),x);case"base64":return l.encode(v);default:return i.transformTo(y,v)}}function p(y,v){var x,b=0,E=null,S=0;for(x=0;x<v.length;x++)S+=v[x].length;switch(y){case"string":return v.join("");case"array":return Array.prototype.concat.apply([],v);case"uint8array":for(E=new Uint8Array(S),x=0;x<v.length;x++)E.set(v[x],b),b+=v[x].length;return E;case"nodebuffer":return Buffer.concat(v);default:throw new Error("concat : unsupported type '"+y+"'")}}function m(y,v){return new d.Promise(function(x,b){var E=[],S=y._internalType,k=y._outputType,C=y._mimeType;y.on("data",function(A,T){E.push(A),v&&v(T)}).on("error",function(A){E=[],b(A)}).on("end",function(){try{var A=f(k,p(S,E),C);x(A)}catch(T){b(T)}E=[]}).resume()})}function g(y,v,x){var b=v;switch(v){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string";break}try{this._internalType=b,this._outputType=v,this._mimeType=x,i.checkSupport(b),this._worker=y.pipe(new a(b)),y.lock()}catch(E){this._worker=new o("error"),this._worker.error(E)}}g.prototype={accumulate:function(y){return m(this,y)},on:function(y,v){var x=this;return y==="data"?this._worker.on(y,function(b){v.call(x,b.data,b.meta)}):this._worker.on(y,function(){i.delay(v,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){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"},y)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,r,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 a=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,o=new a;o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,s){for(var i=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=d>=252?6:d>=248?5:d>=240?4:d>=224?3:d>=192?2:1;u[254]=u[254]=1;var h=function(y){var v,x,b,E,S,k=y.length,C=0;for(E=0;E<k;E++)x=y.charCodeAt(E),(x&64512)===55296&&E+1<k&&(b=y.charCodeAt(E+1),(b&64512)===56320&&(x=65536+(x-55296<<10)+(b-56320),E++)),C+=x<128?1:x<2048?2:x<65536?3:4;for(a.uint8array?v=new Uint8Array(C):v=new Array(C),S=0,E=0;S<C;E++)x=y.charCodeAt(E),(x&64512)===55296&&E+1<k&&(b=y.charCodeAt(E+1),(b&64512)===56320&&(x=65536+(x-55296<<10)+(b-56320),E++)),x<128?v[S++]=x:x<2048?(v[S++]=192|x>>>6,v[S++]=128|x&63):x<65536?(v[S++]=224|x>>>12,v[S++]=128|x>>>6&63,v[S++]=128|x&63):(v[S++]=240|x>>>18,v[S++]=128|x>>>12&63,v[S++]=128|x>>>6&63,v[S++]=128|x&63);return v},f=function(y,v){var x;for(v=v||y.length,v>y.length&&(v=y.length),x=v-1;x>=0&&(y[x]&192)===128;)x--;return x<0||x===0?v:x+u[y[x]]>v?x:v},p=function(y){var v,x,b,E,S=y.length,k=new Array(S*2);for(x=0,v=0;v<S;){if(b=y[v++],b<128){k[x++]=b;continue}if(E=u[b],E>4){k[x++]=65533,v+=E-1;continue}for(b&=E===2?31:E===3?15:7;E>1&&v<S;)b=b<<6|y[v++]&63,E--;if(E>1){k[x++]=65533;continue}b<65536?k[x++]=b:(b-=65536,k[x++]=55296|b>>10&1023,k[x++]=56320|b&1023)}return k.length!==x&&(k.subarray?k=k.subarray(0,x):k.length=x),i.applyFromCharCode(k)};s.utf8encode=function(v){return a.nodebuffer?o.newBufferFrom(v,"utf-8"):h(v)},s.utf8decode=function(v){return a.nodebuffer?i.transformTo("nodebuffer",v).toString("utf-8"):(v=i.transformTo(a.uint8array?"uint8array":"array",v),p(v))};function m(){l.call(this,"utf-8 decode"),this.leftOver=null}i.inherits(m,l),m.prototype.processChunk=function(y){var v=i.transformTo(a.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var x=v;v=new Uint8Array(x.length+this.leftOver.length),v.set(this.leftOver,0),v.set(x,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var b=f(v),E=v;b!==v.length&&(a.uint8array?(E=v.subarray(0,b),this.leftOver=v.subarray(b,v.length)):(E=v.slice(0,b),this.leftOver=v.slice(b,v.length))),this.push({data:s.utf8decode(E),meta:y.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=m;function g(){l.call(this,"utf-8 encode")}i.inherits(g,l),g.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,s){var i=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");t("setimmediate");function u(y){var v=null;return i.uint8array?v=new Uint8Array(y.length):v=new Array(y.length),h(y,v)}s.newBlob=function(y,v){s.checkSupport("blob");try{return new Blob([y],{type:v})}catch{try{var x=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,b=new x;return b.append(y),b.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};function d(y){return y}function h(y,v){for(var x=0;x<y.length;++x)v[x]=y.charCodeAt(x)&255;return v}var f={stringifyByChunk:function(y,v,x){var b=[],E=0,S=y.length;if(S<=x)return String.fromCharCode.apply(null,y);for(;E<S;)v==="array"||v==="nodebuffer"?b.push(String.fromCharCode.apply(null,y.slice(E,Math.min(E+x,S)))):b.push(String.fromCharCode.apply(null,y.subarray(E,Math.min(E+x,S)))),E+=x;return b.join("")},stringifyByChar:function(y){for(var v="",x=0;x<y.length;x++)v+=String.fromCharCode(y[x]);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,o.allocBuffer(1)).length===1}catch{return!1}}()}};function p(y){var v=65536,x=s.getTypeOf(y),b=!0;if(x==="uint8array"?b=f.applyCanBeUsed.uint8array:x==="nodebuffer"&&(b=f.applyCanBeUsed.nodebuffer),b)for(;v>1;)try{return f.stringifyByChunk(y,x,v)}catch{v=Math.floor(v/2)}return f.stringifyByChar(y)}s.applyFromCharCode=p;function m(y,v){for(var x=0;x<y.length;x++)v[x]=y[x];return v}var g={};g.string={string:d,array:function(y){return h(y,new Array(y.length))},arraybuffer:function(y){return g.string.uint8array(y).buffer},uint8array:function(y){return h(y,new Uint8Array(y.length))},nodebuffer:function(y){return h(y,o.allocBuffer(y.length))}},g.array={string:p,array:d,arraybuffer:function(y){return new Uint8Array(y).buffer},uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return o.newBufferFrom(y)}},g.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return m(new Uint8Array(y),new Array(y.byteLength))},arraybuffer:d,uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return o.newBufferFrom(new Uint8Array(y))}},g.uint8array={string:p,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:d,nodebuffer:function(y){return o.newBufferFrom(y)}},g.nodebuffer={string:p,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return g.nodebuffer.uint8array(y).buffer},uint8array:function(y){return m(y,new Uint8Array(y.length))},nodebuffer:d},s.transformTo=function(y,v){if(v||(v=""),!y)return v;s.checkSupport(y);var x=s.getTypeOf(v),b=g[x][y](v);return b},s.resolve=function(y){for(var v=y.split("/"),x=[],b=0;b<v.length;b++){var E=v[b];E==="."||E===""&&b!==0&&b!==v.length-1||(E===".."?x.pop():x.push(E))}return x.join("/")},s.getTypeOf=function(y){if(typeof y=="string")return"string";if(Object.prototype.toString.call(y)==="[object Array]")return"array";if(i.nodebuffer&&o.isBuffer(y))return"nodebuffer";if(i.uint8array&&y instanceof Uint8Array)return"uint8array";if(i.arraybuffer&&y instanceof ArrayBuffer)return"arraybuffer"},s.checkSupport=function(y){var v=i[y.toLowerCase()];if(!v)throw new Error(y+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(y){var v="",x,b;for(b=0;b<(y||"").length;b++)x=y.charCodeAt(b),v+="\\x"+(x<16?"0":"")+x.toString(16).toUpperCase();return v},s.delay=function(y,v,x){setImmediate(function(){y.apply(x||null,v||[])})},s.inherits=function(y,v){var x=function(){};x.prototype=v.prototype,y.prototype=new x},s.extend=function(){var y={},v,x;for(v=0;v<arguments.length;v++)for(x in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],x)&&typeof y[x]>"u"&&(y[x]=arguments[v][x]);return y},s.prepareContent=function(y,v,x,b,E){var S=l.Promise.resolve(v).then(function(k){var C=i.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1);return C&&typeof FileReader<"u"?new l.Promise(function(A,T){var j=new FileReader;j.onload=function(D){A(D.target.result)},j.onerror=function(D){T(D.target.error)},j.readAsArrayBuffer(k)}):k});return S.then(function(k){var C=s.getTypeOf(k);return C?(C==="arraybuffer"?k=s.transformTo("uint8array",k):C==="string"&&(E?k=a.decode(k):x&&b!==!0&&(k=u(k))),k):l.Promise.reject(new Error("Can't read the data of '"+y+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,r,s){var i=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),l=t("./zipEntry"),u=t("./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 ("+a.pretty(f)+", expected "+a.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var m=this.reader.readString(4),g=m===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=a.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=this.zip64EndOfCentralSize-44,f=0,p,m,g;f<h;)p=this.reader.readInt(2),m=this.reader.readInt(4),g=this.reader.readData(m),this.zip64ExtensibleData[p]={id:p,length:m,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)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(o.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)h=new l({zip64:this.zip64},this.loadOptions),h.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(o.CENTRAL_DIRECTORY_END);if(h<0){var f=!this.isSignature(0,o.LOCAL_FILE_HEADER);throw f?new Error("Can't find end of central directory : is this a zip f
988ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(h);var p=h;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,h=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),h<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var g=p-m;if(g>0)this.isSignature(p,o.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()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,r,s){var i=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),l=t("./crc32"),u=t("./utf8"),d=t("./compressions"),h=t("./support"),f=0,p=3,m=function(y){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===y)return d[v];return null};function g(y,v){this.options=y,this.loadOptions=v}g.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(y){var v,x;if(y.skip(22),this.fileNameLength=y.readInt(2),x=y.readInt(2),this.fileName=y.readData(this.fileNameLength),y.skip(x),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(v=m(this.compressionMethod),v===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,v,y.readData(this.compressedSize))},readCentralPart:function(y){this.versionMadeBy=y.readInt(2),y.skip(2),this.bitFlag=y.readInt(2),this.compressionMethod=y.readString(2),this.date=y.readDate(),this.crc32=y.readInt(4),this.compressedSize=y.readInt(4),this.uncompressedSize=y.readInt(4);var v=y.readInt(2);if(this.extraFieldsLength=y.readInt(2),this.fileCommentLength=y.readInt(2),this.diskNumberStart=y.readInt(2),this.internalFileAttributes=y.readInt(2),this.externalFileAttributes=y.readInt(4),this.localHeaderOffset=y.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");y.skip(v),this.readExtraFields(y),this.parseZIP64ExtraField(y),this.fileComment=y.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var y=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),y===f&&(this.dosPermissions=this.externalFileAttributes&63),y===p&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&
vendor: 8,734 bytes, line 988
988(this.compressedSize=y.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var v=y.index+this.extraFieldsLength,x,b,E;for(this.extraFields||(this.extraFields={});y.index+4<v;)x=y.readInt(2),b=y.readInt(2),E=y.readData(b),this.extraFields[x]={id:x,length:b,value:E};y.setIndex(v)},handleUTF8:function(){var y=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var x=a.transformTo(y,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(x)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var E=a.transformTo(y,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(E)}}},findExtraFieldUnicodePath:function(){var y=this.extraFields[28789];if(y){var v=i(y.value);return v.readInt(1)!==1||l(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(y.length-5))}return null},findExtraFieldUnicodeComment:function(){var y=this.extraFields[25461];if(y){var v=i(y.value);return v.readInt(1)!==1||l(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(y.length-5))}return null}},r.exports=g},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,r,s){var i=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),o=t("./utf8"),l=t("./compressedObject"),u=t("./stream/GenericWorker"),d=function(m,g,y){this.name=m,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=g,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}};d.prototype={internalStream:function(m){var g=null,y="string";try{if(!m)throw new Error("No output type specified.");y=m.toLowerCase();var v=y==="string"||y==="text";(y==="binarystring"||y==="text")&&(y="string"),g=this._decompressWorker();var x=!this._dataBinary;x&&!v&&(g=g.pipe(new o.Utf8EncodeWorker)),!x&&v&&(g=g.pipe(new o.Utf8DecodeWorker))}catch(b){g=new u("error"),g.error(b)}return new i(g,y,"")},async:function(m,g){return this.internalStream(m).accumulate(g)},nodeStream:function(m,g){return this.internalStream(m||"nodebuffer").toNodejsStream(g)},_compressWorker:function(m,g){if(this._data instanceof l&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new o.Utf8EncodeWorker)),l.createWorkerFrom(y,m,g)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof u?this._data:new a(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++)d.prototype[h[p]]=f;r.exports=d},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,r,s){(function(i){var a=i.MutationObserver||i.WebKitMutationObserver,o;if(a){var l=0,u=new a(m),d=i.document.createTextNode("");u.observe(d,{characterData:!0}),o=function(){d.data=l=++l%2}}else if(!i.setImmediate&&typeof i.MessageChannel<"u"){var h=new i.MessageChannel;h.port1.onmessage=m,o=function(){h.port2.postMessage(0)}}else"document"in i&&"onreadystatechange"in i.document.createElement("script")?o=function(){var y=i.document.createElement("script");y.onreadystatechange=function(){m(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:o=function(){setTimeout(m,0)};var f,p=[];function m(){f=!0;for(var y,v,x=p.length;x;){for(v=p,p=[],y=-1;++y<x;)v[y]();x=p.length}f=!1}r.exports=g;function g(y){p.push(y)===1&&!f&&o()}}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,r,s){var i=t("immediate");function a(){}var o={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];r.exports=h;function h(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==a&&g(this,S)}h.prototype.finally=function(S){if(typeof S!="function")return this;var k=this.constructor;return this.then(C,A);function C(T){function j(){return T}return k.resolve(S()).then(j)}function A(T){function j(){throw T}return k.resolve(S()).then(j)}},h.prototype.catch=function(S){return this.then(null,S)},h.prototype.then=function(S,k){if(typeof S!="function"&&this.state===u||typeof k!="function"&&this.state===l)return this;var C=new this.constructor(a);if(this.state!==d){var A=this.state===u?S:k;p(C,A,this.outcome)}else this.queue.push(new f(C,S,k));return C};function f(S,k,C){this.promise=S,typeof k=="function"&&(this.onFulfilled=k,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(S){o.resolve(this.promise,S)},f.prototype.otherCallFulfilled=function(S){p(this.promise,this.onFulfilled,S)},f.prototype.callRejected=function(S){o.reject(this.promise,S)},f.prototype.otherCallRejected=function(S){p(this.promise,this.onRejected,S)};function p(S,k,C){i(function(){var A;try{A=k(C)}catch(T){return o.reject(S,T)}A===S?o.reject(S,new TypeError("Cannot resolve promise with itself")):o.resolve(S,A)})}o.resolve=function(S,k){var C=y(m,k);if(C.status==="error")return o.reject(S,C.value);var A=C.value;if(A)g(S,A);else{S.state=u,S.outcome=k;for(var T=-1,j=S.queue.length;++T<j;)S.queue[T].callFulfilled(k)}return S},o.reject=function(S,k){S.state=l,S.outcome=k;for(var C=-1,A=S.queue.length;++C<A;)S.queue[C].callRejected(k);return S};function m(S){var k=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof k=="function")return function(){k.apply(S,arguments)}}function g(S,k){var C=!1;function A(R){C||(C=!0,o.reject(S,R))}function T(R){C||(C=!0,o.resolve(S,R))}function j(){k(T,A)}var D=y(j);D.status==="error"&&A(D.value)}function y(S,k){var C={};try{C.value=S(k),C.status="success"}catch(A){C.status="error",C.value=A}return C}h.resolve=v;function v(S){return S instanceof this?S:o.resolve(new this(a),S)}h.reject=x;function x(S){var k=new this(a);return o.reject(k,S)}h.all=b;function b(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,A=!1;if(!C)return this.resolve([]);for(var T=new Array(C),j=0,D=-1,R=new this(a);++D<C;)M(S[D],D);return R;function M(N,U){k.resolve(N).then(q,function(I){A||(A=!0,o.reject(R,I))});function q(I){T[U]=I,++j===C&&!A&&(A=!0,o.resolve(R,T))}}}h.race=E;function E(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,A=!1;if(!C)return this.resolve([]);for(var T=-1,j=new this(a);++T<C;)D(S[T]);return j;function D(R){k.resolve(R).then(function(M){A||(A=!0,o.resolve(j,M))},function(M){A||(A=!0,o.reject(j,M))})}}},{immediate:36}],38:[function(t,r,s){var i=t("./lib/utils/common").assign,a=t("./lib/deflate"),o=t("./lib/inflate"),l=t("./lib/zlib/constants"),u={};i(u,a,o,l),r.exports=u},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,r,s){var i=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/messages"),u=t("./zlib/zstream"),d=Object.prototype.toString,h=0,f=4,p=0,m=1,g=2,y=-1,v=0,x=8;function b(C){if(!(this instanceof b))return new b(C);this.options=a.assign({level:y,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:""},C||{});var A=this.options;A.raw&&A.windowBits>0?A.windowBits=-A.windowBits:A.gzip&&A.windowBits>0&&A.windowBits<16&&(A.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var T=i.deflateInit2(this.strm,A.level,A.method,A.windowBits,A.memLevel,A.strategy);if(T!==p)throw new Error(l[T]);if(A.header&&i.deflateSetHeader(this.strm,A.header),A.dictionary){var j;if(typeof A.dictionary=="string"?j=o.string2buf(A.dictionary):d.call(A.dictionary)==="[object ArrayBuffer]"?j=new Uint8Array(A.dictionary):j=A.dictionary,T=i.deflateSetDictionary(this.strm,j),T!==p)throw new Error(l[T]);this._dict_set=!0}}b.prototype.push=function(C,A){var T=this.strm,j=this.options.chunkSize,D,R;if(this.ended)return!1;R=A===~~A?A:A===!0?f:h,typeof C=="string"?T.input=o.string2buf(C):d.call(C)==="[object ArrayBuffer]"?T.input=new 
vendor: 10,331 bytes, line 988
988Uint8Array(C):T.input=C,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new a.Buf8(j),T.next_out=0,T.avail_out=j),D=i.deflate(T,R),D!==m&&D!==p)return this.onEnd(D),this.ended=!0,!1;(T.avail_out===0||T.avail_in===0&&(R===f||R===g))&&(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(T.output,T.next_out))):this.onData(a.shrinkBuf(T.output,T.next_out)))}while((T.avail_in>0||T.avail_out===0)&&D!==m);return R===f?(D=i.deflateEnd(this.strm),this.onEnd(D),this.ended=!0,D===p):(R===g&&(this.onEnd(p),T.avail_out=0),!0)},b.prototype.onData=function(C){this.chunks.push(C)},b.prototype.onEnd=function(C){C===p&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg};function E(C,A){var T=new b(A);if(T.push(C,!0),T.err)throw T.msg||l[T.err];return T.result}function S(C,A){return A=A||{},A.raw=!0,E(C,A)}function k(C,A){return A=A||{},A.gzip=!0,E(C,A)}s.Deflate=b,s.deflate=E,s.deflateRaw=S,s.gzip=k},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,r,s){var i=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/constants"),u=t("./zlib/messages"),d=t("./zlib/zstream"),h=t("./zlib/gzheader"),f=Object.prototype.toString;function p(y){if(!(this instanceof p))return new p(y);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},y||{});var v=this.options;v.raw&&v.windowBits>=0&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),v.windowBits>=0&&v.windowBits<16&&!(y&&y.windowBits)&&(v.windowBits+=32),v.windowBits>15&&v.windowBits<48&&(v.windowBits&15||(v.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var x=i.inflateInit2(this.strm,v.windowBits);if(x!==l.Z_OK)throw new Error(u[x]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}p.prototype.push=function(y,v){var x=this.strm,b=this.options.chunkSize,E=this.options.dictionary,S,k,C,A,T,j,D=!1;if(this.ended)return!1;k=v===~~v?v:v===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof y=="string"?x.input=o.binstring2buf(y):f.call(y)==="[object ArrayBuffer]"?x.input=new Uint8Array(y):x.input=y,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new a.Buf8(b),x.next_out=0,x.avail_out=b),S=i.inflate(x,l.Z_NO_FLUSH),S===l.Z_NEED_DICT&&E&&(typeof E=="string"?j=o.string2buf(E):f.call(E)==="[object ArrayBuffer]"?j=new Uint8Array(E):j=E,S=i.inflateSetDictionary(this.strm,j)),S===l.Z_BUF_ERROR&&D===!0&&(S=l.Z_OK,D=!1),S!==l.Z_STREAM_END&&S!==l.Z_OK)return this.onEnd(S),this.ended=!0,!1;x.next_out&&(x.avail_out===0||S===l.Z_STREAM_END||x.avail_in===0&&(k===l.Z_FINISH||k===l.Z_SYNC_FLUSH))&&(this.options.to==="string"?(C=o.utf8border(x.output,x.next_out),A=x.next_out-C,T=o.buf2string(x.output,C),x.next_out=A,x.avail_out=b-A,A&&a.arraySet(x.output,x.output,C,A,0),this.onData(T)):this.onData(a.shrinkBuf(x.output,x.next_out))),x.avail_in===0&&x.avail_out===0&&(D=!0)}while((x.avail_in>0||x.avail_out===0)&&S!==l.Z_STREAM_END);return S===l.Z_STREAM_END&&(k=l.Z_FINISH),k===l.Z_FINISH?(S=i.inflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===l.Z_OK):(k===l.Z_SYNC_FLUSH&&(this.onEnd(l.Z_OK),x.avail_out=0),!0)},p.prototype.onData=function(y){this.chunks.push(y)},p.prototype.onEnd=function(y){y===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg};function m(y,v){var x=new p(v);if(x.push(y,!0),x.err)throw x.msg||u[x.err];return x.result}function g(y,v){return v=v||{},v.raw=!0,m(y,v)}s.Inflate=p,s.inflate=m,s.inflateRaw=g,s.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){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)&&(l[h]=d[h])}}return l},s.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var a={arraySet:function(l,u,d,h,f){if(u.subarray&&l.subarray){l.set(u.subarray(d,d+h),f);return}for(var p=0;p<h;p++)l[f+p]=u[d+p]},flattenChunks:function(l){var u,d,h,f,p,m;for(h=0,u=0,d=l.length;u<d;u++)h+=l[u].length;for(m=new Uint8Array(h),f=0,u=0,d=l.length;u<d;u++)p=l[u],m.set(p,f),f+=p.length;return m}},o={arraySet:function(l,u,d,h,f){for(var p=0;p<h;p++)l[f+p]=u[d+p]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,a)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,o))},s.setTyped(i)},{}],42:[function(t,r,s){var i=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;l[254]=l[254]=1,s.string2buf=function(h){var f,p,m,g,y,v=h.length,x=0;for(g=0;g<v;g++)p=h.charCodeAt(g),(p&64512)===55296&&g+1<v&&(m=h.charCodeAt(g+1),(m&64512)===56320&&(p=65536+(p-55296<<10)+(m-56320),g++)),x+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(x),y=0,g=0;y<x;g++)p=h.charCodeAt(g),(p&64512)===55296&&g+1<v&&(m=h.charCodeAt(g+1),(m&64512)===56320&&(p=65536+(p-55296<<10)+(m-56320),g++)),p<128?f[y++]=p:p<2048?(f[y++]=192|p>>>6,f[y++]=128|p&63):p<65536?(f[y++]=224|p>>>12,f[y++]=128|p>>>6&63,f[y++]=128|p&63):(f[y++]=240|p>>>18,f[y++]=128|p>>>12&63,f[y++]=128|p>>>6&63,f[y++]=128|p&63);return f};function d(h,f){if(f<65537&&(h.subarray&&o||!h.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",m=0;m<f;m++)p+=String.fromCharCode(h[m]);return p}s.buf2binstring=function(h){return d(h,h.length)},s.binstring2buf=function(h){for(var f=new i.Buf8(h.length),p=0,m=f.length;p<m;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,m,g,y,v=f||h.length,x=new Array(v*2);for(m=0,p=0;p<v;){if(g=h[p++],g<128){x[m++]=g;continue}if(y=l[g],y>4){x[m++]=65533,p+=y-1;continue}for(g&=y===2?31:y===3?15:7;y>1&&p<v;)g=g<<6|h[p++]&63,y--;if(y>1){x[m++]=65533;continue}g<65536?x[m++]=g:(g-=65536,x[m++]=55296|g>>10&1023,x[m++]=56320|g&1023)}return d(x,m)},s.utf8border=function(h,f){var p;for(f=f||h.length,f>h.length&&(f=h.length),p=f-1;p>=0&&(h[p]&192)===128;)p--;return p<0||p===0?f:p+l[h[p]]>f?p:f}},{"./common":41}],43:[function(t,r,s){function i(a,o,l,u){for(var d=a&65535|0,h=a>>>16&65535|0,f=0;l!==0;){f=l>2e3?2e3:l,l-=f;do d=d+o[u++]|0,h=h+d|0;while(--f);d%=65521,h%=65521}return d|h<<16|0}r.exports=i},{}],44:[function(t,r,s){r.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(t,r,s){function i(){for(var l,u=[],d=0;d<256;d++){l=d;for(var h=0;h<8;h++)l=l&1?3988292384^l>>>1:l>>>1;u[d]=l}return u}var a=i();function o(l,u,d,h){var f=a,p=h+d;l^=-1;for(var m=h;m<p;m++)l=l>>>8^f[(l^u[m])&255];return l^-1}r.exports=o},{}],46:[function(t,r,s){var i=t("../utils/common"),a=t("./trees"),o=t("./adler32"),l=t("./crc32"),u=t("./messages"),d=0,h=1,f=3,p=4,m=5,g=0,y=1,v=-2,x=-3,b=-5,E=-1,S=1,k=2,C=3,A=4,T=0,j=2,D=8,R=9,M=15,N=8,U=29,q=256,I=q+1+U,B=30,$=19,ie=2*I+1,ne=15,L=3,te=258,ae=te+L+1,de=32,ue=42,le=69,ve=73,_e=91,Ne=103,Pe=113,Se=666,Ce=1,O=2,X=3,ee=4,V=3;function H(P,Ae){return P.msg=u[Ae],Ae}function se(P){return(P<<1)-(P>4?9:0)}function z(P){for(var Ae=P.length;--Ae>=0;)P[Ae]=0}function Q(P){var Ae=P.state,je=Ae.pending;je>P.avail_out&&(je=P.avail_out),je!==0&&(i.arraySet(P.output,Ae.pending_buf,Ae.pending_out,je,P.next_out),P.next_out+=je,Ae.pending_out+=je,P.total_out+=je,P.avail_out-=je,Ae.pending-=je,Ae.pending===0&&(Ae.pending_out=0))}function Y(P,Ae){a._tr_flush_block(P,P.block_start>=0?P.block_start:-1,P.strstart-P.block_start,Ae),P.block_start=P.strstart,Q(P.strm)}function ce(P,Ae){P.pending_buf[P.pending++]=Ae}function he(P,Ae){P.pending_buf[P.pending++]=Ae>>>8&255,P.pending_buf[P.pending++]=Ae&255}function ge(P,Ae,je,Z){var fe=P.avail_in;return fe>Z&&(fe=Z),fe===0?0:(P.avail_in-=fe,i.arraySet(Ae,P.input,P.next_in,fe,je),P.state.wrap===1?P.adler=o(P.adler,Ae,fe,je):P.state.wrap===2&&(P.adler=l(P.adler,Ae,fe,je)),P.next_in+=fe,P.total_in+=fe,fe)}function Ee(P,Ae){var je=P.max_chain_length,Z=P.strstart,fe,Re,ht=P.prev_length,Ze=P.nice_match,nt=P.strstart>P.w_size-ae?P.strstart-(P.w_size-ae):0,an=P.window,Xo=P.w_mask,tr=P.prev,dn=P.strstart+te,Mr=an[Z+ht-1],_s=an[Z+ht];P.prev_length>=P.good_match&&(je>>=2),Ze>P.lookahead&&(Ze=P.lookahead);do if(fe=Ae,!(an[fe+ht]!==_s||an[fe+ht-1]!==Mr||an[fe]!==an[Z]||an[++fe]!==an[Z+1])){Z+=2,fe++;do;while(an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&an[++Z]===an[++fe]&&Z<dn);if(Re=te-(dn-Z),Z=dn-te,Re>ht){if(P.match_start=Ae,ht=Re,Re>=Ze)break;Mr=an[Z+ht-1],_s=an[Z+ht]}}while((Ae=tr[Ae&Xo])>nt&&--je!==0);return ht<=P.lookahead?ht:P.lookahead}function Le(P){var Ae=P.w_size,je,Z,fe,Re,ht;do{if(Re=P.window_size-P.lookahead-P.strstart,P.strstart>=Ae+(Ae-ae)){i.arraySet(P.window,P.window,Ae,Ae,0),P.match_start-=Ae,P.strstart-=Ae,P.block_start-=Ae,Z=P.hash_size,je=Z;do fe=P.head[--je],P.head[je]=fe>=Ae?fe-Ae:0;while(--Z);Z=Ae,je=Z;do fe=P.prev[--je],P.prev[je]=fe>=Ae?fe-Ae:0;while(--Z);Re+=Ae}if(P.strm.avail_in===0)break;if(Z=ge(P.strm,P.window,P.strstart+P.lookahead,Re),P.lookahead+=Z,P.lookahead+P.insert>=L)for(ht=P.strstart-P.insert,P.ins_h=P.window[ht],P.ins_h=(P.ins_h<<P.hash_shift^P.window[ht+1])&P.hash_mask;P.insert&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[ht+L-1])&P.hash_mask,P.prev[ht&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=ht,ht++,P.insert--,!(P.lookahead+P.insert<L)););}while(P.lookahead<ae&&P.strm.avail_in!==0)}function qe(P,Ae){var je=65535;for(je>
vendor: 8,452 bytes, line 988
988P.pending_buf_size-5&&(je=P.pending_buf_size-5);;){if(P.lookahead<=1){if(Le(P),P.lookahead===0&&Ae===d)return Ce;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var Z=P.block_start+je;if((P.strstart===0||P.strstart>=Z)&&(P.lookahead=P.strstart-Z,P.strstart=Z,Y(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-ae&&(Y(P,!1),P.strm.avail_out===0))return Ce}return P.insert=0,Ae===p?(Y(P,!0),P.strm.avail_out===0?X:ee):(P.strstart>P.block_start&&(Y(P,!1),P.strm.avail_out===0),Ce)}function lt(P,Ae){for(var je,Z;;){if(P.lookahead<ae){if(Le(P),P.lookahead<ae&&Ae===d)return Ce;if(P.lookahead===0)break}if(je=0,P.lookahead>=L&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,je=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),je!==0&&P.strstart-je<=P.w_size-ae&&(P.match_length=Ee(P,je)),P.match_length>=L)if(Z=a._tr_tally(P,P.strstart-P.match_start,P.match_length-L),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=L){P.match_length--;do P.strstart++,P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,je=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart;while(--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 Z=a._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++;if(Z&&(Y(P,!1),P.strm.avail_out===0))return Ce}return P.insert=P.strstart<L-1?P.strstart:L-1,Ae===p?(Y(P,!0),P.strm.avail_out===0?X:ee):P.last_lit&&(Y(P,!1),P.strm.avail_out===0)?Ce:O}function rt(P,Ae){for(var je,Z,fe;;){if(P.lookahead<ae){if(Le(P),P.lookahead<ae&&Ae===d)return Ce;if(P.lookahead===0)break}if(je=0,P.lookahead>=L&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,je=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=L-1,je!==0&&P.prev_length<P.max_lazy_match&&P.strstart-je<=P.w_size-ae&&(P.match_length=Ee(P,je),P.match_length<=5&&(P.strategy===S||P.match_length===L&&P.strstart-P.match_start>4096)&&(P.match_length=L-1)),P.prev_length>=L&&P.match_length<=P.prev_length){fe=P.strstart+P.lookahead-L,Z=a._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-L),P.lookahead-=P.prev_length-1,P.prev_length-=2;do++P.strstart<=fe&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+L-1])&P.hash_mask,je=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart);while(--P.prev_length!==0);if(P.match_available=0,P.match_length=L-1,P.strstart++,Z&&(Y(P,!1),P.strm.avail_out===0))return Ce}else if(P.match_available){if(Z=a._tr_tally(P,0,P.window[P.strstart-1]),Z&&Y(P,!1),P.strstart++,P.lookahead--,P.strm.avail_out===0)return Ce}else P.match_available=1,P.strstart++,P.lookahead--}return P.match_available&&(Z=a._tr_tally(P,0,P.window[P.strstart-1]),P.match_available=0),P.insert=P.strstart<L-1?P.strstart:L-1,Ae===p?(Y(P,!0),P.strm.avail_out===0?X:ee):P.last_lit&&(Y(P,!1),P.strm.avail_out===0)?Ce:O}function Pt(P,Ae){for(var je,Z,fe,Re,ht=P.window;;){if(P.lookahead<=te){if(Le(P),P.lookahead<=te&&Ae===d)return Ce;if(P.lookahead===0)break}if(P.match_length=0,P.lookahead>=L&&P.strstart>0&&(fe=P.strstart-1,Z=ht[fe],Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe])){Re=P.strstart+te;do;while(Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&Z===ht[++fe]&&fe<Re);P.match_length=te-(Re-fe),P.match_length>P.lookahead&&(P.match_length=P.lookahead)}if(P.match_length>=L?(je=a._tr_tally(P,1,P.match_length-L),P.lookahead-=P.match_length,P.strstart+=P.match_length,P.match_length=0):(je=a._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++),je&&(Y(P,!1),P.strm.avail_out===0))return Ce}return P.insert=0,Ae===p?(Y(P,!0),P.strm.avail_out===0?X:ee):P.last_lit&&(Y(P,!1),P.strm.avail_out===0)?Ce:O}function en(P,Ae){for(var je;;){if(P.lookahead===0&&(Le(P),P.lookahead===0)){if(Ae===d)return Ce;break}if(P.match_length=0,je=a._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++,je&&(Y(P,!1),P.strm.avail_out===0))return Ce}return P.insert=0,Ae===p?(Y(P,!0),P.strm.avail_out===0?X:ee):P.last_lit&&(Y(P,!1),P.strm.avail_out===0)?Ce:O}function gt(P,Ae,je,Z,fe){this.good_length=P,this.max_lazy=Ae,this.nice_length=je,this.max_chain=Z,this.func=fe}var Wt;Wt=[new gt(0,0,0,0,qe),new gt(4,4,8,4,lt),new gt(4,5,16,8,lt),new gt(4,6,32,32,lt),new gt(4,4,16,16,rt),new gt(8,16,32,32,rt),new gt(8,16,128,128,rt),new gt(8,32,128,256,rt),new gt(32,128,258,1024,rt),new gt(32,258,258,4096,rt)];function wn(P){P.window_size=2*P.w_size,z(P.head),P.max_lazy_match=Wt[P.level].max_lazy,P.good_match=Wt[P.level].good_length,P.nice_match=Wt[P.level].nice_length,P.max_chain_length=Wt[P.level].max_chain,P.strstart=0,P.block_start=0,P.lookahead=0,P.insert=0,P.match_length=P.prev_length=L-1,P.match_available=0,P.ins_h=0}function J(){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=D,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 i.Buf16(ie*2),this.dyn_dtree=new i.Buf16((2*B+1)*2),this.bl_tree=new i.Buf16((2*$+1)*2),z(this.dyn_ltree),z(this.dyn_dtree),z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(ne+1),this.heap=new i.Buf16(2*I+1),z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*I+1),z(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 Me(P){var Ae;return!P||!P.state?H(P,v):(P.total_in=P.total_out=0,P.data_type=j,Ae=P.state,Ae.pending=0,Ae.pending_out=0,Ae.wrap<0&&(Ae.wrap=-Ae.wrap),Ae.status=Ae.wrap?ue:Pe,P.adler=Ae.wrap===2?0:1,Ae.last_flush=d,a._tr_init(Ae),g)}function Be(P){var Ae=Me(P);return Ae===g&&wn(P.state),Ae}function Qe(P,Ae){return!P||!P.state||P.state.wrap!==2?v:(P.state.gzhead=Ae,g)}function ye(P,Ae,je,Z,fe,Re){if(!P)return v;var ht=1;if(Ae===E&&(Ae=6),Z<0?(ht=0,Z=-Z):Z>15&&(ht=2,Z-=16),fe<1||fe>R||je!==D||Z<8||Z>15||Ae<0||Ae>9||Re<0||Re>A)return H(P,v);Z===8&&(Z=9);var Ze=new J;return P.state=Ze,Ze.strm=P,Ze.wrap=ht,Ze.gzhead=null,Ze.w_bits=Z,Ze.w_size=1<<Ze.w_bits,Ze.w_mask=Ze.w_size-1,Ze.hash_bits=fe+7,Ze.hash_size=1<<Ze.hash_bits,Ze.hash_mask=Ze.hash_size-1,Ze.hash_shift=~~((Ze.hash_bits+L-1)/L),Ze.window=new i.Buf8(Ze.w_size*2),Ze.head=new i.Buf16(Ze.hash_size),Ze.prev=new i.Buf16(Ze.w_size),Ze.lit_bufsize=1<<fe+6,Ze.pending_buf_size=Ze.lit_bufsize*4,Ze.pending_buf=new i.Buf8(Ze.pending_buf_size),Ze.d_buf=1*Ze.lit_bufsize,Ze.l_buf=3*Ze.lit_bufsize,Ze.level=Ae,Ze.strategy=Re,Ze.method=je,Be(P)}function De(P,Ae){return ye(P,Ae,D,M,N,T)}function K(P,Ae){var je,Z,fe,Re;if(!P||!P.state||Ae>m||Ae<0)return P?H(P,v):v;if(Z=P.state,!P.output||!P.input&&P.avail_in!==0||Z.status===Se&&Ae!==p)return H(P,P.avail_out===0?b:v);if(Z.strm=P,je=Z.last_flush,Z.last_flush=Ae,Z.status===ue)if(Z.wrap===2)P.adler=0,ce(Z,31),ce(Z,139),ce(Z,8),Z.gzhead?(ce(Z,(Z.gzhead.text?1:0)+(Z.gzhead.hcrc?2:0)+(Z.gzhead.extra?4:0)+(Z.gzhead.name?8:0)+(Z.gzhead.comment?16:0)),ce(Z,Z.gzhead.time&255),ce(Z,Z.gzhead.time>>8&255),ce(Z,Z.gzhead.time>>16&255),ce(Z,Z.gzhead.time>>24&255),ce(Z,Z.level===9?2:Z.strategy>=k||Z.level<2?4:0),ce(Z,Z.gzhead.os&255),Z.gzhead.extra&&Z.gzhead.extra.length&&(ce(Z,Z.gzhead.extra.length&255),ce(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(P.adler=l(P.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=le):(ce(Z,0),ce(Z,0),ce(Z,0),ce(Z,0),ce(Z,0),ce(Z,Z.level===9?2:Z.strategy>=k||Z.level<2?4:0),ce(Z,V),Z.status=Pe);else{var ht=D+(Z.w_bits-8<<4)<<8,Ze=-1;Z.strategy>=k||Z.level<2?Ze=0:Z.level<6?Ze=1:Z.level===6?Ze=2:Ze=3,ht|=Ze<<6,Z.strstart!==0&&(ht|=de),ht+=31-ht%31,Z.status=Pe,he(Z,ht),Z.strstart!==0&&(he(Z,P.adler>>>16),he(Z,P.adler&65535)),P.adler=1}if(Z.status===le)if(Z.gzhead.extra){for(fe=Z.pending;
vendor: 7,777 bytes, line 988
988Z.gzindex<(Z.gzhead.extra.length&65535)&&!(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Q(P),fe=Z.pending,Z.pending===Z.pending_buf_size));)ce(Z,Z.gzhead.extra[Z.gzindex]&255),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=ve)}else Z.status=ve;if(Z.status===ve)if(Z.gzhead.name){fe=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Q(P),fe=Z.pending,Z.pending===Z.pending_buf_size)){Re=1;break}Z.gzindex<Z.gzhead.name.length?Re=Z.gzhead.name.charCodeAt(Z.gzindex++)&255:Re=0,ce(Z,Re)}while(Re!==0);Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Re===0&&(Z.gzindex=0,Z.status=_e)}else Z.status=_e;if(Z.status===_e)if(Z.gzhead.comment){fe=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Q(P),fe=Z.pending,Z.pending===Z.pending_buf_size)){Re=1;break}Z.gzindex<Z.gzhead.comment.length?Re=Z.gzhead.comment.charCodeAt(Z.gzindex++)&255:Re=0,ce(Z,Re)}while(Re!==0);Z.gzhead.hcrc&&Z.pending>fe&&(P.adler=l(P.adler,Z.pending_buf,Z.pending-fe,fe)),Re===0&&(Z.status=Ne)}else Z.status=Ne;if(Z.status===Ne&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&Q(P),Z.pending+2<=Z.pending_buf_size&&(ce(Z,P.adler&255),ce(Z,P.adler>>8&255),P.adler=0,Z.status=Pe)):Z.status=Pe),Z.pending!==0){if(Q(P),P.avail_out===0)return Z.last_flush=-1,g}else if(P.avail_in===0&&se(Ae)<=se(je)&&Ae!==p)return H(P,b);if(Z.status===Se&&P.avail_in!==0)return H(P,b);if(P.avail_in!==0||Z.lookahead!==0||Ae!==d&&Z.status!==Se){var nt=Z.strategy===k?en(Z,Ae):Z.strategy===C?Pt(Z,Ae):Wt[Z.level].func(Z,Ae);if((nt===X||nt===ee)&&(Z.status=Se),nt===Ce||nt===X)return P.avail_out===0&&(Z.last_flush=-1),g;if(nt===O&&(Ae===h?a._tr_align(Z):Ae!==m&&(a._tr_stored_block(Z,0,0,!1),Ae===f&&(z(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),Q(P),P.avail_out===0))return Z.last_flush=-1,g}return Ae!==p?g:Z.wrap<=0?y:(Z.wrap===2?(ce(Z,P.adler&255),ce(Z,P.adler>>8&255),ce(Z,P.adler>>16&255),ce(Z,P.adler>>24&255),ce(Z,P.total_in&255),ce(Z,P.total_in>>8&255),ce(Z,P.total_in>>16&255),ce(Z,P.total_in>>24&255)):(he(Z,P.adler>>>16),he(Z,P.adler&65535)),Q(P),Z.wrap>0&&(Z.wrap=-Z.wrap),Z.pending!==0?g:y)}function Ie(P){var Ae;return!P||!P.state?v:(Ae=P.state.status,Ae!==ue&&Ae!==le&&Ae!==ve&&Ae!==_e&&Ae!==Ne&&Ae!==Pe&&Ae!==Se?H(P,v):(P.state=null,Ae===Pe?H(P,x):g))}function St(P,Ae){var je=Ae.length,Z,fe,Re,ht,Ze,nt,an,Xo;if(!P||!P.state||(Z=P.state,ht=Z.wrap,ht===2||ht===1&&Z.status!==ue||Z.lookahead))return v;for(ht===1&&(P.adler=o(P.adler,Ae,je,0)),Z.wrap=0,je>=Z.w_size&&(ht===0&&(z(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),Xo=new i.Buf8(Z.w_size),i.arraySet(Xo,Ae,je-Z.w_size,Z.w_size,0),Ae=Xo,je=Z.w_size),Ze=P.avail_in,nt=P.next_in,an=P.input,P.avail_in=je,P.next_in=0,P.input=Ae,Le(Z);Z.lookahead>=L;){fe=Z.strstart,Re=Z.lookahead-(L-1);do Z.ins_h=(Z.ins_h<<Z.hash_shift^Z.window[fe+L-1])&Z.hash_mask,Z.prev[fe&Z.w_mask]=Z.head[Z.ins_h],Z.head[Z.ins_h]=fe,fe++;while(--Re);Z.strstart=fe,Z.lookahead=L-1,Le(Z)}return Z.strstart+=Z.lookahead,Z.block_start=Z.strstart,Z.insert=Z.lookahead,Z.lookahead=0,Z.match_length=Z.prev_length=L-1,Z.match_available=0,P.next_in=nt,P.input=an,P.avail_in=Ze,Z.wrap=ht,g}s.deflateInit=De,s.deflateInit2=ye,s.deflateReset=Be,s.deflateResetKeep=Me,s.deflateSetHeader=Qe,s.deflate=K,s.deflateEnd=Ie,s.deflateSetDictionary=St,s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,r,s){function i(){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}r.exports=i},{}],48:[function(t,r,s){var i=30,a=12;r.exports=function(l,u){var d,h,f,p,m,g,y,v,x,b,E,S,k,C,A,T,j,D,R,M,N,U,q,I,B;d=l.state,h=l.next_in,I=l.input,f=h+(l.avail_in-5),p=l.next_out,B=l.output,m=p-(u-l.avail_out),g=p+(l.avail_out-257),y=d.dmax,v=d.wsize,x=d.whave,b=d.wnext,E=d.window,S=d.hold,k=d.bits,C=d.lencode,A=d.distcode,T=(1<<d.lenbits)-1,j=(1<<d.distbits)-1;e:do{k<15&&(S+=I[h++]<<k,k+=8,S+=I[h++]<<k,k+=8),D=C[S&T];t:for(;;){if(R=D>>>24,S>>>=R,k-=R,R=D>>>16&255,R===0)B[p++]=D&65535;else if(R&16){M=D&65535,R&=15,R&&(k<R&&(S+=I[h++]<<k,k+=8),M+=S&(1<<R)-1,S>>>=R,k-=R),k<15&&(S+=I[h++]<<k,k+=8,S+=I[h++]<<k,k+=8),D=A[S&j];n:for(;;){if(R=D>>>24,S>>>=R,k-=R,R=D>>>16&255,R&16){if(N=D&65535,R&=15,k<R&&(S+=I[h++]<<k,k+=8,k<R&&(S+=I[h++]<<k,k+=8)),N+=S&(1<<R)-1,N>y){l.msg="invalid distance too far back",d.mode=i;break e}if(S>>>=R,k-=R,R=p-m,N>R){if(R=N-R,R>x&&d.sane){l.msg="invalid distance too far back",d.mode=i;break e}if(U=0,q=E,b===0){if(U+=v-R,R<M){M-=R;do B[p++]=E[U++];while(--R);U=p-N,q=B}}else if(b<R){if(U+=v+b-R,R-=b,R<M){M-=R;do B[p++]=E[U++];while(--R);if(U=0,b<M){R=b,M-=R;do B[p++]=E[U++];while(--R);U=p-N,q=B}}}else if(U+=b-R,R<M){M-=R;do B[p++]=E[U++];while(--R);U=p-N,q=B}for(;M>2;)B[p++]=q[U++],B[p++]=q[U++],B[p++]=q[U++],M-=3;M&&(B[p++]=q[U++],M>1&&(B[p++]=q[U++]))}else{U=p-N;do B[p++]=B[U++],B[p++]=B[U++],B[p++]=B[U++],M-=3;while(M>2);M&&(B[p++]=B[U++],M>1&&(B[p++]=B[U++]))}}else if(R&64){l.msg="invalid distance code",d.mode=i;break e}else{D=A[(D&65535)+(S&(1<<R)-1)];continue n}break}}else if(R&64)if(R&32){d.mode=a;break e}else{l.msg="invalid literal/length code",d.mode=i;break e}else{D=C[(D&65535)+(S&(1<<R)-1)];continue t}break}}while(h<f&&p<g);M=k>>3,h-=M,k-=M<<3,S&=(1<<k)-1,l.next_in=h,l.next_out=p,l.avail_in=h<f?5+(f-h):5-(h-f),l.avail_out=p<g?257+(g-p):257-(p-g),d.hold=S,d.bits=k}},{}],49:[function(t,r,s){var i=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),l=t("./inffast"),u=t("./inftrees"),d=0,h=1,f=2,p=4,m=5,g=6,y=0,v=1,x=2,b=-2,E=-3,S=-4,k=-5,C=8,A=1,T=2,j=3,D=4,R=5,M=6,N=7,U=8,q=9,I=10,B=11,$=12,ie=13,ne=14,L=15,te=16,ae=17,de=18,ue=19,le=20,ve=21,_e=22,Ne=23,Pe=24,Se=25,Ce=26,O=27,X=28,ee=29,V=30,H=31,se=32,z=852,Q=592,Y=15,ce=Y;function he(ye){return(ye>>>24&255)+(ye>>>8&65280)+((ye&65280)<<8)+((ye&255)<<24)}function ge(){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 Ee(ye){var De;return!ye||!ye.state?b:(De=ye.state,ye.total_in=ye.total_out=De.total=0,ye.msg="",De.wrap&&(ye.adler=De.wrap&1),De.mode=A,De.last=0,De.havedict=0,De.dmax=32768,De.head=null,De.hold=0,De.bits=0,De.lencode=De.lendyn=new i.Buf32(z),De.distcode=De.distdyn=new i.Buf32(Q),De.sane=1,De.back=-1,y)}function Le(ye){var De;return!ye||!ye.state?b:(De=ye.state,De.wsize=0,De.whave=0,De.wnext=0,Ee(ye))}function qe(ye,De){var K,Ie;return!ye||!ye.state||(Ie=ye.state,De<0?(K=0,De=-De):(K=(De>>4)+1,De<48&&(De&=15)),De&&(De<8||De>15))?b:(Ie.window!==null&&Ie.wbits!==De&&(Ie.window=null),Ie.wrap=K,Ie.wbits=De,Le(ye))}function lt(ye,De){var K,Ie;return ye?(Ie=new ge,ye.state=Ie,Ie.window=null,K=qe(ye,De),K!==y&&(ye.state=null),K):b}function rt(ye){return lt(ye,ce)}var Pt=!0,en,gt;function Wt(ye){if(Pt){var De;for(en=new i.Buf32(512),gt=new i.Buf32(32),De=0;De<144;)ye.lens[De++]=8;for(;De<256;)ye.lens[De++]=9;for(;De<280;)ye.lens[De++]=7;for(;De<288;)ye.lens[De++]=8;for(u(h,ye.lens,0,288,en,0,ye.work,{bits:9}),De=0;De<32;)ye.lens[De++]=5;
vendor: 4,330 bytes, line 988
988u(f,ye.lens,0,32,gt,0,ye.work,{bits:5}),Pt=!1}ye.lencode=en,ye.lenbits=9,ye.distcode=gt,ye.distbits=5}function wn(ye,De,K,Ie){var St,P=ye.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new i.Buf8(P.wsize)),Ie>=P.wsize?(i.arraySet(P.window,De,K-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(St=P.wsize-P.wnext,St>Ie&&(St=Ie),i.arraySet(P.window,De,K-Ie,St,P.wnext),Ie-=St,Ie?(i.arraySet(P.window,De,K-Ie,Ie,0),P.wnext=Ie,P.whave=P.wsize):(P.wnext+=St,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=St))),0}function J(ye,De){var K,Ie,St,P,Ae,je,Z,fe,Re,ht,Ze,nt,an,Xo,tr=0,dn,Mr,_s,oi,Lg,Fg,xr,sa,is=new i.Buf8(4),Zo,lo,kE=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!ye||!ye.state||!ye.output||!ye.input&&ye.avail_in!==0)return b;K=ye.state,K.mode===$&&(K.mode=ie),Ae=ye.next_out,St=ye.output,Z=ye.avail_out,P=ye.next_in,Ie=ye.input,je=ye.avail_in,fe=K.hold,Re=K.bits,ht=je,Ze=Z,sa=y;e:for(;;)switch(K.mode){case A:if(K.wrap===0){K.mode=ie;break}for(;Re<16;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(K.wrap&2&&fe===35615){K.check=0,is[0]=fe&255,is[1]=fe>>>8&255,K.check=o(K.check,is,2,0),fe=0,Re=0,K.mode=T;break}if(K.flags=0,K.head&&(K.head.done=!1),!(K.wrap&1)||(((fe&255)<<8)+(fe>>8))%31){ye.msg="incorrect header check",K.mode=V;break}if((fe&15)!==C){ye.msg="unknown compression method",K.mode=V;break}if(fe>>>=4,Re-=4,xr=(fe&15)+8,K.wbits===0)K.wbits=xr;else if(xr>K.wbits){ye.msg="invalid window size",K.mode=V;break}K.dmax=1<<xr,ye.adler=K.check=1,K.mode=fe&512?I:$,fe=0,Re=0;break;case T:for(;Re<16;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(K.flags=fe,(K.flags&255)!==C){ye.msg="unknown compression method",K.mode=V;break}if(K.flags&57344){ye.msg="unknown header flags set",K.mode=V;break}K.head&&(K.head.text=fe>>8&1),K.flags&512&&(is[0]=fe&255,is[1]=fe>>>8&255,K.check=o(K.check,is,2,0)),fe=0,Re=0,K.mode=j;case j:for(;Re<32;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.head&&(K.head.time=fe),K.flags&512&&(is[0]=fe&255,is[1]=fe>>>8&255,is[2]=fe>>>16&255,is[3]=fe>>>24&255,K.check=o(K.check,is,4,0)),fe=0,Re=0,K.mode=D;case D:for(;Re<16;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.head&&(K.head.xflags=fe&255,K.head.os=fe>>8),K.flags&512&&(is[0]=fe&255,is[1]=fe>>>8&255,K.check=o(K.check,is,2,0)),fe=0,Re=0,K.mode=R;case R:if(K.flags&1024){for(;Re<16;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.length=fe,K.head&&(K.head.extra_len=fe),K.flags&512&&(is[0]=fe&255,is[1]=fe>>>8&255,K.check=o(K.check,is,2,0)),fe=0,Re=0}else K.head&&(K.head.extra=null);K.mode=M;case M:if(K.flags&1024&&(nt=K.length,nt>je&&(nt=je),nt&&(K.head&&(xr=K.head.extra_len-K.length,K.head.extra||(K.head.extra=new Array(K.head.extra_len)),i.arraySet(K.head.extra,Ie,P,nt,xr)),K.flags&512&&(K.check=o(K.check,Ie,nt,P)),je-=nt,P+=nt,K.length-=nt),K.length))break e;K.length=0,K.mode=N;case N:if(K.flags&2048){if(je===0)break e;nt=0;do xr=Ie[P+nt++],K.head&&xr&&K.length<65536&&(K.head.name+=String.fromCharCode(xr));while(xr&&nt<je);if(K.flags&512&&(K.check=o(K.check,Ie,nt,P)),je-=nt,P+=nt,xr)break e}else K.head&&(K.head.name=null);K.length=0,K.mode=U;case U:if(K.flags&4096){if(je===0)break e;nt=0;do xr=Ie[P+nt++],K.head&&xr&&K.length<65536&&(K.head.comment+=String.fromCharCode(xr));while(xr&&nt<je);if(K.flags&512&&(K.check=o(K.check,Ie,nt,P)),je-=nt,P+=nt,xr)break e}else K.head&&(K.head.comment=null);K.mode=q;case q:if(K.flags&512){for(;Re<16;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(fe!==(K.check&65535)){ye.msg="header crc mismatch",K.mode=V;break}fe=0,Re=0}K.head&&(K.head.hcrc=K.flags>>9&1,K.head.done=!0),ye.adler=K.check=0,K.mode=$;break;case I:for(;Re<32;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}ye.adler=K.check=he(fe),fe=0,Re=0,K.mode=B;case B:if(K.havedict===0)return ye.next_out=Ae,ye.avail_out=Z,ye.next_in=P,ye.avail_in=je,K.hold=fe,K.bits=Re,x;ye.adler=K.check=1,K.mode=$;case $:if(De===m||De===g)break e;case ie:if(K.last){fe>>>=Re&7,Re-=Re&7,K.mode=O;break}for(;Re<3;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}switch(K.last=fe&1,fe>>>=1,Re-=1,fe&3){case 0:K.mode=ne;break;case 1:if(Wt(K),K.mode=le,De===g){fe>>>=2,Re-=2;break e}break;case 2:K.mode=ae;break;case 3:ye.msg="invalid block type",K.mode=V}fe>>>=2,Re-=2;break;case ne:for(fe>>>=Re&7,Re-=Re&7;Re<32;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if((fe&65535)!==(fe>>
vendor: 6,064 bytes, line 988
988>16^65535)){ye.msg="invalid stored block lengths",K.mode=V;break}if(K.length=fe&65535,fe=0,Re=0,K.mode=L,De===g)break e;case L:K.mode=te;case te:if(nt=K.length,nt){if(nt>je&&(nt=je),nt>Z&&(nt=Z),nt===0)break e;i.arraySet(St,Ie,P,nt,Ae),je-=nt,P+=nt,Z-=nt,Ae+=nt,K.length-=nt;break}K.mode=$;break;case ae:for(;Re<14;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(K.nlen=(fe&31)+257,fe>>>=5,Re-=5,K.ndist=(fe&31)+1,fe>>>=5,Re-=5,K.ncode=(fe&15)+4,fe>>>=4,Re-=4,K.nlen>286||K.ndist>30){ye.msg="too many length or distance symbols",K.mode=V;break}K.have=0,K.mode=de;case de:for(;K.have<K.ncode;){for(;Re<3;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.lens[kE[K.have++]]=fe&7,fe>>>=3,Re-=3}for(;K.have<19;)K.lens[kE[K.have++]]=0;if(K.lencode=K.lendyn,K.lenbits=7,Zo={bits:K.lenbits},sa=u(d,K.lens,0,19,K.lencode,0,K.work,Zo),K.lenbits=Zo.bits,sa){ye.msg="invalid code lengths set",K.mode=V;break}K.have=0,K.mode=ue;case ue:for(;K.have<K.nlen+K.ndist;){for(;tr=K.lencode[fe&(1<<K.lenbits)-1],dn=tr>>>24,Mr=tr>>>16&255,_s=tr&65535,!(dn<=Re);){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(_s<16)fe>>>=dn,Re-=dn,K.lens[K.have++]=_s;else{if(_s===16){for(lo=dn+2;Re<lo;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(fe>>>=dn,Re-=dn,K.have===0){ye.msg="invalid bit length repeat",K.mode=V;break}xr=K.lens[K.have-1],nt=3+(fe&3),fe>>>=2,Re-=2}else if(_s===17){for(lo=dn+3;Re<lo;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}fe>>>=dn,Re-=dn,xr=0,nt=3+(fe&7),fe>>>=3,Re-=3}else{for(lo=dn+7;Re<lo;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}fe>>>=dn,Re-=dn,xr=0,nt=11+(fe&127),fe>>>=7,Re-=7}if(K.have+nt>K.nlen+K.ndist){ye.msg="invalid bit length repeat",K.mode=V;break}for(;nt--;)K.lens[K.have++]=xr}}if(K.mode===V)break;if(K.lens[256]===0){ye.msg="invalid code -- missing end-of-block",K.mode=V;break}if(K.lenbits=9,Zo={bits:K.lenbits},sa=u(h,K.lens,0,K.nlen,K.lencode,0,K.work,Zo),K.lenbits=Zo.bits,sa){ye.msg="invalid literal/lengths set",K.mode=V;break}if(K.distbits=6,K.distcode=K.distdyn,Zo={bits:K.distbits},sa=u(f,K.lens,K.nlen,K.ndist,K.distcode,0,K.work,Zo),K.distbits=Zo.bits,sa){ye.msg="invalid distances set",K.mode=V;break}if(K.mode=le,De===g)break e;case le:K.mode=ve;case ve:if(je>=6&&Z>=258){ye.next_out=Ae,ye.avail_out=Z,ye.next_in=P,ye.avail_in=je,K.hold=fe,K.bits=Re,l(ye,Ze),Ae=ye.next_out,St=ye.output,Z=ye.avail_out,P=ye.next_in,Ie=ye.input,je=ye.avail_in,fe=K.hold,Re=K.bits,K.mode===$&&(K.back=-1);break}for(K.back=0;tr=K.lencode[fe&(1<<K.lenbits)-1],dn=tr>>>24,Mr=tr>>>16&255,_s=tr&65535,!(dn<=Re);){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(Mr&&!(Mr&240)){for(oi=dn,Lg=Mr,Fg=_s;tr=K.lencode[Fg+((fe&(1<<oi+Lg)-1)>>oi)],dn=tr>>>24,Mr=tr>>>16&255,_s=tr&65535,!(oi+dn<=Re);){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}fe>>>=oi,Re-=oi,K.back+=oi}if(fe>>>=dn,Re-=dn,K.back+=dn,K.length=_s,Mr===0){K.mode=Ce;break}if(Mr&32){K.back=-1,K.mode=$;break}if(Mr&64){ye.msg="invalid literal/length code",K.mode=V;break}K.extra=Mr&15,K.mode=_e;case _e:if(K.extra){for(lo=K.extra;Re<lo;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.length+=fe&(1<<K.extra)-1,fe>>>=K.extra,Re-=K.extra,K.back+=K.extra}K.was=K.length,K.mode=Ne;case Ne:for(;tr=K.distcode[fe&(1<<K.distbits)-1],dn=tr>>>24,Mr=tr>>>16&255,_s=tr&65535,!(dn<=Re);){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(!(Mr&240)){for(oi=dn,Lg=Mr,Fg=_s;tr=K.distcode[Fg+((fe&(1<<oi+Lg)-1)>>oi)],dn=tr>>>24,Mr=tr>>>16&255,_s=tr&65535,!(oi+dn<=Re);){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}fe>>>=oi,Re-=oi,K.back+=oi}if(fe>>>=dn,Re-=dn,K.back+=dn,Mr&64){ye.msg="invalid distance code",K.mode=V;break}K.offset=_s,K.extra=Mr&15,K.mode=Pe;case Pe:if(K.extra){for(lo=K.extra;Re<lo;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}K.offset+=fe&(1<<K.extra)-1,fe>>>=K.extra,Re-=K.extra,K.back+=K.extra}if(K.offset>K.dmax){ye.msg="invalid distance too far back",K.mode=V;break}K.mode=Se;case Se:if(Z===0)break e;if(nt=Ze-Z,K.offset>nt){if(nt=K.offset-nt,nt>K.whave&&K.sane){ye.msg="invalid distance too far back",K.mode=V;break}nt>K.wnext?(nt-=K.wnext,an=K.wsize-nt):an=K.wnext-nt,nt>K.length&&(nt=K.length),Xo=K.window}else Xo=St,an=Ae-K.offset,nt=K.length;nt>Z&&(nt=Z),Z-=nt,K.length-=nt;do St[Ae++]=Xo[an++];while(--nt);K.length===0&&(K.mode=ve);break;case Ce:if(Z===0)break e;St[Ae++]=K.length,Z--,K.mode=ve;break;case O:if(K.wrap){for(;Re<32;){if(je===0)break e;je--,fe|=Ie[P++]<<Re,Re+=8}if(Ze-=Z,ye.total_out+=Ze,K.total+=Ze,Ze&&(ye.adler=K.check=K.flags?o(K.check,St,Ze,Ae-Ze):a(K.check,St,Ze,Ae-Ze)),Ze=Z,(K.flags?fe:he(fe))!==K.check){ye.msg="incorrect data check",K.mode=V;break}fe=0,Re=0}K.mode=X;case X:if(K.wrap&&K.flags){for(;Re<32;){if(je===0)break e;je--,fe+=Ie[P++]<<Re,Re+=8}if(fe!==(K.total&4294967295)){ye.msg="incorrect length check",K.mode=V;break}fe=0,Re=0}K.mode=ee;case ee:sa=v;break e;case V:sa=E;break e;case H:return S;case se:default:return b}return ye.next_out=Ae,ye.avail_out=Z,ye.next_in=P,ye.avail_in=je,K.hold=fe,K.bits=Re,(K.wsize||Ze!==ye.avail_out&&K.mode<V&&(K.mode<O||De!==p))&&wn(ye,ye.output,ye.next_out,Ze-ye.avail_out),ht-=ye.avail_in,Ze-=ye.avail_out,ye.total_in+=ht,ye.total_out+=Ze,K.total+=Ze,K.wrap&&Ze&&(ye.adler=K.check=K.flags?o(K.check,St,Ze,ye.next_out-Ze):a(K.check,St,Ze,ye.next_out-Ze)),ye.data_type=K.bits+(K.last?64:0)+(K.mode===$?128:0)+(K.mode===le||K.mode===L?256:0),(ht===0&&Ze===0||De===p)&&sa===y&&(sa=k),sa}function Me(ye){if(!ye||!ye.state)return b;var De=ye.state;return De.window&&(De.window=null),ye.state=null,y}function Be(ye,De){var K;return!ye||!ye.state||(K=ye.state,!(K.wrap&2))?b:(K.head=De,De.done=!1,y)}function Qe(ye,De){var K=De.length,Ie,St,P;return!ye||!ye.state||(Ie=ye.state,Ie.wrap!==0&&Ie.mode!==B)?b:Ie.mode===B&&(St=1,St=a(St,De,K,0),St!==Ie.check)?E:(P=wn(ye,De,K,K),P?(Ie.mode=H,S):(Ie.havedict=1,y))}s.inflateReset=Le,s.inflateReset2=qe,s.inflateResetKeep=Ee,s.inflateInit=rt,s.inflateInit2=lt,s.inflate=J,s.inflateEnd=Me,s.inflateGetHeader=Be,s.inflateSetDictionary=Qe,s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}
vendor: 5,126 bytes, line 988
988],50:[function(t,r,s){var i=t("../utils/common"),a=15,o=852,l=592,u=0,d=1,h=2,f=[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],p=[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],m=[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],g=[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];r.exports=function(v,x,b,E,S,k,C,A){var T=A.bits,j=0,D=0,R=0,M=0,N=0,U=0,q=0,I=0,B=0,$=0,ie,ne,L,te,ae,de=null,ue=0,le,ve=new i.Buf16(a+1),_e=new i.Buf16(a+1),Ne=null,Pe=0,Se,Ce,O;for(j=0;j<=a;j++)ve[j]=0;for(D=0;D<E;D++)ve[x[b+D]]++;for(N=T,M=a;M>=1&&ve[M]===0;M--);if(N>M&&(N=M),M===0)return S[k++]=1<<24|64<<16|0,S[k++]=1<<24|64<<16|0,A.bits=1,0;for(R=1;R<M&&ve[R]===0;R++);for(N<R&&(N=R),I=1,j=1;j<=a;j++)if(I<<=1,I-=ve[j],I<0)return-1;if(I>0&&(v===u||M!==1))return-1;for(_e[1]=0,j=1;j<a;j++)_e[j+1]=_e[j]+ve[j];for(D=0;D<E;D++)x[b+D]!==0&&(C[_e[x[b+D]]++]=D);if(v===u?(de=Ne=C,le=19):v===d?(de=f,ue-=257,Ne=p,Pe-=257,le=256):(de=m,Ne=g,le=-1),$=0,D=0,j=R,ae=k,U=N,q=0,L=-1,B=1<<N,te=B-1,v===d&&B>o||v===h&&B>l)return 1;for(;;){Se=j-q,C[D]<le?(Ce=0,O=C[D]):C[D]>le?(Ce=Ne[Pe+C[D]],O=de[ue+C[D]]):(Ce=96,O=0),ie=1<<j-q,ne=1<<U,R=ne;do ne-=ie,S[ae+($>>q)+ne]=Se<<24|Ce<<16|O|0;while(ne!==0);for(ie=1<<j-1;$&ie;)ie>>=1;if(ie!==0?($&=ie-1,$+=ie):$=0,D++,--ve[j]===0){if(j===M)break;j=x[b+C[D]]}if(j>N&&($&te)!==L){for(q===0&&(q=N),ae+=R,U=j-q,I=1<<U;U+q<M&&(I-=ve[U+q],!(I<=0));)U++,I<<=1;if(B+=1<<U,v===d&&B>o||v===h&&B>l)return 1;L=$&te,S[L]=N<<24|U<<16|ae-k|0}}return $!==0&&(S[ae+$]=j-q<<24|64<<16|0),A.bits=N,0}},{"../utils/common":41}],51:[function(t,r,s){r.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(t,r,s){var i=t("../utils/common"),a=4,o=0,l=1,u=2;function d(J){for(var Me=J.length;--Me>=0;)J[Me]=0}var h=0,f=1,p=2,m=3,g=258,y=29,v=256,x=v+1+y,b=30,E=19,S=2*x+1,k=15,C=16,A=7,T=256,j=16,D=17,R=18,M=[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],N=[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],U=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=512,B=new Array((x+2)*2);d(B);var $=new Array(b*2);d($);var ie=new Array(I);d(ie);var ne=new Array(g-m+1);d(ne);var L=new Array(y);d(L);var te=new Array(b);d(te);function ae(J,Me,Be,Qe,ye){this.static_tree=J,this.extra_bits=Me,this.extra_base=Be,this.elems=Qe,this.max_length=ye,this.has_stree=J&&J.length}var de,ue,le;function ve(J,Me){this.dyn_tree=J,this.max_code=0,this.stat_desc=Me}function _e(J){return J<256?ie[J]:ie[256+(J>>>7)]}function Ne(J,Me){J.pending_buf[J.pending++]=Me&255,J.pending_buf[J.pending++]=Me>>>8&255}function Pe(J,Me,Be){J.bi_valid>C-Be?(J.bi_buf|=Me<<J.bi_valid&65535,Ne(J,J.bi_buf),J.bi_buf=Me>>C-J.bi_valid,J.bi_valid+=Be-C):(J.bi_buf|=Me<<J.bi_valid&65535,J.bi_valid+=Be)}function Se(J,Me,Be){Pe(J,Be[Me*2],Be[Me*2+1])}function Ce(J,Me){var Be=0;do Be|=J&1,J>>>=1,Be<<=1;while(--Me>0);return Be>>>1}function O(J){J.bi_valid===16?(Ne(J,J.bi_buf),J.bi_buf=0,J.bi_valid=0):J.bi_valid>=8&&(J.pending_buf[J.pending++]=J.bi_buf&255,J.bi_buf>>=8,J.bi_valid-=8)}function X(J,Me){var Be=Me.dyn_tree,Qe=Me.max_code,ye=Me.stat_desc.static_tree,De=Me.stat_desc.has_stree,K=Me.stat_desc.extra_bits,Ie=Me.stat_desc.extra_base,St=Me.stat_desc.max_length,P,Ae,je,Z,fe,Re,ht=0;for(Z=0;Z<=k;Z++)J.bl_count[Z]=0;for(Be[J.heap[J.heap_max]*2+1]=0,P=J.heap_max+1;P<S;P++)Ae=J.heap[P],Z=Be[Be[Ae*2+1]*2+1]+1,Z>St&&(Z=St,ht++),Be[Ae*2+1]=Z,!(Ae>Qe)&&(J.bl_count[Z]++,fe=0,Ae>=Ie&&(fe=K[Ae-Ie]),Re=Be[Ae*2],J.opt_len+=Re*(Z+fe),De&&(J.static_len+=Re*(ye[Ae*2+1]+fe)));if(ht!==0){do{for(Z=St-1;J.bl_count[Z]===0;)Z--;J.bl_count[Z]--,J.bl_count[Z+1]+=2,J.bl_count[St]--,ht-=2}while(ht>0);for(Z=St;Z!==0;Z--)for(Ae=J.bl_count[Z];Ae!==0;)je=J.heap[--P],!(je>Qe)&&(Be[je*2+1]!==Z&&(J.opt_len+=(Z-Be[je*2+1])*Be[je*2],Be[je*2+1]=Z),Ae--)}}function ee(J,Me,Be){var Qe=new Array(k+1),ye=0,De,K;for(De=1;De<=k;De++)Qe[De]=ye=ye+Be[De-1]<<1;for(K=0;K<=Me;K++){var Ie=J[K*2+1];Ie!==0&&(J[K*2]=Ce(Qe[Ie]++,Ie))}}function V(){var J,Me,Be,Qe,ye,De=new Array(k+1);for(Be=0,Qe=0;Qe<y-1;Qe++)for(L[Qe]=Be,J=0;J<1<<M[Qe];J++)ne[Be++]=Qe;for(ne[Be-1]=Qe,ye=0,Qe=0;Qe<16;Qe++)for(te[Qe]=ye,J=0;J<1<<N[Qe];J++)ie[ye++]=Qe;for(ye>>=7;Qe<b;Qe++)for(te[Qe]=ye<<7,J=0;J<1<<N[Qe]-7;J++)ie[256+ye++]=Qe;for(Me=0;Me<=k;Me++)De[Me]=0;for(J=0;J<=143;)B[J*2+1]=8,J++,De[8]++;for(;J<=255;)B[J*2+1]=9,J++,De[9]++;for(;J<=279;)B[J*2+1]=7,J++,De[7]++;for(;J<=287;)B[J*2+1]=8,J++,De[8]++;for(ee(B,x+1,De),J=0;J<b;J++)$[J*2+1]=5,$[J*2]=Ce(J,5);de=new ae(B,M,v+1,x,k),ue=new ae($,N,0,b,k),le=new ae(new Array(0),U,0,E,A)}function H(J){var Me;for(Me=0;Me<x;Me++)J.dyn_ltree[Me*2]=0;for(Me=0;Me<b;Me++)J.dyn_dtree[Me*2]=0;for(Me=0;Me<E;Me++)J.bl_tree[Me*2]=0;J.dyn_ltree[T*2]=1,J.opt_len=J.static_len=0,J.last_lit=J.matches=0}function se(J){J.bi_valid>8?Ne(J,J.bi_buf):J.bi_valid>
vendor: 5,171 bytes, line 988
9880&&(J.pending_buf[J.pending++]=J.bi_buf),J.bi_buf=0,J.bi_valid=0}function z(J,Me,Be,Qe){se(J),Ne(J,Be),Ne(J,~Be),i.arraySet(J.pending_buf,J.window,Me,Be,J.pending),J.pending+=Be}function Q(J,Me,Be,Qe){var ye=Me*2,De=Be*2;return J[ye]<J[De]||J[ye]===J[De]&&Qe[Me]<=Qe[Be]}function Y(J,Me,Be){for(var Qe=J.heap[Be],ye=Be<<1;ye<=J.heap_len&&(ye<J.heap_len&&Q(Me,J.heap[ye+1],J.heap[ye],J.depth)&&ye++,!Q(Me,Qe,J.heap[ye],J.depth));)J.heap[Be]=J.heap[ye],Be=ye,ye<<=1;J.heap[Be]=Qe}function ce(J,Me,Be){var Qe,ye,De=0,K,Ie;if(J.last_lit!==0)do Qe=J.pending_buf[J.d_buf+De*2]<<8|J.pending_buf[J.d_buf+De*2+1],ye=J.pending_buf[J.l_buf+De],De++,Qe===0?Se(J,ye,Me):(K=ne[ye],Se(J,K+v+1,Me),Ie=M[K],Ie!==0&&(ye-=L[K],Pe(J,ye,Ie)),Qe--,K=_e(Qe),Se(J,K,Be),Ie=N[K],Ie!==0&&(Qe-=te[K],Pe(J,Qe,Ie)));while(De<J.last_lit);Se(J,T,Me)}function he(J,Me){var Be=Me.dyn_tree,Qe=Me.stat_desc.static_tree,ye=Me.stat_desc.has_stree,De=Me.stat_desc.elems,K,Ie,St=-1,P;for(J.heap_len=0,J.heap_max=S,K=0;K<De;K++)Be[K*2]!==0?(J.heap[++J.heap_len]=St=K,J.depth[K]=0):Be[K*2+1]=0;for(;J.heap_len<2;)P=J.heap[++J.heap_len]=St<2?++St:0,Be[P*2]=1,J.depth[P]=0,J.opt_len--,ye&&(J.static_len-=Qe[P*2+1]);for(Me.max_code=St,K=J.heap_len>>1;K>=1;K--)Y(J,Be,K);P=De;do K=J.heap[1],J.heap[1]=J.heap[J.heap_len--],Y(J,Be,1),Ie=J.heap[1],J.heap[--J.heap_max]=K,J.heap[--J.heap_max]=Ie,Be[P*2]=Be[K*2]+Be[Ie*2],J.depth[P]=(J.depth[K]>=J.depth[Ie]?J.depth[K]:J.depth[Ie])+1,Be[K*2+1]=Be[Ie*2+1]=P,J.heap[1]=P++,Y(J,Be,1);while(J.heap_len>=2);J.heap[--J.heap_max]=J.heap[1],X(J,Me),ee(Be,St,J.bl_count)}function ge(J,Me,Be){var Qe,ye=-1,De,K=Me[0*2+1],Ie=0,St=7,P=4;for(K===0&&(St=138,P=3),Me[(Be+1)*2+1]=65535,Qe=0;Qe<=Be;Qe++)De=K,K=Me[(Qe+1)*2+1],!(++Ie<St&&De===K)&&(Ie<P?J.bl_tree[De*2]+=Ie:De!==0?(De!==ye&&J.bl_tree[De*2]++,J.bl_tree[j*2]++):Ie<=10?J.bl_tree[D*2]++:J.bl_tree[R*2]++,Ie=0,ye=De,K===0?(St=138,P=3):De===K?(St=6,P=3):(St=7,P=4))}function Ee(J,Me,Be){var Qe,ye=-1,De,K=Me[0*2+1],Ie=0,St=7,P=4;for(K===0&&(St=138,P=3),Qe=0;Qe<=Be;Qe++)if(De=K,K=Me[(Qe+1)*2+1],!(++Ie<St&&De===K)){if(Ie<P)do Se(J,De,J.bl_tree);while(--Ie!==0);else De!==0?(De!==ye&&(Se(J,De,J.bl_tree),Ie--),Se(J,j,J.bl_tree),Pe(J,Ie-3,2)):Ie<=10?(Se(J,D,J.bl_tree),Pe(J,Ie-3,3)):(Se(J,R,J.bl_tree),Pe(J,Ie-11,7));Ie=0,ye=De,K===0?(St=138,P=3):De===K?(St=6,P=3):(St=7,P=4)}}function Le(J){var Me;for(ge(J,J.dyn_ltree,J.l_desc.max_code),ge(J,J.dyn_dtree,J.d_desc.max_code),he(J,J.bl_desc),Me=E-1;Me>=3&&J.bl_tree[q[Me]*2+1]===0;Me--);return J.opt_len+=3*(Me+1)+5+5+4,Me}function qe(J,Me,Be,Qe){var ye;for(Pe(J,Me-257,5),Pe(J,Be-1,5),Pe(J,Qe-4,4),ye=0;ye<Qe;ye++)Pe(J,J.bl_tree[q[ye]*2+1],3);Ee(J,J.dyn_ltree,Me-1),Ee(J,J.dyn_dtree,Be-1)}function lt(J){var Me=4093624447,Be;for(Be=0;Be<=31;Be++,Me>>>=1)if(Me&1&&J.dyn_ltree[Be*2]!==0)return o;if(J.dyn_ltree[9*2]!==0||J.dyn_ltree[10*2]!==0||J.dyn_ltree[13*2]!==0)return l;for(Be=32;Be<v;Be++)if(J.dyn_ltree[Be*2]!==0)return l;return o}var rt=!1;function Pt(J){rt||(V(),rt=!0),J.l_desc=new ve(J.dyn_ltree,de),J.d_desc=new ve(J.dyn_dtree,ue),J.bl_desc=new ve(J.bl_tree,le),J.bi_buf=0,J.bi_valid=0,H(J)}function en(J,Me,Be,Qe){Pe(J,(h<<1)+(Qe?1:0),3),z(J,Me,Be)}function gt(J){Pe(J,f<<1,3),Se(J,T,B),O(J)}function Wt(J,Me,Be,Qe){var ye,De,K=0;J.level>0?(J.strm.data_type===u&&(J.strm.data_type=lt(J)),he(J,J.l_desc),he(J,J.d_desc),K=Le(J),ye=J.opt_len+3+7>>>3,De=J.static_len+3+7>>>3,De<=ye&&(ye=De)):ye=De=Be+5,Be+4<=ye&&Me!==-1?en(J,Me,Be,Qe):J.strategy===a||De===ye?(Pe(J,(f<<1)+(Qe?1:0),3),ce(J,B,$)):(Pe(J,(p<<1)+(Qe?1:0),3),qe(J,J.l_desc.max_code+1,J.d_desc.max_code+1,K+1),ce(J,J.dyn_ltree,J.dyn_dtree)),H(J),Qe&&se(J)}function wn(J,Me,Be){return J.pending_buf[J.d_buf+J.last_lit*2]=Me>>>8&255,J.pending_buf[J.d_buf+J.last_lit*2+1]=Me&255,J.pending_buf[J.l_buf+J.last_lit]=Be&255,J.last_lit++,Me===0?J.dyn_ltree[Be*2]++:(J.matches++,Me--,J.dyn_ltree[(ne[Be]+v+1)*2]++,J.dyn_dtree[_e(Me)*2]++),J.last_lit===J.lit_bufsize-1}s._tr_init=Pt,s._tr_stored_block=en,s._tr_flush_block=Wt,s._tr_tally=wn,s._tr_align=gt},{"../utils/common":41}],53:[function(t,r,s){function i(){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}r.exports=i},{}],54:[function(t,r,s){(function(i){(function(a,o){if(a.setImmediate)return;var l=1,u={},d=!1,h=a.document,f;function p(A){typeof A!="function"&&(A=new Function(""+A));for(var T=new Array(arguments.length-1),j=0;j<T.length;j++)T[j]=arguments[j+1];var D={callback:A,args:T};return u[l]=D,f(l),l++}function m(A){delete u[A]}function g(A){var T=A.callback,j=A.args;switch(j.length){case 0:T();break;case 1:T(j[0]);break;case 2:T(j[0],j[1]);break;case 3:T(j[0],j[1],j[2]);break;default:T.apply(o,j);break}}function y(A){if(d)setTimeout(y,0,A);else{var T=u[A];if(T){d=!0;try{g(T)}finally{m(A),d=!1}}}}function v(){f=function(A){process.nextTick(function(){y(A)})}}function x(){if(a.postMessage&&!a.importScripts){var A=!0,T=a.onmessage;return a.onmessage=function(){A=!1},a.postMessage("","*"),a.onmessage=T,A}}function b(){var A="setImmediate$"+Math.random()+"$",T=function(j){j.source===a&&typeof j.data=="str
vendor: 24,748 bytes, lines 988-993
988ing"&&j.data.indexOf(A)===0&&y(+j.data.slice(A.length))};a.addEventListener?a.addEventListener("message",T,!1):a.attachEvent("onmessage",T),f=function(j){a.postMessage(A+j,"*")}}function E(){var A=new MessageChannel;A.port1.onmessage=function(T){var j=T.data;y(j)},f=function(T){A.port2.postMessage(T)}}function S(){var A=h.documentElement;f=function(T){var j=h.createElement("script");j.onreadystatechange=function(){y(T),j.onreadystatechange=null,A.removeChild(j),j=null},A.appendChild(j)}}function k(){f=function(A){setTimeout(y,0,A)}}var C=Object.getPrototypeOf&&Object.getPrototypeOf(a);C=C&&C.setTimeout?C:a,{}.toString.call(a.process)==="[object process]"?v():x()?b():a.MessageChannel?E():h&&"onreadystatechange"in h.createElement("script")?S():k(),C.setImmediate=p,C.clearImmediate=m})(typeof self>"u"?typeof i>"u"?this:i:self)}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Yae);var hUe=Yae.exports;const fUe=ro(hUe);class pUe{constructor(){this.zip=void 0,this.urlCache={},this.checkRequirements()}checkRequirements(){try{this.zip=new fUe}catch{throw new Error("JSZip lib not loaded")}}open(e,t){return this.zip.loadAsync(e,{base64:t})}openUrl(e,t){return Y1(e,"binary").then((function(r){return this.zip.loadAsync(r,{base64:t})}).bind(this))}request(e,t){var r=new fn,s,i=new xd(e);return t||(t=i.extension),t=="blob"?s=this.getBlob(e):s=this.getText(e),s?s.then((function(a){let o=this.handleResponse(a,t);r.resolve(o)}).bind(this)):r.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),r.promise}handleResponse(e,t){var r;return t=="json"?r=JSON.parse(e):K1(t)?r=Wc(e,"text/xml"):t=="xhtml"?r=Wc(e,"application/xhtml+xml"):t=="html"||t=="htm"?r=Wc(e,"text/html"):r=e,r}getBlob(e,t){var r=window.decodeURIComponent(e.substr(1)),s=this.zip.file(r);if(s)return t=t||my.lookup(s.name),s.async("uint8array").then(function(i){return new Blob([i],{type:t})})}getText(e,t){var r=window.decodeURIComponent(e.substr(1)),s=this.zip.file(r);if(s)return s.async("string").then(function(i){return i})}getBase64(e,t){var r=window.decodeURIComponent(e.substr(1)),s=this.zip.file(r);if(s)return t=t||my.lookup(s.name),s.async("base64").then(function(i){return"data:"+t+";base64,"+i})}createUrl(e,t){var r=new fn,s=window.URL||window.webkitURL||window.mozURL,i,a,o=t&&t.base64;return e in this.urlCache?(r.resolve(this.urlCache[e]),r.promise):(o?(a=this.getBase64(e),a&&a.then((function(l){this.urlCache[e]=l,r.resolve(l)}).bind(this))):(a=this.getBlob(e),a&&a.then((function(l){i=s.createObjectURL(l),this.urlCache[e]=i,r.resolve(i)}).bind(this))),a||r.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),r.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,r=this.urlCache[e];r&&t.revokeObjectURL(r)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.zip=void 0,this.urlCache={}}}var Xae={exports:{}};/*!
989    localForage -- Offline Storage, Improved
990    Version 1.10.0
991    https://localforage.github.io/localForage
992    (c) 2013-2017 Mozilla, Apache License 2.0
993*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,s,i){function a(u,d){if(!s[u]){if(!r[u]){var h=typeof Oo=="function"&&Oo;if(!d&&h)return h(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};r[u][0].call(p.exports,function(m){var g=r[u][1][m];return a(g||m)},p,p.exports,t,r,s,i)}return s[u].exports}for(var o=typeof Oo=="function"&&Oo,l=0;l<i.length;l++)a(i[l]);return a}({1:[function(t,r,s){(function(i){var a=i.MutationObserver||i.WebKitMutationObserver,o;if(a){var l=0,u=new a(m),d=i.document.createTextNode("");u.observe(d,{characterData:!0}),o=function(){d.data=l=++l%2}}else if(!i.setImmediate&&typeof i.MessageChannel<"u"){var h=new i.MessageChannel;h.port1.onmessage=m,o=function(){h.port2.postMessage(0)}}else"document"in i&&"onreadystatechange"in i.document.createElement("script")?o=function(){var y=i.document.createElement("script");y.onreadystatechange=function(){m(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:o=function(){setTimeout(m,0)};var f,p=[];function m(){f=!0;for(var y,v,x=p.length;x;){for(v=p,p=[],y=-1;++y<x;)v[y]();x=p.length}f=!1}r.exports=g;function g(y){p.push(y)===1&&!f&&o()}}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(t,r,s){var i=t(1);function a(){}var o={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];r.exports=h;function h(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==a&&g(this,S)}h.prototype.catch=function(S){return this.then(null,S)},h.prototype.then=function(S,k){if(typeof S!="function"&&this.state===u||typeof k!="function"&&this.state===l)return this;var C=new this.constructor(a);if(this.state!==d){var A=this.state===u?S:k;p(C,A,this.outcome)}else this.queue.push(new f(C,S,k));return C};function f(S,k,C){this.promise=S,typeof k=="function"&&(this.onFulfilled=k,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(S){o.resolve(this.promise,S)},f.prototype.otherCallFulfilled=function(S){p(this.promise,this.onFulfilled,S)},f.prototype.callRejected=function(S){o.reject(this.promise,S)},f.prototype.otherCallRejected=function(S){p(this.promise,this.onRejected,S)};function p(S,k,C){i(function(){var A;try{A=k(C)}catch(T){return o.reject(S,T)}A===S?o.reject(S,new TypeError("Cannot resolve promise with itself")):o.resolve(S,A)})}o.resolve=function(S,k){var C=y(m,k);if(C.status==="error")return o.reject(S,C.value);var A=C.value;if(A)g(S,A);else{S.state=u,S.outcome=k;for(var T=-1,j=S.queue.length;++T<j;)S.queue[T].callFulfilled(k)}return S},o.reject=function(S,k){S.state=l,S.outcome=k;for(var C=-1,A=S.queue.length;++C<A;)S.queue[C].callRejected(k);return S};function m(S){var k=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof k=="function")return function(){k.apply(S,arguments)}}function g(S,k){var C=!1;function A(R){C||(C=!0,o.reject(S,R))}function T(R){C||(C=!0,o.resolve(S,R))}function j(){k(T,A)}var D=y(j);D.status==="error"&&A(D.value)}function y(S,k){var C={};try{C.value=S(k),C.status="success"}catch(A){C.status="error",C.value=A}return C}h.resolve=v;function v(S){return S instanceof this?S:o.resolve(new this(a),S)}h.reject=x;function x(S){var k=new this(a);return o.reject(k,S)}h.all=b;function b(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,A=!1;if(!C)return this.resolve([]);for(var T=new Array(C),j=0,D=-1,R=new this(a);++D<C;)M(S[D],D);return R;function M(N,U){k.resolve(N).then(q,function(I){A||(A=!0,o.reject(R,I))});function q(I){T[U]=I,++j===C&&!A&&(A=!0,o.resolve(R,T))}}}h.race=E;function E(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,A=!1;if(!C)return this.resolve([]);for(var T=-1,j=new this(a);++T<C;)D(S[T]);return j;function D(R){k.resolve(R).then(function(M){A||(A=!0,o.resolve(j,M))},function(M){A||(A=!0,o.reject(j,M))})}}},{1:1}],3:[function(t,r,s){(function(i){typeof i.Promise!="function"&&(i.Promise=t(2))}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(t,r,s){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(re){return typeof re}:function(re){return re&&typeof Symbol=="function"&&re.constructor===Symbol&&re!==Symbol.prototype?"symbol":typeof re};function a(re,me){if(!(re instanceof me))throw new TypeError("Cannot call a class as a function")}function o(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=o();function u(){try{if(!l||!l.open)return!1;var re=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),me=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!re||me)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(re,me){re=re||[],me=me||{};try{return new Blob(re,me)}catch(be){if(be.name!=="TypeError")throw be;for(var oe=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,we=new oe,Te=0;Te<re.length;Te+=1)we.append(re[Te]);return we.getBlob(me.type)}}typeof Promise>"u"&&t(3);var h=Promise;function f(re,me){me&&re.then(function(oe){me(null,oe)},function(oe){me(oe)})}function p(re,me,oe){typeof me=="function"&&re.then(me),typeof oe=="function"&&re.catch(oe)}function m(re){return typeof re!="string"&&(console.warn(re+" used as a key, but it is not a string."),re=String(re)),re}function g(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var y="local-forage-detect-blob-support",v=void 0,x={},b=Object.prototype.toString,E="readonly",S="readwrite";function k(re){for(var me=re.length,oe=new ArrayBuffer(me),we=new Uint8Array(oe),Te=0;Te<me;Te++)we[Te]=re.charCodeAt(Te);return oe}function C(re){return new h(function(me){var oe=re.transaction(y,S),we=d([""]);oe.objectStore(y).put(we,"key"),oe.onabort=function(Te){Te.preventDefault(),Te.stopPropagation(),me(!1)},oe.oncomplete=function(){var Te=navigator.userAgent.match(/Chrome\/(\d+)/),be=navigator.userAgent.match(/Edge\//);me(be||!Te||parseInt(Te[1],10)>=43)}}).catch(function(){return!1})}function A(re){return typeof v=="boolean"?h.resolve(v):C(re).then(function(me){return v=me,v})}function T(re){var me=x[re.name],oe={};oe.promise=new h(function(we,Te){oe.resolve=we,oe.reject=Te}),me.deferredOperations.push(oe),me.dbReady?me.dbReady=me.dbReady.then(function(){return oe.promise}):me.dbReady=oe.promise}function j(re){var me=x[re.name],oe=me.deferredOperations.pop();if(oe)return oe.resolve(),oe.promise}function D(re,me){var oe=x[re.name],we=oe.deferredOperations.pop();if(we)return we.reject(me),we.promise}function R(re,me){return new h(function(oe,we){if(x[re.name]=x[re.name]||L(),re.db)if(me)T(re),re.db.close();else return oe(re.db);var Te=[re.name];me&&Te.push(re.version);var be=l.open.apply(l,Te);me&&(be.onupgradeneeded=function(Fe){var Ve=be.result;try{Ve.createObjectStore(re.storeName),Fe.oldVersion<=1&&Ve.createObjectStore(y)}catch(Ge){if(Ge.name==="ConstraintError")console.warn('The database "'+re.name+'" has been upgraded from version '+Fe.oldVersion+" to version "+Fe.newVersion+', but the storage "'+re.storeName+'" already exists.');else throw Ge}}),be.onerror=function(Fe){Fe.preventDefault(),we(be.error)},be.onsuccess=function(){var Fe=be.result;Fe.onversionchange=function(Ve){Ve.target.close()},oe(Fe),j(re)}})}function M(re){return R(re,!1)}function N(re){return R(re,!0)}function U(re,me){if(!re.db)return!0;var oe=!re.db.objectStoreNames.contains(re.storeName),we=re.version<re.db.version,Te=re.version>re.db.version;if(we&&(re.version!==me&&console.warn('The database "'+re.name+`" can't be downgraded from version `+re.db.version+" to version "+re.version+"."),re.version=re.db.version),Te||oe){if(oe){var be=re.db.version+1;be>re.version&&(re.version=be)}return!0}return!1}function q(re){return new h(function(me,oe){var we=new FileReader;we.onerror=oe,we.onloadend=function(Te){var be=btoa(Te.target.result||"");me({__local_forage_encoded_blob:!0,data:be,type:re.type})},we.readAsBinaryString(re)})}function I(re){var me=k(atob(re.data));return d([me],{type:re.type})}function B(re){return re&&re.__local_forage_encoded_blob}function $(re){var me=this,oe=me._initReady().then(function(){var we=x[me._dbInfo.name];if(we&&we.dbReady)return we.dbReady});return p(oe,re,re),oe}function ie(re){T(re);for(var me=x[re.name],oe=me.forages,we=0;we<oe.length;we++){var Te=oe[we];Te._dbInfo.db&&(Te._dbInfo.db.close(),Te._dbInfo.db=null)}return re.db=null,M(re).then(function(be){return re.db=be,U(re)?N(re):be}).then(function(be){re.db=me.db=be;for(var Fe=0;Fe<oe.length;Fe++)oe[Fe]._dbInfo.db=be}).catch(function(be){throw D(re,be),be})}function ne(re,me,oe,we){we===void 0&&(we=1);try{var Te=re.db.transaction(re.storeName,me);oe(null,Te)}catch(be){if(we>0&&(!re.db||be.name==="InvalidStateError"||be.name==="NotFoundError"))return h.resolve().then(function(){if(!re.db||be.name==="NotFoundError"&&!re.db.objectStoreNames.contains(re.storeName)&&re.version<=re.db.version)return re.db&&(re.version=re.db.version+1),N(re)}).then(function(){return ie(re).then(function(){ne(re,me,oe,we-1)})}).catch(oe);oe(be)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function te(re){var me=this,oe={db:null};if(re)for(var we in re)oe[we]=re[we];var Te=x[oe.name];Te||(Te=L(),x[oe.name]=Te),Te.forages.push(me),me._initReady||(me._initReady=me.ready,me.ready=$);var be=[];function Fe(){return h.resolve()}for(var Ve=0;Ve<Te.forages.length;Ve++){var Ge=Te.forages[Ve];Ge!==me&&be.push(Ge._initReady().catch(Fe))}var Ke=Te.forages.slice(0);return h.all(be).then(function(){return oe.db=Te.db,M(oe)}).then(function(Je){return oe.db=Je,U(oe,me._defaultConfig.version)?N(oe):Je}).then(function(Je){oe.db=Te.db=Je,me._dbInfo=oe;for(var xt=0;xt<Ke.length;xt++){var nn=Ke[xt];nn!==me&&(nn._dbInfo.db=oe.db,nn._dbInfo.version=oe.version)}})}function ae(re,me){var oe=this;re=m(re);var we=new h(function(Te,be){oe.ready().then(function(){ne(oe._dbInfo,E,function(Fe,Ve){if(Fe)return be(Fe);try{var Ge=Ve.objectStore(oe._dbInfo.storeName),Ke=Ge.get(re);Ke.onsuccess=function(){var Je=Ke.result;Je===void 0&&(Je=null),B(Je)&&(Je=I(Je)),Te(Je)},Ke.onerror=function(){be(Ke.error)}}catch(Je){be(Je)}})}).catch(be)});return f(we,me),we}function de(re,me){var oe=this,we=new h(function(Te,be){oe.ready().then(function(){ne(oe._dbInfo,E,function(Fe,Ve){if(Fe)return be(Fe);try{var Ge=Ve.objectStore(oe._dbInfo.storeName),Ke=Ge.openCursor(),Je=1;Ke.onsuccess=function(){var xt=Ke.result;if(xt){var nn=xt.value;B(nn)&&(nn=I(nn));var Cn=re(nn,xt.key,Je++);Cn!==void 0?Te(Cn):xt.continue()}else Te()},Ke.onerror=function(){be(Ke.error)}}catch(xt){be(xt)}})}).catch(be)});return f(we,me),we}function ue(re,me,oe){var we=this;re=m(re);var Te=new h(function(be,Fe){var Ve;we.ready().then(function(){return Ve=we._dbInfo,b.call(me)==="[object Blob]"?A(Ve.db).then(function(Ge){return Ge?me:q(me)}):me}).then(function(Ge){ne(we._dbInfo,S,function(Ke,Je){if(Ke)return Fe(Ke);try{var xt=Je.objectStore(we._dbInfo.storeName);Ge===null&&(Ge=void 0);var nn=xt.put(Ge,re);Je.oncomplete=function(){Ge===void 0&&(Ge=null),be(Ge)},Je.onabort=Je.onerror=function(){var Cn=nn.error?nn.error:nn.transaction.error;Fe(Cn)}}catch(Cn){Fe(Cn)}})}).catch(Fe)});return f(Te,oe),Te}function le(re,me){var oe=this;re=m(re);var we=new h(function(Te,be){oe.ready().then(function(){ne(oe._dbInfo,S,function(Fe,Ve){if(Fe)return be(Fe);try{var Ge=Ve.objectStore(oe._dbInfo.storeName),Ke=Ge.delete(re);Ve.oncomplete=function(){Te()},Ve.onerror=function(){be(Ke.error)},Ve.onabort=function(){var Je=Ke.error?Ke.error:Ke.transaction.error;be(Je)}}catch(Je){be(Je)}})}).catch(be)});return f(we,me),we}function ve(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){ne(me._dbInfo,S,function(be,Fe){if(be)return Te(be);try{var Ve=Fe.objectStore(me._dbInfo.storeName),Ge=Ve.clear();Fe.oncomplete=function(){we()},Fe.onabort=Fe.onerror=function(){var Ke=Ge.error?Ge.error:Ge.transaction.error;Te(Ke)}}catch(Ke){Te(Ke)}})}).catch(Te)});return f(oe,re),oe}function _e(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){ne(me._dbInfo,E,function(be,Fe){if(be)return Te(be);try{var Ve=Fe.objectStore(me._dbInfo.storeName),Ge=Ve.count();Ge.onsuccess=function(){we(Ge.result)},Ge.onerror=function(){Te(Ge.error)}}catch(Ke){Te(Ke)}})}).catch(Te)});return f(oe,re),oe}function Ne(re,me){var oe=this,we=new h(function(Te,be){if(re<0){Te(null);return}oe.ready().then(function(){ne(oe._dbInfo,E,function(Fe,Ve){if(Fe)return be(Fe);try{var Ge=Ve.objectStore(oe._dbInfo.storeName),Ke=!1,Je=Ge.openKeyCursor();Je.onsuccess=function(){var xt=Je.result;if(!xt){Te(null);return}re===0||Ke?Te(xt.key):(Ke=!0,xt.advance(re))},Je.onerror=function(){be(Je.error)}}catch(xt){be(xt)}})}).catch(be)});return f(we,me),we}function Pe(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){ne(me._dbInfo,E,function(be,Fe){if(be)return Te(be);try{var Ve=Fe.objectStore(me._dbInfo.storeName),Ge=Ve.openKeyCursor(),Ke=[];Ge.onsuccess=function(){var Je=Ge.result;if(!Je){we(Ke);return}Ke.push(Je.key),Je.continue()},Ge.onerror=function(){Te(Ge.error)}}catch(Je){Te(Je)}})}).catch(Te)});return f(oe,re),oe}function Se(re,me){me=g.apply(this,arguments);var oe=this.config();re=typeof re!="function"&&re||{},re.name||(re.name=re.name||oe.name,re.storeName=re.storeName||oe.storeName);var we=this,Te;if(!re.name)Te=h.reject("Invalid arguments");else{var be=re.name===oe.name&&we._dbInfo.db,Fe=be?h.resolve(we._dbInfo.db):M(re).then(function(Ve){var Ge=x[re.name],Ke=Ge.forages;Ge.db=Ve;for(var Je=0;Je<Ke.length;Je++)Ke[Je]._dbInfo.db=Ve;return Ve});re.storeName?Te=Fe.then(function(Ve){if(Ve.objectStoreNames.contains(re.storeName)){var Ge=Ve.version+1;T(re);var Ke=x[re.name],Je=Ke.forages;Ve.close();for(var xt=0;xt<Je.length;xt++){var nn=Je[xt];nn._dbInfo.db=null,nn._dbInfo.version=Ge}var Cn=new h(function(Tn,qr){var Ir=l.open(re.name,Ge);Ir.onerror=function(co){var V0=Ir.result;V0.close(),qr(co)},Ir.onupgradeneeded=function(){var co=Ir.result;co.deleteObjectStore(re.storeName)},Ir.onsuccess=function(){var co=Ir.result;co.close(),Tn(co)}});return Cn.then(function(Tn){Ke.db=Tn;for(var qr=0;qr<Je.length;qr++){var Ir=Je[qr];Ir._dbInfo.db=Tn,j(Ir._dbInfo)}}).catch(function(Tn){throw(D(re,Tn)||h.resolve()).catch(function(){}),Tn})}}):Te=Fe.then(function(Ve){T(re);var Ge=x[re.name],Ke=Ge.forages;Ve.close();for(var Je=0;Je<Ke.length;Je++){var xt=Ke[Je];xt._dbInfo.db=null}var nn=new h(function(Cn,Tn){var qr=l.deleteDatabase(re.name);qr.onerror=function(){var Ir=qr.result;Ir&&Ir.close(),Tn(qr.error)},qr.onblocked=function(){console.warn('dropInstance blocked for database "'+re.name+'" until all open connections are closed')},qr.onsuccess=function(){var Ir=qr.result;Ir&&Ir.close(),Cn(Ir)}});return nn.then(function(Cn){Ge.db=Cn;for(var Tn=0;Tn<Ke.length;Tn++){var qr=Ke[Tn];j(qr._dbInfo)}}).catch(function(Cn){throw(D(re,Cn)||h.resolve()).catch(function(){}),Cn})})}return f(Te,me),Te}var Ce={_driver:"asyncStorage",_initStorage:te,_support:u(),iterate:de,getItem:ae,setItem:ue,removeItem:le,clear:ve,length:_e,key:Ne,keys:Pe,dropInstance:Se};function O(){return typeof openDatabase=="function"}var X="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ee="~~local_forage_type~",V=/^~~local_forage_type~([^~]+)~/,H="__lfsc__:",se=H.length,z="arbf",Q="blob",Y="si08",ce="ui08",he="uic8",ge="si16",Ee="si32",Le="ur16",qe="ui32",lt="fl32",rt="fl64",Pt=se+z.length,en=Object.prototype.toString;function gt(re){var me=re.length*.75,oe=re.length,we,Te=0,be,Fe,Ve,Ge;re[re.length-1]==="="&&(me--,re[re.length-2]==="="&&me--);var Ke=new ArrayBuffer(me),Je=new Uint8Array(Ke);for(we=0;we<oe;we+=4)be=X.indexOf(re[we]),Fe=X.indexOf(re[we+1]),Ve=X.indexOf(re[we+2]),Ge=X.indexOf(re[we+3]),Je[Te++]=be<<2|Fe>>4,Je[Te++]=(Fe&15)<<4|Ve>>2,Je[Te++]=(Ve&3)<<6|Ge&63;return Ke}function Wt(re){var me=new Uint8Array(re),oe="",we;for(we=0;we<me.length;we+=3)oe+=X[me[we]>>2],oe+=X[(me[we]&3)<<4|me[we+1]>>4],oe+=X[(me[we+1]&15)<<2|me[we+2]>>6],oe+=X[me[we+2]&63];return me.length%3===2?oe=oe.substring(0,oe.length-1)+"=":me.length%3===1&&(oe=oe.substring(0,oe.length-2)+"=="),oe}function wn(re,me){var oe="";if(re&&(oe=en.call(re)),re&&(oe==="[object ArrayBuffer]"||re.buffer&&en.call(re.buffer)==="[object ArrayBuffer]")){var we,Te=H;re instanceof ArrayBuffer?(we=re,Te+=z):(we=re.buffer,oe==="[object Int8Array]"?Te+=Y:oe==="[object Uint8Array]"?Te+=ce:oe==="[object Uint8ClampedArray]"?Te+=he:oe==="[object Int16Array]"?Te+=ge:oe==="[object Uint16Array]"?Te+=Le:oe==="[object Int32Array]"?Te+=Ee:oe==="[object Uint32Array]"?Te+=qe:oe==="[object Float32Array]"?Te+=lt:oe==="[object Float64Array]"?Te+=rt:me(new Error("Failed to get type for BinaryArray"))),me(Te+Wt(we))}else if(oe==="[object Blob]"){var be=new FileReader;be.onload=function(){var Fe=ee+re.type+"~"+Wt(this.result);me(H+Q+Fe)},be.readAsArrayBuffer(re)}else try{me(JSON.stringify(re))}catch(Fe){console.error("Couldn't convert value into a JSON string: ",re),me(null,Fe)}}function J(re){if(re.substring(0,se)!==H)return JSON.parse(re);var me=re.substring(Pt),oe=re.substring(se,Pt),we;if(oe===Q&&V.test(me)){var Te=me.match(V);we=Te[1],me=me.substring(Te[0].length)}var be=gt(me);switch(oe){case z:return be;case Q:return d([be],{type:we});case Y:return new Int8Array(be);case ce:return new Uint8Array(be);case he:return new Uint8ClampedArray(be);case ge:return new Int16Array(be);case Le:return new Uint16Array(be);case Ee:return new Int32Array(be);case qe:return new Uint32Array(be);case lt:return new Float32Array(be);case rt:return new Float64Array(be);default:throw new Error("Unkown type: "+oe)}}var Me={serialize:wn,deserialize:J,stringToBuffer:gt,bufferToString:Wt};function Be(re,me,oe,we){re.executeSql("CREATE TABLE IF NOT EXISTS "+me.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],oe,we)}function Qe(re){var me=this,oe={db:null};if(re)for(var we in re)oe[we]=typeof re[we]!="string"?re[we].toString():re[we];var Te=new h(function(be,Fe){try{oe.db=openDatabase(oe.name,String(oe.version),oe.description,oe.size)}catch(Ve){return Fe(Ve)}oe.db.transaction(function(Ve){Be(Ve,oe,function(){me._dbInfo=oe,be()},function(Ge,Ke){Fe(Ke)})},Fe)});return oe.serializer=Me,Te}function ye(re,me,oe,we,Te,be){re.executeSql(oe,we,Te,function(Fe,Ve){Ve.code===Ve.SYNTAX_ERR?Fe.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[me.storeName],function(Ge,Ke){Ke.rows.length?be(Ge,Ve):Be(Ge,me,function(){Ge.executeSql(oe,we,Te,be)},be)},be):be(Fe,Ve)},be)}function De(re,me){var oe=this;re=m(re);var we=new h(function(Te,be){oe.ready().then(function(){var Fe=oe._dbInfo;Fe.db.transaction(function(Ve){ye(Ve,Fe,"SELECT * FROM "+Fe.storeName+" WHERE key = ? LIMIT 1",[re],function(Ge,Ke){var Je=Ke.rows.length?Ke.rows.item(0).value:null;Je&&(Je=Fe.serializer.deserialize(Je)),Te(Je)},function(Ge,Ke){be(Ke)})})}).catch(be)});return f(we,me),we}function K(re,me){var oe=this,we=new h(function(Te,be){oe.ready().then(function(){var Fe=oe._dbInfo;Fe.db.transaction(function(Ve){ye(Ve,Fe,"SELECT * FROM "+Fe.storeName,[],function(Ge,Ke){for(var Je=Ke.rows,xt=Je.length,nn=0;nn<xt;nn++){var Cn=Je.item(nn),Tn=Cn.value;if(Tn&&(Tn=Fe.serializer.deserialize(Tn)),Tn=re(Tn,Cn.key,nn+1),Tn!==void 0){Te(Tn);return}}Te()},function(Ge,Ke){be(Ke)})})}).catch(be)});return f(we,me),we}function Ie(re,me,oe,we){var Te=this;re=m(re);var be=new h(function(Fe,Ve){Te.ready().then(function(){me===void 0&&(me=null);var Ge=me,Ke=Te._dbInfo;Ke.serializer.serialize(me,function(Je,xt){xt?Ve(xt):Ke.db.transaction(function(nn){ye(nn,Ke,"INSERT OR REPLACE INTO "+Ke.storeName+" (key, value) VALUES (?, ?)",[re,Je],function(){Fe(Ge)},function(Cn,Tn){Ve(Tn)})},function(nn){if(nn.code===nn.QUOTA_ERR){if(we>0){Fe(Ie.apply(Te,[re,Ge,oe,we-1]));return}Ve(nn)}})})}).catch(Ve)});return f(be,oe),be}function St(re,me,oe){return Ie.apply(this,[re,me,oe,1])}function P(re,me){var oe=this;re=m(re);var we=new h(function(Te,be){oe.ready().then(function(){var Fe=oe._dbInfo;Fe.db.transaction(function(Ve){ye(Ve,Fe,"DELETE FROM "+Fe.storeName+" WHERE key = ?",[re],function(){Te()},function(Ge,Ke){be(Ke)})})}).catch(be)});return f(we,me),we}function Ae(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){var be=me._dbInfo;be.db.transaction(function(Fe){ye(Fe,be,"DELETE FROM "+be.storeName,[],function(){we()},function(Ve,Ge){Te(Ge)})})}).catch(Te)});return f(oe,re),oe}function je(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){var be=me._dbInfo;be.db.transaction(function(Fe){ye(Fe,be,"SELECT COUNT(key) as c FROM "+be.storeName,[],function(Ve,Ge){var Ke=Ge.rows.item(0).c;we(Ke)},function(Ve,Ge){Te(Ge)})})}).catch(Te)});return f(oe,re),oe}function Z(re,me){var oe=this,we=new h(function(Te,be){oe.ready().then(function(){var Fe=oe._dbInfo;Fe.db.transaction(function(Ve){ye(Ve,Fe,"SELECT key FROM "+Fe.storeName+" WHERE id = ? L
993IMIT 1",[re+1],function(Ge,Ke){var Je=Ke.rows.length?Ke.rows.item(0).key:null;Te(Je)},function(Ge,Ke){be(Ke)})})}).catch(be)});return f(we,me),we}function fe(re){var me=this,oe=new h(function(we,Te){me.ready().then(function(){var be=me._dbInfo;be.db.transaction(function(Fe){ye(Fe,be,"SELECT key FROM "+be.storeName,[],function(Ve,Ge){for(var Ke=[],Je=0;Je<Ge.rows.length;Je++)Ke.push(Ge.rows.item(Je).key);we(Ke)},function(Ve,Ge){Te(Ge)})})}).catch(Te)});return f(oe,re),oe}function Re(re){return new h(function(me,oe){re.transaction(function(we){we.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Te,be){for(var Fe=[],Ve=0;Ve<be.rows.length;Ve++)Fe.push(be.rows.item(Ve).name);me({db:re,storeNames:Fe})},function(Te,be){oe(be)})},function(we){oe(we)})})}function ht(re,me){me=g.apply(this,arguments);var oe=this.config();re=typeof re!="function"&&re||{},re.name||(re.name=re.name||oe.name,re.storeName=re.storeName||oe.storeName);var we=this,Te;return re.name?Te=new h(function(be){var Fe;re.name===oe.name?Fe=we._dbInfo.db:Fe=openDatabase(re.name,"","",0),re.storeName?be({db:Fe,storeNames:[re.storeName]}):be(Re(Fe))}).then(function(be){return new h(function(Fe,Ve){be.db.transaction(function(Ge){function Ke(Cn){return new h(function(Tn,qr){Ge.executeSql("DROP TABLE IF EXISTS "+Cn,[],function(){Tn()},function(Ir,co){qr(co)})})}for(var Je=[],xt=0,nn=be.storeNames.length;xt<nn;xt++)Je.push(Ke(be.storeNames[xt]));h.all(Je).then(function(){Fe()}).catch(function(Cn){Ve(Cn)})},function(Ge){Ve(Ge)})})}):Te=h.reject("Invalid arguments"),f(Te,me),Te}var Ze={_driver:"webSQLStorage",_initStorage:Qe,_support:O(),iterate:K,getItem:De,setItem:St,removeItem:P,clear:Ae,length:je,key:Z,keys:fe,dropInstance:ht};function nt(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function an(re,me){var oe=re.name+"/";return re.storeName!==me.storeName&&(oe+=re.storeName+"/"),oe}function Xo(){var re="_localforage_support_test";try{return localStorage.setItem(re,!0),localStorage.removeItem(re),!1}catch{return!0}}function tr(){return!Xo()||localStorage.length>0}function dn(re){var me=this,oe={};if(re)for(var we in re)oe[we]=re[we];return oe.keyPrefix=an(re,me._defaultConfig),tr()?(me._dbInfo=oe,oe.serializer=Me,h.resolve()):h.reject()}function Mr(re){var me=this,oe=me.ready().then(function(){for(var we=me._dbInfo.keyPrefix,Te=localStorage.length-1;Te>=0;Te--){var be=localStorage.key(Te);be.indexOf(we)===0&&localStorage.removeItem(be)}});return f(oe,re),oe}function _s(re,me){var oe=this;re=m(re);var we=oe.ready().then(function(){var Te=oe._dbInfo,be=localStorage.getItem(Te.keyPrefix+re);return be&&(be=Te.serializer.deserialize(be)),be});return f(we,me),we}function oi(re,me){var oe=this,we=oe.ready().then(function(){for(var Te=oe._dbInfo,be=Te.keyPrefix,Fe=be.length,Ve=localStorage.length,Ge=1,Ke=0;Ke<Ve;Ke++){var Je=localStorage.key(Ke);if(Je.indexOf(be)===0){var xt=localStorage.getItem(Je);if(xt&&(xt=Te.serializer.deserialize(xt)),xt=re(xt,Je.substring(Fe),Ge++),xt!==void 0)return xt}}});return f(we,me),we}function Lg(re,me){var oe=this,we=oe.ready().then(function(){var Te=oe._dbInfo,be;try{be=localStorage.key(re)}catch{be=null}return be&&(be=be.substring(Te.keyPrefix.length)),be});return f(we,me),we}function Fg(re){var me=this,oe=me.ready().then(function(){for(var we=me._dbInfo,Te=localStorage.length,be=[],Fe=0;Fe<Te;Fe++){var Ve=localStorage.key(Fe);Ve.indexOf(we.keyPrefix)===0&&be.push(Ve.substring(we.keyPrefix.length))}return be});return f(oe,re),oe}function xr(re){var me=this,oe=me.keys().then(function(we){return we.length});return f(oe,re),oe}function sa(re,me){var oe=this;re=m(re);var we=oe.ready().then(function(){var Te=oe._dbInfo;localStorage.removeItem(Te.keyPrefix+re)});return f(we,me),we}function is(re,me,oe){var we=this;re=m(re);var Te=we.ready().then(function(){me===void 0&&(me=null);var be=me;return new h(function(Fe,Ve){var Ge=we._dbInfo;Ge.serializer.serialize(me,function(Ke,Je){if(Je)Ve(Je);else try{localStorage.setItem(Ge.keyPrefix+re,Ke),Fe(be)}catch(xt){(xt.name==="QuotaExceededError"||xt.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Ve(xt),Ve(xt)}})})});return f(Te,oe),Te}function Zo(re,me){if(me=g.apply(this,arguments),re=typeof re!="function"&&re||{},!re.name){var oe=this.config();re.name=re.name||oe.name,re.storeName=re.storeName||oe.storeName}var we=this,Te;return re.name?Te=new h(function(be){re.storeName?be(an(re,we._defaultConfig)):be(re.name+"/")}).then(function(be){for(var Fe=localStorage.length-1;Fe>=0;Fe--){var Ve=localStorage.key(Fe);Ve.indexOf(be)===0&&localStorage.removeItem(Ve)}}):Te=h.reject("Invalid arguments"),f(Te,me),Te}var lo={_driver:"localStorageWrapper",_initStorage:dn,_support:nt(),iterate:oi,getItem:_s,setItem:is,removeItem:sa,clear:Mr,length:xr,key:Lg,keys:Fg,dropInstance:Zo},kE=function(me,oe){return me===oe||typeof me=="number"&&typeof oe=="number"&&isNaN(me)&&isNaN(oe)},_ce=function(me,oe){for(var we=me.length,Te=0;Te<we;){if(kE(me[Te],oe))return!0;Te++}return!1},dz=Array.isArray||function(re){return Object.prototype.toString.call(re)==="[object Array]"},U0={},hz={},Bg={INDEXEDDB:Ce,WEBSQL:Ze,LOCALSTORAGE:lo},Sce=[Bg.INDEXEDDB._driver,Bg.WEBSQL._driver,Bg.LOCALSTORAGE._driver],CE=["dropInstance"],Hj=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(CE),Ece={description:"",driver:Sce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function kce(re,me){re[me]=function(){var oe=arguments;return re.ready().then(function(){return re[me].apply(re,oe)})}}function Wj(){for(var re=1;re<arguments.length;re++){var me=arguments[re];
vendor: 4,575 bytes, line 993
993if(me)for(var oe in me)me.hasOwnProperty(oe)&&(dz(me[oe])?arguments[0][oe]=me[oe].slice():arguments[0][oe]=me[oe])}return arguments[0]}var Cce=function(){function re(me){a(this,re);for(var oe in Bg)if(Bg.hasOwnProperty(oe)){var we=Bg[oe],Te=we._driver;this[oe]=Te,U0[Te]||this.defineDriver(we)}this._defaultConfig=Wj({},Ece),this._config=Wj({},this._defaultConfig,me),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return re.prototype.config=function(oe){if((typeof oe>"u"?"undefined":i(oe))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var we in oe){if(we==="storeName"&&(oe[we]=oe[we].replace(/\W/g,"_")),we==="version"&&typeof oe[we]!="number")return new Error("Database version must be a number.");this._config[we]=oe[we]}return"driver"in oe&&oe.driver?this.setDriver(this._config.driver):!0}else return typeof oe=="string"?this._config[oe]:this._config},re.prototype.defineDriver=function(oe,we,Te){var be=new h(function(Fe,Ve){try{var Ge=oe._driver,Ke=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!oe._driver){Ve(Ke);return}for(var Je=Hj.concat("_initStorage"),xt=0,nn=Je.length;xt<nn;xt++){var Cn=Je[xt],Tn=!_ce(CE,Cn);if((Tn||oe[Cn])&&typeof oe[Cn]!="function"){Ve(Ke);return}}var qr=function(){for(var V0=function(Tce){return function(){var jce=new Error("Method "+Tce+" is not implemented by the current driver"),fz=h.reject(jce);return f(fz,arguments[arguments.length-1]),fz}},qj=0,Nce=CE.length;qj<Nce;qj++){var Gj=CE[qj];oe[Gj]||(oe[Gj]=V0(Gj))}};qr();var Ir=function(V0){U0[Ge]&&console.info("Redefining LocalForage driver: "+Ge),U0[Ge]=oe,hz[Ge]=V0,Fe()};"_support"in oe?oe._support&&typeof oe._support=="function"?oe._support().then(Ir,Ve):Ir(!!oe._support):Ir(!0)}catch(co){Ve(co)}});return p(be,we,Te),be},re.prototype.driver=function(){return this._driver||null},re.prototype.getDriver=function(oe,we,Te){var be=U0[oe]?h.resolve(U0[oe]):h.reject(new Error("Driver not found."));return p(be,we,Te),be},re.prototype.getSerializer=function(oe){var we=h.resolve(Me);return p(we,oe),we},re.prototype.ready=function(oe){var we=this,Te=we._driverSet.then(function(){return we._ready===null&&(we._ready=we._initDriver()),we._ready});return p(Te,oe,oe),Te},re.prototype.setDriver=function(oe,we,Te){var be=this;dz(oe)||(oe=[oe]);var Fe=this._getSupportedDrivers(oe);function Ve(){be._config.driver=be.driver()}function Ge(xt){return be._extend(xt),Ve(),be._ready=be._initStorage(be._config),be._ready}function Ke(xt){return function(){var nn=0;function Cn(){for(;nn<xt.length;){var Tn=xt[nn];return nn++,be._dbInfo=null,be._ready=null,be.getDriver(Tn).then(Ge).catch(Cn)}Ve();var qr=new Error("No available storage method found.");return be._driverSet=h.reject(qr),be._driverSet}return Cn()}}var Je=this._driverSet!==null?this._driverSet.catch(function(){return h.resolve()}):h.resolve();return this._driverSet=Je.then(function(){var xt=Fe[0];return be._dbInfo=null,be._ready=null,be.getDriver(xt).then(function(nn){be._driver=nn._driver,Ve(),be._wrapLibraryMethodsWithReady(),be._initDriver=Ke(Fe)})}).catch(function(){Ve();var xt=new Error("No available storage method found.");return be._driverSet=h.reject(xt),be._driverSet}),p(this._driverSet,we,Te),this._driverSet},re.prototype.supports=function(oe){return!!hz[oe]},re.prototype._extend=function(oe){Wj(this,oe)},re.prototype._getSupportedDrivers=function(oe){for(var we=[],Te=0,be=oe.length;Te<be;Te++){var Fe=oe[Te];this.supports(Fe)&&we.push(Fe)}return we},re.prototype._wrapLibraryMethodsWithReady=function(){for(var oe=0,we=Hj.length;oe<we;oe++)kce(this,Hj[oe])},re.prototype.createInstance=function(oe){return new re(oe)},re}(),Ace=new Cce;r.exports=Ace},{3:3}]},{},[4])(4)})})(Xae);var mUe=Xae.exports;const $W=ro(mUe);class Zae{constructor(e,t,r){this.urlCache={},this.storage=void 0,this.name=e,this.requester=t||Y1,this.resolver=r,this.online=!0,this.checkRequirements(),this.addListeners()}checkRequirements(){try{let e;typeof $W>"u"&&(e=$W),this.storage=e.createInstance({name:this.name})}catch{throw new Error("localForage lib not loaded")}}addListeners(){this._status=this.status.bind(this),window.addEventListener("online",this._status),window.addEventListener("offline",this._status)}removeListeners(){window.removeEventListener("online",this._status),window.removeEventListener("offline",this._status),this._status=void 0}status(e){let t=navigator.onLine;
993this.online=t,t?this.emit("online",this):this.emit("offline",this)}add(e,t){let r=e.resources.map(s=>{let{href:i}=s,a=this.resolver(i),o=window.encodeURIComponent(a);return this.storage.getItem(o).then(l=>!l||t?this.requester(a,"binary").then(u=>this.storage.setItem(o,u)):l)});return Promise.all(r)}put(e,t,r){let s=window.encodeURIComponent(e);return this.storage.getItem(s).then(i=>i||this.requester(e,"binary",t,r).then(a=>this.storage.setItem(s,a)))}request(e,t,r,s){return this.online?this.requester(e,t,r,s).then(i=>(this.put(e),i)):this.retrieve(e,t)}retrieve(e,t){new fn;var r,s=new xd(e);return t||(t=s.extension),t=="blob"?r=this.getBlob(e):r=this.getText(e),r.then(i=>{var a=new fn,o;return i?(o=this.handleResponse(i,t),a.resolve(o)):a.reject({message:"File not found in storage: "+e,stack:new Error().stack}),a.promise})}handleResponse(e,t){var r;return t=="json"?r=JSON.parse(e):K1(t)?r=Wc(e,"text/xml"):t=="xhtml"?r=Wc(e,"application/xhtml+xml"):t=="html"||t=="htm"?r=Wc(e,"text/html"):r=e,r}getBlob(e,t){let r=window.encodeURIComponent(e);return this.storage.getItem(r).then(function(s){if(s)return t=t||my.lookup(e),new Blob([s],{type:t})})}getText(e,t){let r=window.encodeURIComponent(e);return t=t||my.lookup(e),this.storage.getItem(r).then(function(s){var i=new fn,a=new FileReader,o;if(s)return o=new Blob([s],{type:t}),a.addEventListener("loadend",()=>{i.resolve(a.result)}),a.readAsText(o,t),i.promise})}getBase64(e,t){let r=window.encodeURIComponent(e);return t=t||my.lookup(e),this.storage.getItem(r).then(s=>{var i=new fn,a=new FileReader,o;if(s)return o=new Blob([s],{type:t}),a.addEventListener("loadend",()=>{i.resolve(a.result)}),a.readAsDataURL(o,t),i.promise})}createUrl(e,t){var r=new fn,s=window.URL||window.webkitURL||window.mozURL,i,a,o=t&&t.base64;return e in this.urlCache?(r.resolve(this.urlCache[e]),r.promise):(o?(a=this.getBase64(e),a&&a.then((function(l){this.urlCache[e]=l,r.resolve(l)}).bind(this))):(a=this.getBlob(e),a&&a.then((function(l){i=s.createObjectURL(l),this.urlCache[e]=i,r.resolve(i)}).bind(this))),a||r.reject({message:"File not found in storage: "+e,stack:new Error().stack}),r.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,r=this.urlCache[e];r&&t.revokeObjectURL(r)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.urlCache={},this.removeListeners()}}Jc(Zae.prototype);class vD{constructor(e){this.interactive="",this.fixedLayout="",this.openToSpread="",this.orientationLock="",e&&this.parse(e)}parse(e){if(!e)return this;const t=Vn(e,"display_options");return t?(yd(t,"option").forEach(s=>{let i="";switch(s.childNodes.length&&(i=s.childNodes[0].nodeValue),s.attributes.name.value){case"interactive":this.interactive=i;break;case"fixed-layout":this.fixedLayout=i;break;case"open-to-spread":this.openToSpread=i;break;case"orientation-lock":this.orientationLock=i;break}}),this):this}destroy(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}}const UW="META-INF/container.xml",gUe="META-INF/com.apple.ibooks.display-options.xml",nl={BINARY:"binary",BASE64:"base64",EPUB:"epub",OPF:"opf",MANIFEST:"json",DIRECTORY:"directory"};class GB{constructor(e,t){typeof t>"u"&&typeof e!="string"&&!(e instanceof Blob)&&!(e instanceof ArrayBuffer)&&(t=e,e=void 0),this.settings=ri(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),ri(this.settings,t),this.opening=new fn,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new fn,spine:new fn,metadata:new fn,cover:new fn,navigation:new fn,pageList:new fn,resources:new fn,displayOptions:new fn},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise,displayOptions:this.loading.displayOptions.promise}
993,this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||Y1,this.spine=new O6e,this.locations=new Dae(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),e&&this.open(e,this.settings.openAs).catch(r=>{var s=new Error("Cannot load book at "+e);this.emit(ot.BOOK.OPEN_FAILED,s)})}open(e,t){var r,s=t||this.determineType(e);return s===nl.BINARY?(this.archived=!0,this.url=new pl("/",""),r=this.openEpub(e)):s===nl.BASE64?(this.archived=!0,this.url=new pl("/",""),r=this.openEpub(e,s)):s===nl.EPUB?(this.archived=!0,this.url=new pl("/",""),r=this.request(e,"binary",this.settings.requestCredentials,this.settings.requestHeaders).then(this.openEpub.bind(this))):s==nl.OPF?(this.url=new pl(e),r=this.openPackaging(this.url.Path.toString())):s==nl.MANIFEST?(this.url=new pl(e),r=this.openManifest(this.url.Path.toString())):(this.url=new pl(e),r=this.openContainer(UW).then(this.openPackaging.bind(this))),r}openEpub(e,t){return this.unarchive(e,t||this.settings.encoding).then(()=>this.openContainer(UW)).then(r=>this.openPackaging(r))}openContainer(e){return this.load(e).then(t=>(this.container=new M6e(t),this.resolve(this.container.packagePath)))}openPackaging(e){return this.path=new xd(e),this.load(e).then(t=>(this.packaging=new DW(t),this.unpack(this.packaging)))}openManifest(e){return this.path=new xd(e),this.load(e).then(t=>(this.packaging=new DW,this.packaging.load(t),this.unpack(this.packaging)))}load(e){var t=this.resolve(e);return this.archived?this.archive.request(t):this.request(t,null,this.settings.requestCredentials,this.settings.requestHeaders)}resolve(e,t){if(e){var r=e,s=e.indexOf("://")>-1;return s?e:(this.path&&(r=this.path.resolve(e)),t!=!1&&this.url&&(r=this.url.resolve(r)),r)}}canonical(e){var t=e;return e?(this.settings.canonical?t=this.settings.canonical(e):t=this.resolve(e,!0),t):""}determineType(e){var t,r,s;if(this.settings.encoding==="base64")return nl.BASE64;if(typeof e!="string")return nl.BINARY;if(t=new pl(e),r=t.path(),s=r.extension,s&&(s=s.replace(/\?.*$/,"")),!s)return nl.DIRECTORY;if(s==="epub")return nl.EPUB;if(s==="opf")return nl.OPF;if(s==="json")return nl.MANIFEST}unpack(e){this.package=e,this.packaging.metadata.layout===""?this.load(this.url.resolve(gUe)).then(t=>{this.displayOptions=new vD(t),this.loading.displayOptions.resolve(this.displayOptions)}).catch(t=>{this.displayOptions=new vD,this.loading.displayOptions.resolve(this.displayOptions)}):(this.displayOptions=new vD,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new B6e(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?"blobUrl":"base64")}),this.loadNavigation(this.packaging).then(()=>{this.loading.navigation.resolve(this.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived||this.settings.replacements&&this.settings.replacements!="none"?this.replacements().then(()=>{this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}).catch(t=>{console.error(t)}):this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}loadNavigation(e){let t=e.navPath||e.ncxPath,r=e.toc;return r?new Promise((s,i)=>{this.navigation=new pD(r),e.pageList&&(this.pageList=new mD(e.pageList)),s(this.navigation)}):t?this.load(t,"xml").then(s=>(this.navigation=new pD(s),this.pageList=new mD(s),this.navigation)):new Promise((s,i)=>{this.navigation=new pD,this.pageList=new mD,s(this.navigation)})}section(e){return this.spine.get(e)}renderTo(e,t){return this.rendition=new qB(this,t),this.rendition.attachTo(e),this.rendition}setRequestCredentials(e){this.settings.requestCredentials=e}setRequestHeaders(e){this.settings.requestHeaders=e}
993unarchive(e,t){return this.archive=new pUe,this.archive.open(e,t)}store(e){let t=this.settings.replacements&&this.settings.replacements!=="none",r=this.url,s=this.settings.requestMethod||Y1.bind(this);return this.storage=new Zae(e,s,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(()=>{this.archived&&(this.storage.requester=this.archive.request.bind(this.archive));let i=(a,o)=>{o.output=this.resources.substitute(a,o.url)};this.resources.settings.replacements=t||"blobUrl",this.resources.replacements().then(()=>this.resources.replaceCss()),this.storage.on("offline",()=>{this.url=new pl("/",""),this.spine.hooks.serialize.register(i)}),this.storage.on("online",()=>{this.url=r,this.spine.hooks.serialize.deregister(i)})}),this.storage}coverUrl(){return this.loaded.cover.then(()=>this.cover?this.archived?this.archive.createUrl(this.cover):this.cover:null)}replacements(){return this.spine.hooks.serialize.register((e,t)=>{t.output=this.resources.substitute(e,t.url)}),this.resources.replacements().then(()=>this.resources.replaceCss())}getRange(e){var t=new pn(e),r=this.spine.get(t.spinePos),s=this.load.bind(this);return r?r.load(s).then(function(i){var a=t.toRange(r.document);return a}):new Promise((i,a)=>{a("CFI could not be found")})}key(e){var t=e||this.packaging.metadata.identifier||this.url.filename;return`epubjs:${Tj}:${t}`}destroy(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}}Jc(GB.prototype);function Dg(n,e){return new GB(n,e)}Dg.VERSION=Tj;typeof global<"u"&&(global.EPUBJS_VERSION=Tj);Dg.Book=GB;Dg.Rendition=qB;Dg.Contents=VB;Dg.CFI=pn;Dg.utils=C6e;const vUe="Left",yUe="Right",xUe="Up",bUe="Down",Yv={delta:10,preventScrollOnSwipe:!1,rotationAngle:0,trackMouse:!1,trackTouch:!0,swipeDuration:1/0,touchEventOptions:{passive:!0}},KI={first:!0,initial:[0,0],start:0,swiping:!1,xy:[0,0]},VW="mousemove",HW="mouseup",wUe="touchend",_Ue="touchmove",SUe="touchstart";function EUe(n,e,t,r){return n>e?t>0?yUe:vUe:r>0?bUe:xUe}function WW(n,e){if(e===0)return n;const t=Math.PI/180*e,r=n[0]*Math.cos(t)+n[1]*Math.sin(t),s=n[1]*Math.cos(t)-n[0]*Math.sin(t);return[r,s]}function kUe(n,e){const t=d=>{const h="touches"in d;h&&d.touches.length>1||n((f,p)=>{p.trackMouse&&!h&&(document.addEventListener(VW,r),document.addEventListener(HW,a));const{clientX:m,clientY:g}=h?d.touches[0]:d,y=WW([m,g],p.rotationAngle);return p.onTouchStartOrOnMouseDown&&p.onTouchStartOrOnMouseDown({event:d}),Object.assign(Object.assign(Object.assign({},f),KI),{initial:y.slice(),xy:y,start:d.timeStamp||0})})},r=d=>{n((h,f)=>{const p="touches"in d;if(p&&d.touches.length>1)return h;if(d.timeStamp-h.start>f.swipeDuration)return h.swiping?Object.assign(Object.assign({},h),{swiping:!1}):h;const{clientX:m,clientY:g}=p?d.touches[0]:d,[y,v]=WW([m,g],f.rotationAngle),x=y-h.xy[0],b=v-h.xy[1],E=Math.abs(x),S=Math.abs(b),k=(d.timeStamp||0)-h.start,C=Math.sqrt(E*E+S*S)/(k||1),A=[x/(k||1),b/(k||1)],T=EUe(E,S,x,b),j=typeof f.delta=="number"?f.delta:f.delta[T.toLowerCase()]||Yv.delta;if(E<j&&S<j&&!h.swiping)return h;const D={absX:E,absY:S,deltaX:x,deltaY:b,dir:T,event:d,first:h.first,initial:h.initial,velocity:C,vxvy:A};D.first&&f.onSwipeStart&&f.onSwipeStart(D),f.onSwiping&&f.onSwiping(D);let R=!1;return(f.onSwiping||f.onSwiped||f[`onSwiped${T}`])&&(R=!0),R&&f.preventScrollOnSwipe&&f.trackTouch&&d.cancelable&&d.preventDefault(),Object.assign(Object.assign({},h),{first:!1,eventData:D,swiping:!0})})},s=d=>{n((h,f)=>{let p;if(h.swiping&&h.eventData){if(d.timeStamp-h.start<f.swipeDuration){p=Object.assign(Object.assign({},h.eventData),{event:d}),f.onSwiped&&f.onSwiped(p);const m=f[`onSwiped${p.dir}`];m&&m(p)}}
993else f.onTap&&f.onTap({event:d});return f.onTouchEndOrOnMouseUp&&f.onTouchEndOrOnMouseUp({event:d}),Object.assign(Object.assign(Object.assign({},h),KI),{eventData:p})})},i=()=>{document.removeEventListener(VW,r),document.removeEventListener(HW,a)},a=d=>{i(),s(d)},o=(d,h)=>{let f=()=>{};if(d&&d.addEventListener){const p=Object.assign(Object.assign({},Yv.touchEventOptions),h.touchEventOptions),m=[[SUe,t,p],[_Ue,r,Object.assign(Object.assign({},p),h.preventScrollOnSwipe?{passive:!1}:{})],[wUe,s,p]];m.forEach(([g,y,v])=>d.addEventListener(g,y,v)),f=()=>m.forEach(([g,y])=>d.removeEventListener(g,y))}return f},u={ref:d=>{d!==null&&n((h,f)=>{if(h.el===d)return h;const p={};return h.el&&h.el!==d&&h.cleanUpTouch&&(h.cleanUpTouch(),p.cleanUpTouch=void 0),f.trackTouch&&d&&(p.cleanUpTouch=o(d,f)),Object.assign(Object.assign(Object.assign({},h),{el:d}),p)})}};return e.trackMouse&&(u.onMouseDown=t),[u,o]}function CUe(n,e,t,r){return!e.trackTouch||!n.el?(n.cleanUpTouch&&n.cleanUpTouch(),Object.assign(Object.assign({},n),{cleanUpTouch:void 0})):n.cleanUpTouch?e.preventScrollOnSwipe!==t.preventScrollOnSwipe||e.touchEventOptions.passive!==t.touchEventOptions.passive?(n.cleanUpTouch(),Object.assign(Object.assign({},n),{cleanUpTouch:r(n.el,e)})):n:Object.assign(Object.assign({},n),{cleanUpTouch:r(n.el,e)})}function AUe(n){const{trackMouse:e}=n,t=_.useRef(Object.assign({},KI)),r=_.useRef(Object.assign({},Yv)),s=_.useRef(Object.assign({},r.current));s.current=Object.assign({},r.current),r.current=Object.assign(Object.assign({},Yv),n);let i;for(i in Yv)r.current[i]===void 0&&(r.current[i]=Yv[i]);const[a,o]=_.useMemo(()=>kUe(l=>t.current=l(t.current,r.current),{trackMouse:e}),[e]);return t.current=CUe(t.current,r.current,s.current,o),a}var NUe=Object.defineProperty,TUe=(n,e,t)=>e in n?NUe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ms=(n,e,t)=>TUe(n,typeof e!="symbol"?e+"":e,t);const qW={viewHolder:{position:"relative",height:"100%",width:"100%"},view:{height:"100%"}};class jUe extends _.Component{constructor(e){super(e),ms(this,"state",{isLoaded:!1,isError:!1,toc:[]}),ms(this,"viewerRef",Oe.createRef()),ms(this,"location"),ms(this,"book"),ms(this,"rendition"),ms(this,"prevPage"),ms(this,"nextPage"),ms(this,"onLocationChange",t=>{const{location:r,locationChanged:s}=this.props,i=`${t.start}`;r!==i&&(this.location=i,s&&s(i))}),ms(this,"handleKeyPress",t=>{this.props.handleKeyPress||(t.key==="ArrowRight"&&this.nextPage&&this.nextPage(),t.key==="ArrowLeft"&&this.prevPage&&this.prevPage())}),this.location=e.location,this.book=this.rendition=this.prevPage=this.nextPage=void 0}componentDidMount(){this.initBook(),document.addEventListener("keyup",this.handleKeyPress,!1)}initBook(){const{url:e,tocChanged:t,epubInitOptions:r}=this.props;this.book&&this.book.destroy(),this.book=Dg(e,r),this.book.on("openFailed",s=>{this.setState({isError:!0})}),this.book.loaded.navigation.then(({toc:s})=>{this.setState({isLoaded:!0,isError:!1,toc:s},()=>{t&&t(s),this.initReader()})})}componentWillUnmount(){this.book&&this.book.destroy(),this.book=this.rendition=this.prevPage=this.nextPage=void 0,document.removeEventListener("keyup",this.handleKeyPress,!1)}shouldComponentUpdate(e){return!this.state.isLoaded||e.location!==this.props.location||e.url!==this.props.url}componentDidUpdate(e){var t;e.location!==this.props.location&&this.location!==this.props.location&&((t=this.rendition)==null||t.display(this.props.location+"")),e.url!==this.props.url&&this.initBook()}initReader(){const{toc:e}=this.state,{location:t,epubOptions:r,getRendition:s}=this.props;if(this.viewerRef.current){const i=this.viewerRef.current;if(this.book){const a=this.book.renderTo(i,{width:"100%",height:"100%",...r});this.rendition=a,this.prevPage=()=>{a.prev()},this.nextPage=()=>{a.next()},this.registerEvents(),s&&s(a),typeof t=="string"||typeof t=="number"?a.display(t+""):e.length>0&&e[0].href?a.display(e[0].href):a.display()}}}registerEvents(){const{handleKeyPress:e,handleTextSelected:t}=this.props;this.rendition&&(this.rendition.on("locationChanged",this.onLocationChange),this.rendition.on("keyup",e||this.handleKeyPress),t&&this.rendition.on("selected",t))}renderBook(){const{epubViewStyles:e=qW}=this.props;return c.jsx("div",{ref:this.viewerRef,style:e.view})}render(){const{isLoaded:e,isError:t}=this.state,{loadingView:r=null,errorView:s=null,epubViewStyles:i=qW}=this.props;return c.jsxs("div",{style:i.viewHolder,children:[e&&this.renderBook(),!e&&!t&&r,!e&&t&&s]})}}const yD={container:{overflow:"hidden",position:"relative",height:"100%"},readerArea:{position:"relative",zIndex:1,height:"100%",width:"100%",backgroundColor:"#fff",transition:"all .3s ease"},containerExpanded:{transform:"translateX(256px)"},titleArea:{position:"absolute",top:20,left:50,right:50,textAlign:"center",color:"#999"},reader:{position:"absolute",top:50,left:50,bottom:20,right:50},swipeWrapper:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:200},prev:{left:1},next:{right:1},arrow:{outline:"none",border:"none",background:"none",position:"absolute",top:"50%",marginTop:-32,fontSize:64,padding:"0 10px",color:"#E2E2E2",fontFamily:"arial, sans-serif",curs
993or:"pointer",userSelect:"none",appearance:"none",fontWeight:"normal"},arrowHover:{color:"#777"},toc:{},tocBackground:{position:"absolute",left:256,top:0,bottom:0,right:0,zIndex:1},tocArea:{position:"absolute",left:0,top:0,bottom:0,zIndex:0,width:256,overflowY:"auto",WebkitOverflowScrolling:"touch",background:"#f2f2f2",padding:"10px 0"},tocAreaButton:{userSelect:"none",appearance:"none",background:"none",border:"none",display:"block",fontFamily:"sans-serif",width:"100%",fontSize:".9em",textAlign:"left",padding:".9em 1em",borderBottom:"1px solid #ddd",color:"#aaa",boxSizing:"border-box",outline:"none",cursor:"pointer"},tocButton:{background:"none",border:"none",width:32,height:32,position:"absolute",top:10,left:10,borderRadius:2,outline:"none",cursor:"pointer"},tocButtonExpanded:{background:"#f2f2f2"},tocButtonBar:{position:"absolute",width:"60%",background:"#ccc",height:2,left:"50%",margin:"-1px -30%",top:"50%",transition:"all .5s ease"},tocButtonBarTop:{top:"35%"},tocButtonBottom:{top:"66%"},loadingView:{position:"absolute",top:"50%",left:"10%",right:"10%",color:"#ccc",textAlign:"center",marginTop:"-.5em"},errorView:{position:"absolute",top:"50%",left:"10%",right:"10%",color:"#c00",textAlign:"center",marginTop:"-.5em"}},RUe=({children:n,swipeProps:e})=>{const t=AUe(e);return c.jsx("div",{style:{height:"100%"},...t,children:n})},Jae=({data:n,setLocation:e,styles:t})=>c.jsxs("div",{children:[c.jsx("button",{onClick:()=>e(n.href),style:t,children:n.label}),n.subitems&&n.subitems.length>0&&c.jsx("div",{style:{paddingLeft:10},children:n.subitems.map((r,s)=>c.jsx(Jae,{data:r,styles:t,setLocation:e},s))})]});class PUe extends _.PureComponent{constructor(e){super(e),ms(this,"state",{isLoaded:!1,expandedToc:!1,toc:[]}),ms(this,"readerRef",Oe.createRef()),ms(this,"toggleToc",()=>{this.setState({expandedToc:!this.state.expandedToc})}),ms(this,"next",()=>{const t=this.readerRef.current;t&&t.nextPage&&t.nextPage()}),ms(this,"prev",()=>{const t=this.readerRef.current;t&&t.prevPage&&t.prevPage()}),ms(this,"onTocChange",t=>{const{tocChanged:r}=this.props;this.setState({toc:t},()=>r&&r(t))}),ms(this,"setLocation",t=>{const{locationChanged:r}=this.props;this.setState({expandedToc:!1},()=>r&&r(t))}),ms(this,"handleWheel",t=>{var r,s;t.preventDefault();const i=this.readerRef.current;i&&(t.deltaY>0?(r=i.nextPage)==null||r.call(i):t.deltaY<0&&((s=i.prevPage)==null||s.call(i)))}),ms(this,"attachWheelListener",()=>{if(!this.readerRef.current)return;const t=this.readerRef.current.rendition;t&&t.hooks.content.register(r=>{const s=r.window.document;s.removeEventListener("wheel",this.handleWheel),s.addEventListener("wheel",this.handleWheel,{passive:!1})})}),ms(this,"searchInBook",async t=>{var r,s,i,a,o;if(!this.readerRef.current)return;const l=(r=this.readerRef.current)==null?void 0:r.rendition,u=l==null?void 0:l.book;if(!u)return;if(!t){(i=(s=this.props).onSearchResults)==null||i.call(s,[]);return}await u.ready;const d=[],h=[];u.spine.each(f=>{const p=(async()=>{try{await f.load(u.load.bind(u));const m=f.document,g=[],y=m.createTreeWalker(m,NodeFilter.SHOW_TEXT,null,!1);let v;for(;v=y.nextNode();)g.push(v);const x=g.map(S=>S.textContent).join("").toLowerCase(),b=t.toLowerCase();let E=x.indexOf(b);for(;E!==-1;){let S=0,k=E;for(;S<g.length;){const C=g[S].textContent||"";if(k<C.length)break;k-=C.length,S++}if(S<g.length){let C=m.createRange();try{C.setStart(g[S],k),C.setEnd(g[S],k+b.length);const A=f.cfiFromRange(C),T=`${x.substring(Math.max(0,E-(this.props.contextLength||15)),E+b.length+(this.props.contextLength||15))}`;d.push({cfi:A,excerpt:T})}catch(A){console.warn("Skipping invalid range:",A)}}E=x.indexOf(b,E+1)}f.unload()}catch(m){console.error("Error searching chapter:",m)}})();h.push(p)}),await Promise.all(h),t==this.props.searchQuery&&((o=(a=this.props).onSearchResults)==null||o.call(a,d))})}renderToc(){const{toc:e,expandedToc:t}=this.state,{readerStyles:r=yD}=this.props;return c.jsxs("div",{children:[c.jsx("div",{style:r.tocArea,children:c.jsx("div",{style:r.toc,children:e.map((s,i)=>c.jsx(Jae,{data:s,setLocation:this.setLocation,styles:r.tocAreaButton},i))})}
993),t&&c.jsx("div",{style:r.tocBackground,onClick:this.toggleToc})]})}renderTocToggle(){const{expandedToc:e}=this.state,{readerStyles:t=yD}=this.props;return c.jsxs("button",{style:Object.assign({},t.tocButton,e?t.tocButtonExpanded:{}),onClick:this.toggleToc,children:[c.jsx("span",{style:Object.assign({},t.tocButtonBar,t.tocButtonBarTop)}),c.jsx("span",{style:Object.assign({},t.tocButtonBar,t.tocButtonBottom)})]})}componentDidUpdate(e){e.searchQuery!==this.props.searchQuery&&this.searchInBook(this.props.searchQuery),this.props.pageTurnOnScroll===!0&&this.attachWheelListener()}render(){const{title:e,showToc:t=!0,loadingView:r,errorView:s,readerStyles:i=yD,locationChanged:a,swipeable:o,epubViewStyles:l,isRTL:u=!1,pageTurnOnScroll:d=!1,searchQuery:h,contextLength:f,...p}=this.props,{toc:m,expandedToc:g}=this.state;return c.jsxs("div",{style:i.container,children:[c.jsxs("div",{style:Object.assign({},i.readerArea,g?i.containerExpanded:{}),children:[t&&this.renderTocToggle(),c.jsx("div",{style:i.titleArea,children:e}),c.jsx(RUe,{swipeProps:{onSwiped:y=>{const{dir:v}=y;v==="Left"&&(u?this.prev():this.next()),v==="Right"&&(u?this.next():this.prev())},onTouchStartOrOnMouseDown:({event:y})=>y.preventDefault(),touchEventOptions:{passive:!1},preventScrollOnSwipe:!0,trackMouse:!0},children:c.jsxs("div",{style:i.reader,children:[c.jsx(jUe,{ref:this.readerRef,loadingView:r===void 0?c.jsx("div",{style:i.loadingView,children:"Loading…"}):r,errorView:s===void 0?c.jsx("div",{style:i.errorView,children:"Error loading book"}):s,epubViewStyles:l,...p,tocChanged:this.onTocChange,locationChanged:a}),o&&c.jsx("div",{style:i.swipeWrapper})]})}),c.jsx("button",{style:Object.assign({},i.arrow,i.prev),onClick:u?this.next:this.prev,children:"‹"}),c.jsx("button",{style:Object.assign({},i.arrow,i.next),onClick:u?this.prev:this.next,children:"›"})]}),t&&m&&this.renderToc()]})}}const xD=15e3,kk={light:{name:"light",background:"#ffffff",text:"#1e293b",link:"#2563eb"},sepia:{name:"sepia",background:"#f4ecd8",text:"#3d2314",link:"#92400e"},dark:{name:"dark",background:"#0f172a",text:"#e2e8f0",link:"#60a5fa"}};function DUe({url:n,location:e,settings:t,onLocationChange:r,onTocLoad:s,onChapterChange:i,onTextSelect:a,onRenderError:o}){var O,X;const[l,u]=_.useState(e),[d,h]=_.useState(!1),[f,p]=_.useState(0),[m,g]=_.useState(!1),[y,v]=_.useState(null),[x,b]=_.useState(0),[E,S]=_.useState(0),[k,C]=_.useState(!1),[A,T]=_.useState({lastDisplayedHref:"",lastRelocatedCfi:"",currentCfi:"",iframeProbe:"",eventLog:[]}),j=_.useRef(null),D=_.useRef([]),R=_.useRef(null),M=_.useRef(null),N=_.useRef(Date.now()),U=_.useRef(!1),q=_.useRef(!1),I=_.useRef(null),B=_.useRef(null),$=_.useCallback(ee=>{const V=new Date().toISOString().slice(11,23);T(H=>({...H,eventLog:[...H.eventLog.slice(-9),`[${V}] ${ee}`]}))},[]);_.useEffect(()=>{e!==null&&e!==l&&u(e)},[e,l]),_.useEffect(()=>(N.current=Date.now(),h(!1),p(0),U.current=!1,q.current=!1,M.current=setInterval(()=>{p(Math.floor((Date.now()-N.current)/1e3))},1e3),R.current=setTimeout(()=>{h(ee=>(ee||(console.error("[EpubReader] Render timeout after",xD,"ms"),o==null||o(`EPUB render timeout after ${xD/1e3}s - the file may be malformed or too large`)),ee))},xD),()=>{R.current&&clearTimeout(R.current),M.current&&clearInterval(M.current)}),[n,o]),_.useEffect(()=>{d&&(R.current&&clearTimeout(R.current),M.current&&clearInterval(M.current))},[d]);const ie=_.useCallback(ee=>ee.map((V,H)=>({id:V.id||`toc-${H}`,label:V.label,href:V.href,subitems:V.subitems?ie(V.subitems):void 0})),[]),ne=_.useCallback(ee=>{const V=t.lineSpacing==="compact"?1.4:t.lineSpacing==="relaxed"?2:1.6,H=t.fontSize,se=["body","p","div","span","li","a","h1","h2","h3","h4","h5","h6","blockquote","td","th"];Object.values(kk).forEach(z=>{const Q={};se.forEach(Y=>{Q[Y]={color:`${z.text} !important`,"background-color":Y==="body"?`${z.background} !important`:"transparent !important"}}),Q.body={color:`${z.text} !important`,background:`${z.background} !important`,"background-color":`${z.background} !important`,"font-size":`${H}px !important`,"line-height":`${V} !important`,"font-family":"'Source Serif 4', Georgia, serif !important"},Q.a={color:`${z.link} !important`},Q.p={...Q.p,"font-size":`${H}px !important`,"line-height":`${V} !important`},ee.themes.register(z.name,Q)}),U.current=!0},[t.fontSize,t.lineSpacing]),L=_.useCallback(ee=>{const V=t.theme;console.log("[EpubReader] Selecting theme:",V),$(`Theme: ${V}`),ee.themes.select(V)},[t.theme,$]),te=_.useCallback(ee=>{if(q.current)return;const V=kk[t.theme];console.log("[EpubReader] Applying safety styles"),$("Applying safety styles"),ee.hooks.content.register(H=>{try{const se=H.document;if(!se)return;const z=se.getElementById("epub-safety-styles");z&&z.remove();const Q=se.createElement("style");Q.id="epub-safety-styles",Q.textContent=`
994          * {
995            visibility: visible !important;
996            opacity: 1 !important;
997          }
998          body, p, div, span, h1, h2, h3, h4, h5, h6 {
999            color: ${V.text} !important;
1000          }
1001          body {
1002            background-color: ${V.background} !important;
1003            min-height: 100% !important;
1004            overflow: visible !important;
1005          }
1006        `,se.head.appendChild(Q)}catch(se){console.warn("[EpubReader] Safety styles injection failed:",se)}}),q.current=!0},[t.theme,$]),ae=_.useCallback(()=>{var ee,V,H;try{const se=document.querySelector("iframe");
1006if(!(se!=null&&se.contentDocument))return $("probe: no iframe found"),{innerTextLen:0,innerHTMLLen:0};const z=se.contentDocument,Q=z.body,Y=((ee=Q==null?void 0:Q.innerText)==null?void 0:ee.length)||0,ce=((V=Q==null?void 0:Q.innerHTML)==null?void 0:V.length)||0,he=(H=z.defaultView)==null?void 0:H.getComputedStyle(Q),ge={innerTextLen:Y,innerHTMLLen:ce,bodyColor:(he==null?void 0:he.color)||"unknown",bodyBg:(he==null?void 0:he.backgroundColor)||"unknown",bodyVisibility:(he==null?void 0:he.visibility)||"unknown",bodyOpacity:(he==null?void 0:he.opacity)||"unknown",bodyHeight:(he==null?void 0:he.height)||"unknown"};return console.log("[EpubReader] iframe probe:",ge),$(`probe: text=${Y}, html=${ce}`),T(Ee=>({...Ee,iframeProbe:`text=${Y}, html=${ce}, vis=${ge.bodyVisibility}`})),ge}catch(se){return console.warn("[EpubReader] iframe probe failed:",se),$("probe: failed"),{innerTextLen:0,innerHTMLLen:0}}},[$]),de=_.useCallback(()=>{try{const ee=document.querySelector("iframe");if(!(ee!=null&&ee.contentDocument))return;const V=ee.contentDocument;let H=V.getElementById("debug-outlines");m?(H==null||H.remove(),g(!1),$("Outlines OFF")):(H||(H=V.createElement("style"),H.id="debug-outlines"),H.textContent="* { outline: 1px solid red !important; box-shadow: inset 0 0 2px blue; }",V.head.appendChild(H),g(!0),$("Outlines ON"))}catch(ee){console.warn("[EpubReader] Toggle outlines failed:",ee)}},[m,$]),ue=_.useCallback(ee=>{if(u(ee),T(V=>({...V,currentCfi:ee})),j.current){const V=j.current.location;if(V&&V.start){const H=(V.start.percentage||0)*100;r(ee,H);const se=V.start.href,z=Y=>{for(const ce of Y){if(ce.href.includes(se))return ce.label;if(ce.subitems){const he=z(ce.subitems);if(he)return he}}return null},Q=z(D.current);Q&&i(Q)}}},[r,i]),le=_.useCallback(ee=>{j.current=ee,console.log("[EpubReader] Rendition ready"),$("Rendition ready"),ne(ee),L(ee),ee.on("rendered",V=>{console.log("[EpubReader] rendered:",V==null?void 0:V.href),$(`rendered: ${(V==null?void 0:V.href)||"unknown"}`),setTimeout(()=>{ae().innerTextLen>0&&($("Content detected, applying safety styles"),te(ee))},100)}),ee.on("displayed",V=>{const H=(V==null?void 0:V.href)||"unknown";console.log("[EpubReader] displayed:",H),$(`displayed: ${H}`),T(se=>({...se,lastDisplayedHref:H})),h(!0),setTimeout(()=>ae(),200)}),ee.on("relocated",V=>{var se;const H=((se=V==null?void 0:V.start)==null?void 0:se.cfi)||"";console.log("[EpubReader] relocated:",H),$(`relocated: ${H.slice(0,50)}...`),T(z=>({...z,lastRelocatedCfi:H})),h(!0)}),ee.on("selected",(V,H)=>{var z;const se=((z=ee.getRange(V))==null?void 0:z.toString())||"";se.trim()&&a(se,V)}),console.log("[EpubReader] Rendition setup complete, letting ReactReader handle display"),$("Rendition setup complete")},[ne,L,te,ae,a,$]),ve=_.useCallback(ee=>{D.current=ee,s(ie(ee)),console.log("[EpubReader] TOC loaded:",ee.length,"items"),$(`TOC loaded: ${ee.length} items`)},[ie,s,$]);_.useEffect(()=>{j.current&&U.current&&(ne(j.current),L(j.current))},[t,ne,L]);const _e=_.useCallback(ee=>{const V=ee.currentTarget.getBoundingClientRect(),se=(ee.clientX-V.left)/V.width,z=se<.3?"left":se>.7?"right":"center";try{ee.currentTarget.setPointerCapture(ee.pointerId)}catch{}B.current={x:ee.clientX,y:ee.clientY,time:Date.now(),zone:z,pointerId:ee.pointerId},b(0),v(null)},[]),Ne=_.useCallback(ee=>{var se;if(!B.current)return;const V=ee.clientX-B.current.x,H=ee.clientY-B.current.y;if(Math.abs(V)>Math.abs(H)&&Math.abs(V)>20){const z=((se=I.current)==null?void 0:se.offsetWidth)||400,Q=Math.min(Math.abs(V)/(z*.4),1);b(Q),v(V<0?"left":"right")}},[]),Pe=_.useCallback(ee=>{try{ee.currentTarget.releasePointerCapture(ee.pointerId)}catch{}if(!B.current||!j.current||!d){b(0),v(null),B.current=null;return}const V=Date.now();if(V-E<250){B.current=null,b(0),v(null);return}const H=ee.clientX-B.current.x,se=ee.clientY-B.current.y,z=V-B.current.time,Q=Math.abs(H)<10&&Math.abs(se)<10&&z<350,Y=60,ce=()=>{var ge;v("left"),b(1),S(V);try{(ge=j.current)==null||ge.next()}catch(Ee){console.warn("[EpubReader] next() failed:",Ee)}setTimeout(()=>{b(0),v(null)},200)},he=()=>{var ge;v("right"),b(1),S(V);try{(ge=j.current)==null||ge.prev()}catch(Ee){console.warn("[EpubReader] prev() failed:",Ee)}setTimeout(()=>{b(0),v(null)},200)};if(Q){B.current.zone==="left"?he():B.current.zone==="right"&&ce(),B.current=null;return}Math.abs(H)>Math.abs(se)&&Math.abs(H)>Y?H<0?ce():he():(b(0),v(null)),B.current=null},[d,E]),Se=_.useCallback(()=>{const ee=kk[t.theme];return{container:{overflow:"hidden",height:"100%",position:"relative"},readerArea:{position:"relative",zIndex:5,height:"100%",width:"100%",backgroundColor:ee.background,transition:"background-color 0.3s",overflow:"hidden"},containerExpanded:{transform:"translateX(0)"},titleArea:{display:"none"},reader:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:10},swipeWrapper:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:200},prev:{left:0,background:"transparent"},next:{right:0,background:"transparent"},arrow:{outline:"none",border:"none",background:"none",position:"absolute",top:"50%",marginTop:"-32px",fontSize:"40px",padding:"0 10px",color:t.theme==="dark"?"#888":"#333",cursor:"pointer",userSelect:"none",opacity:.5,transition:"opacity 0.2s"},arrowHover:{opacity:1}
1006,tocBackground:{display:"none"},tocArea:{display:"none"},tocAreaButton:{display:"none"},tocButton:{display:"none"},tocButtonExpanded:{display:"none"},tocButtonBar:{display:"none"},tocButtonBarTop:{display:"none"},loadingView:{display:"none"},toc:{},errorView:{},tocButtonBottom:{}}},[t.theme]),Ce=kk[t.theme];return c.jsxs("div",{ref:I,className:ke("w-full h-full relative"),style:{backgroundColor:Ce.background,minHeight:"400px"},children:[c.jsx("div",{className:"absolute inset-0 z-[100]","data-gesture-zone":"center",style:{touchAction:"pan-y",background:"transparent"},onPointerDown:_e,onPointerMove:Ne,onPointerUp:Pe,onPointerCancel:Pe}),c.jsx(y3,{children:y&&x>0&&c.jsxs(c.Fragment,{children:[c.jsx(Oc.div,{initial:{opacity:0,scale:.8},animate:{opacity:x*.8,scale:.9+x*.1},exit:{opacity:0,scale:.8},transition:{duration:.15},className:ke("absolute top-1/2 -translate-y-1/2 z-[300] pointer-events-none","flex items-center justify-center w-14 h-14 rounded-full",y==="left"?"right-4":"left-4"),style:{backgroundColor:`${Ce.text}15`,backdropFilter:"blur(4px)"},children:y==="left"?c.jsx(cd,{className:"w-8 h-8",style:{color:Ce.text,opacity:.7}}):c.jsx(CS,{className:"w-8 h-8",style:{color:Ce.text,opacity:.7}})}),c.jsx(Oc.div,{initial:{opacity:0}
1006,animate:{opacity:x*.5},exit:{opacity:0},transition:{duration:.15},className:ke("absolute top-0 bottom-0 w-16 z-[200] pointer-events-none",y==="left"?"right-0":"left-0"),style:{background:y==="left"?`linear-gradient(to left, ${Ce.text}10, transparent)`:`linear-gradient(to right, ${Ce.text}10, transparent)`}})]})}),!d&&c.jsxs("div",{className:"absolute inset-0 z-[5] flex flex-col items-center justify-center gap-3 pointer-events-none",style:{backgroundColor:Ce.background,visibility:d?"hidden":"visible"},children:[c.jsx(et,{className:"w-8 h-8 animate-spin",style:{color:Ce.text}}),c.jsxs("p",{className:"text-sm",style:{color:Ce.text,opacity:.7},children:["Parsing EPUB... ",f>0&&`(${f}s)`]}),f>8&&c.jsx("p",{className:"text-xs max-w-xs text-center",style:{color:Ce.text,opacity:.5},children:"This is taking longer than expected. The file may be large or have complex formatting."})]}),!1,k&&c.jsx("div",{className:"absolute top-12 right-2 z-[400] p-3 rounded-lg text-xs font-mono max-w-xs overflow-auto max-h-80",style:{backgroundColor:Ce.background,color:Ce.text,border:`1px solid ${Ce.text}30`},children:c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{children:[c.jsx("strong",{children:"Rendered:"})," ",d?"yes":"no"]}),c.jsxs("div",{children:[c.jsx("strong",{children:"Last displayed:"})," ",A.lastDisplayedHref||"-"]}),c.jsxs("div",{children:[c.jsx("strong",{children:"Last relocated:"})," ",((O=A.lastRelocatedCfi)==null?void 0:O.slice(0,40))||"-","..."]}),c.jsxs("div",{children:[c.jsx("strong",{children:"Current CFI:"})," ",((X=A.currentCfi)==null?void 0:X.slice(0,40))||"-","..."]}),c.jsxs("div",{children:[c.jsx("strong",{children:"iframe probe:"})," ",A.iframeProbe||"-"]}),c.jsx("hr",{style:{borderColor:`${Ce.text}30`},className:"my-2"}),c.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[c.jsx(xe,{size:"sm",variant:"outline",className:"text-xs h-6 px-2",onClick:()=>ae(),children:"Probe"}),c.jsxs(xe,{size:"sm",variant:m?"default":"outline",className:"text-xs h-6 px-2",onClick:de,children:[m?"Hide":"Show"," Outlines"]}),c.jsx(xe,{size:"sm",variant:"outline",className:"text-xs h-6 px-2",onClick:()=>{j.current&&te(j.current)},children:"Force Visibility"})]}),c.jsx("div",{className:"text-xs opacity-70",children:A.eventLog.map((ee,V)=>c.jsx("div",{children:ee},V))})]})}),c.jsx(PUe,{url:n,location:l||void 0,locationChanged:ue,getRendition:le,tocChanged:ve,readerStyles:Se(),epubInitOptions:{openAs:"epub"},epubOptions:{flow:"paginated",manager:"default",allowScriptedContent:!0}})]})}var zw={};zw.d=(n,e)=>{for(var t in e)zw.o(e,t)&&!zw.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})};zw.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var Ht=globalThis.pdfjsLib={};zw.d(Ht,{AbortException:()=>Mg,AnnotationEditorLayer:()=>a4,AnnotationEditorParamsType:()=>Bt,AnnotationEditorType:()=>Yt,AnnotationEditorUIManager:()=>pg,AnnotationLayer:()=>RHe,AnnotationMode:()=>eh,ColorPicker:()=>xN,DOMSVGFactory:()=>iz,DrawLayer:()=>u4,FeatureTest:()=>Ki,GlobalWorkerOptions:()=>Wu,ImageKind:()=>wC,InvalidPDFException:()=>eoe,MissingPDFException:()=>Og,OPS:()=>ml,OutputScale:()=>QI,PDFDataRangeTransport:()=>Xoe,PDFDateString:()=>JB,PDFWorker:()=>vy,PasswordResponses:()=>LUe,PermissionFlag:()=>IUe,PixelsPerInch:()=>wf,RenderingCancelledException:()=>XB,TextLayer:()=>AL,UnexpectedResponseException:()=>Ij,Util:()=>_t,VerbosityLevel:()=>Dj,XfaLayer:()=>Joe,build:()=>dHe,createValidAbsoluteUrl:()=>$Ue,fetchData:()=>Fj,getDocument:()=>nHe,getFilenameFromUrl:()=>XUe,getPdfFilenameFromUrl:()=>ZUe,getXfaPageViewport:()=>JUe,isDataScheme:()=>Bj,isPdfFile:()=>ZB,noContextMenu:()=>qo,normalizeUnicode:()=>GUe,setLayerDimensions:()=>fg,shadow:()=>mn,version:()=>uHe});const Ei=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Qae=[1,0,0,1,0,0],YI=[.001,0,0,.001,0,0],OUe=1e7,bD=1.35,$a={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},eh={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},MUe="pdfjs_internal_editor_",Yt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15}
1006,Bt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},IUe={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ui={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},wC={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ls={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},gb={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Dj={ERRORS:0,WARNINGS:1,INFOS:5},ml={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},LUe={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Oj=Dj.WARNINGS;function FUe(n){Number.isInteger(n)&&(Oj=n)}function BUe(){return Oj}function Mj(n){Oj>=Dj.INFOS&&console.log(`Info: ${n}`)}function tn(n){Oj>=Dj.WARNINGS&&console.log(`Warning: ${n}`)}function Qn(n){throw new Error(n)}function ys(n,e){n||Qn(e)}function zUe(n){switch(n==null?void 0:n.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function $Ue(n,e=null,t=null){if(!n)return null;try{if(t&&typeof n=="string"){if(t.addDefaultProtocol&&n.startsWith("www.")){const s=n.match(/\./g);(s==null?void 0:s.length)>=2&&(n=`http://${n}`)}if(t.tryConvertEncoding)try{n=qUe(n)}catch{}}const r=e?new URL(n,e):new URL(n);if(zUe(r))return r}catch{}return null}function mn(n,e,t,r=!1){return Object.defineProperty(n,e,{value:t,enumerable:!r,configurable:!0,writable:!1}),t}const Wf=function(){function e(t,r){this.message=t,this.name=r}return e.prototype=new Error,e.constructor=e,e}();class XI extends Wf{constructor(e,t){super(e,"PasswordException"),this.code=t}}class ZI extends Wf{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class eoe extends Wf{constructor(e){super(e,"InvalidPDFException")}}class Og extends Wf{constructor(e){super(e,"MissingPDFException")}}class Ij extends Wf{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class UUe extends Wf{constructor(e){super(e,"FormatError")}}class Mg extends Wf{constructor(e){super(e,"AbortException")}}function toe(n){(typeof n!="object"||(n==null?void 0:n.length)===void 0)&&Qn("Invalid argument for bytesToString");const e=n.length,t=8192;if(e<t)return String.fromCharCode.apply(null,n);const r=[];for(let s=0;s<e;s+=t){const i=Math.min(s+t,e),a=n.subarray(s,i);r.push(String.fromCharCode.apply(null,a))}return r.join("")}
1006function Lj(n){typeof n!="string"&&Qn("Invalid argument for stringToBytes");const e=n.length,t=new Uint8Array(e);for(let r=0;r<e;++r)t[r]=n.charCodeAt(r)&255;return t}function VUe(n){return String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,n&255)}function KB(n){const e=Object.create(null);for(const[t,r]of n)e[t]=r;return e}function HUe(){const n=new Uint8Array(4);return n[0]=1,new Uint32Array(n.buffer,0,1)[0]===1}function WUe(){try{return new Function(""),!0}catch{return!1}}class Ki{static get isLittleEndian(){return mn(this,"isLittleEndian",HUe())}static get isEvalSupported(){return mn(this,"isEvalSupported",WUe())}static get isOffscreenCanvasSupported(){return mn(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?mn(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):mn(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var e,t;return mn(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const wD=Array.from(Array(256).keys(),n=>n.toString(16).padStart(2,"0"));var rd,_C,JI;class _t{static makeHexColor(e,t,r){return`#${wD[e]}${wD[t]}${wD[r]}`}static scaleMinMax(e,t){let r;e[0]?(e[0]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[3],t[3]*=e[3]):(r=t[0],t[0]=t[1],t[1]=r,r=t[2],t[2]=t[3],t[3]=r,e[1]<0&&(r=t[1],t[1]=t[3],t[3]=r),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(r=t[0],t[0]=t[2],t[2]=r),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){const r=e[0]*t[0]+e[1]*t[2]+t[4],s=e[0]*t[1]+e[1]*t[3]+t[5];return[r,s]}static applyInverseTransform(e,t){const r=t[0]*t[3]-t[1]*t[2],s=(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/r,i=(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/r;return[s,i]}static getAxialAlignedBoundingBox(e,t){const r=this.applyTransform(e,t),s=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),a=this.applyTransform([e[2],e[1]],t);return[Math.min(r[0],s[0],i[0],a[0]),Math.min(r[1],s[1],i[1],a[1]),Math.max(r[0],s[0],i[0],a[0]),Math.max(r[1],s[1],i[1],a[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],r=e[0]*t[0]+e[1]*t[2],s=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(r+a)/2,l=Math.sqrt((r+a)**2-4*(r*a-i*s))/2,u=o+l||1,d=o-l||1;return[Math.sqrt(u),Math.sqrt(d)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const r=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(r>s)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[r,i,s,a]}static bezierBoundingBox(e,t,r,s,i,a,o,l,u){return u?(u[0]=Math.min(u[0],e,o),u[1]=Math.min(u[1],t,l),u[2]=Math.max(u[2],e,o),u[3]=Math.max(u[3],t,l)):u=[Math.min(e,o),Math.min(t,l),Math.max(e,o),Math.max(t,l)],W(this,rd,JI).call(this,e,r,i,o,t,s,a,l,3*(-e+3*(r-i)+o),6*(e-2*r+i),3*(r-e),u),W(this,rd,JI).call(this,e,r,i,o,t,s,a,l,3*(-t+3*(s-a)+l),6*(t-2*s+a),3*(s-t),u),u}}rd=new WeakSet,_C=function(e,t,r,s,i,a,o,l,u,d){if(u<=0||u>=1)return;const h=1-u,f=u*u,p=f*u,m=h*(h*(h*e+3*u*t)+3*f*r)+p*s,g=h*(h*(h*i+3*u*a)+3*f*o)+p*l;d[0]=Math.min(d[0],m),d[1]=Math.min(d[1],g),d[2]=Math.max(d[2],m),d[3]=Math.max(d[3],g)},JI=function(e,t,r,s,i,a,o,l,u,d,h,f){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&W(this,rd,_C).call(this,e,t,r,s,i,a,o,l,-h/d,f);return}const p=d**2-4*h*u;if(p<0)return;const m=Math.sqrt(p),g=2*u;W(this,rd,_C).call(this,e,t,r,s,i,a,o,l,(-d+m)/g,f),W(this,rd,_C).call(this,e,t,r,s,i,a,o,l,(-d-m)/g,f)},G(_t,rd);function qUe(n){return decodeURIComponent(escape(n))}let _D=null,GW=null;function GUe(n){return _D||(_D=/([\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,GW=new Map([["ſt","ſt"]])),n.replaceAll(_D,(e,t,r)=>t?t.normalize("NFKC"):GW.get(r))}function KUe(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const n=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(n);else for(let e=0;e<32;e++)n[e]=Math.floor(Math.random()*255);return toe(n)}const YB="pdfjs_internal_id_",iu={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function YUe(n){return Uint8Array.prototype.toBase64?n.toBase64():btoa(toe(n))}const cu="http://www.w3.org/2000/svg",hp=class hp{};Nt(hp,"CSS",96),Nt(hp,"PDF",72),Nt(hp,"PDF_TO_CSS_UNITS",hp.CSS/hp.PDF);let wf=hp;async function Fj(n,e="text"){if(Ub(n,document.baseURI)){const t=await fetch(n);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,r)=>{const s=new XMLHttpRequest;s.open("GET",n,!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":t(s.response);return}t(s.responseText);return}r(new Error(s.statusText))}},s.send(null)})}class wE{constructor({viewBox:e,scale:t,rotation:r,offsetX:s=0,offsetY:i=0,dontFlip:a=!1}){this.viewBox=e,this.scale=t,this.rotation=r,this.offsetX=s,this.offsetY=i;const o=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let u,d,h,f;switch(r%=360,r<0&&(r+=360),r){case 180:u=-1,d=0,h=0,f=1;break;case 90:u=0,d=1,h=1,f=0;break;case 270:u=0,d=-1,h=-1,f=0;break;case 0:u=1,d=0,h=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(h=-h,f=-f);let p,m,g,y;u===0?(p=Math.abs(l-e[1])*t+s,m=Math.abs(o-e[0])*t+i,g=(e[3]-e[1])*t,y=(e[2]-e[0])*t):(p=Math.abs(o-e[0])*t+s,m=Math.abs(l-e[1])*t+i,g=(e[2]-e[0])*t,y=(e[3]-e[1])*t),this.transform=[u*t,d*t,h*t,f*t,p-u*t*o-h*t*l,m-d*t*o-f*t*l],this.width=g,this.height=y}get rawDims(){const{viewBox:e}=this;return mn(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:r=this.offsetX,offsetY:s=this.offsetY,dontFlip:i=!1}={}){return new wE({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:r,offsetY:s,dontFlip:i})}convertToViewportPoint(e,t){return _t.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=_t.applyTransform([e[0],e[1]],this.transform),r=_t.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],r[0],r[1]]}convertToPdfPoint(e,t){return _t.applyInverseTransform([e,t],this.transform)}}class XB extends Wf{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function Bj(n){const e=n.length;let t=0;for(;t<e&&n[t].trim()==="";)t++;return n.substring(t,t+5).toLowerCase()==="data:"}function ZB(n){return typeof n=="string"&&/\.pdf$/i.test(n)}function XUe(n){return[n]=n.split(/[#?]/,1),n.substring(n.lastIndexOf("/")+1)}
1006function ZUe(n,e="document.pdf"){if(typeof n!="string")return e;if(Bj(n))return tn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,r=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=t.exec(n);let i=r.exec(s[1])||r.exec(s[2])||r.exec(s[3]);if(i&&(i=i[0],i.includes("%")))try{i=r.exec(decodeURIComponent(i))[0]}catch{}return i||e}class KW{constructor(){Nt(this,"started",Object.create(null));Nt(this,"times",[])}time(e){e in this.started&&tn(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||tn(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:r}of this.times)t=Math.max(r.length,t);for(const{name:r,start:s,end:i}of this.times)e.push(`${r.padEnd(t)} ${i-s}ms
1007`);return e.join("")}}function Ub(n,e){try{const{protocol:t}=e?new URL(n,e):new URL(n);return t==="http:"||t==="https:"}catch{return!1}}function qo(n){n.preventDefault()}function YW(n){console.log("Deprecated API usage: "+n)}var r_;class JB{static toDateObject(e){if(!e||typeof e!="string")return null;w(this,r_)||F(this,r_,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=w(this,r_).exec(e);if(!t)return null;const r=parseInt(t[1],10);let s=parseInt(t[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const u=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,u==="-"?(a+=d,o+=h):u==="+"&&(a-=d,o-=h),new Date(Date.UTC(r,s,i,a,o,l))}}r_=new WeakMap,G(JB,r_);function JUe(n,{scale:e=1,rotation:t=0}){const{width:r,height:s}=n.attributes.style,i=[0,0,parseInt(r),parseInt(s)];return new wE({viewBox:i,scale:e,rotation:t})}function QB(n){if(n.startsWith("#")){const e=parseInt(n.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return n.startsWith("rgb(")?n.slice(4,-1).split(",").map(e=>parseInt(e)):n.startsWith("rgba(")?n.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(tn(`Not a valid color format: "${n}"`),[0,0,0])}function QUe(n){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const t of n.keys()){e.style.color=t;const r=window.getComputedStyle(e).color;n.set(t,QB(r))}e.remove()}function lr(n){const{a:e,b:t,c:r,d:s,e:i,f:a}=n.getTransform();return[e,t,r,s,i,a]}function au(n){const{a:e,b:t,c:r,d:s,e:i,f:a}=n.getTransform().invertSelf();return[e,t,r,s,i,a]}function fg(n,e,t=!1,r=!0){if(e instanceof wE){const{pageWidth:s,pageHeight:i}=e.rawDims,{style:a}=n,o=Ki.isCSSRoundSupported,l=`var(--scale-factor) * ${s}px`,u=`var(--scale-factor) * ${i}px`,d=o?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,h=o?`round(down, ${u}, var(--scale-round-y, 1px))`:`calc(${u})`;!t||e.rotation%180===0?(a.width=d,a.height=h):(a.width=h,a.height=d)}r&&n.setAttribute("data-main-rotation",e.rotation)}class QI{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var dh,Ip,yl,Lp,s_,i_,wN,noe,Yi,roe,soe,SC,ioe,tL;const fu=class fu{constructor(e){G(this,Yi);G(this,dh,null);G(this,Ip,null);G(this,yl);G(this,Lp,null);G(this,s_,null);F(this,yl,e),w(fu,i_)||F(fu,i_,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const e=F(this,dh,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=w(this,yl)._uiManager._signal;e.addEventListener("contextmenu",qo,{signal:t}),e.addEventListener("pointerdown",W(fu,wN,noe),{signal:t});const r=F(this,Lp,document.createElement("div"));r.className="buttons",e.append(r);const s=w(this,yl).toolbarPosition;if(s){const{style:i}=e,a=w(this,yl)._uiManager.direction==="ltr"?1-s[0]:s[0];i.insetInlineEnd=`${100*a}%`,i.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return W(this,Yi,ioe).call(this),e}get div(){return w(this,dh)}hide(){var e;w(this,dh).classList.add("hidden"),(e=w(this,Ip))==null||e.hideDropdown()}show(){var e;w(this,dh).classList.remove("hidden"),(e=w(this,s_))==null||e.shown()}async addAltText(e){const t=await e.render();W(this,Yi,SC).call(this,t),w(this,Lp).prepend(t,w(this,Yi,tL)),F(this,s_,e)}addColorPicker(e){F(this,Ip,e);const t=e.renderButton();W(this,Yi,SC).call(this,t),w(this,Lp).prepend(t,w(this,Yi,tL))}remove(){var e;w(this,dh).remove(),(e=w(this,Ip))==null||e.destroy(),F(this,Ip,null)}};dh=new WeakMap,Ip=new WeakMap,yl=new WeakMap,Lp=new WeakMap,s_=new WeakMap,i_=new WeakMap,wN=new WeakSet,noe=function(e){e.stopPropagation()},Yi=new WeakSet,roe=function(e){w(this,yl)._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()},soe=function(e){w(this,yl)._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()},SC=function(e){const t=w(this,yl)._uiManager._signal;e.addEventListener("focusin",W(this,Yi,roe).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",W(this,Yi,soe).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",qo,{signal:t})},ioe=function(){const{editorType:e,_uiManager:t}=w(this,yl),r=document.createElement("button");r.className="delete",r.tabIndex=0,r.setAttribute("data-l10n-id",w(fu,i_)[e]),W(this,Yi,SC).call(this,r),r.addEventListener("click",
1007s=>{t.delete()},{signal:t._signal}),w(this,Lp).append(r)},tL=function(){const e=document.createElement("div");return e.className="divider",e},G(fu,wN),G(fu,i_,null);let eL=fu;var a_,Fp,Bp,Sf,aoe,ooe,loe;class eVe{constructor(e){G(this,Sf);G(this,a_,null);G(this,Fp,null);G(this,Bp);F(this,Bp,e)}show(e,t,r){const[s,i]=W(this,Sf,ooe).call(this,t,r),{style:a}=w(this,Fp)||F(this,Fp,W(this,Sf,aoe).call(this));e.append(w(this,Fp)),a.insetInlineEnd=`${100*s}%`,a.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){w(this,Fp).remove()}}a_=new WeakMap,Fp=new WeakMap,Bp=new WeakMap,Sf=new WeakSet,aoe=function(){const e=F(this,Fp,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",qo,{signal:w(this,Bp)._signal});const t=F(this,a_,document.createElement("div"));return t.className="buttons",e.append(t),W(this,Sf,loe).call(this),e},ooe=function(e,t){let r=0,s=0;for(const i of e){const a=i.y+i.height;if(a<r)continue;const o=i.x+(t?i.width:0);if(a>r){s=o,r=a;continue}t?o>s&&(s=o):o<s&&(s=o)}return[t?1-s:s,r]},loe=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const r=w(this,Bp)._signal;e.addEventListener("contextmenu",qo,{signal:r}),e.addEventListener("click",()=>{w(this,Bp).highlightSelection("floating_button")},{signal:r}),w(this,a_).append(e)};function gN(n,e,t){for(const r of t)e.addEventListener(r,n[r].bind(n))}function tVe(n){return Math.round(Math.min(255,Math.max(1,255*n))).toString(16).padStart(2,"0")}var _N;class nVe{constructor(){G(this,_N,0)}get id(){return`${MUe}${Ss(this,_N)._++}`}}_N=new WeakMap;var Py,o_,fi,Dy,EC;const lz=class lz{constructor(){G(this,Dy);G(this,Py,KUe());G(this,o_,0);G(this,fi,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>',r=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=e;const i=s.decode().then(()=>(r.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(r.getImageData(0,0,1,1).data.buffer)[0]===0));return mn(this,"_isSVGFittingCanvas",i)}async getFromFile(e){const{lastModified:t,name:r,size:s,type:i}=e;return W(this,Dy,EC).call(this,`${t}_${r}_${s}_${i}`,e)}async getFromUrl(e){return W(this,Dy,EC).call(this,e,e)}async getFromBlob(e,t){const r=await t;return W(this,Dy,EC).call(this,e,r)}async getFromId(e){w(this,fi)||F(this,fi,new Map);const t=w(this,fi).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:r}=t;return delete t.blobPromise,this.getFromBlob(t.id,r)}return this.getFromUrl(t.url)}getFromCanvas(e,t){w(this,fi)||F(this,fi,new Map);let r=w(this,fi).get(e);if(r!=null&&r.bitmap)return r.refCounter+=1,r;const s=new OffscreenCanvas(t.width,t.height);return s.getContext("2d").drawImage(t,0,0),r={bitmap:s.transferToImageBitmap(),id:`image_${w(this,Py)}_${Ss(this,o_)._++}`,refCounter:1,isSvg:!1},w(this,fi).set(e,r),w(this,fi).set(r.id,r),r}getSvgUrl(e){const t=w(this,fi).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var s;w(this,fi)||F(this,fi,new Map);const t=w(this,fi).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:r}=t;if(!t.url&&!t.file){const i=new OffscreenCanvas(r.width,r.height);i.getContext("bitmaprenderer").transferFromImageBitmap(r),t.blobPromise=i.convertToBlob()}(s=r.close)==null||s.call(r),t.bitmap=null}isValidId(e){return e.startsWith(`image_${w(this,Py)}_`)}};Py=new WeakMap,o_=new WeakMap,fi=new WeakMap,Dy=new WeakSet,EC=async function(e,t){w(this,fi)||F(this,fi,new Map);let r=w(this,fi).get(e);if(r===null)return null;if(r!=null&&r.bitmap)return r.refCounter+=1,r;try{r||(r={bitmap:null,id:`image_${w(this,Py)}_${Ss(this,o_)._++}`,refCounter:0,isSvg:!1});let s;if(typeof t=="string"?(r.url=t,s=await Fj(t,"blob")):t instanceof File?s=r.file=t:t instanceof Blob&&(s=t),s.type==="image/svg+xml"){const i=lz._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((u,d)=>{o.onload=()=>{r.bitmap=o,r.isSvg=!0,u()},a.onload=async()=>{const h=r.svgUrl=a.result;o.src=await i?`${h}#svgView(preserveAspectRatio(none))`:h},o.onerror=a.onerror=d});a.readAsDataURL(s),await l}else r.bitmap=await createImageBitmap(s);r.refCounter=1}catch(s){console.error(s),r=null}return w(this,fi).set(e,r),r&&w(this,fi).set(r.id,r),r};let nL=lz;var ks,hh,l_,Cs;class rVe{constructor(e=128){G(this,ks,[]);G(this,hh,!1);G(this,l_);G(this,Cs,-1);F(this,l_,e)}add({cmd:e,undo:t,post:r,mustExec:s,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(s&&e(),w(this,hh))return;const l={cmd:e,undo:t,post:r,type:i};if(w(this,Cs)===-1){w(this,ks).length>0&&(w(this,ks).length=0),F(this,Cs,0),w(this,ks).push(l);return}if(a&&w(this,ks)[w(this,Cs)].type===i){o&&(l.undo=w(this,ks)[w(this,Cs)].undo),w(this,ks)[w(this,Cs)]=l;return}const u=w(this,Cs)+1;u===w(this,l_)?w(this,ks).splice(0,1):(F(this,Cs,u),u<w(this,ks).length&&w(this,ks).splice(u)),w(this,ks).push(l)}undo(){if(w(this,Cs)===-1)return;F(this,hh,!0);const{undo:e,post:t}=w(this,ks)[w(this,Cs)];e(),t==null||t(),F(this,hh,!1),F(this,Cs,w(this,Cs)-1)}redo(){if(w(this,Cs)<w(this,ks).length-1){F(this,Cs,w(this,Cs)+1),F(this,hh,!0);const{cmd:e,post:t}=w(this,ks)[w(this,Cs)];e(),t==null||t(),F(this,hh,!1)}}hasSomethingToUndo(){return w(this,Cs)!==-1}hasSomethingToRedo(){return w(this,Cs)<w(this,ks).length-1}destroy(){F(this,ks,null)}}ks=new WeakMap,hh=new WeakMap,l_=new WeakMap,Cs=new WeakMap;var SN,coe;class _E{constructor(e){G(this,SN);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Ki.platform;for(const[r,s,i={}]of e)for(const a of r){const o=a.startsWith("mac+");t&&o?(this.callbacks.set(a.slice(4),{callback:s,options:i}),this.allKeys.add(a.split("+").at(-1))):!t&&!o&&(this.callbacks.set(a,{callback:s,options:i}),this.allKeys.add(a.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const r=this.callbacks.get(W(this,SN,coe).call(this,t));if(!r)return;const{callback:s,options:{bubbles:i=!1,args:a=[],checker:o=null}}=r;o&&!o(e,t)||(s.bind(e,...a,t)(),i||(t.stopPropagation(),t.preventDefault()))}}SN=new WeakSet,coe=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const EN=class EN{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return QUe(e),mn(this,"_colors",e)}convert(e){const t=QB(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[r,s]of this._colors)if(s.every((i,a)=>i===t[a]))return EN._colorsMapping.get(r);return t}getHexCode(e){const t=this._colors.get(e);return t?_t.makeHexColor(...t):e}};Nt(EN,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let rL=EN;var Oy,Da,ds,Hs,My,xu,Iy,xl,fh,Ly,zp,fc,bl,$p,c_,u_,Fy,d_,pc,ph,By,mh,mc,kN,gh,h_,vh,Up,f_,p_,As,jn,bu,Vp,m_,g_,yh,gc,wu,v_,yo,at,kC,sL,uoe,doe,CC,hoe,foe,poe,iL,moe,aL,oL,goe,Ri,Bd,voe,yoe,lL,xoe,Vb,cL;const Xv=class Xv{constructor(e,t,r,s,i,a,o,l,u,d,h){G(this,at);G(this,Oy,new AbortController);G(this,Da,null);G(this,ds,new Map);G(this,Hs,new Map);G(this,My,null);G(this,xu,null);G(this,Iy,null);G(this,xl,new rVe);G(this,fh,null);G(this,Ly,0);G(this,zp,new Set);G(this,fc,null);G(this,bl,null);G(this,$p,new Set);G(this,c_,!1);G(this,u_,!1);G(this,Fy,!1);G(this,d_,null);G(this,pc,null);G(this,ph,null);G(this,By,null);G(this,mh,!1);G(this,mc,null);G(this,kN,new nVe);G(this,gh,!1);G(this,h_,!1);G(this,vh,null);G(this,Up,null);G(this,f_,null);G(this,p_,null);G(this,As,Yt.NONE);G(this,jn,new Set);G(this,bu,null);G(this,Vp,null);G(this,m_,null);G(this,g_,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});G(this,yh,[0,0]);G(this,gc,null);G(this,wu,null);G(this,v_,null);G(this,yo,null);const f=this._signal=w(this,Oy).signal;F(this,wu,e),F(this,v_,t),F(this,My,r),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:f}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),s._on("setpreference",this.onSetPreference.bind(this),{signal:f}),s._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:f}),W(this,at,hoe).call(this),W(this,at,goe).call(this),W(this,at,iL).call(this),F(this,xu,i.annotationStorage),F(this,d_,i.filterFactory),F(this,Vp,a),F(this,By,o||null),F(this,c_,l),F(this,u_,u),F(this,Fy,d),F(this,p_,h||null),this.viewParameters={realScale:wf.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const e=Xv.prototype,t=a=>w(a,wu).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),r=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return mn(this,"_keyboardManager",new _E([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["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:r}
1007],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&w(a,wu).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&w(a,wu).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}destroy(){var e,t,r,s;(e=w(this,yo))==null||e.resolve(),F(this,yo,null),(t=w(this,Oy))==null||t.abort(),F(this,Oy,null),this._signal=null;for(const i of w(this,Hs).values())i.destroy();w(this,Hs).clear(),w(this,ds).clear(),w(this,$p).clear(),F(this,Da,null),w(this,jn).clear(),w(this,xl).destroy(),(r=w(this,My))==null||r.destroy(),(s=w(this,mc))==null||s.hide(),F(this,mc,null),w(this,pc)&&(clearTimeout(w(this,pc)),F(this,pc,null)),w(this,gc)&&(clearTimeout(w(this,gc)),F(this,gc,null))}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return w(this,p_)}get useNewAltTextFlow(){return w(this,u_)}get useNewAltTextWhenAddingImage(){return w(this,Fy)}get hcmFilter(){return mn(this,"hcmFilter",w(this,Vp)?w(this,d_).addHCMFilter(w(this,Vp).foreground,w(this,Vp).background):"none")}get direction(){return mn(this,"direction",getComputedStyle(w(this,wu)).direction)}get highlightColors(){return mn(this,"highlightColors",w(this,By)?new Map(w(this,By).split(",").map(e=>e.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return mn(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){F(this,f_,e)}editAltText(e,t=!1){var r;(r=w(this,My))==null||r.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":F(this,Fy,t);break}}onPageChanging({pageNumber:e}){F(this,Ly,e-1)}focusMainContainer(){w(this,wu).focus()}findParent(e,t){for(const r of w(this,Hs).values()){const{x:s,y:i,width:a,height:o}=r.div.getBoundingClientRect();if(e>=s&&e<=s+a&&t>=i&&t<=i+o)return r}return null}disableUserSelect(e=!1){w(this,v_).classList.toggle("noUserSelect",e)}addShouldRescale(e){w(this,$p).add(e)}removeShouldRescale(e){w(this,$p).delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*wf.PDF_TO_CSS_UNITS;for(const t of w(this,$p))t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:r,anchorOffset:s,focusNode:i,focusOffset:a}=t,o=t.toString(),u=W(this,at,kC).call(this,t).closest(".textLayer"),d=this.getSelectionBoxes(u);if(!d)return;t.empty();const h=W(this,at,sL).call(this,u),f=w(this,As)===Yt.NONE,p=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:r,anchorOffset:s,focusNode:i,focusOffset:a,text:o}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(Yt.HIGHLIGHT,p);return}p()}addToAnnotationStorage(e){!e.isEmpty()&&w(this,xu)&&!w(this,xu).has(e.id)&&w(this,xu).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,w(this,mh)&&(F(this,mh,!1),W(this,at,CC).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of w(this,jn))if(t.div.contains(e)){F(this,Up,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!w(this,Up))return;const[e,t]=w(this,Up);F(this,Up,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){W(this,at,iL).call(this),W(this,at,aL).call(this)}removeEditListeners(){W(this,at,moe).call(this),W(this,at,oL).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const r of w(this,bl))if(r.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const r of w(this,bl))if(r.isHandlingMimeForPasting(t.type)){r.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var r;if(e.preventDefault(),(r=w(this,Da))==null||r.commitOrRemove(),!this.hasSelection)return;const t=[];for(const s of w(this,jn)){const i=s.serialize(!0);
1007i&&t.push(i)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const i of t.items)for(const a of w(this,bl))if(a.isHandlingMimeForPasting(i.type)){a.paste(i,this.currentLayer);return}let r=t.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(i){tn(`paste: "${i.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const s=this.currentLayer;try{const i=[];for(const l of r){const u=await s.deserialize(l);if(!u)return;i.push(u)}const a=()=>{for(const l of i)W(this,at,lL).call(this,l);W(this,at,cL).call(this,i)},o=()=>{for(const l of i)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(i){tn(`paste: "${i.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),w(this,As)!==Yt.NONE&&!this.isEditorHandlingKeyboard&&Xv._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,w(this,mh)&&(F(this,mh,!1),W(this,at,CC).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?(W(this,at,foe).call(this),W(this,at,aL).call(this),W(this,at,Ri).call(this,{isEditing:w(this,As)!==Yt.NONE,isEmpty:W(this,at,Vb).call(this),hasSomethingToUndo:w(this,xl).hasSomethingToUndo(),hasSomethingToRedo:w(this,xl).hasSomethingToRedo(),hasSelectedEditor:!1})):(W(this,at,poe).call(this),W(this,at,oL).call(this),W(this,at,Ri).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!w(this,bl)){F(this,bl,e);for(const t of w(this,bl))W(this,at,Bd).call(this,t.defaultPropertiesToUpdate)}}getId(){return w(this,kN).id}get currentLayer(){return w(this,Hs).get(w(this,Ly))}getLayer(e){return w(this,Hs).get(e)}get currentPageIndex(){return w(this,Ly)}addLayer(e){w(this,Hs).set(e.pageIndex,e),w(this,gh)?e.enable():e.disable()}removeLayer(e){w(this,Hs).delete(e.pageIndex)}async updateMode(e,t=null,r=!1){if(w(this,As)!==e&&!(w(this,yo)&&(await w(this,yo).promise,!w(this,yo)))){if(F(this,yo,Promise.withResolvers()),F(this,As,e),e===Yt.NONE){this.setEditingState(!1),W(this,at,yoe).call(this),w(this,yo).resolve();return}this.setEditingState(!0),await W(this,at,voe).call(this),this.unselectAll();for(const s of w(this,Hs).values())s.updateMode(e);if(!t){r&&this.addNewEditorFromKeyboard(),w(this,yo).resolve();return}for(const s of w(this,ds).values())s.annotationElementId===t?(this.setSelected(s),s.enterInEditMode()):s.unselect();w(this,yo).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==w(this,As)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){var r;if(w(this,bl)){switch(e){case Bt.CREATE:this.currentLayer.addNewEditor();return;case Bt.HIGHLIGHT_DEFAULT_COLOR:(r=w(this,f_))==null||r.updateColor(t);break;case Bt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(w(this,m_)||F(this,m_,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const s of w(this,jn))s.updateParams(e,t);for(const s of w(this,bl))s.updateDefaultParams(e,t)}}showAllEditors(e,t,r=!1){var i;for(const a of w(this,ds).values())a.editorType===e&&a.show(t);(((i=w(this,m_))==null?void 0:i.get(Bt.HIGHLIGHT_SHOW_ALL))??!0)!==t&&W(this,at,Bd).call(this,[[Bt.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(w(this,h_)!==e){F(this,h_,e);for(const t of w(this,Hs).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const r of w(this,ds).values())r.pageIndex===e&&t.push(r);return t}getEditor(e){return w(this,ds).get(e)}addEditor(e){w(this,ds).set(e.id,e)}removeEditor(e){var t;e.div.contains(document.activeElement)&&(w(this,pc)&&clearTimeout(w(this,pc)),F(this,pc,setTimeout(()=>{this.focusMainContainer(),F(this,pc,null)},0))),w(this,ds).delete(e.id),this.unselect(e),(!e.annotationElementId||!w(this,zp).has(e.annotationElementId))&&((t=w(this,xu))==null||t.remove(e.id))}addDeletedAnnotationElement(e){w(this,zp).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}
1007isDeletedAnnotationElement(e){return w(this,zp).has(e)}removeDeletedAnnotationElement(e){w(this,zp).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){w(this,Da)!==e&&(F(this,Da,e),e&&W(this,at,Bd).call(this,e.propertiesToUpdate))}updateUI(e){w(this,at,xoe)===e&&W(this,at,Bd).call(this,e.propertiesToUpdate)}toggleSelected(e){if(w(this,jn).has(e)){w(this,jn).delete(e),e.unselect(),W(this,at,Ri).call(this,{hasSelectedEditor:this.hasSelection});return}w(this,jn).add(e),e.select(),W(this,at,Bd).call(this,e.propertiesToUpdate),W(this,at,Ri).call(this,{hasSelectedEditor:!0})}setSelected(e){for(const t of w(this,jn))t!==e&&t.unselect();w(this,jn).clear(),w(this,jn).add(e),e.select(),W(this,at,Bd).call(this,e.propertiesToUpdate),W(this,at,Ri).call(this,{hasSelectedEditor:!0})}isSelected(e){return w(this,jn).has(e)}get firstSelectedEditor(){return w(this,jn).values().next().value}unselect(e){e.unselect(),w(this,jn).delete(e),W(this,at,Ri).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return w(this,jn).size!==0}get isEnterHandled(){return w(this,jn).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){w(this,xl).undo(),W(this,at,Ri).call(this,{hasSomethingToUndo:w(this,xl).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:W(this,at,Vb).call(this)})}redo(){w(this,xl).redo(),W(this,at,Ri).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:w(this,xl).hasSomethingToRedo(),isEmpty:W(this,at,Vb).call(this)})}addCommands(e){w(this,xl).add(e),W(this,at,Ri).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:W(this,at,Vb).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...w(this,jn)],t=()=>{for(const s of e)s.remove()},r=()=>{for(const s of e)W(this,at,lL).call(this,s)};this.addCommands({cmd:t,undo:r,mustExec:!0})}commitOrRemove(){var e;(e=w(this,Da))==null||e.commitOrRemove()}hasSomethingToControl(){return w(this,Da)||this.hasSelection}selectAll(){for(const e of w(this,jn))e.commit();W(this,at,cL).call(this,w(this,ds).values())}unselectAll(){if(!(w(this,Da)&&(w(this,Da).commitOrRemove(),w(this,As)!==Yt.NONE))&&this.hasSelection){for(const e of w(this,jn))e.unselect();w(this,jn).clear(),W(this,at,Ri).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;w(this,yh)[0]+=e,w(this,yh)[1]+=t;const[s,i]=w(this,yh),a=[...w(this,jn)],o=1e3;w(this,gc)&&clearTimeout(w(this,gc)),F(this,gc,setTimeout(()=>{F(this,gc,null),w(this,yh)[0]=w(this,yh)[1]=0,this.addCommands({cmd:()=>{for(const l of a)w(this,ds).has(l.id)&&l.translateInPage(s,i)},undo:()=>{for(const l of a)w(this,ds).has(l.id)&&l.translateInPage(-s,-i)},mustExec:!1})},o));for(const l of a)l.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),F(this,fc,new Map);for(const e of w(this,jn))w(this,fc).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!w(this,fc))return!1;this.disableUserSelect(!1);const e=w(this,fc);F(this,fc,null);let t=!1;for(const[{x:s,y:i,pageIndex:a},o]of e)o.newX=s,o.newY=i,o.newPageIndex=a,t||(t=s!==o.savedX||i!==o.savedY||a!==o.savedPageIndex);if(!t)return!1;const r=(s,i,a,o)=>{if(w(this,ds).has(s.id)){const l=w(this,Hs).get(o);l?s._setParentAndPosition(l,i,a):(s.pageIndex=o,s.x=i,s.y=a)}};return this.addCommands({cmd:()=>{for(const[s,{newX:i,newY:a,newPageIndex:o}]of e)r(s,i,a,o)},undo:()=>{for(const[s,{savedX:i,savedY:a,savedPageIndex:o}]of e)r(s,i,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(w(this,fc))for(const r of w(this,fc).keys())r.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||w(this,jn).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return w(this,Da)===e}getActive(){return w(this,Da)}getMode(){return w(this,As)}get imageManager(){return mn(this,"imageManager",new nL)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let u=0,d=t.rangeCount;u<d;u++)if(!e.contains(t.getRangeAt(u).commonAncestorContainer))return null;const{x:r,y:s,width:i,height:a}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(u,d,h,f)=>({x:(d-s)/a,y:1-(u+h-r)/i,width:f/a,height:h/i});break;case"180":o=(u,d,h,f)=>({x:1-(u+h-r)/i,y:1-(d+f-s)/a,width:h/i,height:f/a});break;case"270":o=(u,d,h,f)=>({x:1-(d+f-s)/a,y:(u-r)/i,width:f/a,height:h/i});break;default:o=(u,d,h,f)=>({x:(u-r)/i,y:(d-s)/a,width:h/i,height:f/a});break}const l=[];for(let u=0,d=t.rangeCount;u<d;u++){const h=t.getRangeAt(u);if(!h.collapsed)for(const{x:f,y:p,width:m,height:g}of h.getClientRects())m===0||g===0||l.push(o(f,p,m,g))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:t}){(w(this,Iy)||F(this,Iy,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=w(this,Iy))==null||t.delete(e)}renderAnnotationElement(e){var s;const t=(s=w(this,Iy))==null?void 0:s.get(e.data.id);if(!t)return;const r=w(this,xu).getRawValue(t);r&&(w(this,As)===Yt.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}};Oy=new WeakMap,Da=new WeakMap,ds=new WeakMap,Hs=new WeakMap,My=new WeakMap,xu=new WeakMap,Iy=new WeakMap,xl=new WeakMap,fh=new WeakMap,Ly=new WeakMap,zp=new WeakMap,fc=new WeakMap,bl=new WeakMap,$p=new WeakMap,c_=new WeakMap,u_=new WeakMap,Fy=new WeakMap,d_=new WeakMap,pc=new WeakMap,ph=new WeakMap,By=new WeakMap,mh=new WeakMap,mc=new WeakMap,kN=new WeakMap,gh=new WeakMap,h_=new WeakMap,vh=new WeakMap,Up=new WeakMap,f_=new WeakMap,p_=new WeakMap,As=new WeakMap,jn=new WeakMap,bu=new WeakMap,Vp=new WeakMap,m_=new WeakMap,g_=new WeakMap,yh=new WeakMap,gc=new WeakMap,wu=new WeakMap,v_=new WeakMap,yo=new WeakMap,at=new WeakSet,kC=function({anchorNode:e}
1007){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},sL=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const r of w(this,Hs).values())if(r.hasTextLayer(e))return r;return null},uoe=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const r=W(this,at,kC).call(this,e).closest(".textLayer"),s=this.getSelectionBoxes(r);s&&(w(this,mc)||F(this,mc,new eVe(this)),w(this,mc).show(r,s,this.direction==="ltr"))},doe=function(){var i,a,o;const e=document.getSelection();if(!e||e.isCollapsed){w(this,bu)&&((i=w(this,mc))==null||i.hide(),F(this,bu,null),W(this,at,Ri).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===w(this,bu))return;const s=W(this,at,kC).call(this,e).closest(".textLayer");if(!s){w(this,bu)&&((a=w(this,mc))==null||a.hide(),F(this,bu,null),W(this,at,Ri).call(this,{hasSelectedText:!1}));return}if((o=w(this,mc))==null||o.hide(),F(this,bu,t),W(this,at,Ri).call(this,{hasSelectedText:!0}),!(w(this,As)!==Yt.HIGHLIGHT&&w(this,As)!==Yt.NONE)&&(w(this,As)===Yt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),F(this,mh,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=w(this,As)===Yt.HIGHLIGHT?W(this,at,sL).call(this,s):null;l==null||l.toggleDrawing();const u=new AbortController,d=this.combinedSignal(u),h=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&W(this,at,CC).call(this,"main_toolbar"))};window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("blur",h,{signal:d})}},CC=function(e=""){w(this,As)===Yt.HIGHLIGHT?this.highlightSelection(e):w(this,c_)&&W(this,at,uoe).call(this)},hoe=function(){document.addEventListener("selectionchange",W(this,at,doe).bind(this),{signal:this._signal})},foe=function(){if(w(this,ph))return;F(this,ph,new AbortController);const e=this.combinedSignal(w(this,ph));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},poe=function(){var e;(e=w(this,ph))==null||e.abort(),F(this,ph,null)},iL=function(){if(w(this,vh))return;F(this,vh,new AbortController);const e=this.combinedSignal(w(this,vh));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},moe=function(){var e;(e=w(this,vh))==null||e.abort(),F(this,vh,null)},aL=function(){if(w(this,fh))return;F(this,fh,new AbortController);const e=this.combinedSignal(w(this,fh));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})},oL=function(){var e;(e=w(this,fh))==null||e.abort(),F(this,fh,null)},goe=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},Ri=function(e){Object.entries(e).some(([r,s])=>w(this,g_)[r]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(w(this,g_),e)}),w(this,As)===Yt.HIGHLIGHT&&e.hasSelectedEditor===!1&&W(this,at,Bd).call(this,[[Bt.HIGHLIGHT_FREE,!0]]))},Bd=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},voe=async function(){if(!w(this,gh)){F(this,gh,!0);const e=[];for(const t of w(this,Hs).values())e.push(t.enable());await Promise.all(e);for(const t of w(this,ds).values())t.enable()}},yoe=function(){if(this.unselectAll(),w(this,gh)){F(this,gh,!1);for(const e of w(this,Hs).values())e.disable();for(const e of w(this,ds).values())e.disable()}},lL=function(e){const t=w(this,Hs).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},xoe=function(){let e=null;for(e of w(this,jn));return e},Vb=function(){if(w(this,ds).size===0)return!0;if(w(this,ds).size===1)for(const e of w(this,ds).values())return e.isEmpty();return!1},cL=function(e){for(const t of w(this,jn))t.unselect();w(this,jn).clear();for(const t of e)t.isEmpty()||(w(this,jn).add(t),t.select());W(this,at,Ri).call(this,{hasSelectedEditor:this.hasSelection})},Nt(Xv,"TRANSLATE_SMALL",1),Nt(Xv,"TRANSLATE_BIG",10);let pg=Xv;var Ns,vc,wl,zy,yc,Oa,$y,xc,ca,_u,Hp,bc,xh,$l,Hb,AC;const Pi=class Pi{constructor(e){G(this,$l);G(this,Ns,null);G(this,vc,!1);G(this,wl,null);G(this,zy,null);G(this,yc,null);G(this,Oa,null);G(this,$y,!1);G(this,xc,null);G(this,ca,null);G(this,_u,null);G(this,Hp,null);G(this,bc,!1);F(this,ca,e),F(this,bc,e._uiManager.useNewAltTextFlow),w(Pi,xh)||F(Pi,xh,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){Pi._l10n??(Pi._l10n=e)}async render(){const e=F(this,wl,document.createElement("button"));e.className="altText",e.tabIndex="0";
1007const t=F(this,zy,document.createElement("span"));e.append(t),w(this,bc)?(e.classList.add("new"),e.setAttribute("data-l10n-id",w(Pi,xh).missing),t.setAttribute("data-l10n-id",w(Pi,xh)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=w(this,ca)._uiManager._signal;e.addEventListener("contextmenu",qo,{signal:r}),e.addEventListener("pointerdown",i=>i.stopPropagation(),{signal:r});const s=i=>{i.preventDefault(),w(this,ca)._uiManager.editAltText(w(this,ca)),w(this,bc)&&w(this,ca)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:w(this,$l,Hb)}})};return e.addEventListener("click",s,{capture:!0,signal:r}),e.addEventListener("keydown",i=>{i.target===e&&i.key==="Enter"&&(F(this,$y,!0),s(i))},{signal:r}),await W(this,$l,AC).call(this),e}finish(){w(this,wl)&&(w(this,wl).focus({focusVisible:w(this,$y)}),F(this,$y,!1))}isEmpty(){return w(this,bc)?w(this,Ns)===null:!w(this,Ns)&&!w(this,vc)}hasData(){return w(this,bc)?w(this,Ns)!==null||!!w(this,_u):this.isEmpty()}get guessedText(){return w(this,_u)}async setGuessedText(e){w(this,Ns)===null&&(F(this,_u,e),F(this,Hp,await Pi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),W(this,$l,AC).call(this))}toggleAltTextBadge(e=!1){var t;if(!w(this,bc)||w(this,Ns)){(t=w(this,xc))==null||t.remove(),F(this,xc,null);return}if(!w(this,xc)){const r=F(this,xc,document.createElement("div"));r.className="noAltTextBadge",w(this,ca).div.append(r)}w(this,xc).classList.toggle("hidden",!e)}serialize(e){let t=w(this,Ns);return!e&&w(this,_u)===t&&(t=w(this,Hp)),{altText:t,decorative:w(this,vc),guessedText:w(this,_u),textWithDisclaimer:w(this,Hp)}}get data(){return{altText:w(this,Ns),decorative:w(this,vc)}}set data({altText:e,decorative:t,guessedText:r,textWithDisclaimer:s,cancel:i=!1}){r&&(F(this,_u,r),F(this,Hp,s)),!(w(this,Ns)===e&&w(this,vc)===t)&&(i||(F(this,Ns,e),F(this,vc,t)),W(this,$l,AC).call(this))}toggle(e=!1){w(this,wl)&&(!e&&w(this,Oa)&&(clearTimeout(w(this,Oa)),F(this,Oa,null)),w(this,wl).disabled=!e)}shown(){w(this,ca)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:w(this,$l,Hb)}})}destroy(){var e,t;(e=w(this,wl))==null||e.remove(),F(this,wl,null),F(this,zy,null),F(this,yc,null),(t=w(this,xc))==null||t.remove(),F(this,xc,null)}};Ns=new WeakMap,vc=new WeakMap,wl=new WeakMap,zy=new WeakMap,yc=new WeakMap,Oa=new WeakMap,$y=new WeakMap,xc=new WeakMap,ca=new WeakMap,_u=new WeakMap,Hp=new WeakMap,bc=new WeakMap,xh=new WeakMap,$l=new WeakSet,Hb=function(){return w(this,Ns)&&"added"||w(this,Ns)===null&&this.guessedText&&"review"||"missing"},AC=async function(){var s,i,a;const e=w(this,wl);if(!e)return;if(w(this,bc)){if(e.classList.toggle("done",!!w(this,Ns)),e.setAttribute("data-l10n-id",w(Pi,xh)[w(this,$l,Hb)]),(s=w(this,zy))==null||s.setAttribute("data-l10n-id",w(Pi,xh)[`${w(this,$l,Hb)}-label`]),!w(this,Ns)){(i=w(this,yc))==null||i.remove();return}}else{if(!w(this,Ns)&&!w(this,vc)){e.classList.remove("done"),(a=w(this,yc))==null||a.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=w(this,yc);if(!t){F(this,yc,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${w(this,ca).id}`;const o=100,l=w(this,ca)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(w(this,Oa)),F(this,Oa,null)},{once:!0}),e.addEventListener("mouseenter",()=>{F(this,Oa,setTimeout(()=>{F(this,Oa,null),w(this,yc).classList.add("show"),w(this,ca)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var u;w(this,Oa)&&(clearTimeout(w(this,Oa)),F(this,Oa,null)),(u=w(this,yc))==null||u.classList.remove("show")},{signal:l})}w(this,vc)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=w(this,Ns)),t.parentNode||e.append(t);const r=w(this,ca).getImageForAltText();r==null||r.setAttribute("aria-describedby",t.id)},G(Pi,xh,null),Nt(Pi,"_l10n",null);let vN=Pi;var Wp,_l,ar,Uy,qp,Ws,Gp,bh,y_,Kp,wh,x_,Yp,Su,wc,Vy,Hy,xo,b_,CN,Qt,uL,w_,dL,hL,boe,woe,fL,pL,mL,_oe,gL,Soe,Eoe,koe,vL,Wb;const An=class An{constructor(e){G(this,Qt);G(this,Wp,null);G(this,_l,null);G(this,ar,null);G(this,Uy,!1);G(this,qp,!1);G(this,Ws,null);G(this,Gp,null);G(this,bh,null);G(this,y_,"");G(this,Kp,!1);G(this,wh,null);G(this,x_,!1);G(this,Yp,!1);G(this,Su,!1);G(this,wc,null);G(this,Vy,0);G(this,Hy,0);G(this,xo,null);Nt(this,"_editToolbar",null);Nt(this,"_initialOptions",Object.create(null));Nt(this,"_initialData",null);Nt(this,"_isVisible",!0);Nt(this,"_uiManager",null);Nt(this,"_focusEventsAllowed",!0);G(this,b_,!1);G(this,CN,An._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;const{rotation:t,rawDims:{pageWidth:r,pageHeight:s,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,s],this.pageTranslation=[i,a];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=An.prototype._resizeWithKeyboard,t=pg.TRANSLATE_SMALL,r=pg.TRANSLATE_BIG;return mn(this,"_resizerKeyboardManager",new _E([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],An.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return mn(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new sVe({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}
1007static initialize(e,t){if(An._l10n??(An._l10n=e),An._l10nResizer||(An._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"})),An._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);An._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Qn("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return w(this,b_)}set _isDraggable(e){var t;F(this,b_,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=w(this,CN)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):W(this,Qt,Wb).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(w(this,Kp)?F(this,Kp,!1):this.parent.setSelected(this))}focusout(e){var r;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(r=this.parent)!=null&&r.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,r,s){const[i,a]=this.parentDimensions;[r,s]=this.screenToPageTranslation(r,s),this.x=(e+r)/i,this.y=(t+s)/a,this.fixAndSetPosition()}translate(e,t){W(this,Qt,uL).call(this,this.parentDimensions,e,t)}translateInPage(e,t){w(this,wh)||F(this,wh,[this.x,this.y]),W(this,Qt,uL).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){w(this,wh)||F(this,wh,[this.x,this.y]);const[r,s]=this.parentDimensions;if(this.x+=e/r,this.y+=t/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:a}=this;const[o,l]=this.getBaseTranslation();i+=o,a+=l,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!w(this,wh)&&(w(this,wh)[0]!==this.x||w(this,wh)[1]!==this.y)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:r}=An,s=r/e,i=r/t;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[t,r]=this.pageDimensions;let{x:s,y:i,width:a,height:o}=this;if(a*=t,o*=r,s*=t,i*=r,this._mustFixPosition)switch(e){case 0:s=Math.max(0,Math.min(t-a,s)),i=Math.max(0,Math.min(r-o,i));break;case 90:s=Math.max(0,Math.min(t-o,s)),i=Math.min(r,Math.max(a,i));break;case 180:s=Math.min(t,Math.max(a,s)),i=Math.min(r,Math.max(o,i));break;case 270:s=Math.min(t,Math.max(o,s)),i=Math.max(0,Math.min(r-a,i));break}this.x=s/=t,this.y=i/=r;const[l,u]=this.getBaseTranslation();s+=l,i+=u;const{style:d}=this.div;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var r;return W(r=An,w_,dL).call(r,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var r;return W(r=An,w_,dL).call(r,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,r]}=this;return[t*e,r*e]}setDims(e,t){const[r,s]=this.parentDimensions;this.div.style.width=`${(100*e/r).toFixed(2)}%`,w(this,qp)||(this.div.style.height=`${(100*t/s).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:r}=e,s=r.endsWith("%"),i=!w(this,qp)&&t.endsWith("%");if(s&&i)return;const[a,o]=this.parentDimensions;s||(e.width=`${(100*parseFloat(r)/a).toFixed(2)}%`),!w(this,qp)&&!i&&(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=w(this,ar))==null||e.finish()}async addEditToolbar(){return this._editToolbar||w(this,Yp)?this._editToolbar:(this._editToolbar=ne
1007w eL(this),this.div.append(this._editToolbar.render()),w(this,ar)&&await this._editToolbar.addAltText(w(this,ar)),this._editToolbar)}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=w(this,ar))==null||e.destroy())}addContainer(e){var r;const t=(r=this._editToolbar)==null?void 0:r.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){w(this,ar)||(vN.initialize(An._l10n),F(this,ar,new vN(this)),w(this,Wp)&&(w(this,ar).data=w(this,Wp),F(this,Wp,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=w(this,ar))==null?void 0:e.data}set altTextData(e){w(this,ar)&&(w(this,ar).data=e)}get guessedAltText(){var e;return(e=w(this,ar))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=w(this,ar))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=w(this,ar))==null?void 0:t.serialize(e)}hasAltText(){return!!w(this,ar)&&!w(this,ar).isEmpty()}hasAltTextData(){var e;return((e=w(this,ar))==null?void 0:e.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=w(this,Uy)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),W(this,Qt,gL).call(this);const[e,t]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[r,s]=this.getInitialTranslation();return this.translate(r,s),gN(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=Ki.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(F(this,Kp,!0),this._isDraggable){W(this,Qt,_oe).call(this,e);return}W(this,Qt,mL).call(this,e)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){w(this,wc)&&clearTimeout(w(this,wc)),F(this,wc,setTimeout(()=>{var e;F(this,wc,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,r){e.changeParent(this),this.x=t,this.y=r,this.fixAndSetPosition()}getRect(e,t,r=this.rotation){const s=this.parentScale,[i,a]=this.pageDimensions,[o,l]=this.pageTranslation,u=e/s,d=t/s,h=this.x*i,f=this.y*a,p=this.width*i,m=this.height*a;switch(r){case 0:return[h+u+o,a-f-d-m+l,h+u+p+o,a-f-d+l];case 90:return[h+d+o,a-f+u+l,h+d+m+o,a-f+u+p+l];case 180:return[h-u-p+o,a-f+d+l,h-u+o,a-f+d+m+l];case 270:return[h-d-m+o,a-f-u-p+l,h-d+o,a-f-u+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[r,s,i,a]=e,o=i-r,l=a-s;switch(this.rotation){case 0:return[r,t-a,o,l];case 90:return[r,t-s,l,o];case 180:return[i,t-s,o,l];case 270:return[i,t-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){F(this,Yp,!0)}disableEditMode(){F(this,Yp,!1)}isInEditMode(){return w(this,Yp)}shouldGetKeyboardEvents(){return w(this,Su)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){W(this,Qt,gL).call(this)}rotate(e){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){Qn("An editor must be serializable")}static async deserialize(e,t,r){const s=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:r});s.rotation=e.rotation,F(s,Wp,e.accessibilityData);const[i,a]=s.pageDimensions,[o,l,u,d]=s.getRectInCurrentCoords(e.rect,a);return s.x=o/i,s.y=l/a,s.width=u/i,s.height=d/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e;if((e=w(this,bh))==null||e.abort(),F(this,bh,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),w(this,wc)&&(clearTimeout(w(this,wc)),F(this,wc,null)),W(this,Qt,Wb).call(this),this.removeEditToolbar(),w(this,xo)){for(const t of w(this,xo).values())clearTimeout(t);F(this,xo,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(W(this,Qt,boe).call(this),w(this,Ws).classList.remove("hidden"),gN(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),F(this,Gp,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=w(this,Ws).children;if(!w(this,_l)){F(this,_l,Array.from(t));const a=W(this,Qt,Soe).bind(this),o=W(this,Qt,Eoe).bind(this),l=this._uiManager._signal;for(const u of w(this,_l)){const d=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",a,{signal:l}),u.addEventListener("blur",o,{signal:l}),u.addEventListener("focus",W(this,Qt,koe).bind(this,d),{signal:l}),u.setAttribute("data-l10n-id",An._l10nResizer[d])}}const r=w(this,_l)[0];let s=0;for(const a of t){if(a===r)break;s++}const i=(360-this.rotation+this.parentRotation)%360/90*(w(this,_l).length/4);if(i!==s){if(i<s)for(let o=0;o<s-i;o++)w(this,Ws).append(w(this,Ws).firstChild);else if(i>s)for(let o=0;o<i-s;o++)w(this,Ws).firstChild.before(w(this,Ws).lastChild);let a=0;for(const o of t){const u=w(this,_l)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",An._l10nResizer[u])}}W(this,Qt,vL).call(this,0),F(this,Su,!0),w(this,Ws).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){w(this,Su)&&W(this,Qt,pL).call(this,w(this,y_),{movementX:e,movementY:t})}_stopResizingWithKeyboard(){W(this,Qt,Wb).call(this),this.div.focus()}select(){var e,t,r;if(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}(t=this._editToolbar)==null||t.show(),(r=w(this,ar))==null||r.toggleAltTextBadge(!1)}unselect(){var e,t,r,s,i;(e=w(this,Ws))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(i=w(this,ar))==null||i.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return w(this,x_)}set isEditing(e){F(this,x_,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){F(this,qp,!0);const r=e/t,{style:s}=this.div;s.aspectRatio=r,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){w(this,xo)||F(this,xo,new Map);const{action:r}=e;let s=w(this,xo).get(r);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),w(this,xo).delete(r),w(this,xo).size===0&&F(this,xo,null)},An._telemetryTimeout),w(this,xo).set(r,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),F(this,Uy,!1)}disable(){this.div&&(this.div.tabIndex=-1),F(this,Uy,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");
1007if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const r=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),r.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Wp=new WeakMap,_l=new WeakMap,ar=new WeakMap,Uy=new WeakMap,qp=new WeakMap,Ws=new WeakMap,Gp=new WeakMap,bh=new WeakMap,y_=new WeakMap,Kp=new WeakMap,wh=new WeakMap,x_=new WeakMap,Yp=new WeakMap,Su=new WeakMap,wc=new WeakMap,Vy=new WeakMap,Hy=new WeakMap,xo=new WeakMap,b_=new WeakMap,CN=new WeakMap,Qt=new WeakSet,uL=function([e,t],r,s){[r,s]=this.screenToPageTranslation(r,s),this.x+=r/e,this.y+=s/t,this.fixAndSetPosition()},w_=new WeakSet,dL=function(e,t,r){switch(r){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},hL=function(e){switch(e){case 90:{const[t,r]=this.pageDimensions;return[0,-t/r,r/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,r]=this.pageDimensions;return[0,t/r,-r/t,0]}default:return[1,0,0,1]}},boe=function(){if(w(this,Ws))return;F(this,Ws,document.createElement("div")),w(this,Ws).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const r of e){const s=document.createElement("div");w(this,Ws).append(s),s.classList.add("resizer",r),s.setAttribute("data-resizer-name",r),s.addEventListener("pointerdown",W(this,Qt,woe).bind(this,r),{signal:t}),s.addEventListener("contextmenu",qo,{signal:t}),s.tabIndex=-1}this.div.prepend(w(this,Ws))},woe=function(e,t){var m;t.preventDefault();const{isMac:r}=Ki.platform;if(t.button!==0||t.ctrlKey&&r)return;(m=w(this,ar))==null||m.toggle(!1);const s=this._isDraggable;this._isDraggable=!1;const i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",W(this,Qt,pL).bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("contextmenu",qo,{signal:a});const o=this.x,l=this.y,u=this.width,d=this.height,h=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const p=()=>{var g;i.abort(),this.parent.togglePointerEvents(!0),(g=w(this,ar))==null||g.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=h,this.div.style.cursor=f,W(this,Qt,fL).call(this,o,l,u,d)};window.addEventListener("pointerup",p,{signal:a}),window.addEventListener("blur",p,{signal:a})},fL=function(e,t,r,s){const i=this.x,a=this.y,o=this.width,l=this.height;i===e&&a===t&&o===r&&l===s||this.addCommands({cmd:()=>{this.width=o,this.height=l,this.x=i,this.y=a;const[u,d]=this.parentDimensions;this.setDims(u*o,d*l),this.fixAndSetPosition()},undo:()=>{this.width=r,this.height=s,this.x=e,this.y=t;const[u,d]=this.parentDimensions;this.setDims(u*r,d*s),this.fixAndSetPosition()},mustExec:!0})},pL=function(e,t){const[r,s]=this.parentDimensions,i=this.x,a=this.y,o=this.width,l=this.height,u=An.MIN_SIZE/r,d=An.MIN_SIZE/s,h=I=>Math.round(I*1e4)/1e4,f=W(this,Qt,hL).call(this,this.rotation),p=(I,B)=>[f[0]*I+f[2]*B,f[1]*I+f[3]*B],m=W(this,Qt,hL).call(this,360-this.rotation),g=(I,B)=>[m[0]*I+m[2]*B,m[1]*I+m[3]*B];let y,v,x=!1,b=!1;switch(e){case"topLeft":x=!0,y=(I,B)=>[0,0],v=(I,B)=>[I,B];break;case"topMiddle":y=(I,B)=>[I/2,0],v=(I,B)=>[I/2,B];break;case"topRight":x=!0,y=(I,B)=>[I,0],v=(I,B)=>[0,B];break;case"middleRight":b=!0,y=(I,B)=>[I,B/2],v=(I,B)=>[0,B/2];break;case"bottomRight":x=!0,y=(I,B)=>[I,B],v=(I,B)=>[0,0];break;case"bottomMiddle":y=(I,B)=>[I/2,B],v=(I,B)=>[I/2,0];break;case"bottomLeft":x=!0,y=(I,B)=>[0,B],v=(I,B)=>[I,0];break;case"middleLeft":b=!0,y=(I,B)=>[0,B/2],v=(I,B)=>[I,B/2];break}const E=y(o,l),S=v(o,l);let k=p(...S);const C=h(i+k[0]),A=h(a+k[1]);let T=1,j=1,[D,R]=this.screenToPageTranslation(t.movementX,t.movementY);if([D,R]=g(D/r,R/s),x){const I=Math.hypot(o,l);T=j=Math.max(Math.min(Math.hypot(S[0]-E[0]-D,S[1]-E[1]-R)/I,1/o,1/l),u/o,d/l)}else b?T=Math.max(u,Math.min(1,Math.abs(S[0]-E[0]-D)))/o:j=Math.max(d,Math.min(1,Math.abs(S[1]-E[1]-R)))/l;const M=h(o*T),N=h(l*j);k=p(...v(M,N));const U=C-k[0],q=A-k[1];this.width=M,this.height=N,this.x=U,this.y=q,this.setDims(r*M,s*N),this.fixAndSetPosition()},mL=function(e){const{isMac:t}=Ki.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},_oe=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();const r=new AbortController,s=this._uiManager.combinedSignal(r);if(t){this.div.classList.add("moving"),F(this,Vy,e.clientX),F(this,Hy,e.clientY);const a=o=>{const{clientX:l,clientY:u}=o,[d,h]=this.screenToPageTranslation(l-w(this,Vy),u-w(this,Hy));F(this,Vy,l),F(this,Hy,u),this._uiManager.dragSelectedEditors(d,h)};window.addEventListener("pointermove",a,{passive:!0,capture:!0,signal:s})}const i=()=>{r.abort(),t&&this.div.classList.remove("moving"),F(this,Kp,!1),this._uiManager.endDragSession()||W(this,Qt,mL).call(this,e)};window.addEventListener("pointerup",i,{signal:s}),window.addEventListener("blur",i,{signal:s})},gL=function(){if(w(this,bh)||!this.div)return;F(this,bh,new AbortController);const e=this._uiManager.combinedSignal(w(this,bh));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},Soe=function(e){An._resizerKeyboardManager.exec(this,e)},Eoe=function(e){var t;w(this,Su)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==w(this,Ws)&&W(this,Qt,Wb).call(this)},koe=function(e){F(this,y_,w(this,Su)?e:"")},vL=function(e){if(w(this,_l))for(const t of w(this,_l))t.tabIndex=e},Wb=function(){if(F(this,Su,!1),W(this,Qt,vL).call(this,-1),w(this,Gp)){const{savedX:e,s
1007avedY:t,savedWidth:r,savedHeight:s}=w(this,Gp);W(this,Qt,fL).call(this,e,t,r,s),F(this,Gp,null)}},G(An,w_),Nt(An,"_l10n",null),Nt(An,"_l10nResizer",null),Nt(An,"_borderLineWidth",-1),Nt(An,"_colorManager",new rL),Nt(An,"_zIndex",1),Nt(An,"_telemetryTimeout",1e3);let Mn=An;class sVe extends Mn{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const XW=3285377520,fo=4294901760,sc=65535;class Coe{constructor(e){this.h1=e?e&4294967295:XW,this.h2=e?e&4294967295:XW}update(e){let t,r;if(typeof e=="string"){t=new Uint8Array(e.length*2),r=0;for(let g=0,y=e.length;g<y;g++){const v=e.charCodeAt(g);v<=255?t[r++]=v:(t[r++]=v>>>8,t[r++]=v&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),r=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=r>>2,i=r-s*4,a=new Uint32Array(t.buffer,0,s);let o=0,l=0,u=this.h1,d=this.h2;const h=3432918353,f=461845907,p=h&sc,m=f&sc;for(let g=0;g<s;g++)g&1?(o=a[g],o=o*h&fo|o*p&sc,o=o<<15|o>>>17,o=o*f&fo|o*m&sc,u^=o,u=u<<13|u>>>19,u=u*5+3864292196):(l=a[g],l=l*h&fo|l*p&sc,l=l<<15|l>>>17,l=l*f&fo|l*m&sc,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,i){case 3:o^=t[s*4+2]<<16;case 2:o^=t[s*4+1]<<8;case 1:o^=t[s*4],o=o*h&fo|o*p&sc,o=o<<15|o>>>17,o=o*f&fo|o*m&sc,s&1?u^=o:d^=o}this.h1=u,this.h2=d}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&fo|e*36045&sc,t=t*4283543511&fo|((t<<16|e>>>16)*2950163797&fo)>>>16,e^=t>>>1,e=e*444984403&fo|e*60499&sc,t=t*3301882366&fo|((t<<16|e>>>16)*3120437893&fo)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const yL=Object.freeze({map:null,hash:"",transfer:void 0});var Xp,Zp,Ts,AN,Aoe;class ez{constructor(){G(this,AN);G(this,Xp,!1);G(this,Zp,null);G(this,Ts,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const r=w(this,Ts).get(e);return r===void 0?t:Object.assign(t,r)}getRawValue(e){return w(this,Ts).get(e)}remove(e){if(w(this,Ts).delete(e),w(this,Ts).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of w(this,Ts).values())if(t instanceof Mn)return;this.onAnnotationEditor(null)}}setValue(e,t){const r=w(this,Ts).get(e);let s=!1;if(r!==void 0)for(const[i,a]of Object.entries(t))r[i]!==a&&(s=!0,r[i]=a);else s=!0,w(this,Ts).set(e,t);s&&W(this,AN,Aoe).call(this),t instanceof Mn&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return w(this,Ts).has(e)}getAll(){return w(this,Ts).size>0?KB(w(this,Ts)):null}setAll(e){for(const[t,r]of Object.entries(e))this.setValue(t,r)}get size(){return w(this,Ts).size}resetModified(){w(this,Xp)&&(F(this,Xp,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Noe(this)}get serializable(){if(w(this,Ts).size===0)return yL;const e=new Map,t=new Coe,r=[],s=Object.create(null);let i=!1;for(const[a,o]of w(this,Ts)){const l=o instanceof Mn?o.serialize(!1,s):o;l&&(e.set(a,l),t.update(`${a}:${JSON.stringify(l)}`),i||(i=!!l.bitmap))}if(i)for(const a of e.values())a.bitmap&&r.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:r}:yL}get editorStats(){let e=null;const t=new Map;for(const r of w(this,Ts).values()){if(!(r instanceof Mn))continue;const s=r.telemetryFinalData;if(!s)continue;const{type:i}=s;t.has(i)||t.set(i,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const a=e[i]||(e[i]=new Map);for(const[o,l]of Object.entries(s)){if(o==="type")continue;let u=a.get(o);u||(u=new Map,a.set(o,u));const d=u.get(l)??0;u.set(l,d+1)}}for(const[r,s]of t)e[r]=s.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){F(this,Zp,null)}get modifiedIds(){if(w(this,Zp))return w(this,Zp);const e=[];for(const t of w(this,Ts).values())!(t instanceof Mn)||!t.annotationElementId||!t.serialize()||e.push(t.annotationElementId);return F(this,Zp,{ids:new Set(e),hash:e.join(",")})}}Xp=new WeakMap,Zp=new WeakMap,Ts=new WeakMap,AN=new WeakSet,Aoe=function(){w(this,Xp)||(F(this,Xp,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var __;class Noe extends ez{constructor(t){super();G(this,__);const{map:r,hash:s,transfer:i}=t.serializable,a=structuredClone(r,i?{transfer:i}:null);F(this,__,{map:a,hash:s,transfer:i})}get print(){Qn("Should not call PrintAnnotationStorage.print")}get serializable(){return w(this,__)}get modifiedIds(){return mn(this,"modifiedIds",{ids:new Set,hash:""})}}__=new WeakMap;var Wy;class iVe{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){G(this,Wy,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),w(this,Wy).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}
1007){if(!(!e||w(this,Wy).has(e.loadedName))){if(ys(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:r,src:s,style:i}=e,a=new FontFace(r,s,i);this.addNativeFontFace(a);try{await a.load(),w(this,Wy).add(r),t==null||t(e)}catch{tn(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}Qn("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 r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(s){throw tn(`Failed to load font '${r.family}': '${s}'.`),e.disableFontFace=!0,s}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const s=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return mn(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(Ei||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),mn(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function t(){for(ys(!s.done,"completeRequest() cannot be called twice."),s.done=!0;r.length>0&&r[0].done;){const i=r.shift();setTimeout(i.callback,0)}}const{loadingRequests:r}=this,s={done:!1,complete:t,callback:e};return r.push(s),s}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return mn(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function r(E,S){return E.charCodeAt(S)<<24|E.charCodeAt(S+1)<<16|E.charCo
1007deAt(S+2)<<8|E.charCodeAt(S+3)&255}function s(E,S,k,C){const A=E.substring(0,S),T=E.substring(S+k);return A+C+T}let i,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let u=0;function d(E,S){if(++u>30){tn("Load test font never loaded."),S();return}if(l.font="30px "+E,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){S();return}setTimeout(d.bind(null,E,S))}const h=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,h.length,h);const m=16,g=1482184792;let y=r(f,m);for(i=0,a=h.length-3;i<a;i+=4)y=y-g+r(h,i)|0;i<h.length&&(y=y-g+r(h+"XXX",i)|0),f=s(f,m,4,VUe(y));const v=`url(data:font/opentype;base64,${btoa(f)});`,x=`@font-face {font-family:"${h}";src:${v}}`;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 E of[e.loadedName,h]){const S=this._document.createElement("span");S.textContent="Hi",S.style.fontFamily=E,b.append(S)}this._document.body.append(b),d(h,()=>{b.remove(),t.complete()})}}Wy=new WeakMap;class aVe{constructor(e,{disableFontFace:t=!1,inspectFont:r=null}){this.compiledGlyphs=Object.create(null);for(const s in e)this[s]=e[s];this.disableFontFace=t===!0,this._inspectFont=r}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var r;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${YUe(this.data)});`;let t;if(!this.cssFontInfo)t=`@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;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${e}}`}return(r=this._inspectFont)==null||r.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let r;try{r=e.get(this.loadedName+"_path_"+t)}catch(i){tn(`getPathGenerator - ignoring character: "${i}".`)}if(!Array.isArray(r)||r.length===0)return this.compiledGlyphs[t]=function(i,a){};const s=[];for(let i=0,a=r.length;i<a;)switch(r[i++]){case iu.BEZIER_CURVE_TO:{const[o,l,u,d,h,f]=r.slice(i,i+6);s.push(p=>p.bezierCurveTo(o,l,u,d,h,f)),i+=6}break;case iu.MOVE_TO:{const[o,l]=r.slice(i,i+2);s.push(u=>u.moveTo(o,l)),i+=2}break;case iu.LINE_TO:{const[o,l]=r.slice(i,i+2);s.push(u=>u.lineTo(o,l)),i+=2}break;case iu.QUADRATIC_CURVE_TO:{const[o,l,u,d]=r.slice(i,i+4);s.push(h=>h.quadraticCurveTo(o,l,u,d)),i+=4}break;case iu.RESTORE:s.push(o=>o.restore());break;case iu.SAVE:s.push(o=>o.save());break;case iu.SCALE:ys(s.length===2,"Scale command is only valid at the third position.");break;case iu.TRANSFORM:{const[o,l,u,d,h,f]=r.slice(i,i+6);s.push(p=>p.transform(o,l,u,d,h,f)),i+=6}break;case iu.TRANSLATE:{const[o,l]=r.slice(i,i+2);s.push(u=>u.translate(o,l)),i+=2}break}return this.compiledGlyphs[t]=function(a,o){s[0](a),s[1](a),a.scale(o,-o);for(let l=2,u=s.length;l<u;l++)s[l](a)}}}var S_;class Toe{constructor({enableHWA:e=!1}){G(this,S_,!1);F(this,S_,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,t);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!w(this,S_)})}}reset(e,t,r){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=r}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Qn("Abstract method `_createCanvas` called.")}}S_=new WeakMap;class oVe extends Toe{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const r=this._document.createElement("canvas");return r.width=e,r.height=t,r}}class joe{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(e){Qn("Abstract method `_fetch` called.")}}class Roe extends joe{async _fetch(e){const t=await Fj(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Lj(t)}}class Poe{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,r,s,i){return"none"}destroy(e=!1){}}var Jp,Qp,_c,Eu,pi,NN,em,dt,di,xv,bv,NC,wv,Doe,xL,_v,qb,Gb,bL,Kb;class lVe extends Poe{constructor({docId:t,ownerDocument:r=globalThis.document}){super();G(this,dt);G(this,Jp);G(this,Qp);G(this,_c);G(this,Eu);G(this,pi);G(this,NN);G(this,em,0);F(this,Eu,t),F(this,pi,r)}addFilter(t){if(!t)return"none";let r=w(this,dt,di).get(t);if(r)return r;const[s,i,a]=W(this,dt,NC).call(this,t),o=t.length===1?s:`${s}${i}${a}`;if(r=w(this,dt,di).get(o),r)return w(this,dt,di).set(t,r),r;const l=`g_${w(this,Eu)}_transfer_map_${Ss(this,em)._++}`,u=W(this,dt,wv).call(this,l);w(this,dt,di).set(t,u),w(this,dt,di).set(o,u);const d=W(this,dt,_v).call(this,l);return W(this,dt,Gb).call(this,s,i,a,d),u}addHCMFilter(t,r){var m;const s=`${t}-${r}`,i="base";let a=w(this,dt,xv).get(i);if((a==null?void 0:a.key)===s||(a?((m=a.filter)==null||m.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},w(this,dt,xv).set(i,a)),!t||!r))return a.url;const o=W(this,dt,Kb).call(this,t);t=_t.makeHexColor(...o);const l=W(this,dt,Kb).call(this,r);if(r=_t.makeHexColor(...l),w(this,dt,bv).style.color="",t==="#000000"&&r==="#ffffff"||t===r)return a.url;const u=new Array(256);for(let g=0;g<=255;g++){const y=g/255;u[g]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const d=u.join(","),h=`g_${w(this,Eu)}_hcm_filter`,f=a.filter=W(this,dt,_v).call(this,h);W(this,dt,Gb).call(this,d,d,d,f),W(this,dt,xL).call(this,f);const p=(g,y)=>{const v=o[g]/255,x=l[g]/255,b=new Array(y+1);for(let E=0;E<=y;E++)b[E]=v+E/y*(x-v);return b.join(",")};return W(this,dt,Gb).call(this,p(0,5),p(1,5),p(2,5),f),a.url=W(this,dt,wv).call(this,h),a.url}addAlphaFilter(t){let r=w(this,dt,di).get(t);if(r)return r;const[s]=W(this,dt,NC).call(this,[t]),i=`alpha_${s}`;if(r=w(this,dt,di).get(i),r)return w(this,dt,di).set(t,r),r;const a=`g_${w(this,Eu)}_alpha_map_${Ss(this,em)._++}`,o=W(this,dt,wv).call(this,a);w(this,dt,di).set(t,o),w(this,dt,di).set(i,o);const l=W(this,dt,_v).call(this,a);return W(this,dt,bL).call(this,s,l),o}addLuminosityFilter(t){let r=w(this,dt,di).get(t||"luminosity");if(r)return r;let s,i;if(t?([s]=W(this,dt,NC).call(this,[t]),i=`luminosity_${s}`):i="luminosity",r=w(this,dt,di).get(i),r)return w(this,dt,di).set(t,r),r;const a=`g_${w(this,Eu)}_luminosity_map_${Ss(this,em)._++}`,o=W(this,dt,wv).call(this,a);w(this,dt,di).set(t,o),w(this,dt,di).set(i,o);const l=W(this,dt,_v).call(this,a);return W(this,dt,Doe).call(this,l),t&&W(this,dt,bL).call(this,s,l),o}addHighlightHCMFilter(t,r,s,i,a){var x;const o=`${r}-${s}-${i}-${a}`;let l=w(this,dt,xv).get(t);if((l==null?void 0:l.key)===o||(l?((x=l.filter)==null||x.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},w(this,dt,xv).set(t,l)),!r||!s))return l.url;const[u,d]=[r,s].map(W(this,dt,Kb).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,m]=[i,a].map(W(this,dt,Kb).bind(this));f<h&&([h,f,p,m]=[f,h,m,p]),w(this,dt,bv).style.color="";const g=(b,E,S)=>{const k=new Array(256),C=(f-h)/S,A=b/255,T=(E-b)/(255*S);let j=0;for(let D=0;D<=S;D++){const R=Math.round(h+D*C),M=A+D*T;for(let N=j;N<=R;N++)k[N]=M;j=R+1}for(let D=j;D<256;D++)k[D]=k[j-1];return k.join(",")},y=`g_${w(this,Eu)}_hcm_${t}_filter`,v=l.filter=W(this,dt,_v).call(this,y);return W(this,dt,xL).call(this,v),W(this,dt,Gb).call(this,g(p[0],m[0],5),g(p[1],m[1],5),g(p[2],m[2],5),v),l.url=W(this,dt,wv).call(this,y),l.url}destroy(t=!1){t&&w(this,dt,xv).size!==0||(w(this,_c)&&(w(this,_c).parentNode.parentNode.remove(),F(this,_c,null)),w(this,Qp)&&
1007(w(this,Qp).clear(),F(this,Qp,null)),F(this,em,0))}}Jp=new WeakMap,Qp=new WeakMap,_c=new WeakMap,Eu=new WeakMap,pi=new WeakMap,NN=new WeakMap,em=new WeakMap,dt=new WeakSet,di=function(){return w(this,Qp)||F(this,Qp,new Map)},xv=function(){return w(this,NN)||F(this,NN,new Map)},bv=function(){if(!w(this,_c)){const t=w(this,pi).createElement("div"),{style:r}=t;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const s=w(this,pi).createElementNS(cu,"svg");s.setAttribute("width",0),s.setAttribute("height",0),F(this,_c,w(this,pi).createElementNS(cu,"defs")),t.append(s),s.append(w(this,_c)),w(this,pi).body.append(t)}return w(this,_c)},NC=function(t){if(t.length===1){const u=t[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[r,s,i]=t,a=new Array(256),o=new Array(256),l=new Array(256);for(let u=0;u<256;u++)a[u]=r[u]/255,o[u]=s[u]/255,l[u]=i[u]/255;return[a.join(","),o.join(","),l.join(",")]},wv=function(t){if(w(this,Jp)===void 0){F(this,Jp,"");const r=w(this,pi).URL;r!==w(this,pi).baseURI&&(Bj(r)?tn('#createUrl: ignore "data:"-URL for performance reasons.'):F(this,Jp,r.split("#",1)[0]))}return`url(${w(this,Jp)}#${t})`},Doe=function(t){const r=w(this,pi).createElementNS(cu,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(r)},xL=function(t){const r=w(this,pi).createElementNS(cu,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(r)},_v=function(t){const r=w(this,pi).createElementNS(cu,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",t),w(this,dt,bv).append(r),r},qb=function(t,r,s){const i=w(this,pi).createElementNS(cu,r);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),t.append(i)},Gb=function(t,r,s,i){const a=w(this,pi).createElementNS(cu,"feComponentTransfer");i.append(a),W(this,dt,qb).call(this,a,"feFuncR",t),W(this,dt,qb).call(this,a,"feFuncG",r),W(this,dt,qb).call(this,a,"feFuncB",s)},bL=function(t,r){const s=w(this,pi).createElementNS(cu,"feComponentTransfer");r.append(s),W(this,dt,qb).call(this,s,"feFuncA",t)},Kb=function(t){return w(this,dt,bv).style.color=t,QB(getComputedStyle(w(this,dt,bv)).getPropertyValue("color"))};class Ooe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(r=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(e){Qn("Abstract method `_fetch` called.")}}class Moe extends Ooe{async _fetch(e){const t=await Fj(e,"arraybuffer");return new Uint8Array(t)}}if(Ei){var wL=Promise.withResolvers(),$w=null;(async()=>{const e=await Wv(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),t=await Wv(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),r=await Wv(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await Wv(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let i,a;return new Map(Object.entries({fs:e,http:t,https:r,url:s,canvas:i,path2d:a}))})().then(e=>{$w=e,wL.resolve()},e=>{tn(`loadPackages: ${e}`),$w=new Map,wL.resolve()})}class _f{static get promise(){return wL.promise}static get(e){return $w==null?void 0:$w.get(e)}}async function Ioe(n){const t=await _f.get("fs").promises.readFile(n);return new Uint8Array(t)}class cVe extends Poe{}class uVe extends Toe{_createCanvas(e,t){return _f.get("canvas").createCanvas(e,t)}}class dVe extends joe{async _fetch(e){return Ioe(e)}}class hVe extends Ooe{async _fetch(e){return Ioe(e)}}const Bi={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function _L(n,e){if(!e)return;const t=e[2]-e[0],r=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],t,r),n.clip(s)}class tz{getPattern(){Qn("Abstract method `getPattern` called.")}}class fVe extends tz{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)t.addColorStop(r[0],r[1]);return t}getPattern(e,t,r,s){let i;if(s===Bi.STROKE||s===Bi.FILL){const a=t.current.getClippedPathBoundingBox(s,lr(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,u=t.cachedCanvases.getCanvas("pattern",o,l),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(-a[0],-a[1]),r
vendor: 10,498 bytes, line 1007
1007=_t.transform(r,[1,0,0,1,a[0],a[1]]),d.transform(...t.baseTransform),this.matrix&&d.transform(...this.matrix),_L(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),i=e.createPattern(u.canvas,"no-repeat");const h=new DOMMatrix(r);i.setTransform(h)}else _L(e,this._bbox),i=this._createGradient(e);return i}}function SD(n,e,t,r,s,i,a,o){const l=e.coords,u=e.colors,d=n.data,h=n.width*4;let f;l[t+1]>l[r+1]&&(f=t,t=r,r=f,f=i,i=a,a=f),l[r+1]>l[s+1]&&(f=r,r=s,s=f,f=a,a=o,o=f),l[t+1]>l[r+1]&&(f=t,t=r,r=f,f=i,i=a,a=f);const p=(l[t]+e.offsetX)*e.scaleX,m=(l[t+1]+e.offsetY)*e.scaleY,g=(l[r]+e.offsetX)*e.scaleX,y=(l[r+1]+e.offsetY)*e.scaleY,v=(l[s]+e.offsetX)*e.scaleX,x=(l[s+1]+e.offsetY)*e.scaleY;if(m>=x)return;const b=u[i],E=u[i+1],S=u[i+2],k=u[a],C=u[a+1],A=u[a+2],T=u[o],j=u[o+1],D=u[o+2],R=Math.round(m),M=Math.round(x);let N,U,q,I,B,$,ie,ne;for(let L=R;L<=M;L++){if(L<y){const le=L<m?0:(m-L)/(m-y);N=p-(p-g)*le,U=b-(b-k)*le,q=E-(E-C)*le,I=S-(S-A)*le}else{let le;L>x?le=1:y===x?le=0:le=(y-L)/(y-x),N=g-(g-v)*le,U=k-(k-T)*le,q=C-(C-j)*le,I=A-(A-D)*le}let te;L<m?te=0:L>x?te=1:te=(m-L)/(m-x),B=p-(p-v)*te,$=b-(b-T)*te,ie=E-(E-j)*te,ne=S-(S-D)*te;const ae=Math.round(Math.min(N,B)),de=Math.round(Math.max(N,B));let ue=h*L+ae*4;for(let le=ae;le<=de;le++)te=(N-le)/(N-B),te<0?te=0:te>1&&(te=1),d[ue++]=U-(U-$)*te|0,d[ue++]=q-(q-ie)*te|0,d[ue++]=I-(I-ne)*te|0,d[ue++]=255}}function pVe(n,e,t){const r=e.coords,s=e.colors;let i,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(r.length/o)-1,u=o-1;for(i=0;i<l;i++){let d=i*o;for(let h=0;h<u;h++,d++)SD(n,t,r[d],r[d+1],r[d+o],s[d],s[d+1],s[d+o]),SD(n,t,r[d+o+1],r[d+1],r[d+o],s[d+o+1],s[d+1],s[d+o])}break;case"triangles":for(i=0,a=r.length;i<a;i+=3)SD(n,t,r[i],r[i+1],r[i+2],s[i],s[i+1],s[i+2]);break;default:throw new Error("illegal figure")}}class mVe extends tz{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,r){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-l,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,m=d/f,g={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/p,scaleY:1/m},y=h+2*2,v=f+2*2,x=r.getCanvas("mesh",y,v),b=x.context,E=b.createImageData(h,f);if(t){const k=E.data;for(let C=0,A=k.length;C<A;C+=4)k[C]=t[0],k[C+1]=t[1],k[C+2]=t[2],k[C+3]=255}for(const k of this._figures)pVe(E,k,g);return b.putImageData(E,2,2),{canvas:x.canvas,offsetX:o-2*p,offsetY:l-2*m,scaleX:p,scaleY:m}}getPattern(e,t,r,s){_L(e,this._bbox);let i;if(s===Bi.SHADING)i=_t.singularValueDecompose2dScale(lr(e));else if(i=_t.singularValueDecompose2dScale(t.baseTransform),this.matrix){const o=_t.singularValueDecompose2dScale(this.matrix);i=[i[0]*o[0],i[1]*o[1]]}const a=this._createMeshCanvas(i,s===Bi.SHADING?null:this._background,t.cachedCanvases);return s!==Bi.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY),e.createPattern(a.canvas,"no-repeat")}}class gVe extends tz{getPattern(){return"hotpink"}}function vVe(n){switch(n[0]){case"RadialAxial":return new fVe(n);case"Mesh":return new mVe(n);case"Dummy":return new gVe}throw new Error(`Unknown IR type: ${n[0]}`)}const ZW={COLORED:1,UNCOLORED:2},TN=class TN{constructor(e,t,r,s,i){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.color=t,this.ctx=r,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(e){const{bbox:t,operatorList:r,paintType:s,tilingType:i,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:u}=this;l=Math.abs(l),u=Math.abs(u),Mj("TilingType: "+i);const d=t[0],h=t[1],f=t[2],p=t[3],m=f-d,g=p-h,y=_t.singularValueDecompose2dScale(this.matrix),v=_t.singularValueDecompose2dScale(this.baseTransform),x=y[0]*v[0],b=y[1]*v[1];let E=m,S=g,k=!1,C=!1;const A=Math.ceil(l*x),T=Math.ceil(u*b),j=Math.ceil(m*x),D=Math.ceil(g*b);A>=j?E=l:k=!0,T>=D?S=u:C=!0;const R=this.getSizeAndScale(E,this.ctx.canvas.width,x),M=this.getSizeAndScale(S,this.ctx.canvas.height,b),N=e.cachedCanvases.getCanvas("pattern",R.size,M.size),U=N.context,q=o.createCanvasGraphics(U);if(q.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(q,s,a),U.translate(-R.scale*d,-M.scale*h),q.transform(R.scale,0,0,M.scale,0,0),U.save(),this.clipBbox(q,d,h,f,p),q.baseTransform=lr(q.ctx),q.executeOperatorList(r),q.endDrawing(),U.restore(),k||C){const I=N.canvas;k&&(E=l),C&&(S=u);const B=this.getSizeAndScale(E,this.ctx.canvas.width,x),$=this.getSizeAndScale(S,this.ctx.canvas.height,b),ie=B.size,ne=$.size,L=e.cachedCanvases.getCanvas("pattern-workaround",ie,ne),te=L.context,ae=k?Math.floor(m/l):0,de=C?Math.floor(g/u):0;for(let ue=0;ue<=ae;ue++)for(let le=0;le<=de;le++)te.drawImage(I,ie*ue,ne*le,ie,ne,0,0,ie,ne);return{canvas:L.canvas,scaleX:B.scale,scaleY:$.scale,offsetX:d,offsetY:h}}return{canvas:N.canvas,scaleX:R.scale,scaleY:M.scale,offsetX:d,offsetY:h}}getSizeAndScale(e,t,r){const s=Math.max(TN.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*r);return i>=s?i=s:r=i/e,{scale:r,size:i}}clipBbox(e,t,r,s,i){const a=s-t,o=i-r;e.ctx.rect(t,r,a,o),e.current.updateRectMinMax(lr(e.ctx),[t,r,s,i]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,r){const s=e.ctx,i=e.current;switch(t){case ZW.COLORED:const a=this.ctx;s.fillStyle=a.fillStyle,s.strokeStyle=a.strokeStyle,i.fillColor=a.fillStyle,i.strokeColor=a.strokeStyle;break;case ZW.UNCOLORED:const o=_t.makeHexColor(r[0],r[1],r[2]);s.fillStyle=o,s.strokeStyle=o,i.fillColor=o,i.strokeColor=o;break;default:throw new UUe(`Unsupported paint type: ${t}`)}}getPattern(e,t,r,s){let i=r;s!==Bi.SHADING&&(i=_t.transform(i,t.baseTransform),this.matrix&&(i=_t.transform(i,this.matrix)));const a=this.createPatternCanvas(t);let o=new DOMMatrix(i);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=e.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};Nt(TN,"MAX_PATTERN_SIZE",3e3);let SL=TN;function yVe({src:n,srcPos:e=0,dest:t,width:r,height:s,nonBlackColor:i=4294967295,inverseDecode:a=!1}){const o=Ki.isLittleEndian?4278190080:255,[l,u]=a?[i,o]:[o,i],d=r>>3,h=r&7,f=n.length;t=new Uint32Array(t.buffer);let p=0;for(let m=0;m<s;m++){for(const y=e+d;e<y;e++){const v=e<f?n[e]:255;t[p++]=v&128?u:l,t[p++]=v&64?u:l,t[p++]=v&32?u:l,t[p++]=v&16?u:l,t[p++]=v&8?u:l,t[p++]=v&4?u:l,t[p++]=v&2?u:l,t[p++]=v&1?u:l}if(h===0)continue;const g=e<f?n[e++]:255;for(let y=0;y<h;y++)t[p++]=g&1<<7-y?u:l}return{srcPos:e,destPos:p}}const JW=16,QW=100,xVe=15,eq=10,tq=1e3,pa=16;function bVe(n,e){if(n._removeMirroring)throw new Error("Context is already forwarding operations.");n.__originalSave=n.save,n.__originalRestore=n.restore,n.__originalRotate=n.rotate,n.__originalScale=n.scale,n.__originalTranslate=n.translate,n.__originalTransform=n.transform,n.__originalSetTransform=n.setTransform,n.__originalResetTransform=n.resetTransform,n.__originalClip=n.clip,n.__originalMoveTo=n.moveTo,n.__originalLineTo=n.lineTo,n.__originalBezierCurveTo=n.bezierCurveTo,n.__originalRect=n.rect,n.__originalClosePath=n.closePath,n.__originalBeginPath=n.beginPath,n._removeMirroring=()=>{n.save=n.__originalSave,n.restore=n.__originalRestore,n.rotate=n.__originalRotate,n.scale=n.__originalScale,n.translate=n.__originalTranslate,n.transform=n.__originalTransform,n.setTransform=n.__originalSetTransform,n.resetTransform=n.__originalResetTransform,n.clip=n.__originalClip,n.moveTo=n.__originalMoveTo,n.lineTo=n.__originalLineTo,n.bezierCurveTo=n.__originalBezierCurveTo,n.rect=n.__originalRect,n.closePath=n.__originalClosePath,n.beginPath=n.__originalBeginPath,delete n._removeMirroring},n.save=function(){e.save(),this.__originalSave()},n.restore=function(){e.restore(),this.__originalRestore()},n.translate=function(r,s){e.translate(r,s),this.__originalTranslate(r,s)},n.scale=function(r,s){e.scale(r,s),this.__originalScale(r,s)},n.transform=function(r,s,i,a,o,l){e.transform(r,s,i,a,o,l),this.__originalTransform(r,s,i,a,o,l)},n.setTransform=function(r,s,i,a,o,l){e.setTransform(r,s,i,a,o,l),this.__originalSetTransform(r,s,i,a,o,l)},n.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},n.rotate=function(r){e.rotate(r),this.__originalRotate(r)},n.clip=function(r){e.clip(r),this.__originalClip(r)},n.moveTo=function(t,r){e.moveTo(t,r),this.__originalMoveTo(t,r)},n.lineTo=function(t,r){e.lineTo(t,r),this.__originalLineTo(t,r)},n.bezierCurveTo=function(t,r,s,i,a,o){e.bezierCurveTo(t,r,s,i,a,o),this.__originalBezierCurveTo(t,r,s,i,a,o)},n.rect=function(t,r,s,i){e.rect(t,r,s,i),this.__originalRect(t,r,s,i)},n.closePath=function(){e.closePath(),this.__originalClosePath()},n.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class wVe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,r){let s;return this.cache[e]!==void 0?(s=this.cache[e],this.canvasFactory.reset(s,t,r)):(s=this.canvasFactory.create(t,r),this.cache[e]=s),s}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function Ck(n,e,t,r,s,i,a,o,l,u){const[d,h,f,p,m,g]=lr(n);if(h===0&&f===0){const x=a*d+m,b=Math.round(x),E=o*p+g,S=Math.round(E),k=(a+l)*d+m,C=Math.abs(Math.round(k)-b)||1,A=(o+u)*p+g,T=Math.abs(Math.round(A)-S)||1;return n.setTransform(Math.sign(d),0,0,Math.sign(p),b,S),n.drawImage(e,t,r,s,i,0,0,C,T),n.setTransform(d,h,f,p,m,g),[C,T]}if(d===0&&p===0){const x=o*f+m,b=Math.round(x),E=a*h+g,S=Math.round(E),k=(o+u)*f+m,C=Math.abs(Math.round(k)-b)||1,A=(a+l)*h+g,T=Math.abs(Math.round(A)-S)||1;return n.setTransform(0,Math.sign(h),Math.sign(f),0,b,S),n.drawImage(e,t,r,s,i,0,0,T,C),n.setTransform(d,h,f,p,m,g),[T,C]}n.drawImage(e,t,r,s,i,a,o,l,u);const y=Math.hypot(d,h),v=Math.hypot(f,p);return[y*l,v*u]}function _Ve(n){const{width:e,height:t}=n;if(e>tq||t>tq)return null;const r=1e3,s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=e+1;let a=new Uint8Array(i*(t+1)),o,l,u;const d=e+7&-8;let h=new Uint8Array(d*t),f=0;for(const v of n.data){let x=128;for(;x>0;)h[f++]=v&x?0:255,x>>=1}let p=0;for(f=0,h[f]!==0&&(a[0]=1,++p),l=1;l<e;l++)h[f]!==h[f+1]&&(a[l]=h[f]?2:1,++p),f++;for(h[f]!==0&&(a[l]=2,++p),o=1;o<t;o++){f=o*d,u=o*i,h[f-d]!==h[f]&&(a[u]=h[f]?1:8,++p);let v=(h[f]?4:0)+(h[f-d]?8:0);for(l=1;l<e;l++)v=(v>>
10072)+(h[f+1]?4:0)+(h[f-d+1]?8:0),s[v]&&(a[u+l]=s[v],++p),f++;if(h[f-d]!==h[f]&&(a[u+l]=h[f]?2:4,++p),p>r)return null}for(f=d*(t-1),u=o*i,h[f]!==0&&(a[u]=8,++p),l=1;l<e;l++)h[f]!==h[f+1]&&(a[u+l]=h[f]?4:8,++p),f++;if(h[f]!==0&&(a[u+l]=4,++p),p>r)return null;const m=new Int32Array([0,i,-1,0,-i,0,0,0,1]),g=new Path2D;for(o=0;p&&o<=t;o++){let v=o*i;const x=v+e;for(;v<x&&!a[v];)v++;if(v===x)continue;g.moveTo(v%i,o);const b=v;let E=a[v];do{const S=m[E];do v+=S;while(!a[v]);const k=a[v];k!==5&&k!==10?(E=k,a[v]=0):(E=k&51*E>>4,a[v]&=E>>2|E<<2),g.lineTo(v%i,v/i|0),a[v]||--p}while(b!==v);--o}return h=null,a=null,function(v){v.save(),v.scale(1/e,-1/t),v.translate(0,-t),v.fill(g),v.beginPath(),v.restore()}}class nq{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Qae,this.textMatrixScale=1,this.fontMatrix=YI,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=ui.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,r){[t,r]=_t.applyTransform([t,r],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,r),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,r)}updateRectMinMax(e,t){const r=_t.applyTransform(t,e),s=_t.applyTransform(t.slice(2),e),i=_t.applyTransform([t[0],t[3]],e),a=_t.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,r[0],s[0],i[0],a[0]),this.minY=Math.min(this.minY,r[1],s[1],i[1],a[1]),this.maxX=Math.max(this.maxX,r[0],s[0],i[0],a[0]),this.maxY=Math.max(this.maxY,r[1],s[1],i[1],a[1])}updateScalingPathMinMax(e,t){_t.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,r,s,i,a,o,l,u,d){const h=_t.bezierBoundingBox(t,r,s,i,a,o,l,u,d);d||this.updateRectMinMax(e,h)}getPathBoundingBox(e=Bi.FILL,t=null){const r=[this.minX,this.minY,this.maxX,this.maxY];if(e===Bi.STROKE){t||Qn("Stroke bounding box must include transform.");const s=_t.singularValueDecompose2dScale(t),i=s[0]*this.lineWidth/2,a=s[1]*this.lineWidth/2;r[0]-=i,r[1]-=a,r[2]+=i,r[3]+=a}return r}updateClipFromPath(){const e=_t.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=Bi.FILL,t=null){return _t.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function rq(n,e){if(typeof ImageData<"u"&&e instanceof ImageData){n.putImageData(e,0,0);return}const t=e.height,r=e.width,s=t%pa,i=(t-s)/pa,a=s===0?i:i+1,o=n.createImageData(r,pa);let l=0,u;const d=e.data,h=o.data;let f,p,m,g;if(e.kind===wC.GRAYSCALE_1BPP){const y=d.byteLength,v=new Uint32Array(h.buffer,0,h.byteLength>>2),x=v.length,b=r+7>>3,E=4294967295,S=Ki.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(m=f<i?pa:s,u=0,p=0;p<m;p++){const k=y-l;let C=0;const A=k>b?r:k*8-7,T=A&-8;let j=0,D=0;for(;C<T;C+=8)D=d[l++],v[u++]=D&128?E:S,v[u++]=D&64?E:S,v[u++]=D&32?E:S,v[u++]=D&16?E:S,v[u++]=D&8?E:S,v[u++]=D&4?E:S,v[u++]=D&2?E:S,v[u++]=D&1?E:S;for(;C<A;C++)j===0&&(D=d[l++],j=128),v[u++]=D&j?E:S,j>>=1}for(;u<x;)v[u++]=0;n.putImageData(o,0,f*pa)}}else if(e.kind===wC.RGBA_32BPP){for(p=0,g=r*pa*4,f=0;f<i;f++)h.set(d.subarray(l,l+g)),l+=g,n.putImageData(o,0,p),p+=pa;f<a&&(g=r*s*4,h.set(d.subarray(l,l+g)),n.putImageData(o,0,p))}else if(e.kind===wC.RGB_24BPP)for(m=pa,g=r*m,f=0;f<a;f++){for(f>=i&&(m=s,g=r*m),u=0,p=g;p--;)h[u++]=d[l++],h[u++]=d[l++],h[u++]=d[l++],h[u++]=255;n.putImageData(o,0,f*pa)}else throw new Error(`bad image kind: ${e.kind}`)}function sq(n,e){if(e.bitmap){n.drawImage(e.bitmap,0,0);return}const t=e.height,r=e.width,s=t%pa,i=(t-s)/pa,a=s===0?i:i+1,o=n.createImageData(r,pa);let l=0;const u=e.data,d=o.data;for(let h=0;h<a;h++){const f=h<i?pa:s;({srcPos:l}=yVe({src:u,srcPos:l,dest:d,width:r,height:f,nonBlackColor:0})),n.putImageData(o,0,h*pa)}}function vb(n,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of t)n[r]!==void 0&&(e[r]=n[r]);
vendor: 4,738 bytes, line 1007
1007n.setLineDash!==void 0&&(e.setLineDash(n.getLineDash()),e.lineDashOffset=n.lineDashOffset)}function Ak(n){if(n.strokeStyle=n.fillStyle="#000000",n.fillRule="nonzero",n.globalAlpha=1,n.lineWidth=1,n.lineCap="butt",n.lineJoin="miter",n.miterLimit=10,n.globalCompositeOperation="source-over",n.font="10px sans-serif",n.setLineDash!==void 0&&(n.setLineDash([]),n.lineDashOffset=0),!Ei){const{filter:e}=n;e!=="none"&&e!==""&&(n.filter="none")}}function iq(n,e){if(e)return!0;const t=_t.singularValueDecompose2dScale(n);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*wf.PDF_TO_CSS_UNITS);return t[0]<=r&&t[1]<=r}const SVe=["butt","round","square"],EVe=["miter","round","bevel"],kVe={},aq={};var Ef,EL,kL;const cz=class cz{constructor(e,t,r,s,i,{optionalContentConfig:a,markedContentStack:o=null},l,u){G(this,Ef);this.ctx=e,this.current=new nq(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=r,this.canvasFactory=s,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new wVe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,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,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:r=!1,background:s=null}){const i=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,i,a),this.ctx.fillStyle=o,r){const l=this.cachedCanvases.getCanvas("transparent",i,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...lr(this.compositeCtx))}this.ctx.save(),Ak(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=lr(this.ctx)}executeOperatorList(e,t,r,s){const i=e.argsArray,a=e.fnArray;let o=t||0;const l=i.length;if(l===o)return o;const u=l-o>eq&&typeof r=="function",d=u?Date.now()+xVe:0;let h=0;const f=this.commonObjs,p=this.objs;let m;for(;;){if(s!==void 0&&o===s.nextBreakPoint)return s.breakIt(o,r),o;if(m=a[o],m!==ml.dependency)this[m].apply(this,i[o]);else for(const g of i[o]){const y=g.startsWith("g_")?f:p;if(!y.has(g))return y.get(g,r),o}if(o++,o===l)return o;if(u&&++h>eq){if(Date.now()>d)return r(),o;h=0}}}endDrawing(){W(this,Ef,EL).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),W(this,Ef,kL).call(this)}_scaleImage(e,t){const r=e.width??e.displayWidth,s=e.height??e.displayHeight;let i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=r,l=s,u="prescale1",d,h;for(;i>2&&o>1||a>2&&l>1;){let f=o,p=l;i>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),i/=o/f),a>2&&l>1&&(p=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/p),d=this.cachedCanvases.getCanvas(u,f,p),h=d.context,h.clearRect(0,0,f,p),h.drawImage(e,0,0,o,l,0,0,f,p),e=d.canvas,o=f,l=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:o,paintHeight:l}}_createMaskCanvas(e){const t=this.ctx,{width:r,height:s}=e,i=this.current.fillColor,a=this.current.patternFill,o=lr(t);let l,u,d,h;if((e.bitmap||e.data)&&e.count>1){const A=e.bitmap||e.data.buffer;u=JSON.stringify(a?o:[o.slice(0,4),i]),l=this._cachedBitmapsMap.get(A),l||(l=new Map,this._cachedBitmapsMap.set(A,l));const T=l.get(u);if(T&&!a){const j=Math.round(Math.min(o[0],o[2])+o[4]),D=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:T,offsetX:j,offsetY:D}}d=T}d||(h=this.cachedCanvases.getCanvas("maskCanvas",r,s),sq(h.context,e));let f=_t.transform(o,[1/r,0,0,-1/s,0,0]);f=_t.transform(f,[1,0,0,1,0,-s]);const[p,m,g,y]=_t.getAxialAlignedBoundingBox([0,0,r,s],f),v=Math.round(g-p)||1,x=Math.round(y-m)||1,b=this.cachedCanvases.getCanvas("fillCanvas",v,x),E=b.context,S=p,k=m;E.translate(-S,-k),E.transform(...f),d||(d=this._scaleImage(h.canvas,au(E)),d=d.img,l&&a&&l.set(u,d)),E.imageSmoothingEnabled=iq(lr(E),e.interpolate),Ck(E,d,0,0,d.width,d.height,0,0,r,s
vendor: 4,161 bytes, line 1007
1007),E.globalCompositeOperation="source-in";const C=_t.transform(au(E),[1,0,0,1,-S,-k]);return E.fillStyle=a?i.getPattern(t,this,C,Bi.FILL):i,E.fillRect(0,0,r,s),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(u,b.canvas)),{canvas:b.canvas,offsetX:Math.round(S),offsetY:Math.round(k)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=SVe[e]}setLineJoin(e){this.ctx.lineJoin=EVe[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,r]of e)switch(t){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r[0],r[1]);break;case"CA":this.current.strokeAlpha=r;break;case"ca":this.current.fillAlpha=r,this.ctx.globalAlpha=r;break;case"BM":this.ctx.globalCompositeOperation=r;break;case"SMask":this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(r,e,t);this.suspendedCtx=this.ctx,this.ctx=s.context;const i=this.ctx;i.setTransform(...lr(this.suspendedCtx)),vb(this.suspendedCtx,i),bVe(i,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),vb(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,r,s){const i=s[0],a=s[1],o=s[2]-i,l=s[3]-a;o===0||l===0||(this.genericComposeSMask(t.context,r,o,l,t.subtype,t.backdrop,t.transferMap,i,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,t,r,s,i,a,o,l,u,d,h){let f=e.canvas,p=l-d,m=u-h;if(a){const y=_t.makeHexColor(...a);if(p<0||m<0||p+r>f.width||m+s>f.height){const v=this.cachedCanvases.getCanvas("maskExtension",r,s),x=v.context;x.drawImage(f,-p,-m),x.globalCompositeOperation="destination-atop",x.fillStyle=y,x.fillRect(0,0,r,s),x.globalCompositeOperation="source-over",f=v.canvas,p=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(p,m,r,s),e.clip(v),e.globalCompositeOperation="destination-atop",e.fillStyle=y,e.fillRect(p,m,r,s),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),i==="Alpha"&&o?t.filter=this.filterFactory.addAlphaFilter(o):i==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(o));const g=new Path2D;g.rect(l,u,r,s),t.clip(g),t.globalCompositeOperation="destination-in",t.drawImage(f,p,m,r,s,l,u,r,s),t.restore()}save(){this.inSMaskMode?(vb(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(
1007),vb(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,r,s,i,a){this.ctx.transform(e,t,r,s,i,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,r){const s=this.ctx,i=this.current;let a=i.x,o=i.y,l,u;const d=lr(s),h=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,f=h?r.slice(0):null;for(let p=0,m=0,g=e.length;p<g;p++)switch(e[p]|0){case ml.rectangle:a=t[m++],o=t[m++];const y=t[m++],v=t[m++],x=a+y,b=o+v;s.moveTo(a,o),y===0||v===0?s.lineTo(x,b):(s.lineTo(x,o),s.lineTo(x,b),s.lineTo(a,b)),h||i.updateRectMinMax(d,[a,o,x,b]),s.closePath();break;case ml.moveTo:a=t[m++],o=t[m++],s.moveTo(a,o),h||i.updatePathMinMax(d,a,o);break;case ml.lineTo:a=t[m++],o=t[m++],s.lineTo(a,o),h||i.updatePathMinMax(d,a,o);break;case ml.curveTo:l=a,u=o,a=t[m+4],o=t[m+5],s.bezierCurveTo(t[m],t[m+1],t[m+2],t[m+3],a,o),i.updateCurvePathMinMax(d,l,u,t[m],t[m+1],t[m+2],t[m+3],a,o,f),m+=6;break;case ml.curveTo2:l=a,u=o,s.bezierCurveTo(a,o,t[m],t[m+1],t[m+2],t[m+3]),i.updateCurvePathMinMax(d,l,u,a,o,t[m],t[m+1],t[m+2],t[m+3],f),a=t[m+2],o=t[m+3],m+=4;break;case ml.curveTo3:l=a,u=o,a=t[m+2],o=t[m+3],s.bezierCurveTo(t[m],t[m+1],a,o,a,o),i.updateCurvePathMinMax(d,l,u,t[m],t[m+1],a,o,a,o,f),m+=4;break;case ml.closePath:s.closePath();break}h&&i.updateScalingPathMinMax(d,f),i.setCurrentPoint(a,o)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,r=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof r=="object"&&(r!=null&&r.getPattern)?(t.save(),t.strokeStyle=r.getPattern(t,this,au(t),Bi.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,r=this.current.fillColor,s=this.current.patternFill;let i=!1;s&&(t.save(),t.fillStyle=r.getPattern(t,this,au(t),Bi.FILL),i=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),i&&t.restore(),e&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=kVe}eoClip(){this.pendingClip=aq}beginText(){this.current.textMatrix=Qae,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(e===void 0){t.beginPath();return}t.save(),t.beginPath();for(const r of e)t.setTransform(...r.transform),t.translate(r.x,r.y),r.addToPath(t,r.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){var d;const r=this.commonObjs.get(e),s=this.current;if(!r)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=r.fontMatrix||YI,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&tn("Invalid font matrix for font "+e),t<0?(t=-t,s.fontDirection=-1):s.fontDirection=1,this.current.font=r,this.current.fontSize=t,r.isType3Font)return;const i=r.loadedName||"sans-serif",a=((d=r.systemFontInfo)==null?void 0:d.css)||`"${i}", ${r.fallbackName}`;let o="normal";r.black?o="900":r.bold&&(o="bold");const l=r.italic?"italic":"normal";let u=t;t<JW?u=JW:t>QW&&(u=QW),this.current.fontSizeScale=t/u,this.ctx.font=`${l} ${o} ${u}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,r,s,i,a){this.current.textMatrix=[e,t,r,s,i,a],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,r,s){const i=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,u=a.fontSize/a.fontSizeScale,d=l&ui.FILL_STROKE_MASK,h=!!(l&ui.ADD_TO_PATH_FLAG),f=a.patternFill&&!o.missingFile;let p;(o.disableFontFace||h||f)&&(p=o.getPathGenerator(this.commonObjs,e)),o.disableFontFace||f?(i.save(),i.translate(t,r),i.beginPath(),p(i,u),s&&i.setTransform(...s),(d===ui.FILL||d===ui.FILL_STROKE)&&i.fill(),(d===ui.STROKE||d===ui.FILL_STROKE)&&i.stroke(),i.restore(
1007)):((d===ui.FILL||d===ui.FILL_STROKE)&&i.fillText(e,t,r),(d===ui.STROKE||d===ui.FILL_STROKE)&&i.strokeText(e,t,r)),h&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:lr(i),x:t,y:r,fontSize:u,addToPath:p})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let r=!1;for(let s=3;s<t.length;s+=4)if(t[s]>0&&t[s]<255){r=!0;break}return mn(this,"isFontSubpixelAAEnabled",r)}showText(e){const t=this.current,r=t.font;if(r.isType3Font)return this.showType3Text(e);const s=t.fontSize;if(s===0)return;const i=this.ctx,a=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,u=t.fontDirection,d=t.textHScale*u,h=e.length,f=r.vertical,p=f?1:-1,m=r.defaultVMetrics,g=s*t.fontMatrix[0],y=t.textRenderingMode===ui.FILL&&!r.disableFontFace&&!t.patternFill;i.save(),i.transform(...t.textMatrix),i.translate(t.x,t.y+t.textRise),u>0?i.scale(d,-1):i.scale(d,1);let v;if(t.patternFill){i.save();const k=t.fillColor.getPattern(i,this,au(i),Bi.FILL);v=lr(i),i.restore(),i.fillStyle=k}let x=t.lineWidth;const b=t.textMatrixScale;if(b===0||x===0){const k=t.textRenderingMode&ui.FILL_STROKE_MASK;(k===ui.STROKE||k===ui.FILL_STROKE)&&(x=this.getSinglePixelWidth())}else x/=b;if(a!==1&&(i.scale(a,a),x/=a),i.lineWidth=x,r.isInvalidPDFjsFont){const k=[];let C=0;for(const A of e)k.push(A.unicode),C+=A.width;i.fillText(k.join(""),0,0),t.x+=C*g*d,i.restore(),this.compose();return}let E=0,S;for(S=0;S<h;++S){const k=e[S];if(typeof k=="number"){E+=p*k*s/1e3;continue}let C=!1;const A=(k.isSpace?l:0)+o,T=k.fontChar,j=k.accent;let D,R,M=k.width;if(f){const U=k.vmetric||m,q=-(k.vmetric?U[1]:M*.5)*g,I=U[2]*g;M=U?-U[0]:M,D=q/a,R=(E+I)/a}else D=E/a,R=0;if(r.remeasure&&M>0){const U=i.measureText(T).width*1e3/s*a;if(M<U&&this.isFontSubpixelAAEnabled){const q=M/U;C=!0,i.save(),i.scale(q,1),D/=q}else M!==U&&(D+=(M-U)/2e3*s/a)}if(this.contentVisible&&(k.isInFont||r.missingFile)){if(y&&!j)i.fillText(T,D,R);else if(this.paintChar(T,D,R,v),j){const U=D+s*j.offset.x/a,q=R-s*j.offset.y/a;this.paintChar(j.fontChar,U,q,v)}}const N=f?M*g-A*u:M*g+A*u;E+=N,C&&i.restore()}f?t.y-=E:t.x+=E*d,i.restore(),this.compose()}showType3Text(e){const t=this.ctx,r=this.current,s=r.font,i=r.fontSize,a=r.fontDirection,o=s.vertical?1:-1,l=r.charSpacing,u=r.wordSpacing,d=r.textHScale*a,h=r.fontMatrix||YI,f=e.length,p=r.textRenderingMode===ui.INVISIBLE;let m,g,y,v;if(!(p||i===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...r.textMatrix),t.translate(r.x,r.y),t.scale(d,a),m=0;m<f;++m){if(g=e[m],typeof g=="number"){v=o*g*i/1e3,this.ctx.translate(v,0),r.x+=v*d;continue}const x=(g.isSpace?u:0)+l,b=s.charProcOperatorList[g.operatorListId];if(!b){tn(`Type3 character "${g.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=g,this.save(),t.scale(i,i),t.transform(...h),this.executeOperatorList(b),this.restore()),y=_t.applyTransform([g.width,0],h)[0]*i+x,t.translate(y,0),r.x+=y*d}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,r,s,i,a){this.ctx.rect(r,s,i-r,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const r=e[1],s=this.baseTransform||lr(this.ctx),i={createCanvasGraphics:a=>new cz(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new SL(e,r,this.ctx,i,s)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,r){this.ctx.strokeStyle=this.current.strokeColor=_t.makeHexColor(e,t,r)}
vendor: 9,310 bytes, line 1007
1007setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,t,r){this.ctx.fillStyle=this.current.fillColor=_t.makeHexColor(e,t,r),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=vVe(this.getObject(e)),this.cachedPatterns.set(e,r)),t&&(r.matrix=t),r}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const r=this._getPattern(e);t.fillStyle=r.getPattern(t,this,au(t),Bi.SHADING);const s=au(t);if(s){const{width:i,height:a}=t.canvas,[o,l,u,d]=_t.getAxialAlignedBoundingBox([0,0,i,a],s);this.ctx.fillRect(o,l,u-o,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Qn("Should not call beginInlineImage")}beginImageData(){Qn("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=lr(this.ctx),t)){const r=t[2]-t[0],s=t[3]-t[1];this.ctx.rect(t[0],t[1],r,s),this.current.updateRectMinMax(lr(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Mj("TODO: Support non-isolated groups."),e.knockout&&tn("Knockout groups not supported.");const r=lr(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=_t.getAxialAlignedBoundingBox(e.bbox,lr(t));const i=[0,0,t.canvas.width,t.canvas.height];s=_t.intersect(s,i)||[0,0,0,0];const a=Math.floor(s[0]),o=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-a,1),u=Math.max(Math.ceil(s[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,u]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(d,l,u),f=h.context;f.translate(-a,-o),f.transform(...r),e.smask?this.smaskStack.push({canvas:h.canvas,context:f,offsetX:a,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(a,o),t.save()),vb(t,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=lr(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const i=_t.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],s);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,r,s,i){if(W(this,Ef,EL).call(this),Ak(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const a=t[2]-t[0],o=t[3]-t[1];if(i&&this.annotationCanvasMap){r=r.slice(),r[4]-=t[0],r[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=a,t[3]=o;const[l,u]=_t.singularValueDecompose2dScale(lr(this.ctx)),{viewportScale:d}=this,h=Math.ceil(a*this.outputScaleX*d),f=Math.ceil(o*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(h,f);const{canvas:p,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(e,p),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(l,0,0,-u,0,o*u),Ak(this.ctx)}else Ak(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],a,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new nq(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),W(this,Ef,kL).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const r=this.ctx,s=this.processingType3;if(s&&(s.compiled===void 0&&(s.compiled=_Ve(e)),s.compiled)){s.compiled(r);return}const i=this._createMaskCanvas(e),a=i.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(a,i.offsetX,i.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,r=0,s=0,i,a){if(!this.contentVisible)return;e=this.getObject(e.data,e);const o=this.ctx;o.save();const l=lr(o);o.transform(t,r,s,i,0,0);const u=this._createMaskCanvas(e);o.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]);for(let d=0,h=a.length;d<h;d+=2){const f=_t.transform(l,[t,r,s,i,a[d],a[d+1]]),[p,m]=_t.applyTransform([0,0],f);o.drawImage(u.canvas,p,m)}o.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,r=this.current.fillColor,s=this.current.patternFill;for(const i of e){const{data:a,width:o,height:l,transform:u}=i,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),h=d.context;h.save();const f=this.getObject(a,i);sq(h,f),h.globalCompositeOperation="source-in",h.fillStyle=s?r.getPattern(h,this,au(t),Bi.FILL):r,h.fillRect(0,0,o,l),h.restore(),t.save(),t.transform(...u),t.scale(1,-1),Ck(t,d.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){tn("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,r,s){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){tn("Dependent image isn't ready yet");return}const a=i.width,o=i.height,l=[];for(let u=0,d=s.length;u<d;u+=2)l.push({transform:[t,0,0,r,s[u],s[u+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(i,l)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:t,width:r,height:s}=e,i=this.cachedCanvases.getCanvas("inlineImage",r,s),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,r=e.height,s=this.ctx;if(this.save(),!Ei){const{filter:o}=s;o!=="none"&&o!==""&&(s.filter="none")}s.scale(1/t,-1/r);let i;if(e.bitmap)i=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)i=e;else{const l=this.cachedCanvases.getCanvas("inlineImage",t,r).context;rq(l,e),i=this.applyTransferMapsToCanvas(l)}const a=this._scaleImage(i,au(s));s.imageSmoothingEnabled=iq(lr(s),e.interpolate),Ck(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-r,t,r),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const r=this.ctx;let s;if(e.bitmap)s=e.bitmap;else{const i=e.width,a=e.height,l=this.cachedCanvases.getCanvas("inlineImage",i,a).context;rq(l,e),s=this.applyTransferMapsToCanvas(l)}for(const i of t)r.save(),r.transform(...i.transform),r.scale(1,-1),Ck(r,s,i.x,i.y,i.w,i.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const r=this.ctx;this.pendingClip&&(t||(this.pendingClip===aq?r.clip("evenodd"):r.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),r.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=lr(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,s)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:r,c:s,d:i}=this.ctx.getTransform();let a,o;if(r===0&&s===0){const l=Math.abs(t),u=Math.abs(i);if(l===u)if(e===0)a=o=1/l;else{const d=l*e;a=o=d<1?1/d:1}else if(e===0)a=1/l,o=1/u;else{const d=l*e,h=u*e;a=d<1?1/d:1,o=h<1?1/h:1}}else{const l=Math.abs(t*i-r*s),u=Math.hypot(t,r),d=Math.hypot(s,i);if(e===0)a=d/l,o=u/l;else{const h=e*l;a=d>h?d/h:1,o=u>h?u/h:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:r}=this.current,[s,i]=this.getScaleForStroking();if(t.lineWidth=r||1,s===1&&i===1){t.stroke();return}const a=t.getLineDash();if(e&&t.save(),t.scale(s,i),a.length>0){const o=Math.max(s,i);
1007t.setLineDash(a.map(l=>l/o)),t.lineDashOffset/=o}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Ef=new WeakSet,EL=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)},kL=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}};let gy=cz;for(const n in ml)gy.prototype[n]!==void 0&&(gy.prototype[ml[n]]=gy.prototype[n]);var E_,k_;class Wu{static get workerPort(){return w(this,E_)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");F(this,E_,e)}static get workerSrc(){return w(this,k_)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");F(this,k_,e)}}E_=new WeakMap,k_=new WeakMap,G(Wu,E_,null),G(Wu,k_,"");const Nk={UNKNOWN:0,DATA:1,ERROR:2},Gr={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Ra(n){switch(n instanceof Error||typeof n=="object"&&n!==null||Qn('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),n.name){case"AbortException":return new Mg(n.message);case"MissingPDFException":return new Og(n.message);case"PasswordException":return new XI(n.message,n.code);case"UnexpectedResponseException":return new Ij(n.message,n.status);case"UnknownErrorException":return new ZI(n.message,n.details);default:return new ZI(n.message,n.toString())}}var qy,$o,Loe,Foe,Boe,TC;class Yb{constructor(e,t,r){G(this,$o);G(this,qy,new AbortController);this.sourceName=e,this.targetName=t,this.comObj=r,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),r.addEventListener("message",W(this,$o,Loe).bind(this),{signal:w(this,qy).signal})}on(e,t){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=t}send(e,t,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},r)}sendWithPromise(e,t,r){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:t},r)}catch(a){i.reject(a)}return i.promise}sendWithStream(e,t,r,s){const i=this.streamId++,a=this.sourceName,o=this.targetName,l=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},l.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:u.desiredSize},s),d.promise},pull:u=>{const d=Promise.withResolvers();return this.streamControllers[i].pullCall=d,l.postMessage({sourceName:a,targetName:o,stream:Gr.PULL,streamId:i,desiredSize:u.desiredSize}),d.promise},cancel:u=>{ys(u instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[i].cancelCall=d,this.streamControllers[i].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Gr.CANCEL,streamId:i,reason:Ra(u)}),d.promise}},r)}destroy(){var e;(e=w(this,qy))==null||e.abort(),F(this,qy,null)}}qy=new WeakMap,$o=new WeakSet,Loe=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){W(this,$o,Boe).call(this,e);return}if(e.callback){const r=e.callbackId,s=this.callbackCapabilities[r];if(!s)throw new Error(`Cannot resolve callback ${r}`);if(delete this.callbackCapabilities[r],e.callback===Nk.DATA)s.resolve(e.data);else if(e.callback===Nk.ERROR)s.reject(Ra(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const r=this.sourceName,s=e.sourceName,i=this.comObj;new Promise(function(a){a(t(e.data))}).then(function(a){i.postMessage({sourceName:r,targetName:s,callback:Nk.DATA,callbackId:e.callbackId,data:a})},function(a){i.postMessage({sourceName:r,targetName:s,callback:Nk.ERROR,callbackId:e.callbackId,reason:Ra(a)})});return}if(e.streamId){W(this,$o,Foe).call(this,e);return}t(e.data)},Foe=function(e){const t=e.streamId,r=this.sourceName,s=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],l={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:r,targetName:s,stream:Gr.ENQUEUE,streamId:t,chunk:u},h)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:s,stream:Gr.CLOSE,streamId:t}),delete a.streamSinks[t])},error(u){ys(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:r,targetName:s,stream:Gr.ERROR,streamId:t,reason:Ra(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,new Promise(function(u){u(o(e.data,l))}).then(function(){i.postMessage({sourceName:r,targetName:s,stream:Gr.START_COMPLETE,streamId:t,success:!0})},function(u){i.postMessage({sourceName:r,targetName:s,stream:Gr.START_COMPLETE,streamId:t,reason:Ra(u)})})},Boe=function(e){const t=e.streamId,r=this.sourceName,s=e.sourceName,i=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case Gr.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Ra(e.reason));break;case Gr.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Ra(e.reason));break;case Gr.PULL:if(!o){i.postMessage({sourceName:r,targetName:s,stream:Gr.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,new Promise(function(l){var u;l((u=o.onPull)==null?void 0:u.call(o))}).then(function(){i.postMessage({sourceName:r,targetName:s,stream:Gr.PULL_COMPLETE,streamId:t,success:!0})},function(l){i.postMessage({sourceName:r,targetName:s,stream:Gr.PULL_COMPLETE,streamId:t,reason:Ra(l)})});break;case Gr.ENQUEUE:if(ys(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Gr.CLOSE:if(ys(a,"close should have stream controller"),a.isClosed)break;
1007a.isClosed=!0,a.controller.close(),W(this,$o,TC).call(this,a,t);break;case Gr.ERROR:ys(a,"error should have stream controller"),a.controller.error(Ra(e.reason)),W(this,$o,TC).call(this,a,t);break;case Gr.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Ra(e.reason)),W(this,$o,TC).call(this,a,t);break;case Gr.CANCEL:if(!o)break;new Promise(function(l){var u;l((u=o.onCancel)==null?void 0:u.call(o,Ra(e.reason)))}).then(function(){i.postMessage({sourceName:r,targetName:s,stream:Gr.CANCEL_COMPLETE,streamId:t,success:!0})},function(l){i.postMessage({sourceName:r,targetName:s,stream:Gr.CANCEL_COMPLETE,streamId:t,reason:Ra(l)})}),o.sinkCapability.reject(Ra(e.reason)),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},TC=async function(e,t){var r,s,i;await Promise.allSettled([(r=e.startCall)==null?void 0:r.promise,(s=e.pullCall)==null?void 0:s.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[t]};var tm,C_;class CVe{constructor({parsedData:e,rawData:t}){G(this,tm);G(this,C_);F(this,tm,e),F(this,C_,t)}getRaw(){return w(this,C_)}get(e){return w(this,tm).get(e)??null}getAll(){return KB(w(this,tm))}has(e){return w(this,tm).has(e)}}tm=new WeakMap,C_=new WeakMap;const Sv=Symbol("INTERNAL");var A_,N_,T_,Gy;class AVe{constructor(e,{name:t,intent:r,usage:s,rbGroups:i}){G(this,A_,!1);G(this,N_,!1);G(this,T_,!1);G(this,Gy,!0);F(this,A_,!!(e&$a.DISPLAY)),F(this,N_,!!(e&$a.PRINT)),this.name=t,this.intent=r,this.usage=s,this.rbGroups=i}get visible(){if(w(this,T_))return w(this,Gy);if(!w(this,Gy))return!1;const{print:e,view:t}=this.usage;return w(this,A_)?(t==null?void 0:t.viewState)!=="OFF":w(this,N_)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,r=!1){e!==Sv&&Qn("Internal method `_setVisible` called."),F(this,T_,r),F(this,Gy,t)}}A_=new WeakMap,N_=new WeakMap,T_=new WeakMap,Gy=new WeakMap;var _h,Rn,Ky,Yy,j_,CL;class NVe{constructor(e,t=$a.DISPLAY){G(this,j_);G(this,_h,null);G(this,Rn,new Map);G(this,Ky,null);G(this,Yy,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,F(this,Yy,e.order);for(const r of e.groups)w(this,Rn).set(r.id,new AVe(t,r));if(e.baseState==="OFF")for(const r of w(this,Rn).values())r._setVisible(Sv,!1);for(const r of e.on)w(this,Rn).get(r)._setVisible(Sv,!0);for(const r of e.off)w(this,Rn).get(r)._setVisible(Sv,!1);F(this,Ky,this.getHash())}}isVisible(e){if(w(this,Rn).size===0)return!0;if(!e)return Mj("Optional content group not defined."),!0;if(e.type==="OCG")return w(this,Rn).has(e.id)?w(this,Rn).get(e.id).visible:(tn(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return W(this,j_,CL).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!w(this,Rn).has(t))return tn(`Optional content group not found: ${t}`),!0;if(w(this,Rn).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!w(this,Rn).has(t))return tn(`Optional content group not found: ${t}`),!0;if(!w(this,Rn).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!w(this,Rn).has(t))return tn(`Optional content group not found: ${t}`),!0;if(!w(this,Rn).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!w(this,Rn).has(t))return tn(`Optional content group not found: ${t}`),!0;if(w(this,Rn).get(t).visible)return!1}return!0}return tn(`Unknown optional content policy ${e.policy}.`),!0}return tn(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,r=!0){var i;const s=w(this,Rn).get(e);if(!s){tn(`Optional content group not found: ${e}`);return}if(r&&t&&s.rbGroups.length)for(const a of s.rbGroups)for(const o of a)o!==e&&((i=w(this,Rn).get(o))==null||i._setVisible(Sv,!1,!0));s._setVisible(Sv,!!t,!0),F(this,_h,null)}setOCGState({state:e,preserveRB:t}){let r;for(const s of e){switch(s){case"ON":case"OFF":case"Toggle":r=s;continue}const i=w(this,Rn).get(s);if(i)switch(r){case"ON":this.setVisibility(s,!0,t);break;case"OFF":this.setVisibility(s,!1,t);break;case"Toggle":this.setVisibility(s,!i.visible,t);break}}F(this,_h,null)}get hasInitialVisibility(){return w(this,Ky)===null||this.getHash()===w(this,Ky)}getOrder(){return w(this,Rn).size?w(this,Yy)?w(this,Yy).slice():[...w(this,Rn).keys()]:null}getGroups(){return w(this,Rn).size>0?KB(w(this,Rn)):null}getGroup(e){return w(this,Rn).get(e)||null}getHash(){if(w(this,_h)!==null)return w(this,_h);const e=new Coe;for(const[t,r]of w(this,Rn))e.update(`${t}:${r.visible}`);return F(this,_h,e.hexdigest())}}_h=new WeakMap,Rn=new WeakMap,Ky=new WeakMap,Yy=new WeakMap,j_=new WeakSet,CL=function(e){const t=e.length;if(t<2)return!0;const r=e[0];for(let s=1;s<t;s++){const i=e[s];let a;
1007if(Array.isArray(i))a=W(this,j_,CL).call(this,i);else if(w(this,Rn).has(i))a=w(this,Rn).get(i).visible;else return tn(`Optional content group not found: ${i}`),!0;switch(r){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return r==="And"};class TVe{constructor(e,{disableRange:t=!1,disableStream:r=!1}){ys(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:i,progressiveDone:a,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(i==null?void 0:i.length)>0){const l=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!t,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,u)=>{this._onReceiveData({begin:l,chunk:u})}),e.addProgressListener((l,u)=>{this._onProgress({loaded:l,total:u})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const r=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const s=this._rangeReaders.some(function(i){return i._begin!==e?!1:(i._enqueue(r),!0)});ys(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,r,s,i;e.total===void 0?(r=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||r.call(t,{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 t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){ys(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new jVe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new RVe(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class jVe{constructor(e,t,r=!1,s=null){this._stream=e,this._done=r||!1,this._filename=ZB(s)?s:null,this._queuedChunks=t||[],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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class RVe{constructor(e,t,r){this._stream=e,this._begin=t,this._end=r,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 r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function PVe(n){let e=!0,t=r("filename\\*","i").exec(n);if(t){t=t[1];let d=o(t);return d=unescape(d),d=l(d),d=u(d),i(d)}if(t=a(n),t){const d=u(t);return i(d)}
1007if(t=r("filename","i").exec(n),t){t=t[1];let d=o(t);return d=u(d),i(d)}function r(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=Lj(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 a(d){const h=[];let f;const p=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,g,y,v]=f;if(g=parseInt(g,10),g in h){if(g===0)break;continue}h[g]=[y,v]}const m=[];for(let g=0;g<h.length&&g in h;++g){let[y,v]=h[g];v=o(v),y&&(v=unescape(v),g===0&&(v=l(v))),m.push(v)}return m.join("")}function o(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 l(d){const h=d.indexOf("'");if(h===-1)return d;const f=d.slice(0,h),m=d.slice(h+1).replace(/^[^']*'/,"");return s(f,m)}function u(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(h,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(g,y){return String.fromCharCode(parseInt(y,16))}),s(f,m);try{m=atob(m)}catch{}return s(f,m)})}return""}function nz(n,e){const t=new Headers;if(!n||!e||typeof e!="object")return t;for(const r in e){const s=e[r];s!==void 0&&t.append(r,s)}return t}function rz({responseHeaders:n,isHttp:e,rangeChunkSize:t,disableRange:r}){const s={allowRangeRequests:!1,suggestedLength:void 0},i=parseInt(n.get("Content-Length"),10);return!Number.isInteger(i)||(s.suggestedLength=i,i<=2*t)||r||!e||n.get("Accept-Ranges")!=="bytes"||(n.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function sz(n){const e=n.get("Content-Disposition");if(e){let t=PVe(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(ZB(t))return t}return null}function zj(n,e){return n===404||n===0&&e.startsWith("file:")?new Og('Missing PDF "'+e+'".'):new Ij(`Unexpected server response (${n}) while retrieving PDF "${e}".`,n)}function zoe(n){return n===200||n===206}function $oe(n,e,t){return{method:"GET",headers:n,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Uoe(n){return n instanceof Uint8Array?n.buffer:n instanceof ArrayBuffer?n:(tn(`getArrayBuffer - unexpected data format: ${n}`),new Uint8Array(n).buffer)}class oq{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=nz(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 ys(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new DVe(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=new OVe(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class DVe{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const r=new Headers(e.headers),s=t.url;fetch(s,$oe(r,this._withCredentials,this._abortController)).then(i=>{if(!zoe(i.status))throw zj(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const a=i.headers,{allowRangeRequests:o,suggestedLength:l}=rz({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=sz(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Mg("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 r;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Uoe(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class OVe{constructor(e,t,r){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=${t}-${r-1}`);const a=s.url;fetch(a,$oe(i,this._withCredentials,this._abortController)).then(o=>{if(!zoe(o.status))throw zj(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:Uoe(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const ED=200,kD=206;function MVe(n){const e=n.response;return typeof e!="string"?e:Lj(e).buffer}class IVe{constructor({url:e,httpHeaders:t,withCredentials:r}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=nz(this.isHttp,t),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,r){const s={begin:e,end:t};for(const i in r)s[i]=r[i];return this.request(s)}requestFull(e){return this.request(e)}request(e){const t=new XMLHttpRequest,r=this.currXhrId++,s=this.pendingRequests[r]={x
1007hr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[i,a]of this.headers)t.setRequestHeader(i,a);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.expectedStatus=kD):s.expectedStatus=ED,t.responseType="arraybuffer",e.onError&&(t.onerror=function(i){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,r),t.onprogress=this.onProgress.bind(this,r),s.onHeadersReceived=e.onHeadersReceived,s.onDone=e.onDone,s.onError=e.onError,s.onProgress=e.onProgress,t.send(null),r}onProgress(e,t){var s;const r=this.pendingRequests[e];r&&((s=r.onProgress)==null||s.call(r,t))}onStateChange(e,t){var l,u,d;const r=this.pendingRequests[e];if(!r)return;const s=r.xhr;if(s.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),s.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],s.status===0&&this.isHttp){(l=r.onError)==null||l.call(r,s.status);return}const i=s.status||ED;if(!(i===ED&&r.expectedStatus===kD)&&i!==r.expectedStatus){(u=r.onError)==null||u.call(r,s.status);return}const o=MVe(s);if(i===kD){const h=s.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(h);r.onDone({begin:parseInt(f[1],10),chunk:o})}else o?r.onDone({begin:0,chunk:o}):(d=r.onError)==null||d.call(r,s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class LVe{constructor(e){this._source=e,this._manager=new IVe(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return ys(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new FVe(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const r=new BVe(this._manager,e,t);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class FVe{constructor(e,t){this._manager=e;const r={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(r),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),r=new Headers(t.getAllResponseHeaders().trim().split(/[\r\n]+/).map(a=>{const[o,...l]=a.split(": ");return[o,l.join(": ")]})),{allowRangeRequests:s,suggestedLength:i}=rz({responseHeaders:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=sz(r),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=zj(e,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var t;(t=this.onProgress)==null||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
1007(this._fullRequestId),this._fullRequestReader=null}}class BVe{constructor(e,t,r){this._manager=e;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,r,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=zj(e,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const zVe=/^[a-z][a-z0-9\-+.]+:/i;function $Ve(n){if(zVe.test(n))return new URL(n);const e=_f.get("url");return new URL(e.pathToFileURL(n))}function Voe(n,e,t){return n.protocol==="http:"?_f.get("http").request(n,{headers:e},t):_f.get("https").request(n,{headers:e},t)}class UVe{constructor(e){this.source=e,this.url=$Ve(e.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=nz(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 ys(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new WVe(this):new VVe(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const r=this.isFsUrl?new qVe(this,e,t):new HVe(this,e,t);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class Hoe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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 r;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,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Mg("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Woe{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var r;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,(r=this.onProgress)==null||r.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class VVe extends Hoe{constructor(e){super(e);const t=Object.fromEntries(e.headers),r=s=>{if(s.statusCode===404){const l=new Og(`Missing PDF "${this._url}".`);this._storedError=l,this._headersCapability.reject(l);return}this._headersCapability.resolve(),this._setReadableStream(s);const i=new Headers(this._readableStream.headers),{allowRangeRequests:a,suggestedLength:o}=rz({responseHeaders:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=sz(i)};this._request=Voe(this._url,t,r),this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}class HVe extends Woe{constructor(e,t,r){super(e);const s=Object.fromEntries(e.headers);s.Range=`bytes=${t}-${r-1}`;const i=a=>
1007{if(a.statusCode===404){const o=new Og(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(a)};this._request=Voe(this._url,s,i),this._request.on("error",a=>{this._storedError=a}),this._request.end()}}class WVe extends Hoe{constructor(e){super(e);const t=_f.get("fs");t.promises.lstat(this._url).then(r=>{this._contentLength=r.size,this._setReadableStream(t.createReadStream(this._url)),this._headersCapability.resolve()},r=>{r.code==="ENOENT"&&(r=new Og(`Missing PDF "${this._url}".`)),this._storedError=r,this._headersCapability.reject(r)})}}class qVe extends Woe{constructor(e,t,r){super(e);const s=_f.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:t,end:r-1}))}}const GVe=1e5,ia=30,KVe=.8;var Oq,Sh,ua,R_,P_,nm,ku,D_,O_,rm,Xy,Zy,Eh,Jy,M_,Qy,sm,I_,L_,Er,im,am,F_,kh,ex,bd,qoe,Goe,NL,eo,jC,TL,Koe,Yoe;let AL=(Er=class{constructor({textContentSource:e,container:t,viewport:r}){G(this,bd);G(this,Sh,Promise.withResolvers());G(this,ua,null);G(this,R_,!1);G(this,P_,!!((Oq=globalThis.FontInspector)!=null&&Oq.enabled));G(this,nm,null);G(this,ku,null);G(this,D_,0);G(this,O_,0);G(this,rm,null);G(this,Xy,null);G(this,Zy,0);G(this,Eh,0);G(this,Jy,Object.create(null));G(this,M_,[]);G(this,Qy,null);G(this,sm,[]);G(this,I_,new WeakMap);G(this,L_,null);var l;if(e instanceof ReadableStream)F(this,Qy,e);else if(typeof e=="object")F(this,Qy,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');F(this,ua,F(this,Xy,t)),F(this,Eh,r.scale*(globalThis.devicePixelRatio||1)),F(this,Zy,r.rotation),F(this,ku,{div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:i,pageX:a,pageY:o}=r.rawDims;F(this,L_,[1,0,0,-1,-a,o+i]),F(this,O_,s),F(this,D_,i),W(l=Er,eo,Koe).call(l),fg(t,r),w(this,Sh).promise.finally(()=>{w(Er,ex).delete(this),F(this,ku,null),F(this,Jy,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Ki.platform;return mn(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{w(this,rm).read().then(({value:t,done:r})=>{if(r){w(this,Sh).resolve();return}w(this,nm)??F(this,nm,t.lang),Object.assign(w(this,Jy),t.styles),W(this,bd,qoe).call(this,t.items),e()},w(this,Sh).reject)};return F(this,rm,w(this,Qy).getReader()),w(Er,ex).add(this),e(),w(this,Sh).promise}update({viewport:e,onBefore:t=null}){var i;const r=e.scale*(globalThis.devicePixelRatio||1),s=e.rotation;if(s!==w(this,Zy)&&(t==null||t(),F(this,Zy,s),fg(w(this,Xy),{rotation:s})),r!==w(this,Eh)){t==null||t(),F(this,Eh,r);const a={div:null,properties:null,ctx:W(i=Er,eo,jC).call(i,w(this,nm))};for(const o of w(this,sm))a.properties=w(this,I_).get(o),a.div=o,W(this,bd,NL).call(this,a)}}cancel(){var t;const e=new Mg("TextLayer task cancelled.");(t=w(this,rm))==null||t.cancel(e).catch(()=>{}),F(this,rm,null),w(this,Sh).reject(e)}get textDivs(){return w(this,sm)}get textContentItemsStr(){return w(this,M_)}static cleanup(){if(!(w(this,ex).size>0)){w(this,im).clear();for(const{canvas:e}of w(this,am).values())e.remove();w(this,am).clear()}}},Sh=new WeakMap,ua=new WeakMap,R_=new WeakMap,P_=new WeakMap,nm=new WeakMap,ku=new WeakMap,D_=new WeakMap,O_=new WeakMap,rm=new WeakMap,Xy=new WeakMap,Zy=new WeakMap,Eh=new WeakMap,Jy=new WeakMap,M_=new WeakMap,Qy=new WeakMap,sm=new WeakMap,I_=new WeakMap,L_=new WeakMap,im=new WeakMap,am=new WeakMap,F_=new WeakMap,kh=new WeakMap,ex=new WeakMap,bd=new WeakSet,qoe=function(e){var s,i;if(w(this,R_))return;(i=w(this,ku)).ctx??(i.ctx=W(s=Er,eo,jC).call(s,w(this,nm)));const t=w(this,sm),r=w(this,M_);for(const a of e){if(t.length>GVe){tn("Ignoring additional textDivs for performance reasons."),F(this,R_,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=w(this,ua);F(this,ua,document.createElement("span")),w(this,ua).classList.add("markedContent"),a.id!==null&&w(this,ua).setAttribute("id",`${a.id}`),o.append(w(this,ua))}else a.type==="endMarkedContent"&&F(this,ua,w(this,ua).parentNode);continue}r.push(a.str),W(this,bd,Goe).call(this,a)}},Goe=function(e){var g;const t=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};w(this,sm).push(t);const s=_t.transform(w(this,L_),e.transform);let i=Math.atan2(s[1],s[0]);const a=w(this,Jy)[e.fontName];a.vertical&&(i+=Math.PI/2);let o=w(this,P_)&&a.fontSubstitution||a.fontFamily;o=Er.fontFamilyMap.get(o)||o;const l=Math.hypot(s[2],s[3]),u=l*W(g=Er,eo,Yoe).call(g,o,w(this,nm));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(--scale-factor)*",p=t.style;w(this,ua)===w(this,Xy)?(p.left=`${(100*d/w(this,O_)).toFixed(2)}%`,p.top=`${(100*h/w(this,D_)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${h.toFixed(2)}px)`),p.fontSize=`${f}${(w(Er,kh)*l).toFixed(2)}px)`,p.fontFamily=o,r.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,w(this,P_)&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),i!==0&&(r.angle=i*(180/Math.PI));let m=!1;if(e.str.length>1)m=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const y=Math.abs(e.transform[0]),v=Math.abs(e.transform[3]);y!==v&&Math.max(y,v)/Math.min(y,v)>1.5&&(m=!0)}if(m&&(r.canvasWidth=a.vertical?e.height:e.width),w(this,I_).set(t,r),w(this,ku).div=t,w(this,ku).properties=r,W(this,bd,NL).call(this,w(this,ku)),r.hasText&&w(this,ua).append(t),r.hasEOL){const y=document.createElement("br");y.setAttribute("role","presentation"),w(this,ua).append(y)}},NL=function(e){var o;const{div:t,properties:r,ctx:s}=e,{style:i}=t;let a="";if(w(Er,kh)>1&&(a=`scale(${1/w(Er,kh)})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:l}=i,{canvasWidth:u,fontSize:d}=r;W(o=Er,eo,TL).call(o,s,d*w(this,Eh),l);const{width:h}=s.measureText(t.textContent);h>0&&(a=`scaleX(${u*w(this,Eh)/h}) ${a}`)}r.angle!==0&&(a=`rotate(${r.angle}deg) ${a}`),a.length>0&&(i.transform=a)},eo=new WeakSet,jC=function(e=null){let t=w(this,am).get(e||(e=""));if(!t){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),t=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),w(this,am).set(e,t),w(this,F_).set(t,{size:0,family:""})}return t},TL=function(e,t,r){const s=w(this,F_).get(e);t===s.size&&r===s.family||(e.font=`${t}px ${r}`,s.size=t,s.family=r)},Koe=function(){if(w(this,kh)!==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),F(this,kh,e.getBoundingClientRect().height),e.remove()},Yoe=function(e,t){const r=w(this,im).get(e);if(r)return r;const s=W(this,eo,jC).call(this,t);s.canvas.width=s.canvas.height=ia,W(this,eo,TL).call(this,s,ia,e);const i=s.measureText("");let a=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(a){const d=a/(a+o);return w(this,im).set(e,d),s.canvas.width=s.canvas.height=0,d}
1007s.strokeStyle="red",s.clearRect(0,0,ia,ia),s.strokeText("g",0,0);let l=s.getImageData(0,0,ia,ia).data;o=0;for(let d=l.length-1-3;d>=0;d-=4)if(l[d]>0){o=Math.ceil(d/4/ia);break}s.clearRect(0,0,ia,ia),s.strokeText("A",0,ia),l=s.getImageData(0,0,ia,ia).data,a=0;for(let d=0,h=l.length;d<h;d+=4)if(l[d]>0){a=ia-Math.floor(d/4/ia);break}s.canvas.width=s.canvas.height=0;const u=a?a/(a+o):KVe;return w(this,im).set(e,u),u},G(Er,eo),G(Er,im,new Map),G(Er,am,new Map),G(Er,F_,new WeakMap),G(Er,kh,null),G(Er,ex,new Set),Er);class Z1{static textContent(e){const t=[],r={items:t,styles:Object.create(null)};function s(i){var l;if(!i)return;let a=null;const o=i.name;if(o==="#text")a=i.value;else if(Z1.shouldBuildText(o))(l=i==null?void 0:i.attributes)!=null&&l.textContent?a=i.attributes.textContent:i.value&&(a=i.value);else return;if(a!==null&&t.push({str:a}),!!i.children)for(const u of i.children)s(u)}return s(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const YVe=65536,XVe=100,ZVe=5e3,JVe=Ei?uVe:oVe,QVe=Ei?dVe:Roe,eHe=Ei?cVe:lVe,tHe=Ei?hVe:Moe;function nHe(n={}){typeof n=="string"||n instanceof URL?n={url:n}:(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});const e=new jL,{docId:t}=e,r=n.url?rHe(n.url):null,s=n.data?sHe(n.data):null,i=n.httpHeaders||null,a=n.withCredentials===!0,o=n.password??null,l=n.range instanceof Xoe?n.range:null,u=Number.isInteger(n.rangeChunkSize)&&n.rangeChunkSize>0?n.rangeChunkSize:YVe;let d=n.worker instanceof vy?n.worker:null;const h=n.verbosity,f=typeof n.docBaseUrl=="string"&&!Bj(n.docBaseUrl)?n.docBaseUrl:null,p=typeof n.cMapUrl=="string"?n.cMapUrl:null,m=n.cMapPacked!==!1,g=n.CMapReaderFactory||QVe,y=typeof n.standardFontDataUrl=="string"?n.standardFontDataUrl:null,v=n.StandardFontDataFactory||tHe,x=n.stopAtErrors!==!0,b=Number.isInteger(n.maxImageSize)&&n.maxImageSize>-1?n.maxImageSize:-1,E=n.isEvalSupported!==!1,S=typeof n.isOffscreenCanvasSupported=="boolean"?n.isOffscreenCanvasSupported:!Ei,k=typeof n.isChrome=="boolean"?n.isChrome:!Ki.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),C=Number.isInteger(n.canvasMaxAreaInBytes)?n.canvasMaxAreaInBytes:-1,A=typeof n.disableFontFace=="boolean"?n.disableFontFace:Ei,T=n.fontExtraProperties===!0,j=n.enableXfa===!0,D=n.ownerDocument||globalThis.document,R=n.disableRange===!0,M=n.disableStream===!0,N=n.disableAutoFetch===!0,U=n.pdfBug===!0,q=n.CanvasFactory||JVe,I=n.FilterFactory||eHe,B=n.enableHWA===!0,$=l?l.length:n.length??NaN,ie=typeof n.useSystemFonts=="boolean"?n.useSystemFonts:!Ei&&!A,ne=typeof n.useWorkerFetch=="boolean"?n.useWorkerFetch:g===Roe&&v===Moe&&p&&y&&Ub(p,document.baseURI)&&Ub(y,document.baseURI);n.canvasFactory&&YW("`canvasFactory`-instance option, please use `CanvasFactory` instead."),n.filterFactory&&YW("`filterFactory`-instance option, please use `FilterFactory` instead.");const L=null;FUe(h);const te={canvasFactory:new q({ownerDocument:D,enableHWA:B}),filterFactory:new I({docId:t,ownerDocument:D}),cMapReaderFactory:ne?null:new g({baseUrl:p,isCompressed:m}),standardFontDataFactory:ne?null:new v({baseUrl:y})};if(!d){const ue={verbosity:h,port:Wu.workerPort};d=ue.port?vy.fromPort(ue):new vy(ue),e._worker=d}const ae={docId:t,apiVersion:"4.8.69",data:s,password:o,disableAutoFetch:N,rangeChunkSize:u,length:$,docBaseUrl:f,enableXfa:j,evaluatorOptions:{maxImageSize:b,disableFontFace:A,ignoreErrors:x,isEvalSupported:E,isOffscreenCanvasSupported:S,isChrome:k,canvasMaxAreaInBytes:C,fontExtraProperties:T,useSystemFonts:ie,cMapUrl:ne?p:null,standardFontDataUrl:ne?y:null}},de={disableFontFace:A,fontExtraProperties:T,ownerDocument:D,pdfBug:U,styleElement:L,loadingParams:{disableAutoFetch:N,enableXfa:j}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ue=d.messageHandler.sendWithPromise("GetDocRequest",ae,s?[s.buffer]:null);let le;if(l)le=new TVe(l,{disableRange:R,disableStream:M});else if(!s){if(!r)throw new Error("getDocument - no `url` parameter provided.");let ve;Ei?ve=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Ub(r)?oq:UVe:ve=Ub(r)?oq:LVe,le=new ve({url:r,length:$,httpHeaders:i,withCredentials:a,rangeChunkSize:u,disableRange:R,disableStream:M})}return ue.then(ve=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const _e=new Yb(t,ve,d.port),Ne=new lHe(_e,e,le,de,te);e._transport=Ne,_e.send("Ready",null)})}).catch(e._capability.reject),e}function rHe(n){if(n instanceof URL)return n.href;try{return new URL(n,window.location).href}catch{if(Ei&&typeof n=="string")return n}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function sHe(n){if(Ei&&typeof Buffer<"u"&&n instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength)return n;if(typeof n=="string")return Lj(n);if(n instanceof ArrayBuffer||ArrayBuffer.isView(n)||typeof n=="object"&&!isNaN(n==null?void 0:n.length))return new Uint8Array(n);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function lq(n){return typeof n=="object"&&Number.isInteger(n==null?void 0:n.num)&&n.num>=0&&Number.isInteger(n==null?void 0:n.gen)&&n.gen>=0}var jN;const RN=class RN{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${Ss(RN,jN)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,t,r;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(s){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};jN=new WeakMap,G(RN,jN,0);let jL=RN,Xoe=class{constructor(e,t,r=!1,s=null){this.length=e,this.initialData=t,this.progressiveDone=r,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const r of this._rangeListeners)r(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(const r of this._progressListeners)r(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){Qn("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class iHe{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return mn(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)}
1007getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Ch,Cu,To,Ev,RC;class aHe{constructor(e,t,r,s=!1){G(this,To);G(this,Ch,null);G(this,Cu,!1);this._pageIndex=e,this._pageInfo=t,this._transport=r,this._stats=s?new KW:null,this._pdfBug=s,this.commonObjs=r.commonObjs,this.objs=new Zoe,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:r=0,offsetY:s=0,dontFlip:i=!1}={}){return new wE({viewBox:this.view,scale:e,rotation:t,offsetX:r,offsetY:s,dontFlip:i})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return mn(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,viewport:t,intent:r="display",annotationMode:s=eh.ENABLE,transform:i=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:u=null,printAnnotationStorage:d=null,isEditing:h=!1}){var E,S;(E=this._stats)==null||E.time("Overall");const f=this._transport.getRenderingIntent(r,s,d,h),{renderingIntent:p,cacheKey:m}=f;F(this,Cu,!1),W(this,To,RC).call(this),o||(o=this._transport.getOptionalContentConfig(p));let g=this._intentStates.get(m);g||(g=Object.create(null),this._intentStates.set(m,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const y=!!(p&$a.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(S=this._stats)==null||S.time("Page Request"),this._pumpOperatorList(f));const v=k=>{var C;g.renderTasks.delete(x),(this._maybeCleanupAfterRender||y)&&F(this,Cu,!0),W(this,To,Ev).call(this,!y),k?(x.capability.reject(k),this._abortOperatorList({intentState:g,reason:k instanceof Error?k:new Error(k)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(C=globalThis.Stats)!=null&&C.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new PL({callback:v,params:{canvasContext:e,viewport:t,transform:i,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,page
1007Colors:u});(g.renderTasks||(g.renderTasks=new Set)).add(x);const b=x.task;return Promise.all([g.displayReadyCapability.promise,o]).then(([k,C])=>{var A;if(this.destroyed){v();return}if((A=this._stats)==null||A.time("Rendering"),!(C.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:k,optionalContentConfig:C}),x.operatorListChanged()}).catch(v),b}getOperatorList({intent:e="display",annotationMode:t=eh.ENABLE,printAnnotationStorage:r=null,isEditing:s=!1}={}){var u;function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(e,t,r,s,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>Z1.textContent(r));const t=this.streamTextContent(e);return new Promise(function(r,s){function i(){a.read().then(function({value:l,done:u}){if(u){r(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),i()},s)}const a=t.getReader(),o={items:[],styles:Object.create(null),lang:null};i()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const r of t.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),F(this,Cu,!1),W(this,To,RC).call(this),Promise.all(e)}cleanup(e=!1){F(this,Cu,!0);const t=W(this,To,Ev).call(this,!1);return e&&t&&this._stats&&(this._stats=new KW),t}_startRenderPage(e,t){var s,i;const r=this._intentStates.get(t);r&&((s=this._stats)==null||s.timeEnd("Page Request"),(i=r.displayReadyCapability)==null||i.resolve(e))}_renderPageChunk(e,t){for(let r=0,s=e.length;r<s;r++)t.operatorList.fnArray.push(e.fnArray[r]),t.operatorList.argsArray.push(e.argsArray[r]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const r of t.renderTasks)r.operatorListChanged();e.lastChunk&&W(this,To,Ev).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:r,modifiedIds:s}){const{map:i,transfer:a}=r,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:s},a).getReader(),u=this._intentStates.get(t);u.streamReader=l;const d=()=>{l.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();W(this,To,Ev).call(this,!0)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:e,reason:t,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(t instanceof XB){let s=XVe;t.extraDelay>0&&t.extraDelay<1e3&&(s+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},s);return}}if(e.streamReader.cancel(new Mg(t.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}}Ch=new WeakMap,Cu=new WeakMap,To=new WeakSet,Ev=function(e=!1){if(W(this,To,RC).call(this),!w(this,Cu)||this.destroyed)return!1;if(e)return F(this,Ch,setTimeout(()=>{F(this,Ch,null),W(this,To,Ev).call(this,!1)},ZVe)),!1;for(const{renderTasks:t,operatorList:r}of this._intentStates.values())if(t.size>0||!r.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),F(this,Cu,!1),!0},RC=function(){w(this,Ch)&&(clearTimeout(w(this,Ch)),F(this,Ch,null))};var Au,PN;class oHe{constructor(){G(this,Au,new Map);G(this,PN,Promise.resolve())}postMessage(e,t){const r={data:structuredClone(e,t?{transfer:t}:null)};w(this,PN).then(()=>{for(const[s]of w(this,Au))s.call(this,r)})}addEventListener(e,t,r=null){let s=null;if((r==null?void 0:r.signal)instanceof AbortSignal){const{signal:i}=r;if(i.aborted){tn("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(e,t);s=()=>i.removeEventListener("abort",a),i.addEventListener("abort",a)}w(this,Au).set(t,s)}removeEventListener(e,t){const r=w(this,Au).get(t);r==null||r(),w(this,Au).delete(t)}terminate(){for(const[,e]of w(this,Au))e==null||e();w(this,Au).clear()}}Au=new WeakMap,PN=new WeakMap;var DN,om,lm,tx,PC,nx,DC;const nr=class nr{constructor({name:e=null,port:t=null,verbosity:r=BUe()}={}){G(this,tx);var s;if(this.name=e,this.destroyed=!1,this.verbosity=r,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if((s=w(nr,lm))!=null&&s.has(t))throw new Error("Cannot use more than one PDFWorker per port.");(w(nr,lm)||F(nr,lm,new WeakMap)).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return Ei?Promise.all([_f.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new Yb("main","worker",e),this._messageHandler.on("ready",function(){}),W(this,tx,PC).call(this)}_initialize(){if(w(nr,om)||w(nr,nx,DC)){this._setupFakeWorker();return}let{workerSrc:e}=nr;try{nr._isSameOrigin(window.location.href,e)||(e=nr._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),r=new Yb("main","worker",t),s=()=>{i.abort(),r.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=new AbortController;t.addEventListener("error",()=>{this._webWorker||s()},{signal:i.signal}),r.on("test",o=>{if(i.abort(),this.destroyed||!o){s();return}this._messageHandler=r,this._port=t,this._webWorker=t,W(this,tx,PC).call(this)}),r.on("ready",o=>{if(i.abort(),this.destroyed){s();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const o=new Uint8Array;r.send("test",o,[o.buffer])};a();return}catch{Mj("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){w(nr,om)||(tn("Setting up fake worker."),F(nr,om,!0)),nr._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new oHe;this._port=t;const r=`fake${Ss(nr,DN)._++}`,s=new Yb(r+"_worker",r,t);e.setup(s,t),this._messageHandler=new Yb(r,r+"_worker",t),W(this,tx,PC).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(e=w(nr,lm))==null||e.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){var r;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const t=(r=w(this,lm))==null?void 0:r.get(e.port);
1007if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new nr(e)}static get workerSrc(){if(Wu.workerSrc)return Wu.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return mn(this,"_setupFakeWorkerGlobal",(async()=>w(this,nx,DC)?w(this,nx,DC):(await import(this.workerSrc)).WorkerMessageHandler)())}};DN=new WeakMap,om=new WeakMap,lm=new WeakMap,tx=new WeakSet,PC=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},nx=new WeakSet,DC=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},G(nr,nx),G(nr,DN,0),G(nr,om,!1),G(nr,lm),Ei&&(F(nr,om,!0),Wu.workerSrc||(Wu.workerSrc="./pdf.worker.mjs")),nr._isSameOrigin=(e,t)=>{let r;try{if(r=new URL(e),!r.origin||r.origin==="null")return!1}catch{return!1}const s=new URL(t,r);return r.origin===s.origin},nr._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};let vy=nr;
1007var Nu,Sc,rx,sx,Ec,cm,Xb;class lHe{constructor(e,t,r,s,i){G(this,cm);G(this,Nu,new Map);G(this,Sc,new Map);G(this,rx,new Map);G(this,sx,new Map);G(this,Ec,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Zoe,this.fontLoader=new iVe({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.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return mn(this,"annotationStorage",new ez)}getRenderingIntent(e,t=eh.ENABLE,r=null,s=!1,i=!1){let a=$a.DISPLAY,o=yL;switch(e){case"any":a=$a.ANY;break;case"display":break;case"print":a=$a.PRINT;break;default:tn(`getRenderingIntent - invalid intent: ${e}`)}const l=a&$a.PRINT&&r instanceof Noe?r:this.annotationStorage;switch(t){case eh.DISABLE:a+=$a.ANNOTATIONS_DISABLE;break;case eh.ENABLE:break;case eh.ENABLE_FORMS:a+=$a.ANNOTATIONS_FORMS;break;case eh.ENABLE_STORAGE:a+=$a.ANNOTATIONS_STORAGE,o=l.serializable;break;default:tn(`getRenderingIntent - invalid annotationMode: ${t}`)}s&&(a+=$a.IS_EDITING),i&&(a+=$a.OPLIST);const{ids:u,hash:d}=l.modifiedIds,h=[a,o.hash,d];return{renderingIntent:a,cacheKey:h.join("_"),annotationStorageSerializable:o,modifiedIds:u}}destroy(){var r;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(r=w(this,Ec))==null||r.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of w(this,Sc).values())e.push(s._destroy());w(this,Sc).clear(),w(this,rx).clear(),w(this,sx).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var s;this.commonObjs.clear(),this.fontLoader.clear(),w(this,Nu).clear(),this.filterFactory.destroy(),AL.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new Mg("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(r,s)=>{ys(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:a}){if(a){s.close();return}ys(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(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async r=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:i,contentLength:a}=this._fullReader;return(!s||!i)&&(this._lastProgress&&((o=t.onProgress)==null||o.call(t,this._lastProgress)),this._fullReader.onProgress=l=>{var u;(u=t.onProgress)==null||u.call(t,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:s,isRangeSupported:i,contentLength:a}}),e.on("GetRangeReader",(r,s)=>{ys(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(r.begin,r.end);if(!i){s.close();return}s.onPull=()=>{i.read().then(function({value:a,done:o}){if(o){s.close();return}ys(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{s.error(a)})},s.onCancel=a=>{i.cancel(a),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,t._capability.resolve(new iHe(r,this))}),e.on("DocException",function(r){let s;switch(r.name){case"PasswordException":s=new XI(r.message,r.code);break;case"InvalidPDFException":s=new eoe(r.message);break;case"MissingPDFException":s=new Og(r.message);break;case"UnexpectedResponseException":s=new Ij(r.message,r.status);break;case"UnknownErrorException":s=new ZI(r.message,r.details);break;default:Qn("DocException - expected a valid Error.")}t._capability.reject(s)}),e.on("PasswordRequest",r=>{if(F(this,Ec,Promise.withResolvers()),t.onPassword){const s=i=>{i instanceof Error?w(this,Ec).reject(i):w(this,Ec).resolve({password:i})};try{t.onPassword(s,r.code)}catch(i){w(this,Ec).reject(i)}}else w(this,Ec).reject(new XI(r.message,r.code));return w(this,Ec).promise}),e.on("DataLoaded",r=>{var s;(s=t.onProgress)==null||s.call(t,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{if(this.destroyed)return;w(this,Sc).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,s,i])=>{var a;if(this.destroyed||this.commonObjs.has(r))return null;switch(s){case"Font":const{disableFontFace:o,fontExtraProperties:l,pdfBug:u}=this._params;if("error"in i){const p=i.error;tn(`Error during font loading: ${p}`),this.commonObjs.resolve(r,p);break}const d=u&&((a=globalThis.FontInspector)!=null&&a.enabled)?(p,m)=>globalThis.FontInspector.fontAdded(p,m):null,h=new aVe(i,{disableFontFace:o,inspectFont:d});this.fontLoader.bind(h).catch(()=>
1007e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l&&h.data&&(h.data=null),this.commonObjs.resolve(r,h)});break;case"CopyLocalImage":const{imageRef:f}=i;ys(f,"The imageRef must be defined.");for(const p of w(this,Sc).values())for(const[,m]of p.objs)if((m==null?void 0:m.ref)===f)return m.dataLen?(this.commonObjs.resolve(r,structuredClone(m)),m.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,i);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([r,s,i,a])=>{var l;if(this.destroyed)return;const o=w(this,Sc).get(s);if(!o.objs.has(r)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(i){case"Image":o.objs.resolve(r,a),(a==null?void 0:a.dataLen)>OUe&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(r,a);break;default:throw new Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",r=>{var s;this.destroyed||(s=t.onProgress)==null||s.call(t,{loaded:r.loaded,total:r.total})}),e.on("FetchBuiltInCMap",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(r)}),e.on("FetchStandardFontData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var r;this.annotationStorage.size<=0&&tn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((r=this._fullReader)==null?void 0:r.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,r=w(this,rx).get(t);if(r)return r;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&w(this,sx).set(i.refStr,e);const a=new aHe(t,i,this,this._params.pdfBug);return w(this,Sc).set(t,a),a});return w(this,rx).set(t,s),s}getPageIndex(e){return lq(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return W(this,cm,Xb).call(this,"GetFieldObjects")}hasJSActions(){return W(this,cm,Xb).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 W(this,cm,Xb).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 W(this,cm,Xb).call(this,"GetOptionalContentConfig").then(t=>new NVe(t,e))}
1007getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=w(this,Nu).get(e);if(t)return t;const r=this.messageHandler.sendWithPromise(e,null).then(s=>{var i,a;return{info:s[0],metadata:s[1]?new CVe(s[1]):null,contentDispositionFilename:((i=this._fullReader)==null?void 0:i.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return w(this,Nu).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of w(this,Sc).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),w(this,Nu).clear(),this.filterFactory.destroy(!0),AL.cleanup()}}cachedPageNumber(e){if(!lq(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return w(this,sx).get(t)??null}}Nu=new WeakMap,Sc=new WeakMap,rx=new WeakMap,sx=new WeakMap,Ec=new WeakMap,cm=new WeakSet,Xb=function(e,t=null){const r=w(this,Nu).get(e);if(r)return r;const s=this.messageHandler.sendWithPromise(e,t);return w(this,Nu).set(e,s),s};const Tk=Symbol("INITIAL_DATA");var Sl,B_,RL;class Zoe{constructor(){G(this,B_);G(this,Sl,Object.create(null))}get(e,t=null){if(t){const s=W(this,B_,RL).call(this,e);return s.promise.then(()=>t(s.data)),null}const r=w(this,Sl)[e];if(!r||r.data===Tk)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const t=w(this,Sl)[e];return!!t&&t.data!==Tk}resolve(e,t=null){const r=W(this,B_,RL).call(this,e);r.data=t,r.resolve()}clear(){var e;for(const t in w(this,Sl)){const{data:r}=w(this,Sl)[t];(e=r==null?void 0:r.bitmap)==null||e.close()}F(this,Sl,Object.create(null))}*[Symbol.iterator](){for(const e in w(this,Sl)){const{data:t}=w(this,Sl)[e];t!==Tk&&(yield[e,t])}}}Sl=new WeakMap,B_=new WeakSet,RL=function(e){var t;return(t=w(this,Sl))[e]||(t[e]={...Promise.withResolvers(),data:Tk})};var Ah;class cHe{constructor(e){G(this,Ah,null);F(this,Ah,e),this.onContinue=null}get promise(){return w(this,Ah).capability.promise}cancel(e=0){w(this,Ah).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=w(this,Ah).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=w(this,Ah);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}Ah=new WeakMap;var Nh,um;const fp=class fp{constructor({callback:e,params:t,objs:r,commonObjs:s,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:u,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:f=null}){G(this,Nh,null);this.callback=e,this.params=t,this.objs=r,this.commonObjs=s,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,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 cHe(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var o,l;if(this.cancelled)return;if(this._canvas){if(w(fp,um).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.");w(fp,um).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:r,viewport:s,transform:i,background:a}=this.params;this.gfx=new gy(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:s,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(e=null,t=0){var r;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),w(this,Nh)&&(window.cancelAnimationFrame(w(this,Nh)),F(this,Nh,null)),w(fp,um).delete(this._canvas),this.callback(e||new XB(`Rendering cancelled, page ${this._pageIndex+1}`,t))}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?F(this,Nh,window.requestAnimationFrame(()=>{F(this,Nh,null),this._nextBound().catch(this._cancelBound)}
1007)):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(),w(fp,um).delete(this._canvas),this.callback())))}};Nh=new WeakMap,um=new WeakMap,G(fp,um,new WeakSet);let PL=fp;const uHe="4.8.69",dHe="3634dab10";function cq(n){return Math.floor(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")}function yb(n){return Math.max(0,Math.min(255,255*n))}class uq{static CMYK_G([e,t,r,s]){return["G",1-Math.min(1,.3*e+.59*r+.11*t+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=yb(e),[e,e,e]}static G_HTML([e]){const t=cq(e);return`#${t}${t}${t}`}static RGB_G([e,t,r]){return["G",.3*e+.59*t+.11*r]}static RGB_rgb(e){return e.map(yb)}static RGB_HTML(e){return`#${e.map(cq).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,r,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,r+s),1-Math.min(1,t+s)]}static CMYK_rgb([e,t,r,s]){return[yb(1-Math.min(1,e+s)),yb(1-Math.min(1,r+s)),yb(1-Math.min(1,t+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,r]){const s=1-e,i=1-t,a=1-r,o=Math.min(s,i,a);return["CMYK",s,i,a,o]}}class hHe{create(e,t,r=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),r||(s.setAttribute("width",`${e}px`),s.setAttribute("height",`${t}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${t}`),s}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Qn("Abstract method `_createSVG` called.")}}class iz extends hHe{_createSVG(e){return document.createElementNS(cu,e)}}class Joe{static setupStorage(e,t,r,s,i){const a=s.getValue(t,{value:null});switch(r.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),i==="print")break;e.addEventListener("input",o=>{s.setValue(t,{value:o.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(a.value===r.attributes.xfaOn?e.setAttribute("checked",!0):a.value===r.attributes.xfaOff&&e.removeAttribute("checked"),i==="print")break;e.addEventListener("change",o=>{s.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),i==="print")break;e.addEventListener("input",o=>{s.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const o of r.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,u=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(t,{value:u})});break}}static setAttributes({html:e,element:t,storage:r=null,intent:s,linkService:i}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${s}`);for(const[l,u]of Object.entries(a))if(u!=null)switch(l){case"class":u.length&&e.setAttribute(l,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:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,u)}o&&i.addLinkAttributes(e,a.href,a.newWindow),r&&a.dataId&&this.setupStorage(e,a.dataId,t,r)}static render(e){var h,f;const t=e.annotationStorage,r=e.linkService,s=e.xfaHtml,i=e.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:i,linkService:r});const o=i!=="richText",l=e.div;if(l.append(a),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=p}o&&l.setAttribute("class","xfaLayer xfaFont");const u=[];
1007if(s.children.length===0){if(s.value){const p=document.createTextNode(s.value);a.append(p),o&&Z1.shouldBuildText(s.name)&&u.push(p)}return{textDivs:u}}const d=[[s,-1,a]];for(;d.length>0;){const[p,m,g]=d.at(-1);if(m+1===p.children.length){d.pop();continue}const y=p.children[++d.at(-1)[1]];if(y===null)continue;const{name:v}=y;if(v==="#text"){const b=document.createTextNode(y.value);u.push(b),g.append(b);continue}const x=(h=y==null?void 0:y.attributes)!=null&&h.xmlns?document.createElementNS(y.attributes.xmlns,v):document.createElement(v);if(g.append(x),y.attributes&&this.setAttributes({html:x,element:y,storage:t,intent:i,linkService:r}),((f=y.children)==null?void 0:f.length)>0)d.push([y,-1,x]);else if(y.value){const b=document.createTextNode(y.value);o&&Z1.shouldBuildText(v)&&u.push(b),x.append(b)}}for(const p of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const SE=1e3,fHe=9,mg=new WeakSet;function td(n){return{width:n[2]-n[0],height:n[3]-n[1]}}class pHe{static create(e){switch(e.data.annotationType){case ls.LINK:return new Qoe(e);case ls.TEXT:return new mHe(e);case ls.WIDGET:switch(e.data.fieldType){case"Tx":return new gHe(e);case"Btn":return e.data.radioButton?new nle(e):e.data.checkBox?new yHe(e):new xHe(e);case"Ch":return new bHe(e);case"Sig":return new vHe(e)}return new Ig(e);case ls.POPUP:return new OL(e);case ls.FREETEXT:return new ole(e);case ls.LINE:return new _He(e);case ls.SQUARE:return new SHe(e);case ls.CIRCLE:return new EHe(e);case ls.POLYLINE:return new lle(e);case ls.CARET:return new CHe(e);case ls.INK:return new az(e);case ls.POLYGON:return new kHe(e);case ls.HIGHLIGHT:return new cle(e);case ls.UNDERLINE:return new AHe(e);case ls.SQUIGGLY:return new NHe(e);case ls.STRIKEOUT:return new THe(e);case ls.STAMP:return new ule(e);case ls.FILEATTACHMENT:return new jHe(e);default:return new Vr(e)}}}var dm,ix,ax,z_,DL;const uz=class uz{constructor(e,{isRenderable:t=!1,ignoreBorder:r=!1,createQuadrilaterals:s=!1}={}){G(this,z_);G(this,dm,null);G(this,ix,!1);G(this,ax,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(r)),s&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:r}){return!!(e!=null&&e.str||t!=null&&t.str||r!=null&&r.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return uz._hasPopupData(this.data)}updateEdited(e){var r;if(!this.container)return;w(this,dm)||F(this,dm,{rect:this.data.rect.slice(0)});const{rect:t}=e;t&&W(this,z_,DL).call(this,t),(r=w(this,ax))==null||r.popup.updateEdited(e)}resetEdited(){var e;w(this,dm)&&(W(this,z_,DL).call(this,w(this,dm).rect),(e=w(this,ax))==null||e.popup.resetEdited(),F(this,dm,null))}_createContainer(e){const{data:t,parent:{page:r,viewport:s}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id),this instanceof Ig||(i.tabIndex=SE);const{style:a}=i;if(a.zIndex=this.parent.zIndex++,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add("norotate"),!t.rect||this instanceof OL){const{rotation:g}=t;return!t.hasOwnCanvas&&g!==0&&this.setRotation(g,i),i}const{width:o,height:l}=td(t.rect);if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const g=t.borderStyle.horizontalCornerRadius,y=t.borderStyle.verticalCornerRadius;if(g>0||y>0){const x=`calc(${g}px * var(--scale-factor)) / calc(${y}px * var(--scale-factor))`;a.borderRadius=x}else if(this instanceof nle){const x=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;a.borderRadius=x}switch(t.borderStyle.style){case gb.SOLID:a.borderStyle="solid";break;case gb.DASHED:a.borderStyle="dashed";break;case gb.BEVELED:tn("Unimplemented border style: beveled");break;case gb.INSET:tn("Unimplemented border style: inset");break;case gb.UNDERLINE:a.borderBottomStyle="solid";break}const v=t.borderColor||null;v?(F(this,ix,!0),a.borderColor=_t.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):a.borderWidth=0}const u=_t.normalizeRect([t.rect[0],r.view[3]-t.rect[1]+r.view[1],t.rect[2],r.view[3]-t.rect[3]+r.view[1]]),{pageWidth:d,pageHeight:h,pageX:f,pageY:p}=s.rawDims;a.left=`${100*(u[0]-f)/d}%`,a.top=`${100*(u[1]-p)/h}%`;const{rotation:m}=t;return t.hasOwnCanvas||m===0?(a.width=`${100*o/d}%`,a.height=`${100*l/h}%`):this.setRotation(m,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:s}=this.parent.viewport.rawDims,{width:i,height:a}=td(this.data.rect);let o,l;e%180===0?(o=100*i/r,l=100*a/s):(o=100*a/r,l=100*i/s),t.style.width=`${o}%`,t.style.height=`${l}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,r,s)=>{const i=s.detail[t],a=i[0],o=i.slice(1);s.target.style[r]=uq[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[r]:uq[`${a}_rgb`](o)})};return mn(this,"_commonActions",{display:t=>{const{display:r}=t.detail,s=r%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:r===1||r===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:r}=t.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:t=>{setTimeout(()=>
1007t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const r=t.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,t){const r=this._commonActions;for(const s of Object.keys(t.detail)){const i=e[s]||r[s];i==null||i(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const r=this._commonActions;for(const[s,i]of Object.entries(t)){const a=r[s];if(a){const o={detail:{[s]:i},target:e};a(o),delete t[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,r,s,i]=this.data.rect.map(g=>Math.fround(g));if(e.length===8){const[g,y,v,x]=e.subarray(2,6);if(s===g&&i===y&&t===v&&r===x)return}const{style:a}=this.container;let o;if(w(this,ix)){const{borderColor:g,borderWidth:y}=a;a.borderWidth=0,o=["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="${g}" stroke-width="${y}">`],this.container.classList.add("hasBorder")}const l=s-t,u=i-r,{svgFactory:d}=this,h=d.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0);const f=d.createElement("defs");h.append(f);const p=d.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let g=2,y=e.length;g<y;g+=8){const v=e[g],x=e[g+1],b=e[g+2],E=e[g+3],S=d.createElement("rect"),k=(b-t)/l,C=(i-x)/u,A=(v-b)/l,T=(x-E)/u;S.setAttribute("x",k),S.setAttribute("y",C),S.setAttribute("width",A),S.setAttribute("height",T),p.append(S),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${k}" y="${C}" width="${A}" height="${T}"/>`)}w(this,ix)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:e}=this,t=F(this,ax,new OL({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(t.render())}render(){Qn("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const r=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:i,id:a,exportValues:o}of s){if(i===-1||a===t)continue;const l=typeof o=="string"?o:null,u=document.querySelector(`[data-element-id="${a}"]`);if(u&&!mg.has(u)){tn(`_getElementsByName - element not allowed: ${a}`);continue}r.push({id:a,exportValue:l,domElement:u})}return r}for(const s of document.getElementsByName(e)){const{exportValue:i}=s,a=s.getAttribute("data-element-id");a!==t&&mg.has(s)&&r.push({id:a,exportValue:i,domElement:s})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})})}};dm=new WeakMap,ix=new WeakMap,ax=new WeakMap,z_=new WeakSet,DL=function(e){const{container:{style:t},data:{rect:r,rotation:s},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:l}}}}=this;r==null||r.splice(0,4,...e);const{width:u,height:d}=td(e);t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(a-e[3]+l)/a}%`,s===0?(t.width=`${100*u/i}%`,t.height=`${100*d/a}%`):this.setRotation(s)};let Vr=uz;var qa,sp,ele,tle;class Qoe extends Vr{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!(r!=null&&r.ignoreBorder),createQuadrilaterals:!0});G(this,qa);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let i=!1;return t.url?(r.addLinkAttributes(s,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(s,t.action),i=!0):t.attachment?(W(this,qa,ele).call(this,s,t.attachment,t.attachmentDest),i=!0):t.setOCGState?(W(this,qa,tle).call(this,s,t.setOCGState),i=!0):t.dest?(this._bindLink(s,t.dest),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),i=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkA
1007nnotation"),i&&this.container.append(s),this.container}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&W(this,qa,sp).call(this)}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),W(this,qa,sp).call(this)}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(r.actions)){const a=s.get(i);a&&(t[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:i}}),!1})}t.onclick||(t.onclick=()=>!1),W(this,qa,sp).call(this)}_bindResetFormAction(t,r){const s=t.onclick;if(s||(t.href=this.linkService.getAnchorUrl("")),W(this,qa,sp).call(this),!this._fieldObjects){tn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(t.onclick=()=>!1);return}t.onclick=()=>{var h;s==null||s();const{fields:i,refs:a,include:o}=r,l=[];if(i.length!==0||a.length!==0){const f=new Set(a);for(const p of i){const m=this._fieldObjects[p]||[];for(const{id:g}of m)f.add(g)}for(const p of Object.values(this._fieldObjects))for(const m of p)f.has(m.id)===o&&l.push(m)}else for(const f of Object.values(this._fieldObjects))l.push(...f);const u=this.annotationStorage,d=[];for(const f of l){const{id:p}=f;switch(d.push(p),f.type){case"text":{const g=f.defaultValue||"";u.setValue(p,{value:g});break}case"checkbox":case"radiobutton":{const g=f.defaultValue===f.exportValues;u.setValue(p,{value:g});break}case"combobox":case"listbox":{const g=f.defaultValue||"";u.setValue(p,{value:g});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!mg.has(m)){tn(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.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}}}qa=new WeakSet,sp=function(){this.container.setAttribute("data-internal-link","")},ele=function(t,r,s=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>{var i;return(i=this.downloadManager)==null||i.openOrDownloadData(r.content,r.filename,s),!1},W(this,qa,sp).call(this)},tle=function(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),W(this,qa,sp).call(this)};class mHe extends Vr{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 Ig extends Vr{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Ki.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,r,s,i){r.includes("mouse")?e.addEventListener(r,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(r,a=>{var o;if(r==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(r==="focus"){if(t.focused)return;t.focused=!0}i&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(a)}}))})}_setEventListeners(e,t,r,s){var i,a,o;for(const[l,u]of r)(u==="Action"||(i=this.data.actions)!=null&&i[u])&&((u==="Focus"||u==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,l,u,s),u==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(e,t,"blur","Blur",null):u==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}
1007_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":_t.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||fHe,i=e.style;let a;const o=2,l=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(u/(bD*s))||1,h=u/d;a=Math.min(s,l(h/bD))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(s,l(u/bD))}i.fontSize=`calc(${a}px * var(--scale-factor))`,i.color=_t.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class gHe extends Ig{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,r,s){const i=this.annotationStorage;
1007for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=r),i.setValue(a.id,{[s]:r})}render(){var s,i;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const a=e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let u=a.formattedValue||((s=this.data.textContent)==null?void 0:s.join(`
1008`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=u??o,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type="text",r.setAttribute("value",u??o),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),mg.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=SE,this._setRequired(r,this.data.required),l&&(r.maxLength=l),r.addEventListener("input",f=>{e.setValue(t,{value:f.target.value}),this.setPropertyOnSiblings(r,"value",f.target.value,"value"),d.formattedValue=null}),r.addEventListener("resetform",f=>{const p=this.data.defaultFieldValue??"";r.value=d.userValue=p,d.formattedValue=null});let h=f=>{const{formattedValue:p}=d;p!=null&&(f.target.value=p),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",p=>{var g;if(d.focused)return;const{target:m}=p;d.userValue&&(m.value=d.userValue),d.lastCommittedValue=m.value,d.commitKey=1,(g=this.data.actions)!=null&&g.Focus||(d.focused=!0)}),r.addEventListener("updatefromsandbox",p=>{this.showElementAndHideCanvas(p.target);const m={value(g){d.userValue=g.detail.value??"",e.setValue(t,{value:d.userValue.toString()}),g.target.value=d.userValue},formattedValue(g){const{formattedValue:y}=g.detail;d.formattedValue=y,y!=null&&g.target!==document.activeElement&&(g.target.value=y),e.setValue(t,{formattedValue:y})},selRange(g){g.target.setSelectionRange(...g.detail.selRange)},charLimit:g=>{var b;const{charLimit:y}=g.detail,{target:v}=g;if(y===0){v.removeAttribute("maxLength");return}v.setAttribute("maxLength",y);let x=d.userValue;!x||x.length<=y||(x=x.slice(0,y),v.value=d.userValue=x,e.setValue(t,{value:x}),(b=this.linkService.eventBus)==null||b.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:v.selectionStart,selEnd:v.selectionEnd}}))}};this._dispatchEventFromSandbox(m,p)}),r.addEventListener("keydown",p=>{var y;d.commitKey=1;let m=-1;if(p.key==="Escape"?m=0:p.key==="Enter"&&!this.data.multiLine?m=2:p.key==="Tab"&&(d.commitKey=3),m===-1)return;const{value:g}=p.target;d.lastCommittedValue!==g&&(d.lastCommittedValue=g,d.userValue=g,(y=this.linkService.eventBus)==null||y.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:g,willCommit:!0,commitKey:m,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}}))});const f=h;h=null,r.addEventListener("blur",p=>{var g,y;if(!d.focused||!p.relatedTarget)return;(g=this.data.actions)!=null&&g.Blur||(d.focused=!1);const{value:m}=p.target;d.userValue=m,d.lastCommittedValue!==m&&((y=this.linkService.eventBus)==null||y.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}})),f(p)}),(i=this.data.actions)!=null&&i.Keystroke&&r.addEventListener("beforeinput",p=>{var S;d.lastCommittedValue=null;const{data:m,target:g}=p,{value:y,selectionStart:v,selectionEnd:x}=g;let b=v,E=x;switch(p.inputType){case"deleteWordBackward":{const k=y.substring(0,v).match(/\w*[^\w]*$/);k&&(b-=k[0].length);break}
vendor: 4,159 bytes, line 1008
1008case"deleteWordForward":{const k=y.substring(v).match(/^[^\w]*\w*/);k&&(E+=k[0].length);break}case"deleteContentBackward":v===x&&(b-=1);break;case"deleteContentForward":v===x&&(E+=1);break}p.preventDefault(),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:y,change:m||"",willCommit:!1,selStart:b,selEnd:E}})}),this._setEventListeners(r,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],p=>p.target.value)}if(h&&r.addEventListener("blur",h),this.data.comb){const p=(this.data.rect[2]-this.data.rect[0])/l;r.classList.add("comb"),r.style.letterSpacing=`calc(${p}px * var(--scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class vHe extends Ig{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class yHe extends Ig{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,r=t.id;let s=e.getValue(r,{value:t.exportValue===t.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",e.setValue(r,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return mg.add(i),i.setAttribute("data-element-id",r),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,s&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=SE,i.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const u of this._getElementsByName(o,r)){const d=l&&u.exportValue===t.exportValue;u.domElement&&(u.domElement.checked=d),e.setValue(u.id,{value:d})}e.setValue(r,{value:l})}),i.addEventListener("resetform",a=>{const o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class nle extends Ig{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,r=t.id;let s=e.getValue(r,{value:t.fieldValue===t.buttonValue}).value;if(typeof s=="string"&&(s=s!==t.buttonValue,e.setValue(r,{value:s})),s)for(const a of this._getElementsByName(t.fieldName,r))e.setValue(a.id,{value:!1});const i=document.createElement("input");if(mg.add(i),i.setAttribute("data-element-id",r),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,s&&i.setAttribute("checked",!0),i.tabIndex=SE,i.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const u of this._getElementsByName(o,r))e.setValue(u.id,{value:!1});e.setValue(r,{value:l})}),i.addEventListener("resetform",a=>{const o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const a=t.buttonValue;i.addEventListener("updatefromsandbox",o=>{const l={value:u=>{const d=a===u.detail.value;for(const h of this._getElementsByName(u.target.name)){const f=d&&h.id===r;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}}};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)}
1008return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class xHe extends Qoe{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class bHe extends Ig{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,r=e.getValue(t,{value:this.data.fieldValue}),s=document.createElement("select");mg.add(s),s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=SE;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,r.value.includes(d.exportValue)&&(h.setAttribute("selected",!0),i=!1),s.append(h)}let a=null;if(i){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),s.prepend(d),a=()=>{d.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const o=d=>{const h=d?"value":"textContent",{options:f,multiple:p}=s;return p?Array.prototype.filter.call(f,m=>m.selected).map(m=>m[h]):f.selectedIndex===-1?null:f[f.selectedIndex][h]};let l=o(!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){a==null||a();const p=f.detail.value,m=new Set(Array.isArray(p)?p:[p]);for(const g of s.options)g.selected=m.has(g.value);e.setValue(t,{value:o(!0)}),l=o(!1)},multipleSelection(f){s.multiple=!0},remove(f){const p=s.options,m=f.detail.remove;p[m].selected=!1,s.remove(m),p.length>0&&Array.prototype.findIndex.call(p,y=>y.selected)===-1&&(p[0].selected=!0),e.setValue(t,{value:o(!0),items:u(f)}),l=o(!1)},clear(f){for(;s.length!==0;)s.remove(0);e.setValue(t,{value:null,items:[]}),l=o(!1)},insert(f){const{index:p,displayValue:m,exportValue:g}=f.detail.insert,y=s.children[p],v=document.createElement("option");v.textContent=m,v.value=g,y?y.before(v):s.append(v),e.setValue(t,{value:o(!0),items:u(f)}),l=o(!1)},items(f){const{items:p}=f.detail;for(;s.length!==0;)s.remove(0);for(const m of p){const{displayValue:g,exportValue:y}=m,v=document.createElement("option");v.textContent=g,v.value=y,s.append(v)}s.options.length>0&&(s.options[0].selected=!0),e.setValue(t,{value:o(!0),items:u(f)}),l=o(!1)},indices(f){const p=new Set(f.detail.indices);for(const m of f.target.options)m.selected=p.has(m.index);e.setValue(t,{value:o(!0)}),l=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(h,d)}),s.addEventListener("input",d=>{var p;const h=o(!0),f=o(!1);e.setValue(t,{value:h}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:l,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(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class OL extends Vr{constructor(e){const{data:t,elements:r}=e;super(e,{isRenderable:Vr._hasPopupData(t)}),this.elements=r,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new wHe({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const r of this.elements)r.popup=e,r.container.ariaHasPopup="dialog",t.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(r=>`${YB}${r}`).join(",")),this.container}}
1008var ox,ON,MN,lx,hm,_r,Tu,cx,$_,U_,ux,ju,El,Ru,V_,Pu,H_,fm,pm,zn,OC,ML,rle,sle,ile,ale,MC,IC,IL;class wHe{constructor({container:e,color:t,elements:r,titleObj:s,modificationDate:i,contentsObj:a,richText:o,parent:l,rect:u,parentRect:d,open:h}){G(this,zn);G(this,ox,W(this,zn,ile).bind(this));G(this,ON,W(this,zn,IL).bind(this));G(this,MN,W(this,zn,IC).bind(this));G(this,lx,W(this,zn,MC).bind(this));G(this,hm,null);G(this,_r,null);G(this,Tu,null);G(this,cx,null);G(this,$_,null);G(this,U_,null);G(this,ux,null);G(this,ju,!1);G(this,El,null);G(this,Ru,null);G(this,V_,null);G(this,Pu,null);G(this,H_,null);G(this,fm,null);G(this,pm,!1);var f;F(this,_r,e),F(this,H_,s),F(this,Tu,a),F(this,Pu,o),F(this,U_,l),F(this,hm,t),F(this,V_,u),F(this,ux,d),F(this,$_,r),F(this,cx,JB.toDateObject(i)),this.trigger=r.flatMap(p=>p.getElementsToTriggerPopup());for(const p of this.trigger)p.addEventListener("click",w(this,lx)),p.addEventListener("mouseenter",w(this,MN)),p.addEventListener("mouseleave",w(this,ON)),p.classList.add("popupTriggerArea");for(const p of r)(f=p.container)==null||f.addEventListener("keydown",w(this,ox));w(this,_r).hidden=!0,h&&W(this,zn,MC).call(this)}render(){if(w(this,El))return;const e=F(this,El,document.createElement("div"));if(e.className="popup",w(this,hm)){const i=e.style.outlineColor=_t.makeHexColor(...w(this,hm));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`:e.style.backgroundColor=_t.makeHexColor(...w(this,hm).map(o=>Math.floor(.7*(255-o)+o)))}const t=document.createElement("span");t.className="header";const r=document.createElement("h1");if(t.append(r),{dir:r.dir,str:r.textContent}=w(this,H_),e.append(t),w(this,cx)){const i=document.createElement("span");i.classList.add("popupDate"),i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:w(this,cx).valueOf()})),t.append(i)}const s=w(this,zn,OC);if(s)Joe.render({xfaHtml:s,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const i=this._formatContents(w(this,Tu));e.append(i)}w(this,_r).append(e)}_formatContents({str:e,dir:t}){const r=document.createElement("p");r.classList.add("popupContent"),r.dir=t;const s=e.split(/(?:\r\n?|\n)/);for(let i=0,a=s.length;i<a;++i){const o=s[i];r.append(document.createTextNode(o)),i<a-1&&r.append(document.createElement("br"))}return r}updateEdited({rect:e,popupContent:t}){var r;w(this,fm)||F(this,fm,{contentsObj:w(this,Tu),richText:w(this,Pu)}),e&&F(this,Ru,null),t&&(F(this,Pu,W(this,zn,sle).call(this,t)),F(this,Tu,null)),(r=w(this,El))==null||r.remove(),F(this,El,null)}resetEdited(){var e;w(this,fm)&&({contentsObj:Ss(this,Tu)._,richText:Ss(this,Pu)._}=w(this,fm),F(this,fm,null),(e=w(this,El))==null||e.remove(),F(this,El,null),F(this,Ru,null))}forceHide(){F(this,pm,this.isVisible),w(this,pm)&&(w(this,_r).hidden=!0)}maybeShow(){w(this,pm)&&(w(this,El)||W(this,zn,IC).call(this),F(this,pm,!1),w(this,_r).hidden=!1)}get isVisible(){return w(this,_r).hidden===!1}}ox=new WeakMap,ON=new WeakMap,MN=new WeakMap,lx=new WeakMap,hm=new WeakMap,_r=new WeakMap,Tu=new WeakMap,cx=new WeakMap,$_=new WeakMap,U_=new WeakMap,ux=new WeakMap,ju=new WeakMap,El=new WeakMap,Ru=new WeakMap,V_=new WeakMap,Pu=new WeakMap,H_=new WeakMap,fm=new WeakMap,pm=new WeakMap,zn=new WeakSet,OC=function(){const e=w(this,Pu),t=w(this,Tu);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&w(this,Pu).html||null},ML=function(){var e,t,r;return((r=(t=(e=w(this,zn,OC))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.fontSize)||0},rle=function(){var e,t,r;return((r=(t=(e=w(this,zn,OC))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:r.color)||null},sle=function(e){const t=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},s={style:{color:w(this,zn,rle),fontSize:w(this,zn,ML)?`calc(${w(this,zn,ML)}px * var(--scale-factor))`:""}};for(const i of e.split(`
1009`))t.push({name:"span",value:i,attributes:s});return r},ile=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&w(this,ju))&&W(this,zn,MC).call(this)},ale=function(){if(w(this,Ru)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:r,pageX:s,pageY:i}}}=w(this,U_);let a=!!w(this,ux),o=a?w(this,ux):w(this,V_);for(const m of w(this,$_))if(!o||_t.intersect(m.data.rect,o)!==null){o=m.data.rect,a=!0;break}const l=_t.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),d=a?o[2]-o[0]+5:0,h=l[0]+d,f=l[1];F(this,Ru,[100*(h-s)/t,100*(f-i)/r]);const{style:p}=w(this,_r);
1009p.left=`${w(this,Ru)[0]}%`,p.top=`${w(this,Ru)[1]}%`},MC=function(){F(this,ju,!w(this,ju)),w(this,ju)?(W(this,zn,IC).call(this),w(this,_r).addEventListener("click",w(this,lx)),w(this,_r).addEventListener("keydown",w(this,ox))):(W(this,zn,IL).call(this),w(this,_r).removeEventListener("click",w(this,lx)),w(this,_r).removeEventListener("keydown",w(this,ox)))},IC=function(){w(this,El)||this.render(),this.isVisible?w(this,ju)&&w(this,_r).classList.add("focused"):(W(this,zn,ale).call(this),w(this,_r).hidden=!1,w(this,_r).style.zIndex=parseInt(w(this,_r).style.zIndex)+1e3)},IL=function(){w(this,_r).classList.remove("focused"),!(w(this,ju)||!this.isVisible)&&(w(this,_r).hidden=!0,w(this,_r).style.zIndex=parseInt(w(this,_r).style.zIndex)-1e3)};class ole extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Yt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const r=document.createElement("span");r.textContent=t,e.append(r)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var W_;class _He extends Vr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});G(this,W_,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:r,height:s}=td(t.rect),i=this.svgFactory.create(r,s,!0),a=F(this,W_,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),i.append(a),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return w(this,W_)}addHighlightArea(){this.container.classList.add("highlightArea")}}W_=new WeakMap;var q_;class SHe extends Vr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});G(this,q_,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:r,height:s}=td(t.rect),i=this.svgFactory.create(r,s,!0),a=t.borderStyle.width,o=F(this,q_,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",r-a),o.setAttribute("height",s-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return w(this,q_)}addHighlightArea(){this.container.classList.add("highlightArea")}}q_=new WeakMap;var G_;class EHe extends Vr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});G(this,G_,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:r,height:s}=td(t.rect),i=this.svgFactory.create(r,s,!0),a=t.borderStyle.width,o=F(this,G_,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",r/2),o.setAttribute("cy",s/2),o.setAttribute("rx",r/2-a/2),o.setAttribute("ry",s/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),i.append(o),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return w(this,G_)}addHighlightArea(){this.container.classList.add("highlightArea")}}G_=new WeakMap;var K_;class lle extends Vr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});G(this,K_,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:r,borderStyle:s,popupRef:i}}=this;if(!r)return this.container;const{width:a,height:o}=td(t),l=this.svgFactory.create(a,o,!0);let u=[];for(let h=0,f=r.length;h<f;h+=2){const p=r[h]-t[0],m=t[3]-r[h+1];u.push(`${p},${m}`)}u=u.join(" ");const d=F(this,K_,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"),l.append(d),this.container.append(l),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return w(this,K_)}addHighlightArea(){this.container.classList.add("highlightArea")}}K_=new WeakMap;class kHe extends lle{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class CHe extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
1009var Y_;class az extends Vr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});G(this,Y_,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Yt.HIGHLIGHT:Yt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:r,borderStyle:s,popupRef:i}}=this,{width:a,height:o}=td(t),l=this.svgFactory.create(a,o,!0);for(const u of r){let d=[];for(let f=0,p=u.length;f<p;f+=2){const m=u[f]-t[0],g=t[3]-u[f+1];d.push(`${m},${g}`)}d=d.join(" ");const h=this.svgFactory.createElement(this.svgElementName);w(this,Y_).push(h),h.setAttribute("points",d),h.setAttribute("stroke-width",s.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),l.append(h)}return!i&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return w(this,Y_)}addHighlightArea(){this.container.classList.add("highlightArea")}}Y_=new WeakMap;class cle extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Yt.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class AHe extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class NHe extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class THe extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ule extends Vr{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Yt.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 X_,Z_,LL;class jHe extends Vr{constructor(t){var s;super(t,{isRenderable:!0});G(this,Z_);G(this,X_,null);const{file:r}=this.data;this.filename=r.filename,this.content=r.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:r}=this;let s;r.hasAppearance||r.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),s.addEventListener("dblclick",W(this,Z_,LL).bind(this)),F(this,X_,s);const{isMac:i}=Ki.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(i?a.metaKey:a.ctrlKey)&&W(this,Z_,LL).call(this)}),!r.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),t.append(s),t}getElementsToTriggerPopup(){return w(this,X_)}addHighlightArea(){this.container.classList.add("highlightArea")}}X_=new WeakMap,Z_=new WeakSet,LL=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var J_,mm,gm,Q_,vg,dle,FL,Mq;let RHe=(Mq=class{constructor({div:e,accessibilityManager:t,annotationCanvasMap:r,annotationEditorUIManager:s,page:i,viewport:a,structTreeLayer:o}){G(this,vg);G(this,J_,null);G(this,mm,null);G(this,gm,new Map);G(this,Q_,null);this.div=e,F(this,J_,t),F(this,mm,r),F(this,Q_,o||null),this.page=i,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return w(this,gm).size>0}async render(e){var a;const{annotations:t}=e,r=this.div;fg(r,this.viewport);const s=new Map,i={data:null,layer:r,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new iz,annotationStorage:e.annotationStorage||new ez,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const o of t){if(o.noHTML)continue;const l=o.annotationType===ls.POPUP;if(l){const h=s.get(o.id);if(!h)continue;i.elements=h}else{const{width:h,height:f}=td(o.rect);if(h<=0||f<=0)continue}i.data=o;const u=pHe.create(i);if(!u.isRenderable)continue;if(!l&&o.popupRef){const h=s.get(o.popupRef);h?h.push(u):s.set(o.popupRef,[u])}const d=u.render();o.hidden&&(d.style.visibility="hidden"),await W(this,vg,dle).call(this,d,o.id),u._isEditable&&(w(this,gm).set(u.data.id,u),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(u))}W(this,vg,FL).call(this)}update({viewport:e}){const t=this.div;this.viewport=e,fg(t,{rotation:e.rotation}),W(this,vg,FL).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(w(this,gm).values())}getEditableAnnotation(e){return w(this,gm).get(e)}},J_=new WeakMap,mm=new WeakMap,gm=new WeakMap,Q_=new WeakMap,vg=new WeakSet,dle=async function(e,t){var a,o;const r=e.firstChild||e,s=r.id=`${YB}${t}`,i=await((a=w(this,Q_))==null?void 0:a.getAriaAttributes(s));if(i)for(const[l,u]of i)r.setAttribute(l,u);this.div.append(e),(o=w(this,J_))==null||o.moveElementInDOM(this.div,e,r,!1)},FL=function(){if(!w(this,mm))return;const e=this.div;for(const[t,r]of w(this,mm)){const s=e.querySelector(`[data-annotation-id="${t}"]`);if(!s)continue;r.className="annotationContent";const{firstChild:i}=s;i?i.nodeName==="CANVAS"?i.replaceWith(r):i.classList.contains("annotationContent")?i.after(r):i.before(r):s.append(r)}w(this,mm).clear()},Mq);const jk=/\r\n?|\n/g;var kl,Ma,eS,vm,Ia,ts,hle,fle,ple,LC,sd,FC,BC,mle,zL,gle;const Gn=class Gn extends Mn{constructor(t){super({...t,name:"freeTextEditor"});G(this,ts);G(this,kl);G(this,Ma,"");G(this,eS,`${this.id}-editor`);G(this,vm,null);G(this,Ia);F(this,kl,t.color||Gn._defaultColor||Mn._defaultLineColor),F(this,Ia,t.fontSize||Gn._defaultFontSize)}static get _keyboardManager(){const t=Gn.prototype,r=a=>a.isEmpty(),s=pg.TRANSLATE_SMALL,i=pg.TRANSLATE_BIG;return mn(this,"_keyboardManager",new _E([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[s,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:r}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,s],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:r}]]))}static initialize(t,r){Mn.initialize(t,r);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}
1009static updateDefaultParams(t,r){switch(t){case Bt.FREETEXT_SIZE:Gn._defaultFontSize=r;break;case Bt.FREETEXT_COLOR:Gn._defaultColor=r;break}}updateParams(t,r){switch(t){case Bt.FREETEXT_SIZE:W(this,ts,hle).call(this,r);break;case Bt.FREETEXT_COLOR:W(this,ts,fle).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[Bt.FREETEXT_SIZE,Gn._defaultFontSize],[Bt.FREETEXT_COLOR,Gn._defaultColor||Mn._defaultLineColor]]}get propertiesToUpdate(){return[[Bt.FREETEXT_SIZE,w(this,Ia)],[Bt.FREETEXT_COLOR,w(this,kl)]]}_translateEmpty(t,r){this._uiManager.translateSelectedEditors(t,r,!0)}getInitialTranslation(){const t=this.parentScale;return[-Gn._internalPadding*t,-(Gn._internalPadding+w(this,Ia))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Yt.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),F(this,vm,new AbortController);const t=this._uiManager.combinedSignal(w(this,vm));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",w(this,eS)),this._isDraggable=!0,(t=w(this,vm))==null||t.abort(),F(this,vm,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),(t=this._initialOptions)!=null&&t.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=w(this,Ma),r=F(this,Ma,W(this,ts,ple).call(this).trimEnd());if(t===r)return;const s=i=>{if(F(this,Ma,i),!i){this.remove();return}W(this,ts,BC).call(this),this._uiManager.rebuild(this),W(this,ts,LC).call(this)};this.addCommands({cmd:()=>{s(r)},undo:()=>{s(t)},mustExec:!1}),W(this,ts,LC).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Gn._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",w(this,eS)),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(${w(this,Ia)}px * var(--scale-factor))`,s.color=w(this,kl),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),gN(this,this.div,["dblclick","keydown"]),this.width){const[i,a]=this.parentDimensions;
1009if(this.annotationElementId){const{position:o}=this._initialData;let[l,u]=this.getInitialTranslation();[l,u]=this.pageTranslationToScreen(l,u);const[d,h]=this.pageDimensions,[f,p]=this.pageTranslation;let m,g;switch(this.rotation){case 0:m=t+(o[0]-f)/d,g=r+this.height-(o[1]-p)/h;break;case 90:m=t+(o[0]-f)/d,g=r-(o[1]-p)/h,[l,u]=[u,-l];break;case 180:m=t-this.width+(o[0]-f)/d,g=r-(o[1]-p)/h,[l,u]=[-l,-u];break;case 270:m=t+(o[0]-f-this.height*h)/d,g=r+(o[1]-p-this.width*d)/h,[l,u]=[-u,l];break}this.setAt(m*i,g*a,l,u)}else this.setAt(t*i,r*a,this.width*i,this.height*a);W(this,ts,BC).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var m,g,y;const r=t.clipboardData||window.clipboardData,{types:s}=r;if(s.length===1&&s[0]==="text/plain")return;t.preventDefault();const i=W(m=Gn,sd,zL).call(m,r.getData("text")||"").replaceAll(jk,`
1010`);if(!i)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!i.includes(`
1011`)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:u}=o,d=[],h=[];if(l.nodeType===Node.TEXT_NODE){const v=l.parentElement;if(h.push(l.nodeValue.slice(u).replaceAll(jk,"")),v!==this.editorDiv){let x=d;for(const b of this.editorDiv.childNodes){if(b===v){x=h;continue}x.push(W(g=Gn,sd,FC).call(g,b))}}d.push(l.nodeValue.slice(0,u).replaceAll(jk,""))}else if(l===this.editorDiv){let v=d,x=0;for(const b of this.editorDiv.childNodes)x++===u&&(v=h),v.push(W(y=Gn,sd,FC).call(y,b))}F(this,Ma,`${d.join(`
1012`)}${i}${h.join(`
1013`)}`),W(this,ts,BC).call(this);const f=new Range;let p=d.reduce((v,x)=>v+x.length,0);for(const{firstChild:v}of this.editorDiv.childNodes)if(v.nodeType===Node.TEXT_NODE){const x=v.nodeValue.length;if(p<=x){f.setStart(v,p),f.setEnd(v,p);break}p-=x}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(t,r,s){var o;let i=null;if(t instanceof ole){const{data:{defaultAppearanceData:{fontSize:l,fontColor:u},rect:d,rotation:h,id:f,popupRef:p},textContent:m,textPosition:g,parent:{page:{pageNumber:y}}}=t;if(!m||m.length===0)return null;i=t={annotationType:Yt.FREETEXT,color:Array.from(u),fontSize:l,value:m.join(`
1014`),position:g,pageIndex:y-1,rect:d.slice(0),rotation:h,id:f,deleted:!1,popupRef:p}}const a=await super.deserialize(t,r,s);return F(a,Ia,t.fontSize),F(a,kl,_t.makeHexColor(...t.color)),F(a,Ma,W(o=Gn,sd,zL).call(o,t.value)),a.annotationElementId=t.id||null,a._initialData=i,a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const r=Gn._internalPadding*this.parentScale,s=this.getRect(r,r),i=Mn._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:w(this,kl)),a={annotationType:Yt.FREETEXT,color:i,fontSize:w(this,Ia),value:W(this,ts,mle).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?a:this.annotationElementId&&!W(this,ts,gle).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){const r=super.renderAnnotationElement(t);if(this.deleted)return r;const{style:s}=r;s.fontSize=`calc(${w(this,Ia)}px * var(--scale-factor))`,s.color=w(this,kl),r.replaceChildren();for(const a of w(this,Ma).split(`
1015`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),r.append(o)}const i=Gn._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(i,i),popupContent:w(this,Ma)}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};kl=new WeakMap,Ma=new WeakMap,eS=new WeakMap,vm=new WeakMap,Ia=new WeakMap,ts=new WeakSet,hle=function(t){const r=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--scale-factor))`,this.translate(0,-(i-w(this,Ia))*this.parentScale),F(this,Ia,i),W(this,ts,LC).call(this)},s=w(this,Ia);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.FREETEXT_S
vendor: 10,532 bytes, lines 1015-1017
1015IZE,overwriteIfSameType:!0,keepUndo:!0})},fle=function(t){const r=i=>{F(this,kl,this.editorDiv.style.color=i)},s=w(this,kl);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},ple=function(){var s;const t=[];this.editorDiv.normalize();let r=null;for(const i of this.editorDiv.childNodes)(r==null?void 0:r.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(t.push(W(s=Gn,sd,FC).call(s,i)),r=i);return t.join(`
1016`)},LC=function(){const[t,r]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",i.div.append(this.div),s=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=s.width/t,this.height=s.height/r):(this.width=s.height/t,this.height=s.width/r),this.fixAndSetPosition()},sd=new WeakSet,FC=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(jk,"")},BC=function(){if(this.editorDiv.replaceChildren(),!!w(this,Ma))for(const t of w(this,Ma).split(`
1017`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},mle=function(){return w(this,Ma).replaceAll(" "," ")},zL=function(t){return t.replaceAll(" "," ")},gle=function(t){const{value:r,fontSize:s,color:i,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==r||t.fontSize!==s||t.color.some((o,l)=>o!==i[l])||t.pageIndex!==a},G(Gn,sd),Nt(Gn,"_freeTextDefaultContent",""),Nt(Gn,"_internalPadding",0),Nt(Gn,"_defaultColor",null),Nt(Gn,"_defaultFontSize",10),Nt(Gn,"_type","freetext"),Nt(Gn,"_editorType",Yt.FREETEXT);let BL=Gn;class vle{toSVGPath(){Qn("Abstract method `toSVGPath` must be implemented.")}get box(){Qn("Abstract getter `box` must be implemented.")}serialize(e,t){Qn("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){Qn("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){Qn("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var La,Cl,dx,hx,kc,rn,ym,xm,tS,nS,fx,px,Th,rS,IN,LN,bs,Zb,yle,xle,ble,wle,_le,Sle;const pu=class pu{constructor({x:e,y:t},r,s,i,a,o=0){G(this,bs);G(this,La);G(this,Cl,[]);G(this,dx);G(this,hx);G(this,kc,[]);G(this,rn,new Float64Array(18));G(this,ym);G(this,xm);G(this,tS);G(this,nS);G(this,fx);G(this,px);G(this,Th,[]);F(this,La,r),F(this,px,i*s),F(this,hx,a),w(this,rn).set([NaN,NaN,NaN,NaN,e,t],6),F(this,dx,o),F(this,nS,w(pu,rS)*s),F(this,tS,w(pu,LN)*s),F(this,fx,s),w(this,Th).push(e,t)}isEmpty(){return isNaN(w(this,rn)[8])}add({x:e,y:t}){var T;F(this,ym,e),F(this,xm,t);const[r,s,i,a]=w(this,La);let[o,l,u,d]=w(this,rn).subarray(8,12);const h=e-u,f=t-d,p=Math.hypot(h,f);if(p<w(this,tS))return!1;const m=p-w(this,nS),g=m/p,y=g*h,v=g*f;let x=o,b=l;o=u,l=d,u+=y,d+=v,(T=w(this,Th))==null||T.push(e,t);const E=-v/m,S=y/m,k=E*w(this,px),C=S*w(this,px);return w(this,rn).set(w(this,rn).subarray(2,8),0),w(this,rn).set([u+k,d+C],4),w(this,rn).set(w(this,rn).subarray(14,18),12),w(this,rn).set([u-k,d-C],16),isNaN(w(this,rn)[6])?(w(this,kc).length===0&&(w(this,rn).set([o+k,l+C],2),w(this,kc).push(NaN,NaN,NaN,NaN,(o+k-r)/i,(l+C-s)/a),w(this,rn).set([o-k,l-C],14),w(this,Cl).push(NaN,NaN,NaN,NaN,(o-k-r)/i,(l-C-s)/a)),w(this,rn).set([x,b,o,l,u,d],6),!this.isEmpty()):(w(this,rn).set([x,b,o,l,u,d],6),Math.abs(Math.atan2(b-l,x-o)-Math.atan2(v,y))<Math.PI/2?([o,l,u,d]=w(this,rn).subarray(2,6),w(this,kc).push(NaN,NaN,NaN,NaN,((o+u)/2-r)/i,((l+d)/2-s)/a),[o,l,x,b]=w(this,rn).subarray(14,18),w(this,Cl).push(NaN,NaN,NaN,NaN,((x+o)/2-r)/i,((b+l)/2-s)/a),!0):([x,b,o,l,u,d]=w(this,rn).subarray(0,6),w(this,kc).push(((x+5*o)/6-r)/i,((b+5*l)/6-s)/a,((5*o+u)/6-r)/i,((5*l+d)/6-s)/a,((o+u)/2-r)/i,((l+d)/2-s)/a),[u,d,o,l,x,b]=w(this,rn).subarray(12,18),w(this,Cl).push(((x+5*o)/6-r)/i,((b+5*l)/6-s)/a,((5*o+u)/6-r)/i,((5*l+d)/6-s)/a,((o+u)/2-r)/i,((l+d)/2-s)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=w(this,kc),t=w(this,Cl);if(isNaN(w(this,rn)[6])&&!this.isEmpty())return W(this,bs,yle).call(this);const r=[];r.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)isNaN(e[s])?r.push(`L${e[s+4]} ${e[s+5]}`):r.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);W(this,bs,ble).call(this,r);for(let s=t.length-6;s>=6;s-=6)isNaN(t[s])?r.push(`L${t[s+4]} ${t[s+5]}`):r.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);return W(this,bs,xle).call(this,r),r.join(" ")}newFreeDrawOutline(e,t,r,s,i,a){return new Ele(e,t,r,s,i,a)}getOutlines(){var h;const e=w(this,kc),t=w(this,Cl),r=w(this,rn),[s,i,a,o]=w(this,La),l=new Float64Array((((h=w(this,Th))==null?void 0:h.length)??0)+2);for(let f=0,p=l.length-2;f<p;f+=2)l[f]=(w(this,Th)[f]-s)/a,l[f+1]=(w(this,Th)[f+1]-i)/o;if(l[l.length-2]=(w(this,ym)-s)/a,l[l.length-1]=(w(this,xm)-i)/o,isNaN(r[6])&&!this.isEmpty())return W(this,bs,wle).call(this,l);const u=new Float64Array(w(this,kc).length+24+w(this,Cl).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=W(this,bs,Sle).call(this,u,d);for(let f=t.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(t[f+p])){u[d]=u[d+1]=NaN,d+=2;continue}u[d]=t[f+p],u[d+1]=t[f+p+1],d+=2}return W(this,bs,_le).call(this,u,d),this.newFreeDrawOutline(u,l,w(this,La),w(this,fx),w(this,dx),w(this,hx))}};La=new WeakMap,Cl=new WeakMap,dx=new WeakMap,hx=new WeakMap,kc=new WeakMap,rn=new WeakMap,ym=new WeakMap,xm=new WeakMap,tS=new WeakMap,nS=new WeakMap,fx=new WeakMap,px=new WeakMap,Th=new WeakMap,rS=new WeakMap,IN=new WeakMap,LN=new WeakMap,bs=new WeakSet,Zb=function(){const e=w(this,rn).subarray(4,6),t=w(this,rn).subarray(16,18),[r,s,i,a]=w(this,La);return[(w(this,ym)+(e[0]-t[0])/2-r)/i,(w(this,xm)+(e[1]-t[1])/2-s)/a,(w(this,ym)+(t[0]-e[0])/2-r)/i,(w(this,xm)+(t[1]-e[1])/2-s)/a]},yle=function(){const[e,t,r,s]=w(this,La),[i,a,o,l]=W(this,bs,Zb).call(this);return`M${(w(this,rn)[2]-e)/r} ${(w(this,rn)[3]-t)/s} L${(w(this,rn)[4]-e)/r} ${(w(this,rn)[5]-t)/s} L${i} ${a} L${o} ${l} L${(w(this,rn)[16]-e)/r} ${(w(this,rn)[17]-t)/s} L${(w(this,rn)[14]-e)/r} ${(w(this,rn)[15]-t)/s} Z`},xle=function(e){const t=w(this,Cl);e.push(`L${t[4]} ${t[5]} Z`)},ble=function(e){const[t,r,s,i]=w(this,La),a=w(this,rn).subarray(4,6),o=w(this,rn).subarray(16,18),[l,u,d,h]=W(this,bs,Zb).call(this);e.push(`L${(a[0]-t)/s} ${(a[1]-r)/i} L${l} ${u} L${d} ${h} L${(o[0]-t)/s} ${(o[1]-r)/i}`)},wle=function(e){const t=w(this,rn),[r,s,i,a]=w(this,La),[o,l,u,d]=W(this,bs,Zb).call(this),h=new Float64Array(36);return h.set([NaN,NaN,NaN,NaN,(t[2]-r)/i,(t[3]-s)/a,NaN,NaN,NaN,NaN,(t[4]-r)/i,(t[5]-s)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(t[16]-r)/i,(t[17]-s)/a,NaN,NaN,NaN,NaN,(t[14]-r)/i,(t[15]-s)/a],0),this.newFreeDrawOutline(h,e,w(this,La),w(this,fx),w(this,dx),w(this,hx))},_le=function(e,t){const r=w(this,Cl);return e.set([NaN,NaN,NaN,NaN,r[4],r[5]],t),t+=6},Sle=function(e,t){const r=w(this,rn).subarray(4,6),s=w(this,rn).subarray(16,18),[i,a,o,l]=w(this,La),[u,d,h,f]=W(this,bs,Zb).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,(s[0]-i)/o,(s[1]-a)/l],t),t+=24},G(pu,rS,8),G(pu,IN,2),G(pu,LN,w(pu,rS)+w(pu,IN));let yN=pu;var mx,bm,Du,sS,Fa,iS,Lr,ba,Jb,Qb,kle;class Ele extends vle{constructor(t,r,s,i,a,o){super();G(this,ba);G(this,mx);G(this,bm,null);G(this,Du);G(this,sS);G(this,Fa);G(this,iS);G(this,Lr);F(this,Lr,t),F(this,Fa,r),F(this,mx,s),F(this,iS,i),F(this,Du,a),F(this,sS,o),W(this,ba,kle).call(this,o);const{x:l,y:u,width:d,height:h}=w(this,bm);for(let f=0,p=t.length;f<p;f+=2)t[f]=(t[f]-l)/d,t[f+1]=(t[f+1]-u)/h;for(let f=0,p=r.length;f<p;f+=2)r[f]=(r[f]-l)/d,r[f+1]=(r[f+1]-u)/h}toSVGPath(){const t=[`M${w(this,Lr)[4]} ${w(this,Lr)[5]}`];for(let r=6,s=w(this,Lr).length;r<s;r+=6){if(isNaN(w(this,Lr)[r])){t.push(`L${w(this,Lr)[r+4]} ${w(this,Lr)[r+5]}`);continue}t.push(`C${w(this,Lr)[r]} ${w(this,Lr)[r+1]} ${w(this,Lr)[r+2]} ${w(this,Lr)[r+3]} ${w(this,Lr)[r+4]} ${w(this,Lr)[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,s,i],a){const o=s-t,l=i-r;let u,d;switch(a){case 0:u=W(this,ba,Jb).call(this,w(this,Lr),t,i,o,-l),d=W(this,ba,Jb).call(this,w(this,Fa),t,i,o,-l);break;case 90:u=W(this,ba,Qb).call(this,w(this,Lr),t,r,o,l),d=W(this,ba,Qb).call(this,w(this,Fa),t,r,o,l);break;case 180:u=W(this,ba,Jb).call(this,w(this,Lr),s,r,-o,l),d=W(this,ba,Jb).call(this,w(this,Fa),s,r,-o,l);break;case 270:u=W(this,ba,Qb).call(this,w(this,Lr),s,i,-o,-l),d=W(this,ba,Qb).call(this,w(this,Fa),s,i,-o,-l);break}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return w(this,bm)}newOutliner(t,r,s,i,a,o=0){return new yN(t,r,s,i,a,o)}getNewOutline(t,r){const{x:s,y:i,width:a,height:o}=w(this,bm),[l,u,d,h]=w(this,mx),f=a*d,p=o*h,m=s*d+l,g=i*h+u,y=this.newOutliner({x:w(this,Fa)[0]*f+m,y:w(this,Fa)[1]*p+g},w(this,mx),w(this,iS),t,w(this,sS),r??w(this,Du));for(let v=2;v<w(this,Fa).length;v+=2)y.add({x:w(this,Fa)[v]*f+m,y:w(this,Fa)[v+1]*p+g});return y.getOutlines()}get mustRemoveSelfIntersections(){return!0}}mx=new WeakMap,bm=new WeakMap,Du=new WeakMap,sS=new WeakMap,Fa=new WeakMap,iS=new WeakMap,Lr=new WeakMap,ba=new WeakSet,Jb=function(t,r,s,i,a){const o=new Float64Array(t.length);for(let l=0,u=t.length;l<u;l+=2)o[l]=r+t[l]*i,o[l+1]=s+t[l+1]*a;return o},Qb=function(t,r,s,i,a){const o=new Float64Array(t.length);for(let l=0,u=t.length;l<u;l+=2)o[l]=r+t[l+1]*i,o[l+1]=s+t[l]*a;return o},kle=function(t){const r=w(this,Lr);let s=r[4],i=r[5],a=s,o=i,l=s,u=i,d=s,h=i;const f=t?Math.max:Math.min;for(let v=6,x=r.length;v<x;v+=6){if(isNaN(r[v]))a=Math.min(a,r[v+4]),o=Math.min(o,r[v+5]),l=Math.max(l,r[v+4]),u=Math.max(u,r[v+5]),h<r[v+5]?(d=r[v+4],h=r[v+5]):h===r[v+5]&&(d=f(d,r[v+4]));else{const b=_t.bezierBoundingBox(s,i,...r.slice(v,v+6));a=Math.min(a,b[0]),o=Math.min(o,b[1]),l=Math.max(l,b[2]),u=Math.max(u,b[3]),h<b[3]?(d=b[2],h=b[3]):h===b[3]&&(d=f(d,b[2]))}s=r[v+4],i=r[v+5]}const p=a-w(this,Du),m=o-w(this,Du),g=l-a+2*w(this,Du),y=u-o+2*w(this,Du);F(this,bm,{x:p,y:m,width:g,height:y,lastPoint:[d,h]})};var aS,jh,Al,Xi,Cle,zC,Ale,Nle,$L;class dq{constructor(e,t=0,r=0,s=!0){G(this,Xi);G(this,aS);G(this,jh,[]);G(this,Al,[]);let i=1/0,a=-1/0,o=1/0,l=-1/0;const d=10**-4;for(const{x:v,y:x,width:b,height:E}
1017of e){const S=Math.floor((v-t)/d)*d,k=Math.ceil((v+b+t)/d)*d,C=Math.floor((x-t)/d)*d,A=Math.ceil((x+E+t)/d)*d,T=[S,C,A,!0],j=[k,C,A,!1];w(this,jh).push(T,j),i=Math.min(i,S),a=Math.max(a,k),o=Math.min(o,C),l=Math.max(l,A)}const h=a-i+2*r,f=l-o+2*r,p=i-r,m=o-r,g=w(this,jh).at(s?-1:-2),y=[g[0],g[2]];for(const v of w(this,jh)){const[x,b,E]=v;v[0]=(x-p)/h,v[1]=(b-m)/f,v[2]=(E-m)/f}F(this,aS,{x:p,y:m,width:h,height:f,lastPoint:y})}getOutlines(){w(this,jh).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of w(this,jh))t[3]?(e.push(...W(this,Xi,$L).call(this,t)),W(this,Xi,Ale).call(this,t)):(W(this,Xi,Nle).call(this,t),e.push(...W(this,Xi,$L).call(this,t)));return W(this,Xi,Cle).call(this,e)}}aS=new WeakMap,jh=new WeakMap,Al=new WeakMap,Xi=new WeakSet,Cle=function(e){const t=[],r=new Set;for(const a of e){const[o,l,u]=a;t.push([o,l,a],[o,u,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],u=t[a+1][2];l.push(u),u.push(l),r.add(l),r.add(u)}const s=[];let i;for(;r.size>0;){const a=r.values().next().value;let[o,l,u,d,h]=a;r.delete(a);let f=o,p=l;for(i=[o,u],s.push(i);;){let m;if(r.has(d))m=d;else if(r.has(h))m=h;else break;r.delete(m),[o,l,u,d,h]=m,f!==o&&(i.push(f,p,o,p===l?l:u),f=o),p=p===l?u:l}i.push(f,p)}return new PHe(s,w(this,aS))},zC=function(e){const t=w(this,Al);let r=0,s=t.length-1;for(;r<=s;){const i=r+s>>1,a=t[i][0];if(a===e)return i;a<e?r=i+1:s=i-1}return s+1},Ale=function([,e,t]){const r=W(this,Xi,zC).call(this,e);w(this,Al).splice(r,0,[e,t])},Nle=function([,e,t]){const r=W(this,Xi,zC).call(this,e);for(let s=r;s<w(this,Al).length;s++){const[i,a]=w(this,Al)[s];if(i!==e)break;if(i===e&&a===t){w(this,Al).splice(s,1);return}}for(let s=r-1;s>=0;s--){const[i,a]=w(this,Al)[s];if(i!==e)break;if(i===e&&a===t){w(this,Al).splice(s,1);return}}},$L=function(e){const[t,r,s]=e,i=[[t,r,s]],a=W(this,Xi,zC).call(this,s);for(let o=0;o<a;o++){const[l,u]=w(this,Al)[o];for(let d=0,h=i.length;d<h;d++){const[,f,p]=i[d];if(!(u<=f||p<=l)){if(f>=l){if(p>u)i[d][1]=u;else{if(h===1)return[];i.splice(d,1),d--,h--}continue}i[d][2]=l,p>u&&i.push([t,u,p])}}}return i};var oS,gx;class PHe extends vle{constructor(t,r){super();G(this,oS);G(this,gx);F(this,gx,t),F(this,oS,r)}toSVGPath(){const t=[];for(const r of w(this,gx)){let[s,i]=r;t.push(`M${s} ${i}`);for(let a=2;a<r.length;a+=2){const o=r[a],l=r[a+1];o===s?(t.push(`V${l}`),i=l):l===i&&(t.push(`H${o}`),s=o)}t.push("Z")}return t.join(" ")}serialize([t,r,s,i],a){const o=[],l=s-t,u=i-r;for(const d of w(this,gx)){const h=new Array(d.length);for(let f=0;f<d.length;f+=2)h[f]=t+d[f]*l,h[f+1]=i-d[f+1]*u;o.push(h)}return o}get box(){return w(this,oS)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}oS=new WeakMap,gx=new WeakMap;class UL extends yN{newFreeDrawOutline(e,t,r,s,i,a){return new DHe(e,t,r,s,i,a)}get classNamesForDrawing(){return["highlight","free"]}}class DHe extends Ele{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(e,t,r,s,i,a=0){return new UL(e,t,r,s,i,a)}}var Nl,wm,vx,hs,lS,yx,cS,uS,Rh,Tl,xx,dS,Bn,VL,HL,WL,ip,Tle,zd;const aa=class aa{constructor({editor:e=null,uiManager:t=null}){G(this,Bn);G(this,Nl,null);G(this,wm,null);G(this,vx);G(this,hs,null);G(this,lS,!1);G(this,yx,!1);G(this,cS,null);G(this,uS);G(this,Rh,null);G(this,Tl,null);G(this,xx);var r;e?(F(this,yx,!1),F(this,xx,Bt.HIGHLIGHT_COLOR),F(this,cS,e)):(F(this,yx,!0),F(this,xx,Bt.HIGHLIGHT_DEFAULT_COLOR)),F(this,Tl,(e==null?void 0:e._uiManager)||t),F(this,uS,w(this,Tl)._eventBus),F(this,vx,(e==null?void 0:e.color)||((r=w(this,Tl))==null?void 0:r.highlightColors.values().next().value)||"#FFFF98"),w(aa,dS)||F(aa,dS,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 mn(this,"_keyboardManager",new _E([[["Escape","mac+Escape"],aa.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],aa.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],aa.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],aa.prototype._moveToPrevious],[["Home","mac+Home"],aa.prototype._moveToBeginning],[["End","mac+End"],aa.prototype._moveToEnd]]))}renderButton(){const e=F(this,Nl,document.createElement("button"));
1017e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=w(this,Tl)._signal;e.addEventListener("click",W(this,Bn,ip).bind(this),{signal:t}),e.addEventListener("keydown",W(this,Bn,WL).bind(this),{signal:t});const r=F(this,wm,document.createElement("span"));return r.className="swatch",r.setAttribute("aria-hidden",!0),r.style.backgroundColor=w(this,vx),e.append(r),e}renderMainDropdown(){const e=F(this,hs,W(this,Bn,VL).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===w(this,Nl)){W(this,Bn,ip).call(this,e);return}const t=e.target.getAttribute("data-color");t&&W(this,Bn,HL).call(this,t,e)}_moveToNext(e){var t,r;if(!w(this,Bn,zd)){W(this,Bn,ip).call(this,e);return}if(e.target===w(this,Nl)){(t=w(this,hs).firstChild)==null||t.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var t,r;if(e.target===((t=w(this,hs))==null?void 0:t.firstChild)||e.target===w(this,Nl)){w(this,Bn,zd)&&this._hideDropdownFromKeyboard();return}w(this,Bn,zd)||W(this,Bn,ip).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var t;if(!w(this,Bn,zd)){W(this,Bn,ip).call(this,e);return}(t=w(this,hs).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!w(this,Bn,zd)){W(this,Bn,ip).call(this,e);return}(t=w(this,hs).lastChild)==null||t.focus()}hideDropdown(){var e,t;(e=w(this,hs))==null||e.classList.add("hidden"),(t=w(this,Rh))==null||t.abort(),F(this,Rh,null)}_hideDropdownFromKeyboard(){var e;if(!w(this,yx)){if(!w(this,Bn,zd)){(e=w(this,cS))==null||e.unselect();return}this.hideDropdown(),w(this,Nl).focus({preventScroll:!0,focusVisible:w(this,lS)})}}updateColor(e){if(w(this,wm)&&(w(this,wm).style.backgroundColor=e),!w(this,hs))return;const t=w(this,Tl).highlightColors.values();for(const r of w(this,hs).children)r.setAttribute("aria-selected",t.next().value===e)}destroy(){var e,t;(e=w(this,Nl))==null||e.remove(),F(this,Nl,null),F(this,wm,null),(t=w(this,hs))==null||t.remove(),F(this,hs,null)}};Nl=new WeakMap,wm=new WeakMap,vx=new WeakMap,hs=new WeakMap,lS=new WeakMap,yx=new WeakMap,cS=new WeakMap,uS=new WeakMap,Rh=new WeakMap,Tl=new WeakMap,xx=new WeakMap,dS=new WeakMap,Bn=new WeakSet,VL=function(){const e=document.createElement("div"),t=w(this,Tl)._signal;e.addEventListener("contextmenu",qo,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[r,s]of w(this,Tl).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",s),i.title=r,i.setAttribute("data-l10n-id",w(aa,dS)[r]);const a=document.createElement("span");i.append(a),a.className="swatch",a.style.backgroundColor=s,i.setAttribute("aria-selected",s===w(this,vx)),i.addEventListener("click",W(this,Bn,HL).bind(this,s),{signal:t}),e.append(i)}return e.addEventListener("keydown",W(this,Bn,WL).bind(this),{signal:t}),e},HL=function(e,t){t.stopPropagation(),w(this,uS).dispatch("switchannotationeditorparams",{source:this,type:w(this,xx),value:e})},WL=function(e){aa._keyboardManager.exec(this,e)},ip=function(e){if(w(this,Bn,zd)){this.hideDropdown();return}if(F(this,lS,e.detail===0),w(this,Rh)||(F(this,Rh,new AbortController),window.addEventListener("pointerdown",W(this,Bn,Tle).bind(this),{signal:w(this,Tl).combinedSignal(w(this,Rh))})),w(this,hs)){w(this,hs).classList.remove("hidden");return}const t=F(this,hs,W(this,Bn,VL).call(this));w(this,Nl).append(t)},Tle=function(e){var t;(t=w(this,hs))!=null&&t.contains(e.target)||this.hideDropdown()},zd=function(){return w(this,hs)&&!w(this,hs).classList.contains("hidden")},G(aa,dS,null);let xN=aa;var bx,hS,Ou,_m,wx,bo,fS,pS,Sm,jl,mi,da,_x,Mu,fs,Sx,wo,mS,Gt,qL,$C,jle,Rle,Ple,GL,ap,jo,kv,Dle,UC,ew,Ole,Mle,Ile,Lle,Fle;const Sn=class Sn extends Mn{constructor(t){super({...t,name:"highlightEditor"});G(this,Gt);G(this,bx,null);G(this,hS,0);G(this,Ou);G(this,_m,null);G(this,wx,null);G(this,bo,null);G(this,fS,null);G(this,pS,0);G(this,Sm,null);G(this,jl,null);G(this,mi,null);G(this,da,!1);G(this,_x,null);G(this,Mu);G(this,fs,null);G(this,Sx,"");G(this,wo);G(this,mS,"");this.color=t.color||Sn._defaultColor,F(this,wo,t.thickness||Sn._defaultThickness),F(this,Mu,t.opacity||Sn._defaultOpacity),F(this,Ou,t.boxes||null),F(this,mS,t.methodOfCreation||""),F(this,Sx,t.text||""),this._isDraggable=!1,t.highlightId>
1017-1?(F(this,da,!0),W(this,Gt,$C).call(this,t),W(this,Gt,ap).call(this)):w(this,Ou)&&(F(this,bx,t.anchorNode),F(this,hS,t.anchorOffset),F(this,fS,t.focusNode),F(this,pS,t.focusOffset),W(this,Gt,qL).call(this),W(this,Gt,ap).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const t=Sn.prototype;return mn(this,"_keyboardManager",new _E([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:w(this,da)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:w(this,wo),methodOfCreation:w(this,mS)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var s;Mn.initialize(t,r),Sn._defaultColor||(Sn._defaultColor=((s=r.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case Bt.HIGHLIGHT_DEFAULT_COLOR:Sn._defaultColor=r;break;case Bt.HIGHLIGHT_THICKNESS:Sn._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return w(this,_x)}updateParams(t,r){switch(t){case Bt.HIGHLIGHT_COLOR:W(this,Gt,jle).call(this,r);break;case Bt.HIGHLIGHT_THICKNESS:W(this,Gt,Rle).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[Bt.HIGHLIGHT_DEFAULT_COLOR,Sn._defaultColor],[Bt.HIGHLIGHT_THICKNESS,Sn._defaultThickness]]}get propertiesToUpdate(){return[[Bt.HIGHLIGHT_COLOR,this.color||Sn._defaultColor],[Bt.HIGHLIGHT_THICKNESS,w(this,wo)||Sn._defaultThickness],[Bt.HIGHLIGHT_FREE,w(this,da)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(F(this,wx,new xN({editor:this})),t.addColorPicker(w(this,wx))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(W(this,Gt,ew).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,W(this,Gt,ew).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){W(this,Gt,GL).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(W(this,Gt,ap).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var s;let r=!1;this.parent&&!t?W(this,Gt,GL).call(this):t&&(W(this,Gt,ap).call(this,t),r=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var i,a,o;const{drawLayer:r}=this.parent;let s;w(this,da)?(t=(t-this.rotation+360)%360,s=W(i=Sn,jo,kv).call(i,w(this,jl).box,t)):s=W(a=Sn,jo,kv).call(a,this,t),r.rotate(w(this,mi),t),r.rotate(w(this,fs),t),r.updateBox(w(this,mi),s),r.updateBox(w(this,fs),W(o=Sn,jo,kv).call(o,w(this,bo).box,t))}render(){if(this.div)return this.div;const t=super.render();w(this,Sx)&&(t.setAttribute("aria-label",w(this,Sx)),t.setAttribute("role","mark")),w(this,da)?t.classList.add("free"):this.div.addEventListener("keydown",W(this,Gt,Dle).bind(this),{signal:this._uiManager._signal});const r=F(this,Sm,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=w(this,_m);const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),gN(this,w(this,Sm),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(w(this,fs),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(w(this,fs),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:W(this,Gt,UC).call(this,!0);break;case 1:case 3:W(this,Gt,UC).call(this,!1);break}}select(){var t,r;super.select(),w(this,fs)&&((t=this.parent)==null||t.drawLayer.removeClass(w(this,fs),"hovered"),(r=this.parent)==null||r.drawLayer.addClass(w(this,fs),"selected"))}unselect(){var t;super.unselect(),w(this,fs)&&((t=this.parent)==null||t.drawLayer.removeClass(w(this,fs),"selected"),w(this,da)||W(this,Gt,UC).call(this,!1))}get _mustFixPosition(){return!w(this,da)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(w(this,mi),t),this.parent.drawLayer.show(w(this,fs),t))}static startHighlighting(t,r,{target:s,x:i,y:a}){const{x:o,y:l,width:u,height:d}=s.getBoundingClientRect(),h=new AbortController,f=t.combinedSignal(h),p=g=>{g.preventDefault(),g.stopPropagation()},m=g=>{h.abort(),W(this,jo,Lle).call(this,t,g)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",p,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",qo,{signal:f}),s.addEventListener("pointermove",W(this,jo,Ile).bind(this,t),{signal:f}),this._freeHighlight=new UL({x:i,y:a},[o,l,u,d],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(t,r,s){var g,y,v,x;let i=null;if(t instanceof cle){const{data:{quadPoints:b,rect:E,rotation:S,id:k,color:C,opacity:A,popupRef:T},parent:{page:{pageNumber:j}}}=t;i=t={annotationType:Yt.HIGHLIGHT,color:Array.from(C),opacity:A,quadPoints:b,boxes:null,pageIndex:j-1,rect:E.slice(0),rotation:S,id:k,deleted:!1,popupRef:T}}else if(t instanceof az){const{data:{inkLists:b,rect:E,rotation:S,id:k,color:C,borderStyle:{rawWidth:A},popupRef:T},parent:{page:{pageNumber:j}}}=t;i=t={annotationType:Yt.HIGHLIGHT,color:Array.from(C),thickness:A,inkLists:b,boxes:null,pageIndex:j-1,rect:E.slice(0),rotation:S,id:k,deleted:!1,popupRef:T}}const{color:a,quadPoints:o,inkLists:l,opacity:u}=t,d=await super.deserialize(t,r,s);d.color=_t.makeHexColor(...a),F(d,Mu,u||1),l&&F(d,wo,t.thickness),d.annotationElementId=t.id||null,d._initialData=i;const[h,f]=d.pageDimensions,[p,m]=d.pageTranslation;if(o){const b=F(d,Ou,[]);for(let E=0;E<o.length;E+=8)b.push({x:(o[E]-p)/h,y:1-(o[E+1]-m)/f,width:(o[E+2]-o[E])/h,height:(o[E+1]-o[E+5])/f});
1017W(g=d,Gt,qL).call(g),W(y=d,Gt,ap).call(y),d.rotate(d.rotation)}else if(l){F(d,da,!0);const b=l[0],E={x:b[0]-p,y:f-(b[1]-m)},S=new UL(E,[0,0,h,f],1,w(d,wo)/2,!0,.001);for(let A=0,T=b.length;A<T;A+=2)E.x=b[A]-p,E.y=f-(b[A+1]-m),S.add(E);const{id:k,clipPathId:C}=r.drawLayer.draw(S,d.color,d._defaultOpacity,!0);W(v=d,Gt,$C).call(v,{highlightOutlines:S.getOutlines(),highlightId:k,clipPathId:C}),W(x=d,Gt,ap).call(x)}return d}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const r=this.getRect(0,0),s=Mn._colorManager.convert(this.color),i={annotationType:Yt.HIGHLIGHT,color:s,opacity:w(this,Mu),thickness:w(this,wo),quadPoints:W(this,Gt,Ole).call(this),outlines:W(this,Gt,Mle).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:W(this,Gt,ew).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!W(this,Gt,Fle).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};bx=new WeakMap,hS=new WeakMap,Ou=new WeakMap,_m=new WeakMap,wx=new WeakMap,bo=new WeakMap,fS=new WeakMap,pS=new WeakMap,Sm=new WeakMap,jl=new WeakMap,mi=new WeakMap,da=new WeakMap,_x=new WeakMap,Mu=new WeakMap,fs=new WeakMap,Sx=new WeakMap,wo=new WeakMap,mS=new WeakMap,Gt=new WeakSet,qL=function(){const t=new dq(w(this,Ou),.001);F(this,jl,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=w(this,jl).box;const r=new dq(w(this,Ou),.0025,.001,this._uiManager.direction==="ltr");F(this,bo,r.getOutlines());const{lastPoint:s}=w(this,bo).box;F(this,_x,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},$C=function({highlightOutlines:t,highlightId:r,clipPathId:s}){var h,f;if(F(this,jl,t),F(this,bo,t.getNewOutline(w(this,wo)/2+1.5,.0025)),r>=0)F(this,mi,r),F(this,_m,s),this.parent.drawLayer.finalizeLine(r,t),F(this,fs,this.parent.drawLayer.drawOutline(w(this,bo)));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(w(this,mi),t),this.parent.drawLayer.updateBox(w(this,mi),W(h=Sn,jo,kv).call(h,w(this,jl).box,(p-this.rotation+360)%360)),this.parent.drawLayer.updateLine(w(this,fs),w(this,bo)),this.parent.drawLayer.updateBox(w(this,fs),W(f=Sn,jo,kv).call(f,w(this,bo).box,p))}const{x:a,y:o,width:l,height:u}=t.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=u;break;case 90:{const[p,m]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*m/p,this.height=u*p/m;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=u;break;case 270:{const[p,m]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*m/p,this.height=u*p/m;break}}const{lastPoint:d}=w(this,bo).box;F(this,_x,[(d[0]-a)/l,(d[1]-o)/u])},jle=function(t){const r=(a,o)=>{var l,u,d;this.color=a,(l=this.parent)==null||l.drawLayer.changeColor(w(this,mi),a),(u=w(this,wx))==null||u.updateColor(a),F(this,Mu,o),(d=this.parent)==null||d.drawLayer.changeOpacity(w(this,mi),o)},s=this.color,i=w(this,Mu);this.addCommands({cmd:r.bind(this,t,Sn._defaultOpacity),undo:r.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},Rle=function(t){const r=w(this,wo),s=i=>{F(this,wo,i),W(this,Gt,Ple).call(this,i)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Ple=function(t){if(!w(this,da))return;W(this,Gt,$C).call(this,{highlightOutlines:w(this,jl).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,s]=this.parentDimensions;this.setDims(this.width*r,this.height*s)},GL=function(){w(this,mi)===null||!this.parent||(this.parent.drawLayer.remove(w(this,mi)),F(this,mi,null),this.parent.drawLayer.remove(w(this,fs)),F(this,fs,null))},ap=function(t=this.parent){w(this,mi)===null&&({id:Ss(this,mi)._,clipPathId:Ss(this,_m)._}=t.drawLayer.draw(w(this,jl),this.color,w(this,Mu)),F(this,fs,t.drawLayer.drawOutline(w(this,bo))),w(this,Sm)&&(w(this,Sm).style.clipPath=w(this,_m)))},jo=new WeakSet,kv=function({x:t,y:r,width:s,height:i},a){switch(a){case 90:return{x:1-r-i,y:t,width:i,height:s};case 180:return{x:1-t-s,y:1-r-i,width:s,height:i};case 270:return{x:r,y:1-t-s,width:i,height:s}}return{x:t,y:r,width:s,height:i}},Dle=function(t){Sn._keyboardManager.exec(this,t)},UC=function(t){if(!w(this,bx))return;const r=window.getSelection();t?r.setPosition(w(this,bx),w(this,hS)):r.setPosition(w(this,fS),w(this,pS))},ew=function(){return w(this,da)?this.rotation:0},Ole=function(){if(w(this,da))return null;const[t,r]=this.pageDimensions,[s,i]=this.pageTranslation,a=w(this,Ou),o=new Float32Array(a.length*8);let l=0;for(const{x:u,y:d,width:h,height:f}of a){const p=u*t+s,m=(1-d-f)*r+i;o[l]=o[l+4]=p,o[l+1]=o[l+3]=m,o[l+2]=o[l+6]=p+h*t,o[l+5]=o[l+7]=m+f*r,l+=8}return o},Mle=function(t){return w(this,jl).serialize(t,W(this,Gt,ew).call(this))},Ile=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Lle=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Fle=function(t){const{color:r}=this._initialData;return t.color.some((s,i)=>s!==r[i])},G(Sn,jo),Nt(Sn,"_defaultColor",null),Nt(Sn,"_defaultOpacity",1),Nt(Sn,"_defaultThickness",12),Nt(Sn,"_type","highlight"),Nt(Sn,"_editorType",Yt.HIGHLIGHT),Nt(Sn,"_freeHighlightId",-1),Nt(Sn,"_freeHighlight",null),Nt(Sn,"_freeHighlightClipId","");let bN=Sn;var Em,km,Cc,Iu,_o,Cm,Am,Nm,Lu,Ex,Tm,jm,Ph,tt,Ble,zle,$le,Ule,YL,Vle,XL,Hle,Wle,qle,Gle,Kle,op,ZL,JL,QL,VC,HC,Cv,e4,WC,wd,Yle,t4,Xle,Zle,n4,qC,tw;const ir=class ir extends Mn{constructor(t){super({...t,name:"inkEditor"});G(this,tt);G(this,Em,0);G(this,km,0);G(this,Cc,null);G(this,Iu,new Path2D);G(this,_o,!1);G(this,Cm,null);G(this,Am,!1);G(this,Nm,!1);G(this,Lu,null);G(this,Ex,null);G(this,Tm,0);G(this,jm,0);G(this,Ph,null);this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,r){Mn.initialize(t,r)}static updateDefaultParams(t,r){switch(t){case Bt.INK_THICKNESS:ir._defaultThickness=r;break;case Bt.INK_COLOR:ir._defaultColor=r;break;case Bt.INK_OPACITY:ir._defaultOpacity=r/100;break}}updateParams(t,r){switch(t){case Bt.INK_THICKNESS:W(this,tt,Ble).call(this,r);break;case Bt.INK_COLOR:W(this,tt,zle).call(this,r);break;case Bt.INK_OPACITY:W(this,tt,$le).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[Bt.INK_THICKNESS,ir._defaultThickness],[Bt.INK_COLOR,ir._defaultColor||Mn._defaultLineColor],[Bt.INK_OPACITY,Math.round(ir._defaultOpacity*100)]]}get propertiesToUpdate(){return[[Bt.INK_THICKNESS,this.thickness||ir._defaultThickness],[Bt.INK_COLOR,this.color||ir._defaultColor||Mn._defaultLineColor],[Bt.INK_OPACITY,Math.round(100*(this.opacity??ir._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(W(this,tt,VC).call(this),W(this,tt,HC).call(this)),this.isAttachedToDOM||(this.parent.add(this),W(this,tt,Cv).call(this)),W(this,tt,tw).c
1017all(this)))}remove(){var t;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,w(this,Cc)&&(clearTimeout(w(this,Cc)),F(this,Cc,null)),(t=w(this,Lu))==null||t.disconnect(),F(this,Lu,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,r]=this.parentDimensions,s=this.width*t,i=this.height*r;this.setDimensions(s,i)}enableEditMode(){w(this,_o)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,W(this,tt,ZL).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),W(this,tt,JL).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){w(this,_o)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),F(this,_o,!0),this.div.classList.add("disabled"),W(this,tt,tw).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button!==0||!this.isInEditMode()||w(this,_o)||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),W(this,tt,Vle).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),W(this,tt,XL).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),W(this,tt,QL).call(this,t)}canvasPointerleave(t){W(this,tt,QL).call(this,t)}get isResizable(){return!this.isEmpty()&&w(this,_o)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,a,o]=W(this,tt,Ule).call(this);if(this.setAt(s,i,0,0),this.setDims(a,o),W(this,tt,VC).call(this),this.width){const[l,u]=this.parentDimensions;this.setAspectRatio(this.width*l,this.height*u),this.setAt(t*l,r*u,this.width*l,this.height*u),F(this,Nm,!0),W(this,tt,Cv).call(this),this.setDims(this.width*l,this.height*u),W(this,tt,op).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return W(this,tt,HC).call(this),this.div}setDimensions(t,r){const s=Math.round(t),i=Math.round(r);if(w(this,Tm)===s&&w(this,jm)===i)return;F(this,Tm,s),F(this,jm,i),this.canvas.style.visibility="hidden";const[a,o]=this.parentDimensions;this.width=t/a,this.height=r/o,this.fixAndSetPosition(),w(this,_o)&&W(this,tt,e4).call(this,t,r),W(this,tt,Cv).call(this),W(this,tt,op).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(t,r,s){var y,v,x;if(t instanceof az)return null;const i=await super.deserialize(t,r,s);i.thickness=t.thickness,i.color=_t.makeHexColor(...t.color),i.opacity=t.opacity;const[a,o]=i.pageDimensions,l=i.width*a,u=i.height*o,d=i.parentScale,h=t.thickness/2;F(i,_o,!0),F(i,Tm,Math.round(l)),F(i,jm,Math.round(u));const{paths:f,rect:p,rotation:m}=t;for(let{bezier:b}of f){b=W(y=ir,wd,Xle).call(y,b,p,m);const E=[];i.paths.push(E);let S=d*(b[0]-h),k=d*(b[1]-h);for(let A=2,T=b.length;A<T;A+=6){const j=d*(b[A]-h),D=d*(b[A+1]-h),R=d*(b[A+2]-h),M=d*(b[A+3]-h),N=d*(b[A+4]-h),U=d*(b[A+5]-h);E.push([[S,k],[j,D],[R,M],[N,U]]),S=N,k=U}const C=W(this,wd,Yle).call(this,E);i.bezierPath2D.push(C)}const g=W(v=i,tt,n4).call(v);return F(i,km,Math.max(Mn.MIN_SIZE,g[2]-g[0])),F(i,Em,Math.max(Mn.MIN_SIZE,g[3]-g[1])),W(x=i,tt,e4).call(x,l,u),i}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),r=Mn._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Yt.INK,color:r,thickness:this.thickness,opacity:this.opacity,paths:W(this,tt,Zle).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Em=new WeakMap,km=new WeakMap,Cc=new WeakMap,Iu=new WeakMap,_o=new WeakMap,Cm=new WeakMap,Am=new WeakMap,Nm=new WeakMap,Lu=new WeakMap,Ex=new WeakMap,Tm=new WeakMap,jm=new WeakMap,Ph=new WeakMap,tt=new WeakSet,Ble=function(t){const r=i=>
1017{this.thickness=i,W(this,tt,tw).call(this)},s=this.thickness;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},zle=function(t){const r=i=>{this.color=i,W(this,tt,op).call(this)},s=this.color;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},$le=function(t){const r=i=>{this.opacity=i,W(this,tt,op).call(this)};t/=100;const s=this.opacity;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Bt.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Ule=function(){const{parentRotation:t,parentDimensions:[r,s]}=this;switch(t){case 90:return[0,s,s,r];case 180:return[r,s,r,s];case 270:return[r,0,s,r];default:return[0,0,r,s]}},YL=function(){const{ctx:t,color:r,opacity:s,thickness:i,parentScale:a,scaleFactor:o}=this;t.lineWidth=i*a/o,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${r}${tVe(s)}`},Vle=function(t,r){this.canvas.addEventListener("contextmenu",qo,{signal:this._uiManager._signal}),W(this,tt,JL).call(this),F(this,Cm,new AbortController);const s=this._uiManager.combinedSignal(w(this,Cm));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:s}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:s}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:s}),this.isEditing=!0,w(this,Nm)||(F(this,Nm,!0),W(this,tt,Cv).call(this),this.thickness||(this.thickness=ir._defaultThickness),this.color||(this.color=ir._defaultColor||Mn._defaultLineColor),this.opacity??(this.opacity=ir._defaultOpacity)),this.currentPath.push([t,r]),F(this,Am,!1),W(this,tt,YL).call(this),F(this,Ph,()=>{W(this,tt,qle).call(this),w(this,Ph)&&window.requestAnimationFrame(w(this,Ph))}),window.requestAnimationFrame(w(this,Ph))},XL=function(t,r){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===s&&r===i)return;const a=this.currentPath;let o=w(this,Iu);if(a.push([t,r]),F(this,Am,!0),a.length<=2){o.moveTo(...a[0]),o.lineTo(t,r);return}a.length===3&&(F(this,Iu,o=new Path2D),o.moveTo(...a[0])),W(this,tt,Gle).call(this,o,...a.at(-3),...a.at(-2),t,r)},Hle=function(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);w(this,Iu).lineTo(...t)},Wle=function(t,r){F(this,Ph,null),t=Math.min(Math.max(t,0),this.canvas.width),r=Math.min(Math.max(r,0),this.canvas.height),W(this,tt,XL).call(this,t,r),W(this,tt,Hle).call(this);let s;if(this.currentPath.length!==1)s=W(this,tt,Kle).call(this);else{const u=[t,r];s=[[u,u.slice(),u.slice(),u]]}const i=w(this,Iu),a=this.currentPath;this.currentPath=[],F(this,Iu,new Path2D);const o=()=>{this.allRawPaths.push(a),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},l=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(W(this,tt,VC).call(this),W(this,tt,HC).call(this)),W(this,tt,tw).call(this))};this.addCommands({cmd:o,undo:l,mustExec:!0})},qle=function(){if(!w(this,Am))return;F(this,Am,!1);const t=Math.ceil(this.thickness*this.parentScale),r=this.currentPath.slice(-3),s=r.map(o=>o[0]),i=r.map(o=>o[1]);Math.min(...s)-t,Math.max(...s)+t,Math.min(...i)-t,Math.max(...i)+t;const{ctx:a}=this;a.save(),a.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)a.stroke(o);a.stroke(w(this,Iu)),a.restore()},Gle=function(t,r,s,i,a,o,l){const u=(r+i)/2,d=(s+a)/2,h=(i+o)/2,f=(a+l)/2;t.bezierCurveTo(u+2*(i-u)/3,d+2*(a-d)/3,h+2*(i-h)/3,f+2*(a-f)/3,h,f)},Kle=function(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const r=[];let s,[i,a]=t[0];for(s=1;s<t.length-2;s++){const[p,m]=t[s],[g,y]=t[s+1],v=(p+g)/2,x=(m+y)/2,b=[i+2*(p-i)/3,a+2*(m-a)/3],E=[v+2*(p-v)/3,x+2*(m-x)/3];r.push([[i,a],b,E,[v,x]]),[i,a]=[v,x]}const[o,l]=t[s],[u,d]=t[s+1],h=[i+2*(o-i)/3,a+2*(l-a)/3],f=[u+2*(o-u)/3,d+2*(l-d)/3];return r.push([[i,a],h,f,[u,d]]),r},op=function(){if(this.isEmpty()){W(this,tt,WC).call(this);return}W(this,tt,YL).call(this);const{canvas:t,ctx:r}=this;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.width,t.height),W(this,tt,WC).call(this);for(const s of this.bezierPath2D)r.stroke(s)},ZL=function(){if(w(this,Ex))return;F(this,Ex,new AbortController);const t=this._uiManager.combinedSignal(w(this,Ex));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})},JL=function(){var t;(t=this.pointerdownAC)==null||t.abort(),this.pointerdownAC=null},QL=function(t){var r;(r=w(this,Cm))==null||r.abort(),F(this,Cm,null),W(this,tt,ZL).call(this),w(this,Cc)&&clearTimeout(w(this,Cc)),F(this,Cc,setTimeout(()=>{F(this,Cc,null),this.canvas.removeEventListener("contextmenu",qo)},10)),W(this,tt,Wle).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
1017d()},VC=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},HC=function(){F(this,Lu,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&this.setDimensions(r.width,r.height)})),w(this,Lu).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=w(this,Lu))==null||t.disconnect(),F(this,Lu,null)},{once:!0})},Cv=function(){if(!w(this,Nm))return;const[t,r]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*r),W(this,tt,WC).call(this)},e4=function(t,r){const s=W(this,tt,qC).call(this),i=(t-s)/w(this,km),a=(r-s)/w(this,Em);this.scaleFactor=Math.min(i,a)},WC=function(){const t=W(this,tt,qC).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},wd=new WeakSet,Yle=function(t){const r=new Path2D;for(let s=0,i=t.length;s<i;s++){const[a,o,l,u]=t[s];s===0&&r.moveTo(...a),r.bezierCurveTo(o[0],o[1],l[0],l[1],u[0],u[1])}return r},t4=function(t,r,s){const[i,a,o,l]=r;switch(s){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]+=i,t[u+1]=l-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=t[u+1]+i,t[u+1]=h+a}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=o-t[u],t[u+1]+=a;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=o-t[u+1],t[u+1]=l-h}break;default:throw new Error("Invalid rotation")}return t},Xle=function(t,r,s){const[i,a,o,l]=r;switch(s){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]-=i,t[u+1]=l-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=t[u+1]-a,t[u+1]=h-i}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=o-t[u],t[u+1]-=a;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const h=t[u];t[u]=l-t[u+1],t[u+1]=o-h}break;default:throw new Error("Invalid rotation")}return t},Zle=function(t,r,s,i){var d,h;const a=[],o=this.thickness/2,l=t*r+o,u=t*s+o;for(const f of this.paths){const p=[],m=[];for(let g=0,y=f.length;g<y;g++){const[v,x,b,E]=f[g];if(v[0]===E[0]&&v[1]===E[1]&&y===1){const M=t*v[0]+l,N=t*v[1]+u;p.push(M,N),m.push(M,N);break}const S=t*v[0]+l,k=t*v[1]+u,C=t*x[0]+l,A=t*x[1]+u,T=t*b[0]+l,j=t*b[1]+u,D=t*E[0]+l,R=t*E[1]+u;g===0&&(p.push(S,k),m.push(S,k)),p.push(C,A,T,j,D,R),m.push(C,A),g===y-1&&m.push(D,R)}a.push({bezier:W(d=ir,wd,t4).call(d,p,i,this.rotation),points:W(h=ir,wd,t4).call(h,m,i,this.rotation)})}return a},n4=function(){let t=1/0,r=-1/0,s=1/0,i=-1/0;for(const a of this.paths)for(const[o,l,u,d]of a){const h=_t.bezierBoundingBox(...o,...l,...u,...d);t=Math.min(t,h[0]),s=Math.min(s,h[1]),r=Math.max(r,h[2]),i=Math.max(i,h[3])}return[t,s,r,i]},qC=function(){return w(this,_o)?Math.ceil(this.thickness*this.parentScale):0},tw=function(t=!1){if(this.isEmpty())return;if(!w(this,_o)){W(this,tt,op).call(this);return}const r=W(this,tt,n4).call(this),s=W(this,tt,qC).call(this);F(this,km,Math.max(Mn.MIN_SIZE,r[2]-r[0])),F(this,Em,Math.max(Mn.MIN_SIZE,r[3]-r[1]));const i=Math.ceil(s+w(this,km)*this.scaleFactor),a=Math.ceil(s+w(this,Em)*this.scaleFactor),[o,l]=this.parentDimensions;this.width=i/o,this.height=a/l,this.setAspectRatio(i,a);const u=this.translationX,d=this.translationY;this.translationX=-r[0],this.translationY=-r[1],W(this,tt,Cv).call(this),W(this,tt,op).call(this),F(this,Tm,i),F(this,jm,a),this.setDims(i,a);const h=t?s/this.scaleFactor/2:0;this.translate(u-this.translationX-h,d-this.translationY-h)},G(ir,wd),Nt(ir,"_defaultColor",null),Nt(ir,"_defaultOpacity",1),Nt(ir,"_defaultThickness",1),Nt(ir,"_type","ink"),Nt(ir,"_editorType",Yt.INK);let KL=ir;var or,qs,Dh,Fu,Oh,kx,Ac,Bu,Nc,Ba,Cx,un,nw,rw,GC,s4,Jle,KC,i4,YC,Qle,ece;const Uw=class Uw extends Mn{constructor(t){super({...t,name:"stampEditor"});G(this,un);G(this,or,null);G(this,qs,null);G(this,Dh,null);G(this,Fu,null);G(this,Oh,null);G(this,kx,"");G(this,Ac,null);G(this,Bu,null);G(this,Nc,null);G(this,Ba,!1);G(this,Cx,!1);F(this,Fu,t.bitmapUrl),F(this,Oh,t.bitmapFile)}static initialize(t,r){Mn.initialize(t,r)}static get supportedTypes(){return mn(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(r=>`image/${r}`))}static get supportedTypesStr(){return mn(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,r){r.pasteEditor(Yt.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!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:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await s.guess({name:"altText",request:{data:i,width:a,height:o,channels:i.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const u=l.output;return await this.setGuessedAltText(u),r&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t,r;w(this,qs)&&(F(this,or,null),this._uiManager.imageManager.deleteId(w(this,qs)),(t=w(this,Ac))==null||t.remove(),F(this,Ac,null),(r=w(this,Bu))==null||r.disconnect(),F(this,Bu,null),w(this,Nc)&&(clearTimeout(w(this,Nc)),F(this,Nc,null))),super.remove()}rebuild(){if(!this.parent){w(this,qs)&&W(this,un,GC).call(this);return}super.rebuild(),this.div!==null&&(w(this,qs)&&w(this,Ac)===null&&W(this,un,GC).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(w(this,Dh)||w(this,or)||w(this,Fu)||w(this,Oh)||w(this,qs))}get isResizable(){return!0}
vendor: 4,820 bytes, line 1017
1017render(){if(this.div)return this.div;let t,r;if(this.width&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),w(this,or)?W(this,un,s4).call(this):W(this,un,GC).call(this),this.width&&!this.annotationElementId){const[s,i]=this.parentDimensions;this.setAt(t*s,r*i,this.width*s,this.height*i)}return this.div}copyCanvas(t,r,s=!1){var p;t||(t=224);const{width:i,height:a}=w(this,or),o=new QI;let l=w(this,or),u=i,d=a,h=null;if(r){if(i>r||a>r){const A=Math.min(r/i,r/a);u=Math.floor(i*A),d=Math.floor(a*A)}h=document.createElement("canvas");const m=h.width=Math.ceil(u*o.sx),g=h.height=Math.ceil(d*o.sy);w(this,Ba)||(l=W(this,un,KC).call(this,m,g));const y=h.getContext("2d");y.filter=this._uiManager.hcmFilter;let v="white",x="#cfcfd8";this._uiManager.hcmFilter!=="none"?x="black":(p=window.matchMedia)!=null&&p.call(window,"(prefers-color-scheme: dark)").matches&&(v="#8f8f9d",x="#42414d");const b=15,E=b*o.sx,S=b*o.sy,k=new OffscreenCanvas(E*2,S*2),C=k.getContext("2d");C.fillStyle=v,C.fillRect(0,0,E*2,S*2),C.fillStyle=x,C.fillRect(0,0,E,S),C.fillRect(E,S,E,S),y.fillStyle=y.createPattern(k,"repeat"),y.fillRect(0,0,m,g),y.drawImage(l,0,0,l.width,l.height,0,0,m,g)}let f=null;if(s){let m,g;if(o.symmetric&&l.width<t&&l.height<t)m=l.width,g=l.height;else if(l=w(this,or),i>t||a>t){const x=Math.min(t/i,t/a);m=Math.floor(i*x),g=Math.floor(a*x),w(this,Ba)||(l=W(this,un,KC).call(this,m,g))}const v=new OffscreenCanvas(m,g).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,m,g),f={width:m,height:g,data:v.getImageData(0,0,m,g).data}}return{canvas:h,width:u,height:d,imageData:f}}getImageForAltText(){return w(this,Ac)}static async deserialize(t,r,s){var g;let i=null;if(t instanceof ule){const{data:{rect:y,rotation:v,id:x,structParent:b,popupRef:E},container:S,parent:{page:{pageNumber:k}}}=t,C=S.querySelector("canvas"),A=s.imageManager.getFromCanvas(S.id,C);C.remove();const T=((g=await r._structTree.getAriaAttributes(`${YB}${x}`))==null?void 0:g.get("aria-label"))||"";i=t={annotationType:Yt.STAMP,bitmapId:A.id,bitmap:A.bitmap,pageIndex:k-1,rect:y.slice(0),rotation:v,id:x,deleted:!1,accessibilityData:{decorative:!1,altText:T},isSvg:!1,structParent:b,popupRef:E}}const a=await super.deserialize(t,r,s),{rect:o,bitmap:l,bitmapUrl:u,bitmapId:d,isSvg:h,accessibilityData:f}=t;d&&s.imageManager.isValidId(d)?(F(a,qs,d),l&&F(a,or,l)):F(a,Fu,u),F(a,Ba,h);const[p,m]=a.pageDimensions;return a.width=(o[2]-o[0])/p,a.height=(o[3]-o[1])/m,a.annotationElementId=t.id||null,f&&(a.altTextData=f),a._initialData=i,F(a,Cx,!!i),a}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s={annotationType:Yt.STAMP,bitmapId:w(this,qs),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:w(this,Ba),structTreeParentId:this._structTreeParentId};if(t)return s.bitmapUrl=W(this,un,YC).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s;const{decorative:i,altText:a}=this.serializeAltText(!1);if(!i&&a&&(s.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=W(this,un,ece).call(this,s);if(l.isSame)return null;l.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1}if(s.id=this.annotationElementId,r===null)return s;r.stamps||(r.stamps=new Map);const o=w(this,Ba)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!r.stamps.has(w(this,qs)))r.stamps.set(w(this,qs),{area:o,serialized:s}),s.bitmap=W(this,un,YC).call(this,!1);else if(w(this,Ba)){const l=r.stamps.get(w(this,qs));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=W(this,un,YC).call(this,!1))}return s}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}};or=new WeakMap,qs=new WeakMap,Dh=new WeakMap,Fu=new WeakMap,Oh=new WeakMap,kx=new WeakMap,Ac=new WeakMap,Bu=new WeakMap,Nc=new WeakMap,Ba=new WeakMap,Cx=new WeakMap,un=new WeakSet,nw=function(t,r=!1){if(!t){this.remove();return}F(this,or,t.bitmap),r||(F(this,qs,t.id),F(this,Ba,t.isSvg)),t.file&&F(this,kx,t.file.name),W(this,un,s4).call(this)},rw=function(){if(F(this,Dh,null),this._uiManager.enableWaiting(!1),!!w(this,Ac)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&w(this,or)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&w(this,or)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},GC=function(){if(w(this,qs)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(w(this,qs)).then(s=>W(this,un,nw).call(this,s,!0)).finally(()=>
1017W(this,un,rw).call(this));return}if(w(this,Fu)){const s=w(this,Fu);F(this,Fu,null),this._uiManager.enableWaiting(!0),F(this,Dh,this._uiManager.imageManager.getFromUrl(s).then(i=>W(this,un,nw).call(this,i)).finally(()=>W(this,un,rw).call(this)));return}if(w(this,Oh)){const s=w(this,Oh);F(this,Oh,null),this._uiManager.enableWaiting(!0),F(this,Dh,this._uiManager.imageManager.getFromFile(s).then(i=>W(this,un,nw).call(this,i)).finally(()=>W(this,un,rw).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Uw.supportedTypesStr;const r=this._uiManager._signal;F(this,Dh,new Promise(s=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),W(this,un,nw).call(this,i)}s()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),s()},{signal:r})}).finally(()=>W(this,un,rw).call(this))),t.click()},s4=function(){const{div:t}=this;let{width:r,height:s}=w(this,or);const[i,a]=this.pageDimensions,o=.75;if(this.width)r=this.width*i,s=this.height*a;else if(r>o*i||s>o*a){const h=Math.min(o*i/r,o*a/s);r*=h,s*=h}const[l,u]=this.parentDimensions;this.setDims(r*l/i,s*u/a),this._uiManager.enableWaiting(!1);const d=F(this,Ac,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),W(this,un,i4).call(this,r,s),W(this,un,Qle).call(this),w(this,Cx)||(this.parent.addUndoableEditor(this),F(this,Cx,!0)),this._reportTelemetry({action:"inserted_image"}),w(this,kx)&&d.setAttribute("aria-label",w(this,kx))},Jle=function(t,r){var o;const[s,i]=this.parentDimensions;this.width=t/s,this.height=r/i,(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,w(this,Nc)!==null&&clearTimeout(w(this,Nc)),F(this,Nc,setTimeout(()=>{F(this,Nc,null),W(this,un,i4).call(this,t,r)},200))},KC=function(t,r){const{width:s,height:i}=w(this,or);let a=s,o=i,l=w(this,or);for(;a>2*t||o>2*r;){const u=a,d=o;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const h=new OffscreenCanvas(a,o);h.getContext("2d").drawImage(l,0,0,u,d,0,0,a,o),l=h.transferToImageBitmap()}return l},i4=function(t,r){const s=new QI,i=Math.ceil(t*s.sx),a=Math.ceil(r*s.sy),o=w(this,Ac);if(!o||o.width===i&&o.height===a)return;o.width=i,o.height=a;const l=w(this,Ba)?w(this,or):W(this,un,KC).call(this,i,a),u=o.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(l,0,0,l.width,l.height,0,0,i,a)},YC=function(t){if(t){if(w(this,Ba)){const i=this._uiManager.imageManager.getSvgUrl(w(this,qs));if(i)return i}const r=document.createElement("canvas");return{width:r.width,height:r.height}=w(this,or),r.getContext("2d").drawImage(w(this,or),0,0),r.toDataURL()}if(w(this,Ba)){const[r,s]=this.pageDimensions,i=Math.round(this.width*r*wf.PDF_TO_CSS_UNITS),a=Math.round(this.height*s*wf.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(i,a);return o.getContext("2d").drawImage(w(this,or),0,0,w(this,or).width,w(this,or).height,0,0,i,a),o.transferToImageBitmap()}return structuredClone(w(this,or))},Qle=function(){this._uiManager._signal&&(F(this,Bu,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&W(this,un,Jle).call(this,r.width,r.height)})),w(this,Bu).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=w(this,Bu))==null||t.disconnect(),F(this,Bu,null)},{once:!0}))},ece=function(t){var u;const{rect:r,pageIndex:s,accessibilityData:{altText:i}}=this._initialData,a=t.rect.every((d,h)=>Math.abs(d-r[h])<1),o=t.pageIndex===s,l=(((u=t.accessibilityData)==null?void 0:u.alt)||"")===i;return{isSame:a&&o&&l,isSameAltText:l}},Nt(Uw,"_type","stamp"),Nt(Uw,"_editorType",Yt.STAMP);let r4=Uw;var Rm,Ax,Tc,Mh,zu,za,Ih,Nx,Tx,gi,$u,At,Lh,si,tce,o4,l4,c4,XC;const dl=class dl{constructor({uiManager:e,pageIndex:t,div:r,structTreeLayer:s,accessibilityManager:i,annotationLayer:a,drawLayer:o,textLayer:l,viewport:u,l10n:d}){G(this,si);G(this,Rm);G(this,Ax,!1);G(this,Tc,null);G(this,Mh,null);G(this,zu,null);G(this,za,new Map);G(this,Ih,!1);G(this,Nx,!1);G(this,Tx,!1);G(this,gi,null);G(this,$u,null);G(this,At);const h=[...w(dl,Lh).values()];if(!dl._initialized){dl._initialized=!0;for(const f of h)f.initialize(d,e)}
1017e.registerEditorTypes(h),F(this,At,e),this.pageIndex=t,this.div=r,F(this,Rm,i),F(this,Tc,a),this.viewport=u,F(this,gi,l),this.drawLayer=o,this._structTree=s,w(this,At).addLayer(this)}get isEmpty(){return w(this,za).size===0}get isInvisible(){return this.isEmpty&&w(this,At).getMode()===Yt.NONE}updateToolbar(e){w(this,At).updateToolbar(e)}updateMode(e=w(this,At).getMode()){switch(W(this,si,XC).call(this),e){case Yt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Yt.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Yt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of w(dl,Lh).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=w(this,gi))==null?void 0:t.div)}addInkEditorIfNeeded(e){if(w(this,At).getMode()!==Yt.INK)return;if(!e){for(const r of w(this,za).values())if(r.isEmpty()){r.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){w(this,At).setEditingState(e)}addCommands(e){w(this,At).addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=w(this,Tc))==null||t.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const r of w(this,za).values())r.enableEditing(),r.show(!0),r.annotationElementId&&(w(this,At).removeChangedExistingAnnotation(r),e.add(r.annotationElementId));if(!w(this,Tc))return;const t=w(this,Tc).getEditableAnnotations();for(const r of t){if(r.hide(),w(this,At).isDeletedAnnotationElement(r.data.id)||e.has(r.data.id))continue;const s=await this.deserialize(r);s&&(this.addOrRebuild(s),s.enableEditing())}}disable(){var s;F(this,Tx,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const i of w(this,za).values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else t.set(i.annotationElementId,i);(s=this.getEditableAnnotation(i.annotationElementId))==null||s.show(),i.remove()}if(w(this,Tc)){const i=w(this,Tc).getEditableAnnotations();for(const a of i){const{id:o}=a.data;if(w(this,At).isDeletedAnnotationElement(o))continue;let l=t.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=e.get(o),l&&(w(this,At).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}W(this,si,XC).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const i of w(dl,Lh).values())r.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),F(this,Tx,!1)}getEditableAnnotation(e){var t;return((t=w(this,Tc))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){w(this,At).getActive()!==e&&w(this,At).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=w(this,gi))!=null&&e.div&&!w(this,$u)){F(this,$u,new AbortController);const t=w(this,At).combinedSignal(w(this,$u));w(this,gi).div.addEventListener("pointerdown",W(this,si,tce).bind(this),{signal:t}),w(this,gi).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=w(this,gi))!=null&&e.div&&w(this,$u)&&(w(this,$u).abort(),F(this,$u,null),w(this,gi).div.classList.remove("highlighting"))}enableClick(){if(w(this,Mh))return;F(this,Mh,new AbortController);const e=w(this,At).combinedSignal(w(this,Mh));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){var e;(e=w(this,Mh))==null||e.abort(),F(this,Mh,null)}attach(e){w(this,za).set(e.id,e);const{annotationElementId:t}=e;t&&w(this,At).isDeletedAnnotationElement(t)&&w(this,At).removeDeletedAnnotationElement(e)}detach(e){var t;w(this,za).delete(e.id),(t=w(this,Rm))==null||t.removePointerInTextLayer(e.contentDiv),!w(this,Tx)&&e.annotationElementId&&w(this,At).addDeletedAnnotationElement(e)}remove(e){this.detach(e),w(this,At).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,w(this,Nx)||this.addInkEditorIfNeeded(!1)}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(w(this,At).addDeletedAnnotationElement(e.annotationElementId),Mn.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}
1017add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),w(this,At).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),w(this,At).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!w(this,zu)&&(e._focusEventsAllowed=!1,F(this,zu,setTimeout(()=>{F(this,zu,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:w(this,At)._signal}),t.focus())},0))),e._structTreeParentId=(r=w(this,Rm))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:t,undo:r,mustExec:!1})}getNextId(){return w(this,At).getId()}combinedSignal(e){return w(this,At).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=w(this,si,o4))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,t){w(this,At).updateToolbar(e),w(this,At).updateMode(e);const{offsetX:r,offsetY:s}=W(this,si,c4).call(this),i=this.getNextId(),a=W(this,si,l4).call(this,{parent:this,id:i,x:r,y:s,uiManager:w(this,At),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=w(dl,Lh).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,w(this,At)))||null}createAndAddNewEditor(e,t,r={}){const s=this.getNextId(),i=W(this,si,l4).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:w(this,At),isCentered:t,...r});return i&&this.add(i),i}addNewEditor(){this.createAndAddNewEditor(W(this,si,c4).call(this),!0)}setSelected(e){w(this,At).setSelected(e)}toggleSelected(e){w(this,At).toggleSelected(e)}unselect(e){w(this,At).unselect(e)}pointerup(e){const{isMac:t}=Ki.platform;if(!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&w(this,Ih)){if(F(this,Ih,!1),!w(this,Ax)){F(this,Ax,!0);return}if(w(this,At).getMode()===Yt.STAMP){w(this,At).unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(w(this,At).getMode()===Yt.HIGHLIGHT&&this.enableTextSelection(),w(this,Ih)){F(this,Ih,!1);return}const{isMac:t}=Ki.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;F(this,Ih,!0);const r=w(this,At).getActive();F(this,Ax,!r||r.isEmpty())}findNewParent(e,t,r){const s=w(this,At).findParent(t,r);return s===null||s===this?!1:(s.changeParent(e),!0)}destroy(){var e,t;((e=w(this,At).getActive())==null?void 0:e.parent)===this&&(w(this,At).commitOrRemove(),w(this,At).setActiveEditor(null)),w(this,zu)&&(clearTimeout(w(this,zu)),F(this,zu,null));for(const r of w(this,za).values())(t=w(this,Rm))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,w(this,za).clear(),w(this,At).removeLayer(this)}render({viewport:e}){this.viewport=e,fg(this.div,e);for(const t of w(this,At).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){w(this,At).commitOrRemove(),W(this,si,XC).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,fg(this.div,{rotation:r}),t!==r)for(const s of w(this,za).values())s.rotate(r);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return w(this,At).viewParameters.realScale}};Rm=new WeakMap,Ax=new WeakMap,Tc=new WeakMap,Mh=new WeakMap,zu=new WeakMap,za=new WeakMap,Ih=new WeakMap,Nx=new WeakMap,Tx=new WeakMap,gi=new WeakMap,$u=new WeakMap,At=new WeakMap,Lh=new WeakMap,si=new WeakSet,tce=function(e){w(this,At).unselectAll();const{target:t}=e;if(t===w(this,gi).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&w(this,gi).div.contains(t)){const{isMac:r}=Ki.platform;if(e.button!==0||e.ctrlKey&&r)return;w(this,At).showAllEditors("highlight",!0,!0),w(this,gi).div.classList.add("free"),this.toggleDrawing(),bN.startHighlighting(this,w(this,At).direction==="ltr",{target:w(this,gi).div,x:e.x,y:e.y}),w(this,gi).div.addEventListener("pointerup",()=>{w(this,gi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:w(this,At)._signal}),e.preventDefault()}},o4=function(){return w(dl,Lh).get(w(this,At).getMode())},l4=function(e){const t=w(this,si,o4);return t?new t.prototype.constructor(e):null},c4=function(){const{x:e,y:t,width:r,height:s}=this.div.getBoundingClientRect(),i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+r),l=Math.min(window.innerHeight,t+s),u=(i+o)/2-e,d=(a+l)/2-t,[h,f]=this.viewport.rotation%180===0?[u,d]:[d,u];return{offsetX:h,offsetY:f}},XC=function(){F(this,Nx,!0);for(const e of w(this,za).values())e.isEmpty()&&e.remove();F(this,Nx,!1)},Nt(dl,"_initialized",!1),G(dl,Lh,new Map([BL,KL,r4,bN].map(e=>[e._editorType,e])));let a4=dl;
1017var jc,gS,Yr,Uu,vS,d4,yg,h4,nce;const Vs=class Vs{constructor({pageIndex:e}){G(this,yg);G(this,jc,null);G(this,gS,0);G(this,Yr,new Map);G(this,Uu,new Map);this.pageIndex=e}setParent(e){if(!w(this,jc)){F(this,jc,e);return}if(w(this,jc)!==e){if(w(this,Yr).size>0)for(const t of w(this,Yr).values())t.remove(),e.append(t);F(this,jc,e)}}static get _svgFactory(){return mn(this,"_svgFactory",new iz)}draw(e,t,r,s=!1){const i=Ss(this,gS)._++,a=W(this,yg,h4).call(this,e.box);a.classList.add(...e.classNamesForDrawing);const o=Vs._svgFactory.createElement("defs");a.append(o);const l=Vs._svgFactory.createElement("path");o.append(l);const u=`path_p${this.pageIndex}_${i}`;l.setAttribute("id",u),l.setAttribute("d",e.toSVGPath()),s&&w(this,Uu).set(i,l);const d=W(this,yg,nce).call(this,o,u),h=Vs._svgFactory.createElement("use");return a.append(h),a.setAttribute("fill",t),a.setAttribute("fill-opacity",r),h.setAttribute("href",`#${u}`),w(this,Yr).set(i,a),{id:i,clipPathId:`url(#${d})`}}drawOutline(e){const t=Ss(this,gS)._++,r=W(this,yg,h4).call(this,e.box);r.classList.add(...e.classNamesForOutlining);const s=Vs._svgFactory.createElement("defs");r.append(s);const i=Vs._svgFactory.createElement("path");s.append(i);const a=`path_p${this.pageIndex}_${t}`;i.setAttribute("id",a),i.setAttribute("d",e.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke");let o;if(e.mustRemoveSelfIntersections){const d=Vs._svgFactory.createElement("mask");s.append(d),o=`mask_p${this.pageIndex}_${t}`,d.setAttribute("id",o),d.setAttribute("maskUnits","objectBoundingBox");const h=Vs._svgFactory.createElement("rect");d.append(h),h.setAttribute("width","1"),h.setAttribute("height","1"),h.setAttribute("fill","white");const f=Vs._svgFactory.createElement("use");d.append(f),f.setAttribute("href",`#${a}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const l=Vs._svgFactory.createElement("use");r.append(l),l.setAttribute("href",`#${a}`),o&&l.setAttribute("mask",`url(#${o})`);const u=l.cloneNode();return r.append(u),l.classList.add("mainOutline"),u.classList.add("secondaryOutline"),w(this,Yr).set(t,r),t}finalizeLine(e,t){const r=w(this,Uu).get(e);w(this,Uu).delete(e),this.updateBox(e,t.box),r.setAttribute("d",t.toSVGPath())}updateLine(e,t){w(this,Yr).get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}updatePath(e,t){w(this,Uu).get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){var r;W(r=Vs,vS,d4).call(r,w(this,Yr).get(e),t)}show(e,t){w(this,Yr).get(e).classList.toggle("hidden",!t)}rotate(e,t){w(this,Yr).get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){w(this,Yr).get(e).setAttribute("fill",t)}changeOpacity(e,t){w(this,Yr).get(e).setAttribute("fill-opacity",t)}addClass(e,t){w(this,Yr).get(e).classList.add(t)}removeClass(e,t){w(this,Yr).get(e).classList.remove(t)}getSVGRoot(e){return w(this,Yr).get(e)}remove(e){w(this,Uu).delete(e),w(this,jc)!==null&&(w(this,Yr).get(e).remove(),w(this,Yr).delete(e))}destroy(){F(this,jc,null);for(const e of w(this,Yr).values())e.remove();w(this,Yr).clear(),w(this,Uu).clear()}};jc=new WeakMap,gS=new WeakMap,Yr=new WeakMap,Uu=new WeakMap,vS=new WeakSet,d4=function(e,{x:t=0,y:r=0,width:s=1,height:i=1}={}){const{style:a}=e;a.top=`${100*r}%`,a.left=`${100*t}%`,a.width=`${100*s}%`,a.height=`${100*i}%`},yg=new WeakSet,h4=function(e){var r;const t=Vs._svgFactory.create(1,1,!0);return w(this,jc).append(t),t.setAttribute("aria-hidden",!0),W(r=Vs,vS,d4).call(r,t,e),t},nce=function(e,t){const r=Vs._svgFactory.createElement("clipPath");e.append(r);const s=`clip_${t}`;r.setAttribute("id",s),r.setAttribute("clipPathUnits","objectBoundingBox");const i=Vs._svgFactory.createElement("use");return r.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),s},G(Vs,vS);let u4=Vs;var OHe=Ht.AbortException,MHe=Ht.AnnotationEditorLayer,IHe=Ht.AnnotationEditorParamsType,LHe=Ht.AnnotationEditorType,FHe=Ht.AnnotationEditorUIManager,rce=Ht.AnnotationLayer,sce=Ht.AnnotationMode,BHe=Ht.ColorPicker,zHe=Ht.DOMSVGFactory,$He=Ht.DrawLayer,UHe=Ht.FeatureTest,oz=Ht.GlobalWorkerOptions,VHe=Ht.ImageKind,HHe=Ht.InvalidPDFException,WHe=Ht.MissingPDFException,qHe=Ht.OPS,GHe=Ht.OutputScale,KHe=Ht.PDFDataRangeTransport,YHe=Ht.PDFDateString,XHe=Ht.PDFWorker,ZHe=Ht.PasswordResponses,JHe=Ht.PermissionFlag,QHe=Ht.PixelsPerInch,eWe=Ht.RenderingCancelledException,ice=Ht.TextLayer,tWe=Ht.UnexpectedResponseException,nWe=Ht.Util,rWe=Ht.VerbosityLevel,sWe=Ht.XfaLayer,iWe=Ht.build,aWe=Ht.createValidAbsoluteUrl,oWe=Ht.fetchData,ace=Ht.getDocument,lWe=Ht.getFilenameFromUrl,cWe=Ht.getPdfFilenameFromUrl,uWe=Ht.getXfaPageViewport,dWe=Ht.isDataScheme,hWe=Ht.isPdfFile,fWe=Ht.noContextMenu,pWe=Ht.normalizeUnicode,mWe=Ht.setLayerDimensions,gWe=Ht.shadow,oce=Ht.version;const vWe=Object.freeze(Object.defineProperty({__proto__:null,AbortException:OHe,AnnotationEditorLayer:MHe,AnnotationEditorParamsType:IHe,AnnotationEditorType:LHe,AnnotationEditorUIManager:FHe,AnnotationLayer:rce,AnnotationMode:sce,ColorPicker:BHe,DOMSVGFactory:zHe,DrawLayer:$He,FeatureTest:UHe,GlobalWorkerOptions:oz,ImageKind:VHe,InvalidPDFException:HHe,MissingPDFException:WHe,OPS:qHe,OutputScale:GHe,PDFDataRangeTransport:KHe,PDFDateString:YHe,PDFWorker:XHe,PasswordResponses:ZHe,PermissionFlag:JHe,PixelsPerInch:QHe,RenderingCancelledException:eWe,TextLayer:ice,UnexpectedResponseException:tWe,Util:nWe,VerbosityLevel:rWe,XfaLayer:sWe,build:iWe,createValidAbsoluteUrl:aWe,fetchData:oWe,getDocument:ace,getFilenameFromUrl:lWe,getPdfFilenameFromUrl:cWe,getXfaPageViewport:uWe,isDataScheme:dWe,isPdfFile:hWe,noContextMenu:fWe,normalizeUnicode:pWe,setLayerDimensions:mWe,shadow:gWe,version:oce},Symbol.toStringTag,{value:"Module"}));var Es=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))},yWe=["onCopy","onCut","onPaste"],xWe=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],bWe=["onFocus","onBlur"],wWe=["onInput","onInvalid","onReset","onSubmit"],_We=["onLoad","onError"],SWe=["onKeyDown","onKeyPress","onKeyUp"],EWe=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],kWe=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],CWe=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],AWe=["onSelect"],NWe=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],TWe=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],jWe=["onScroll"],RWe=["onWheel"],PWe=["onAnimationStart","onAnimationEnd","onAnimationIteration"],DWe=["onTransitionEnd"],OWe=["onToggle"],MWe=["onChange"],IWe=Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es(Es([],yWe,!0),xWe,!0),bWe,!0),wWe,!0),_We,!0),SWe,!0),EWe,!0),kWe,!0),CWe,!0),AWe,!0),NWe,!0),TWe,!0),jWe,!0),RWe,!0),PWe,!0),DWe,!0),MWe,!0),OWe,!0);function lce(n,e){var t={};return IWe.forEach(function(r){var s=n[r];s&&(e?t[r]=function(i){return s(i,e(r))}:t[r]=s)}),t}function EE(n){var e=!1,t=new Promise(function(r,s){n.then(function(i){return!e&&r(i)}).catch(function(i){return!e&&s(i)})});return{promise:t,cancel:function(){e=!0}}}var LWe="Invariant failed";function Un(n,e){if(!n)throw new Error(LWe)}var FWe=function(){},BWe=FWe;const xi=ro(BWe);var hq=Object.prototype.hasOwnProperty;function fq(n,e,t){for(t of n.keys())if(yy(t,e))return t}function yy(n,e){var t,r,s;if(n===e)return!0;
1017if(n&&e&&(t=n.constructor)===e.constructor){if(t===Date)return n.getTime()===e.getTime();if(t===RegExp)return n.toString()===e.toString();if(t===Array){if((r=n.length)===e.length)for(;r--&&yy(n[r],e[r]););return r===-1}if(t===Set){if(n.size!==e.size)return!1;for(r of n)if(s=r,s&&typeof s=="object"&&(s=fq(e,s),!s)||!e.has(s))return!1;return!0}if(t===Map){if(n.size!==e.size)return!1;for(r of n)if(s=r[0],s&&typeof s=="object"&&(s=fq(e,s),!s)||!yy(r[1],e.get(s)))return!1;return!0}if(t===ArrayBuffer)n=new Uint8Array(n),e=new Uint8Array(e);else if(t===DataView){if((r=n.byteLength)===e.byteLength)for(;r--&&n.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(n)){if((r=n.byteLength)===e.byteLength)for(;r--&&n[r]===e[r];);return r===-1}if(!t||typeof n=="object"){r=0;for(t in n)if(hq.call(n,t)&&++r&&!hq.call(e,t)||!(t in e)||!yy(n[t],e[t]))return!1;return Object.keys(e).length===r}}return n!==n&&e!==e}const cce=_.createContext(null);function xy({children:n,type:e}){return c.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:n})}const zWe="noopener noreferrer nofollow";class $We{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Un(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(e){Un(this.pdfViewer),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(t=>{Un(this.pdfDocument),Un(e),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{Un(Array.isArray(t));const r=t[0];new Promise(s=>{Un(this.pdfDocument),r instanceof Object?this.pdfDocument.getPageIndex(r).then(i=>{s(i)}).catch(()=>{Un(!1)}):typeof r=="number"?s(r):Un(!1)}).then(s=>{const i=s+1;Un(this.pdfViewer),Un(i>=1&&i<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:s,pageNumber:i})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Un(this.pdfViewer),Un(e>=1&&e<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,r){e.href=t,e.rel=this.externalLinkRel||zWe,e.target=r?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const pq={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},$j=typeof window<"u",uce=$j&&window.location.protocol==="file:";function UWe(n){return typeof n<"u"}function Zf(n){return UWe(n)&&n!==null}function VWe(n){return typeof n=="string"}function HWe(n){return n instanceof ArrayBuffer}function WWe(n){return Un($j),n instanceof Blob}function f4(n){return VWe(n)&&/^data:/.test(n)}function mq(n){Un(f4(n));const[e="",t=""]=n.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function qWe(){return $j&&window.devicePixelRatio||1}const dce="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function gq(){xi(!uce,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${dce}`)}function GWe(){xi(!uce,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${dce}`)}function gg(n){n!=null&&n.cancel&&n.cancel()}function p4(n,e){return Object.defineProperty(n,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(n,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(n,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(n,"originalHeight",{get(){return this.view[3]},configurable:!0}),n}function KWe(n){return n.name==="RenderingCancelledException"}function YWe(n){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>
1017{if(!r.result)return t(new Error("Error while reading a file."));e(r.result)},r.onerror=s=>{if(!s.target)return t(new Error("Error while reading a file."));const{error:i}=s.target;if(!i)return t(new Error("Error while reading a file."));switch(i.code){case i.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case i.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case i.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},r.readAsArrayBuffer(n)})}function XWe(n,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return n}}function d0(){return _.useReducer(XWe,{value:void 0,error:void 0})}var ZWe=function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(d){try{u(r.next(d))}catch(h){a(h)}}function l(d){try{u(r.throw(d))}catch(h){a(h)}}function u(d){d.done?i(d.value):s(d.value).then(o,l)}u((r=r.apply(n,e||[])).next())})},vq=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t};const{PDFDataRangeTransport:JWe}=vWe,QWe=(n,e)=>{switch(e){case pq.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");n(t);break}case pq.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");n(t);break}}};function yq(n){return typeof n=="object"&&n!==null&&("data"in n||"range"in n||"url"in n)}const eqe=_.forwardRef(function(e,t){var{children:r,className:s,error:i="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:o,file:l,inputRef:u,imageResourcesPath:d,loading:h="Loading PDF…",noData:f="No PDF file specified.",onItemClick:p,onLoadError:m,onLoadProgress:g,onLoadSuccess:y,onPassword:v=QWe,onSourceError:x,onSourceSuccess:b,options:E,renderMode:S,rotate:k}=e,C=vq(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[A,T]=d0(),{value:j,error:D}=A,[R,M]=d0(),{value:N,error:U}=R,q=_.useRef(new $We),I=_.useRef([]),B=_.useRef(void 0),$=_.useRef(void 0);l&&l!==B.current&&yq(l)&&(xi(!yy(l,B.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),B.current=l),E&&E!==$.current&&(xi(!yy(E,$.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),$.current=E);const ie=_.useRef({scrollPageIntoView:Ce=>{const{dest:O,pageNumber:X,pageIndex:ee=X-1}=Ce;if(p){p({dest:O,pageIndex:ee,pageNumber:X});return}const V=I.current[ee];if(V){V.scrollIntoView();return}xi(!1,`An internal link leading to page ${X} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});_.useImperativeHandle(t,()=>({linkService:q,pages:I,viewer:ie}),[]);function ne(){b&&b()}function L(){D&&(xi(!1,D.toString()),x&&x(D))}function te(){T({type:"RESET"})}_.useEffect(te,[l,T]);const ae=_.useCallback(()=>ZWe(this,void 0,void 0,function*(){if(!l)return null;if(typeof l=="string")return f4(l)?{data:mq(l)}:(gq(),{url:l});if(l instanceof JWe)return{range:l};if(HWe(l))return{data:l};if($j&&WWe(l))return{data:yield YWe(l)};if(Un(typeof l=="object"),Un(yq(l)),"url"in l&&typeof l.url=="string"){if(f4(l.url)){const{url:Ce}=l,O=vq(l,["url"]),X=mq(Ce);return Object.assign({data:X},O)}gq()}return l}),[l]);_.useEffect(()=>{const Ce=EE(ae());return Ce.promise.then(O=>{T({type:"RESOLVE",value:O})}).catch(O=>{T({type:"REJECT",error:O})}),()=>{gg(Ce)}},[ae,T]),_.useEffect(()=>{if(!(typeof j>"u")){if(j===!1){L();return}ne()}},[j]);
1017function de(){N&&(y&&y(N),I.current=new Array(N.numPages),q.current.setDocument(N))}function ue(){U&&(xi(!1,U.toString()),m&&m(U))}_.useEffect(function(){M({type:"RESET"})},[M,j]),_.useEffect(function(){if(!j)return;const O=E?Object.assign(Object.assign({},j),E):j,X=ace(O);g&&(X.onProgress=g),v&&(X.onPassword=v);const ee=X,V=ee.promise.then(H=>{M({type:"RESOLVE",value:H})}).catch(H=>{ee.destroyed||M({type:"REJECT",error:H})});return()=>{V.finally(()=>ee.destroy())}},[E,M,j]),_.useEffect(()=>{if(!(typeof N>"u")){if(N===!1){ue();return}de()}},[N]),_.useEffect(function(){q.current.setViewer(ie.current),q.current.setExternalLinkRel(a),q.current.setExternalLinkTarget(o)},[a,o]);const le=_.useCallback((Ce,O)=>{I.current[Ce]=O},[]),ve=_.useCallback(Ce=>{delete I.current[Ce]},[]),_e=_.useMemo(()=>({imageResourcesPath:d,linkService:q.current,onItemClick:p,pdf:N,registerPage:le,renderMode:S,rotate:k,unregisterPage:ve}),[d,p,N,le,S,k,ve]),Ne=_.useMemo(()=>lce(C,()=>N),[C,N]);function Pe(){return c.jsx(cce.Provider,{value:_e,children:r})}function Se(){return l?N==null?c.jsx(xy,{type:"loading",children:typeof h=="function"?h():h}):N===!1?c.jsx(xy,{type:"error",children:typeof i=="function"?i():i}):Pe():c.jsx(xy,{type:"no-data",children:typeof f=="function"?f():f})}return c.jsx("div",Object.assign({className:g0("react-pdf__Document",s),ref:u,style:{"--scale-factor":"1"}},Ne,{children:Se()}))});function hce(){return _.useContext(cce)}function fce(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n.filter(Boolean);if(t.length<=1){var r=t[0];return r||null}return function(i){t.forEach(function(a){typeof a=="function"?a(i):a&&(a.current=i)})}}const pce=_.createContext(null),mce={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},tqe=/^H(\d+)$/;function nqe(n){return n in mce}function Uj(n){return"children"in n}function gce(n){return Uj(n)?n.children.length===1&&0 in n.children&&"id"in n.children[0]:!1}function rqe(n){const e={};if(Uj(n)){const{role:t}=n,r=t.match(tqe);if(r)e.role="heading",e["aria-level"]=Number(r[1]);else if(nqe(t)){const s=mce[t];s&&(e.role=s)}}return e}function vce(n){const e={};if(Uj(n)){if(n.alt!==void 0&&(e["aria-label"]=n.alt),n.lang!==void 0&&(e.lang=n.lang),gce(n)){const[t]=n.children;if(t){const r=vce(t);return Object.assign(Object.assign({},e),r)}}}else"id"in n&&(e["aria-owns"]=n.id);return e}function sqe(n){return n?Object.assign(Object.assign({},rqe(n)),vce(n)):null}function yce({className:n,node:e}){const t=_.useMemo(()=>sqe(e),[e]),r=_.useMemo(()=>!Uj(e)||gce(e)?null:e.children.map((s,i)=>c.jsx(yce,{node:s},i)),[e]);return c.jsx("span",Object.assign({className:n},t,{children:r}))}function Vj(){return _.useContext(pce)}function iqe(){const n=Vj();Un(n);const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=n,[r,s]=d0(),{value:i,error:a}=r,{customTextRenderer:o,page:l}=n;function u(){i&&t&&t(i)}function d(){a&&(xi(!1,a.toString()),e&&e(a))}return _.useEffect(function(){s({type:"RESET"})},[s,l]),_.useEffect(function(){if(o||!l)return;const f=EE(l.getStructTree()),p=f;return f.promise.then(m=>{s({type:"RESOLVE",value:m})}).catch(m=>{s({type:"REJECT",error:m})}),()=>gg(p)},[o,l,s]),_.useEffect(()=>{if(i!==void 0){if(i===!1){d();return}u()}},[i]),i?c.jsx(yce,{className:"react-pdf__Page__structTree structTree",node:i}):null}const xq=sce;function aqe(n){const e=Vj();Un(e);const t=Object.assign(Object.assign({},e),n),{_className:r,canvasBackground:s,devicePixelRatio:i=qWe(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:u,renderTextLayer:d,rotate:h,scale:f}=t,{canvasRef:p}=n;Un(l);const m=_.useRef(null);function g(){l&&o&&o(p4(l,f))}function y(E){KWe(E)||(xi(!1,E.toString()),a&&a(E))}const v=_.useMemo(()=>l.getViewport({scale:f*i,rotation:h}),[i,l,h,f]),x=_.useMemo(()=>l.getViewport({scale:f,rotation:h}),[l,h,f]);_.useEffect(function(){if(!l)return;l.cleanup();const{current:S}=m;if(!S)return;S.width=v.width,S.height=v.height,S.style.width=`${Math.floor(x.width)}
1017px`,S.style.height=`${Math.floor(x.height)}px`,S.style.visibility="hidden";const k={annotationMode:u?xq.ENABLE_FORMS:xq.ENABLE,canvasContext:S.getContext("2d",{alpha:!1}),viewport:v};s&&(k.background=s);const C=l.render(k),A=C;return C.promise.then(()=>{S.style.visibility="",g()}).catch(y),()=>gg(A)},[s,l,u,v,x]);const b=_.useCallback(()=>{const{current:E}=m;E&&(E.width=0,E.height=0)},[]);return _.useEffect(()=>b,[b]),c.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:fce(p,m),style:{display:"block",userSelect:"none"},children:d?c.jsx(iqe,{}):null})}function oqe(n){return"str"in n}function lqe(){const n=Vj();Un(n);const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:r,onRenderTextLayerError:s,onRenderTextLayerSuccess:i,page:a,pageIndex:o,pageNumber:l,rotate:u,scale:d}=n;Un(a);const[h,f]=d0(),{value:p,error:m}=h,g=_.useRef(null);xi(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function y(){p&&r&&r(p)}function v(){m&&(xi(!1,m.toString()),t&&t(m))}_.useEffect(function(){f({type:"RESET"})},[a,f]),_.useEffect(function(){if(!a)return;const A=EE(a.getTextContent()),T=A;return A.promise.then(j=>{f({type:"RESOLVE",value:j})}).catch(j=>{f({type:"REJECT",error:j})}),()=>gg(T)},[a,f]),_.useEffect(()=>{if(p!==void 0){if(p===!1){v();return}y()}},[p]);const x=_.useCallback(()=>{i&&i()},[i]),b=_.useCallback(C=>{xi(!1,C.toString()),s&&s(C)},[s]);function E(){const C=g.current;C&&C.classList.add("selecting")}function S(){const C=g.current;C&&C.classList.remove("selecting")}const k=_.useMemo(()=>a.getViewport({scale:d,rotation:u}),[a,u,d]);return _.useLayoutEffect(function(){if(!a||!p)return;const{current:A}=g;if(!A)return;A.innerHTML="";const T=a.streamTextContent({includeMarkedContent:!0}),j={container:A,textContentSource:T,viewport:k},D=new ice(j),R=D;return D.render().then(()=>{const M=document.createElement("div");M.className="endOfContent",A.append(M);const N=A.querySelectorAll('[role="presentation"]');if(e){let U=0;p.items.forEach((q,I)=>{if(!oqe(q))return;const B=N[U];if(!B)return;const $=e(Object.assign({pageIndex:o,pageNumber:l,itemIndex:I},q));B.innerHTML=$,U+=q.str&&q.hasEOL?2:1})}x()}).catch(b),()=>gg(R)},[e,b,x,a,o,l,p,k]),c.jsx("div",{className:g0("react-pdf__Page__textContent","textLayer"),onMouseUp:S,onMouseDown:E,ref:g})}function cqe(){const n=hce(),e=Vj();Un(e);const t=Object.assign(Object.assign({},n),e),{imageResourcesPath:r,linkService:s,onGetAnnotationsError:i,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:u,pdf:d,renderForms:h,rotate:f,scale:p=1}=t;Un(d),Un(u),Un(s);const[m,g]=d0(),{value:y,error:v}=m,x=_.useRef(null);xi(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function b(){y&&a&&a(y)}function E(){v&&(xi(!1,v.toString()),i&&i(v))}_.useEffect(function(){g({type:"RESET"})},[g,u]),_.useEffect(function(){if(!u)return;const T=EE(u.getAnnotations()),j=T;return T.promise.then(D=>{g({type:"RESOLVE",value:D})}).catch(D=>{g({type:"REJECT",error:D})}),()=>{gg(j)}},[g,u]),_.useEffect(()=>{if(y!==void 0){if(y===!1){E();return}b()}},[y]);function S(){l&&l()}function k(A){xi(!1,`${A}`),o&&o(A)}const C=_.useMemo(()=>u.getViewport({scale:p,rotation:f}),[u,f,p]);return _.useEffect(function(){if(!d||!u||!s||!y)return;const{current:T}=x;if(!T)return;const j=C.clone({dontFlip:!0}),D={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:T,l10n:null,page:u,structTreeLayer:null,viewport:j},R={annotations:y,annotationStorage:d.annotationStorage,div:T,imageResourcesPath:r,linkService:s,page:u,renderForms:h,viewport:j};T.innerHTML="";try{new rce(D).render(R),S()}catch(M){k(M)}return()=>{}},[y,r,s,u,d,h,C]),c.jsx("div",{className:g0("react-pdf__Page__annotations","annotationLayer"),ref:x})}var uqe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t};const bq=1;function dqe(n){const e=hce(),t=Object.assign(Object.assign({},e),n),{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:s=!0,canvasBackgroun
1017d:i,canvasRef:a,children:o,className:l,customRenderer:u,customTextRenderer:d,devicePixelRatio:h,error:f="Failed to load the page.",height:p,inputRef:m,loading:g="Loading page…",noData:y="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:x,onGetStructTreeError:b,onGetStructTreeSuccess:E,onGetTextError:S,onGetTextSuccess:k,onLoadError:C,onLoadSuccess:A,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:j,onRenderError:D,onRenderSuccess:R,onRenderTextLayerError:M,onRenderTextLayerSuccess:N,pageIndex:U,pageNumber:q,pdf:I,registerPage:B,renderAnnotationLayer:$=!0,renderForms:ie=!1,renderMode:ne="canvas",renderTextLayer:L=!0,rotate:te,scale:ae=bq,unregisterPage:de,width:ue}=t,le=uqe(t,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[ve,_e]=d0(),{value:Ne,error:Pe}=ve,Se=_.useRef(null);Un(I);const Ce=Zf(q)?q-1:U??null,O=q??(Zf(U)?U+1:null),X=te??(Ne?Ne.rotate:null),ee=_.useMemo(()=>{if(!Ne)return null;let Le=1;const qe=ae??bq;if(ue||p){const lt=Ne.getViewport({scale:1,rotation:X});ue?Le=ue/lt.width:p&&(Le=p/lt.height)}return qe*Le},[p,Ne,X,ae,ue]);_.useEffect(function(){return()=>{Zf(Ce)&&s&&de&&de(Ce)}},[s,I,Ce,de]);function V(){if(A){if(!Ne||!ee)return;A(p4(Ne,ee))}if(s&&B){if(!Zf(Ce)||!Se.current)return;B(Ce,Se.current)}}function H(){Pe&&(xi(!1,Pe.toString()),C&&C(Pe))}_.useEffect(function(){_e({type:"RESET"})},[_e,I,Ce]),_.useEffect(function(){if(!I||!O)return;const qe=EE(I.getPage(O)),lt=qe;return qe.promise.then(rt=>{_e({type:"RESOLVE",value:rt})}).catch(rt=>{_e({type:"REJECT",error:rt})}),()=>gg(lt)},[_e,I,O]),_.useEffect(()=>{if(Ne!==void 0){if(Ne===!1){H();return}V()}},[Ne,ee]);const se=_.useMemo(()=>Ne&&Zf(Ce)&&O&&Zf(X)&&Zf(ee)?{_className:r,canvasBackground:i,customTextRenderer:d,devicePixelRatio:h,onGetAnnotationsError:v,onGetAnnotationsSuccess:x,onGetStructTreeError:b,onGetStructTreeSuccess:E,onGetTextError:S,onGetTextSuccess:k,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:j,onRenderError:D,onRenderSuccess:R,onRenderTextLayerError:M,onRenderTextLayerSuccess:N,page:Ne,pageIndex:Ce,pageNumber:O,renderForms:ie,renderTextLayer:L,rotate:X,scale:ee}:null,[r,i,d,h,v,x,b,E,S,k,T,j,D,R,M,N,Ne,Ce,O,ie,L,X,ee]),z=_.useMemo(()=>lce(le,()=>Ne&&(ee?p4(Ne,ee):void 0)),[le,Ne,ee]),Q=`${Ce}@${ee}/${X}`;function Y(){switch(ne){case"custom":return Un(u),c.jsx(u,{},`${Q}_custom`);case"none":return null;case"canvas":default:return c.jsx(aqe,{canvasRef:a},`${Q}_canvas`)}}function ce(){return L?c.jsx(lqe,{},`${Q}_text`):null}function he(){return $?c.jsx(cqe,{},`${Q}_annotations`):null}function ge(){return c.jsxs(pce.Provider,{value:se,children:[Y(),ce(),he(),o]})}function Ee(){return O?I===null||Ne===void 0||Ne===null?c.jsx(xy,{type:"loading",children:typeof g=="function"?g():g}):I===!1||Ne===!1?c.jsx(xy,{type:"error",children:typeof f=="function"?f():f}):ge():c.jsx(xy,{type:"no-data",children:typeof y=="function"?y():y})}return c.jsx("div",Object.assign({className:g0(r,l),"data-page-number":O,ref:fce(m,Se),style:{"--scale-factor":`${ee}`,backgroundColor:i||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},z,{children:Ee()}))}GWe();oz.workerSrc="pdf.worker.mjs";oz.workerSrc=`//unpkg.com/pdfjs-dist@${oce}/build/pdf.worker.min.mjs`;function hqe({url:n,location:e,settings:t,onLocationChange:r,onTextSelect:s}){const[i,a]=_.useState(0),[o,l]=_.useState(()=>{if(e)try{return JSON.parse(e).page||1}catch{return 1}return 1}),[u,d]=_.useState(600),[h,f]=_.useState(!0),{impact:p}=zie(),{isNative:m,isIOS:g}=$S(),y=_.useRef(null),v=_.useRef(null),x=_.useCallback(({numPages:R})=>{a(R),f(!1)},[]),b=_.useCallback((R,M=!1)=>{const N=Math.max(1,Math.min(R,i));if(N===o)return;l(N);const U=N/i*100;r(JSON.stringify({page:N}),U),M&&p("light")},[i,r,o,p]),E=()=>b(o-1,!0),S=()=>b(o+1,!0),k=_.useCallback(()=>{const R=window.getSelection();R&&R.toString().trim()&&s(R.toString(),JSON.stringify({page:o}))},[o,s]),C=_.useCallback(R=>{const M=R.touches[0];y.current={x:M.clientX,y:M.clientY,time:Date.now()}},[]),A=_.useCallback(R=>
1017{if(!y.current)return;const M=R.changedTouches[0],N=M.clientX-y.current.x,U=M.clientY-y.current.y,q=Date.now()-y.current.time;y.current=null,Math.abs(N)>50&&Math.abs(U)<100&&q<500&&(N>0?b(o-1,!0):b(o+1,!0))},[o,b]),T=_.useCallback(R=>{if(!v.current)return;const M=v.current.getBoundingClientRect(),N=R.clientX-M.left,U=M.width;N<U*.2?b(o-1,!0):N>U*.8&&b(o+1,!0)},[o,b]),j=()=>{switch(t.theme){case"dark":return"bg-[#1a1a2e]";case"sepia":return"bg-[#f4ecd8]";default:return"bg-white"}},D=_.useCallback(R=>{if(v.current=R,R){const M=Math.min(R.clientWidth-40,800);d(M)}},[]);return c.jsxs("div",{ref:D,className:ke("w-full h-full flex flex-col items-center overflow-auto",j()),onMouseUp:k,onTouchStart:C,onTouchEnd:A,onClick:T,children:[h&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:c.jsx(et,{className:"w-8 h-8 animate-spin text-muted-foreground"})}),c.jsx("div",{className:"flex-1 flex items-start justify-center py-4 overflow-auto",children:c.jsx(eqe,{file:n,onLoadSuccess:x,loading:null,className:"pdf-document",children:c.jsx(dqe,{pageNumber:o,width:u,renderTextLayer:!0,renderAnnotationLayer:!0,className:ke("shadow-lg",t.theme==="dark"&&"invert")})})}),c.jsxs("div",{className:ke("sticky bottom-0 w-full p-4 flex items-center justify-center gap-4","bg-background/80 backdrop-blur-sm border-t border-border",m&&g&&"pb-safe-bottom"),children:[c.jsx(xe,{variant:"outline",size:"icon",onClick:E,disabled:o<=1,className:"touch-target",children:c.jsx(CS,{className:"w-5 h-5"})}),c.jsxs("span",{className:"text-sm text-muted-foreground min-w-[120px] text-center",children:["Page ",o," of ",i]}),c.jsx(xe,{variant:"outline",size:"icon",onClick:S,disabled:o>=i,className:"touch-target",children:c.jsx(cd,{className:"w-5 h-5"})})]})]})}function fqe({open:n,onOpenChange:e,settings:t,onSettingsChange:r}){const s=(i,a)=>{r({...t,[i]:a})};return c.jsx(rE,{open:n,onOpenChange:e,children:c.jsxs(B0,{side:"right",className:"w-[300px] sm:w-[350px]",children:[c.jsx(sE,{children:c.jsxs(iE,{className:"flex items-center gap-2",children:[c.jsx(ape,{className:"w-5 h-5"}),"Reading Settings"]})}),c.jsxs("div",{className:"space-y-6 mt-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx(yt,{className:"text-sm font-medium",children:"Font Size"}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-xs text-muted-foreground",children:"A"}),c.jsx(kw,{value:[t.fontSize],onValueChange:([i])=>s("fontSize",i),min:12,max:24,step:1,className:"flex-1"}),c.jsx("span",{className:"text-lg font-medium text-muted-foreground",children:"A"})]}),c.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.fontSize,"px"]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(yt,{className:"text-sm font-medium",children:"Line Spacing"}),c.jsxs(rA,{value:t.lineSpacing,onValueChange:i=>s("lineSpacing",i),className:"flex gap-2",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"compact",id:"compact",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"compact",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted bg-transparent p-3 hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary cursor-pointer",children:[c.jsx(AR,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Compact"})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"normal",id:"normal",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"normal",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted bg-transparent p-3 hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary cursor-pointer",children:[c.jsx(AR,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Normal"})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"relaxed",id:"relaxed",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"relaxed",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted bg-transparent p-3 hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary curs
1017or-pointer",children:[c.jsx(AR,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Relaxed"})]})]})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(yt,{className:"text-sm font-medium",children:"Theme"}),c.jsxs(rA,{value:t.theme,onValueChange:i=>s("theme",i),className:"flex gap-2",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"light",id:"light",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"light",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted bg-white text-gray-900 p-3 hover:bg-gray-50 peer-data-[state=checked]:border-primary cursor-pointer",children:[c.jsx(jO,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Light"})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"sepia",id:"sepia",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"sepia",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted p-3 hover:opacity-90 peer-data-[state=checked]:border-primary cursor-pointer",style:{backgroundColor:"#f4ecd8",color:"#5c4b37"},children:[c.jsx(jO,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Sepia"})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(gu,{value:"dark",id:"dark",className:"peer sr-only"}),c.jsxs(yt,{htmlFor:"dark",className:"flex flex-col items-center justify-center rounded-md border-2 border-muted bg-gray-900 text-white p-3 hover:bg-gray-800 peer-data-[state=checked]:border-primary cursor-pointer",children:[c.jsx(FG,{className:"w-4 h-4 mb-1"}),c.jsx("span",{className:"text-xs",children:"Dark"})]})]})]})]})]})]})})}function xce({item:n,currentHref:e,onNavigate:t,depth:r=0}){var i;const s=e===n.href;return c.jsxs("div",{children:[c.jsx("button",{onClick:()=>t(n.href),className:ke("w-full text-left px-3 py-2 text-sm rounded-md transition-colors","hover:bg-accent hover:text-accent-foreground",s&&"bg-primary/10 text-primary font-medium",r>0&&"pl-6"),style:{paddingLeft:`${12+r*16}px`},children:c.jsx("span",{className:"line-clamp-2",children:n.label})}),(i=n.subitems)==null?void 0:i.map(a=>c.jsx(xce,{item:a,currentHref:e,onNavigate:t,depth:r+1},a.id))]})}function pqe({open:n,onOpenChange:e,items:t,currentHref:r,onNavigate:s}){const i=a=>{s(a),e(!1)};return c.jsx(rE,{open:n,onOpenChange:e,children:c.jsxs(B0,{side:"left",className:"w-[300px] sm:w-[350px] p-0",children:[c.jsx(sE,{className:"p-4 border-b",children:c.jsxs(iE,{className:"flex items-center gap-2",children:[c.jsx(bF,{className:"w-5 h-5"}),"Table of Contents"]})}),c.jsx(Or,{className:"h-[calc(100vh-80px)]",children:c.jsx("div",{className:"p-2",children:t.length>0?t.map(a=>c.jsx(xce,{item:a,currentHref:r,onNavigate:i},a.id)):c.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No table of contents available"})})})]})})}const wq={yellow:"bg-yellow-200 dark:bg-yellow-800/50",green:"bg-green-200 dark:bg-green-800/50",blue:"bg-blue-200 dark:bg-blue-800/50",pink:"bg-pink-200 dark:bg-pink-800/50",purple:"bg-purple-200 dark:bg-purple-800/50"};function mqe({open:n,onOpenChange:e,highlights:t,bookId:r,onNavigate:s}){const i=f$e(),a=l=>{i.mutate({highlightId:l,bookId:r})},o=l=>{s(l),e(!1)};return c.jsx(rE,{open:n,onOpenChange:e,children:c.jsxs(B0,{side:"right",className:"w-[300px] sm:w-[400px] p-0",children:[c.jsx(sE,{className:"p-4 border-b",children:c.jsxs(iE,{className:"flex items-center gap-2",children:[c.jsx(E2,{className:"w-5 h-5"}),"Highlights & Notes"]})}),c.jsx(Or,{className:"h-[calc(100vh-80px)]",children:c.jsx("div",{className:"p-4 space-y-4",children:t.length>0?t.map(l=>c.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-2",children:[c.jsx("div",{className:ke("p-2 rounded text-sm",wq[l.color]||wq.yellow),children:c.jsxs("p",{className:"line-clamp-4 italic",children:['"',l.selected_text,'"']})}),l.note&&c.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[c.jsx(Tf,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),c.jsx("p",{className:"line-clamp-3",children:l.note})]}),c.jsxs("div",{className:"flex items-center justify-between pt-2",children:[c.jsx("span",{className:"text-xs text-muted-foreground",children:EQ(new Date(l.created_at),{addSuffix:!0})}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>o(l.location_range),className:"text-xs",children:"Go to"}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>a(l.id),className:"h-8 w-8 text-destructive hover:text-destructive",children:c.jsx(ao,{className:"w-4 h-4"})})]})]})]},l.id)):c.jsxs("div",{className:"text-center py-12",children:[c.jsx(E2,{className:"w-12 h-12 mx-auto text-muted-foreground
1017/30 mb-3"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No highlights yet"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Select text while reading to highlight it"})]})})})]})})}const gqe=[{label:"Summarize this section",prompt:"Can you summarize the section I'm currently reading?"},{label:"Explain simply",prompt:"Can you explain what I'm reading in simpler terms?"},{label:"Key takeaways",prompt:"What are the key takeaways from this part of the book?"},{label:"Quiz me",prompt:"Quiz me on what I've read so far in this book."}];function vqe({open:n,onOpenChange:e,bookId:t,bookTitle:r,persona:s,currentLocation:i}){const{user:a}=Vt(),[o,l]=_.useState([]),[u,d]=_.useState(""),[h,f]=_.useState(!1),[p,m]=_.useState(null),g=_.useRef(null),y=_.useRef(null);_.useEffect(()=>{n&&a&&!p&&v()},[n,a,p]),_.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[o]);const v=async()=>{if(!a)return;const{data:S}=await pe.from("book_chat_sessions").select("id").eq("user_id",a.id).eq("book_id",t).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(S){m(S.id);const{data:k}=await pe.from("book_chat_messages").select("id, role, content").eq("session_id",S.id).order("created_at",{ascending:!0});k&&l(k.map(C=>({id:C.id,role:C.role,content:C.content})))}else{const{data:k}=await pe.from("book_chat_sessions").insert({user_id:a.id,book_id:t,persona_id:s.id}).select("id").single();k&&m(k.id)}},x=async S=>{if(!S.trim()||!a||!p||h)return;const k={id:`temp-${Date.now()}`,role:"user",content:S.trim()};l(C=>[...C,k]),d(""),f(!0);try{const{data:C}=await pe.from("book_chat_messages").insert({session_id:p,role:"user",content:S.trim(),current_location:i}).select("id").single();C&&l(R=>R.map(M=>M.id===k.id?{...M,id:C.id}:M));const{data:A,error:T}=await pe.functions.invoke("book-companion-chat",{body:{bookId:t,personaId:s.id,messages:[...o,k].map(R=>({role:R.role,content:R.content})),currentLocation:i}});if(T)throw T;const j={id:`temp-assistant-${Date.now()}`,role:"assistant",content:A.content};l(R=>[...R,j]);const{data:D}=await pe.from("book_chat_messages").insert({session_id:p,role:"assistant",content:A.content,current_location:i}).select("id").single();D&&l(R=>R.map(M=>M.id===j.id?{...M,id:D.id}:M))}catch(C){console.error("Chat error:",C),l(A=>[...A,{id:`error-${Date.now()}`,role:"assistant",content:"I apologize, but I encountered an error. Please try again."}])}finally{f(!1)}},b=S=>{S.preventDefault(),x(u)},E=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),x(u))};return c.jsx(rE,{open:n,onOpenChange:e,children:c.jsxs(B0,{side:"bottom",className:"h-[70vh] sm:h-auto sm:max-h-[80vh] rounded-t-xl sm:rounded-none sm:w-[400px] sm:!inset-y-0 sm:!left-auto sm:!right-0 sm:!top-0 sm:!bottom-0 sm:!translate-y-0 p-0 flex flex-col",children:[c.jsx(sE,{className:"p-4 border-b flex-shrink-0",children:c.jsxs("div",{className:"flex items-center gap-3",children:[s.portrait_image_url?c.jsx("img",{src:s.portrait_image_url,alt:s.full_name,className:"w-10 h-10 rounded-full object-cover"}):c.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:c.jsx(Js,{className:"w-5 h-5 text-primary"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx(iE,{className:"text-left",children:s.full_name}),c.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[c.jsx(En,{className:"w-3 h-3"}),c.jsx("span",{className:"truncate",children:r})]})]})]})}),c.jsx(Or,{ref:g,className:"flex-1 p-4",children:o.length===0?c.jsxs("div",{className:"text-center py-8",children:[c.jsx(jS,{className:"w-12 h-12 mx-auto text-primary/30 mb-4"}),c.jsxs("h3",{className:"font-medium mb-2",children:["Chat with ",s.full_name]}),c.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Ask questions about the book as you read"}),c.jsx("div",{className:"space-y-2",children:gqe.map((S,k)=>c.jsx(xe,{variant:"outline",size:"sm",className:"w-full justify-start text-left",onClick:()=>x(S.prompt),disabled:h||!a,children:S.label},k))}),!a&&c.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Sign in to chat with the author"})]}):c.jsxs("div",{className:"space-y-4",children:[o.map(S=>c.jsxs("div",{className:ke("flex gap-3",S.role==="user"&&"flex-row-reverse"),children:[S.role==="assistant"&&s.portrait_image_url&&c.jsx("img",{src:s.portrait_image_url,alt:s.full_name,className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),c.jsx("div",{className:ke("rounded-lg px-3 py-2 max-w-[85%]",S.role==="user"?"bg-primary text-primary-foreground":"bg-muted"),children:c.jsx("p",{className:"text-sm whitespace-pre-wrap",children:S.content})})]},S.id)),h&&c.jsxs("div",{className:"flex gap-3",children:[s.portrait_image_url&&c.jsx("img",{src:s.portrait_image_url,alt:s.full_name,className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),c.jsx("div",{className:"bg-muted rounded-lg px-3 py-2",children:c.jsx(et,{className:"w-4 h-4 animate-spin"})})]})]})}),a&&c.jsx("form",{onSubmit:b,className:"p-4 border-t flex-shrink-0",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Ca,{ref:y,value:u,onChange:S=>d(S.target.value),onKeyDown:E,placeholder:"Ask a question...",className:"min-h-[44px] max-h-[120px] resize-none",disabled:h}),c.jsx(xe,{type:"submit",size:"icon",disabled:!u.trim()||h,children:c.jsx(TS,{className:"w-4 h-4"})})]})})]})})}const yqe=[{name:"yellow",class:"bg-yellow-400"},{name:"green",class:"bg-green-400"},{name:"blue",class:"bg-blue-400"},{name:"pink",class:"bg-pink-400"},{name:"purple",class:"bg-purple-400"}];function xqe({position:n,onHighlight:e,onDismiss:t}){const[r,s]=_.useState(!1),[i,a]=_.useState(""),[o,l]=_.useState("yellow"),u=h=>{r?e(h,i||void 0):e(h)},d={position:"fixed",left:`${Math.min(Math.max(n.x-100,10),window.innerWidth-220)}px`,top:`${Math.max(n.y-(r?180:60),10)}px`,zIndex:9999};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:t}),c.jsxs("div",{style:d,className:ke("bg-popover border rounded-lg shadow-lg p-2","animate-in fade-in-0 zoom-in-95"),children:[c.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[yqe.map(h=>c.jsx("button",{onClick:()=>{l(h.name),r||u(h.name)},className:ke("w-6 h-6 rounded-full transition-transform hover:scale-110",h.class,o===h.name&&r&&"ring-2 ring-offset-2 ring-foreground"),title:`Highlight ${h.name}`},h.name)),c.jsx("div",{className:"w-px h-6 bg-border mx-1"}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>s(!r),title:"Add note",children:c.jsx(Tf,{className:"w-4 h-4"})}),c.jsx(xe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t,children:c.jsx(Ho,{className:"w-4 h-4"})})]}),r&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ca,{value:i,onChange:h=>a(h.target.value),placeholder:"Add a note...",className:"min-h-[80px] text-sm",autoFocus:!0}),c.jsxs(xe,{size:"sm",className:"w-full",onClick:()=>u(o),children:[c.jsx(E2,{className:"w-4 h-4 mr-2"}),"Save highlight"]})]})]})]})}function J1(n){if(!n)return"";let e=n;return e=e.replace(/^\/+/,""),e.startsWith("books/")&&(e=e.slice(6)),e}function Od(n){var t;const e=n.error;return{bookId:n.bookId,rawFilePath:n.rawFilePath,normalizedPath:n.normalizedPath,format:n.format??"unknown",isPublic:n.isPublic,userId:n.userId,stage:n.stage,errorCode:(e==null?void 0:e.statusCode)||((t=e==null?void 0:e.status)==null?void 0:t.toString())||(e==null?void 0:e.name)||null,errorMessage:(e==null?void 0:e.message)||null,blobSize:n.blobSize??null,blobType:n.blobType??null,magicBytes:n.magicBytes??null,validationError:n.validationError??null,downloadMs:n.downloadMs??null,totalMs:n.totalMs??null,timestamp:new Date().toISOString()}}function _q(n){const e=[`Book ID: ${n.bookId}`,`Format: ${n.format}`,`Raw file_path: ${n.rawFilePath??"(null)"}`,`Normalized path: ${n.normalizedPath||"(empty)"}`,`Is public: ${n.isPublic}`,`User ID: ${n.userId??"(not authenticated)"}`,`Stage: ${n.stage}`];return n.blobSize!==null&&e.push(`Blob size: ${n.blobSize} bytes`),n.blobType&&e.push(`Blob type: ${n.blobType}`),n.magicBytes&&e.push(`Magic bytes: ${n.magicBytes}`),n.validationError&&e.push(`Validation error: ${n.validationError}`),n.downloadMs!==null&&e.push(`Download time: ${n.downloadMs}ms`),n.totalMs!==null&&e.push(`Total time: ${n.totalMs}
1017ms`),n.errorCode&&e.push(`Error code: ${n.errorCode}`),n.errorMessage&&e.push(`Error message: ${n.errorMessage}`),e.push(`Timestamp: ${n.timestamp}`),e.join(`
1018`)}function bqe({debugInfo:n,requiresAuth:e,onRetry:t}){var f,p;const r=vr(),[s,i]=_.useState(!1),a=async()=>{try{await navigator.clipboard.writeText(_q(n)),i(!0),Ye.success("Debug info copied"),setTimeout(()=>i(!1),2e3)}catch{Ye.error("Failed to copy")}},o=!!n.validationError,l=((f=n.errorMessage)==null?void 0:f.includes("timeout"))||((p=n.validationError)==null?void 0:p.includes("timeout")),u=()=>e?"Sign in required":o?"Invalid file format":l?"Loading timed out":"Could not load this book",d=()=>e?"This book is private and requires authentication. Please sign in to access it.":n.validationError?n.validationError:n.errorMessage?n.errorMessage:"The book file could not be loaded. This may be a storage configuration issue or the file may be corrupted.",h=()=>o?c.jsx(Ffe,{className:"w-12 h-12 text-destructive mx-auto mb-4"}):c.jsx(ipe,{className:"w-12 h-12 text-warning mx-auto mb-4"});return c.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",children:c.jsxs(mt,{className:"max-w-lg w-full",children:[c.jsxs(Ln,{className:"text-center pb-2",children:[!e&&h(),c.jsx(Wn,{className:"text-xl",children:u()})]}),c.jsxs(kt,{className:"space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground text-center",children:d()}),!e&&c.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-xs space-y-1",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Format:"}),c.jsx("span",{className:"font-medium",children:n.format.toUpperCase()})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Stage:"}),c.jsx("span",{className:"font-medium",children:n.stage})]}),n.blobSize!==null&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"File size:"}),c.jsxs("span",{className:"font-medium",children:[(n.blobSize/1024).toFixed(1)," KB"]})]}),n.magicBytes&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Magic bytes:"}),c.jsx("span",{className:"font-mono",children:n.magicBytes})]})]}),c.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[e?c.jsxs(xe,{onClick:()=>r("/auth"),children:[c.jsx(Gfe,{className:"w-4 h-4 mr-2"}),"Sign in"]}):c.jsxs(xe,{onClick:t,children:[c.jsx(AS,{className:"w-4 h-4 mr-2"}),"Try again"]}),c.jsxs(xe,{variant:"outline",onClick:()=>r("/library"),children:[c.jsx(Ji,{className:"w-4 h-4 mr-2"}),"Back to Library"]})]}),c.jsxs("details",{className:"mt-6",children:[c.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Show full debug info"}),c.jsx("div",{className:"mt-2 p-3 bg-muted rounded-md text-xs font-mono whitespace-pre-wrap break-all max-h-64 overflow-y-auto",children:_q(n)}),c.jsx(xe,{variant:"ghost",size:"sm",className:"mt-2 text-xs",onClick:a,children:s?c.jsxs(c.Fragment,{children:[c.jsx(Go,{className:"w-3 h-3 mr-1"}),"Copied"]}):c.jsxs(c.Fragment,{children:[c.jsx(vF,{className:"w-3 h-3 mr-1"}),"Copy debug info"]})})]})]})]})})}var bce={exports:{}};/*!
1019
1020JSZip v3.10.1 - A JavaScript class for generating and reading zip files
1021<http://stuartk.com/jszip>
1022
1023(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
1024Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
1025
1026JSZip uses the library pako released under the MIT license :
1027https://github.com/nodeca/pako/blob/main/LICENSE
1028*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,s,i){function a(u,d){if(!s[u]){if(!r[u]){var h=typeof Oo=="function"&&Oo;if(!d&&h)return h(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=s[u]={exports:{}};r[u][0].call(p.exports,function(m){var g=r[u][1][m];return a(g||m)},p,p.exports,t,r,s,i)}return s[u].exports}for(var o=typeof Oo=="function"&&Oo,l=0;l<i.length;l++)a(i[l]);return a}({1:[function(t,r,s){var i=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 10,602 bytes, lines 1028-1029
1028+/=";s.encode=function(l){for(var u,d,h,f,p,m,g,y=[],v=0,x=l.length,b=x,E=i.getTypeOf(l)!=="string";v<l.length;)b=x-v,h=E?(u=l[v++],d=v<x?l[v++]:0,v<x?l[v++]:0):(u=l.charCodeAt(v++),d=v<x?l.charCodeAt(v++):0,v<x?l.charCodeAt(v++):0),f=u>>2,p=(3&u)<<4|d>>4,m=1<b?(15&d)<<2|h>>6:64,g=2<b?63&h:64,y.push(o.charAt(f)+o.charAt(p)+o.charAt(m)+o.charAt(g));return y.join("")},s.decode=function(l){var u,d,h,f,p,m,g=0,y=0,v="data:";if(l.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var x,b=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&b--,l.charAt(l.length-2)===o.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=a.uint8array?new Uint8Array(0|b):new Array(0|b);g<l.length;)u=o.indexOf(l.charAt(g++))<<2|(f=o.indexOf(l.charAt(g++)))>>4,d=(15&f)<<4|(p=o.indexOf(l.charAt(g++)))>>2,h=(3&p)<<6|(m=o.indexOf(l.charAt(g++))),x[y++]=u,p!==64&&(x[y++]=d),m!==64&&(x[y++]=h);return x}},{"./support":30,"./utils":32}],2:[function(t,r,s){var i=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function u(d,h,f,p,m){this.compressedSize=d,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("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 a(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 o).pipe(new l("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,s){var i=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,s){var i=t("./utils"),a=function(){for(var o,l=[],u=0;u<256;u++){o=u;for(var d=0;d<8;d++)o=1&o?3988292384^o>>>1:o>>>1;l[u]=o}return l}();r.exports=function(o,l){return o!==void 0&&o.length?i.getTypeOf(o)!=="string"?function(u,d,h,f){var p=a,m=f+h;u^=-1;for(var g=f;g<m;g++)u=u>>>8^p[255&(u^d[g])];return-1^u}(0|l,o,o.length,0):function(u,d,h,f){var p=a,m=f+h;u^=-1;for(var g=f;g<m;g++)u=u>>>8^p[255&(u^d.charCodeAt(g))];return-1^u}(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(t,r,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(t,r,s){var i=null;i=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:i}},{lie:37}],7:[function(t,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),u=i?"uint8array":"array";function d(h,f){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}s.magic="\b\0",o.inherits(d,l),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,h.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[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(t,r,s){function i(p,m){var g,y="";for(g=0;g<m;g++)y+=String.fromCharCode(255&p),p>>>=8;return y}function a(p,m,g,y,v,x){var b,E,S=p.file,k=p.compression,C=x!==u.utf8encode,A=o.transformTo("string",x(S.name)),T=o.transformTo("string",u.utf8encode(S.name)),j=S.comment,D=o.transformTo("string",x(j)),R=o.transformTo("string",u.utf8encode(j)),M=T.length!==S.name.length,N=R.length!==j.length,U="",q="",I="",B=S.dir,$=S.date,ie={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(ie.crc32=p.crc32,ie.compressedSize=p.compressedSize,ie.uncompressedSize=p.uncompressedSize);var ne=0;m&&(ne|=8),C||!M&&!N||(ne|=2048);var L=0,te=0;B&&(L|=16),v==="UNIX"?(te=798,L|=function(de,ue){var le=de;return de||(le=ue?16893:33204),(65535&le)<<16}(S.unixPermissions,B)):(te=20,L|=function(de){return 63&(de||0)}(S.dosPermissions)),b=$.getUTCHours(),b<<=6,b|=$.getUTCMinutes(),b<<=5,b|=$.getUTCSeconds()/2,E=$.getUTCFullYear()-1980,E<<=4,E|=$.getUTCMonth()+1,E<<=5,E|=$.getUTCDate(),M&&(q=i(1,1)+i(d(A),4)+T,U+="up"+i(q.length,2)+q),N&&(I=i(1,1)+i(d(D),4)+R,U+="uc"+i(I.length,2)+I);var ae="";return ae+=`
1029\0`,ae+=i(ne,2),ae+=k.magic,ae+=i(b,2),ae+=i(E,2),ae+=i(ie.crc32,4),ae+=i(ie.compressedSize,4),ae+=i(ie.uncompressedSize,4),ae+=i(A.length,2),ae+=i(U.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ae+A+U,dirRecord:h.CENTRAL_FILE_HEADER+i(te,2)+ae+i(D.length,2)+"\0\0\0\0"+i(L,4)+i(y,4)+A+U+D}}var o=t("../utils"),l=t("../stream/GenericWorker"),u=t("../utf8"),d=t("../crc32"),h=t("../signature");function f(p,m,g,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=y,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,l),f.prototype.push=function(p){var m=p.meta.percent||0,g=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-y-1))/g:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var m=this.streamFiles&&!p.file.dir;if(m){var g=a(p,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var m=this.streamFiles&&!p.file.dir,g=a(p,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:function(y){return h.DATA_DESCRIPTOR+i(y.crc32,4)+i(y.compressedSize,4)+i(y.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var g=this.bytesWritten-p,y=function(v,x,b,E,S){var k=o.transformTo("string",S(E));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(v,2)+i(v,2)+i(x,4)+i(b,4)+i(k.length,2)+k}(this.dirRecords.length,g,p,this.zipComment,this.encodeFileName);this.push({data:y,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 m=this;return p.on("data",function(g){m.processChunk(g)}),p.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),p.on("error",function(g){m.error(g)}),this},f.prototype.resume=function(){return!!l.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 m=this._sources;if(!l.prototype.error.call(this,p))return!1;for(var g=0;g<m.length;g++)try{m[g].error(p)}catch{}return!0},f.prototype.lock=function(){l.prototype.lock.call(this);for(var p=this._sources,m=0;m<p.length;m++)p[m].lock()},r.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,r,s){var i=t("../compressions"),a=t("./ZipFileWorker");s.generateWorker=function(o,l,u){var d=new a(l.streamFiles,u,l.platform,l.encodeFileName),h=0;try{o.forEach(function(f,p){h++;var m=function(x,b){var E=x||b,S=i[E];if(!S)throw new Error(E+" is not a valid compression method !");return S}(p.options.compression,l.compression),g=p.options.compressionOptions||l.compressionOptions||{},y=p.dir,v=p.date;p._compressWorker(m,g).withStreamInfo("file",{name:f,dir:y,date:v,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(t,r,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 a=new i;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}(i.prototype=t("./object")).loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.10.1",i.loadAsync=function(a,o){return new i().loadAsync(a,o)},i.external=t("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,r,s){var i=t("./utils"),a=t("./external"),o=t("./utf8"),l=t("./zipEntries"),u=t("./stream/Crc32Probe"),d=t("./nodejsUtils");function h(f){return new a.Promise(function(p,m){var g=f.decompressed.getContentWorker().pipe(new u);g.on("error",function(y){m(y)}).on("end",function(){g.streamInfo.crc32!==f.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(f,p){var m=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),d.isNode&&d.isStream(f)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip f
1029ile",f,!0,p.optimizedBinaryString,p.base64).then(function(g){var y=new l(p);return y.load(g),y}).then(function(g){var y=[a.Promise.resolve(g)],v=g.files;if(p.checkCRC32)for(var x=0;x<v.length;x++)y.push(h(v[x]));return a.Promise.all(y)}).then(function(g){for(var y=g.shift(),v=y.files,x=0;x<v.length;x++){var b=v[x],E=b.fileNameStr,S=i.resolve(b.fileNameStr);m.file(S,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||(m.file(S).unsafeOriginalName=E)}return y.zipComment.length&&(m.comment=y.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,r,s){var i=t("../utils"),a=t("../stream/GenericWorker");function o(l,u){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(o,a),o.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.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()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,r,s){var i=t("readable-stream").Readable;function a(o,l,u){i.call(this,l),this._helper=o;var d=this;o.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)})}t("../utils").inherits(a,i),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(t,r,s){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,a);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,a)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var a=new Buffer(i);return a.fill(0),a},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(t,r,s){function i(S,k,C){var A,T=o.getTypeOf(k),j=o.extend(C||{},d);j.date=j.date||new Date,j.compression!==null&&(j.compression=j.compression.toUpperCase()),typeof j.unixPermissions=="string"&&(j.unixPermissions=parseInt(j.unixPermissions,8)),j.unixPermissions&&16384&j.unixPermissions&&(j.dir=!0),j.dosPermissions&&16&j.dosPermissions&&(j.dir=!0),j.dir&&(S=v(S)),j.createFolders&&(A=y(S))&&x.call(this,A,!0);var D=T==="string"&&j.binary===!1&&j.base64===!1;C&&C.binary!==void 0||(j.binary=!D),(k instanceof h&&k.uncompressedSize===0||j.dir||!k||k.length===0)&&(j.base64=!1,j.binary=!0,k="",j.compression="STORE",T="string");var R=null;R=k instanceof h||k instanceof l?k:m.isNode&&m.isStream(k)?new g(S,k):o.prepareContent(S,k,j.binary,j.optimizedBinaryString,j.base64);var M=new f(S,R,j);this.files[S]=M}var a=t("./utf8"),o=t("./utils"),l=t("./stream/GenericWorker"),u=t("./stream/StreamHelper"),d=t("./defaults"),h=t("./compressedObject"),f=t("./zipObject"),p=t("./generate"),m=t("./nodejsUtils"),g=t("./nodejs/NodejsStreamInputAdapter"),y=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var k=S.lastIndexOf("/");return 0<k?S.substring(0,k):""},v=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},x=function(S,k){return k=k!==void 0?k:d.createFolders,S=v(S),this.files[S]||i.call(this,S,null,{dir:!0,createFolders:k}),this.files[S]};function b(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var k,C,A;for(k in this.files)A=this.files[k],(C=k.slice(this.root.length,k.length))&&k.slice(0,this.root.length)===this.root&&S(C,A)},filter:function(S){var k=[];return this.forEach(function(C,A){S(C,A)&&k.push(A)}),k},file:function(S,k,C){if(arguments.length!==1)return S=this.root+S,i.call(this,S,k,C),this;if(b(S)){var A=S;return this.filter(function(j,D){return!D.dir&&A.test(j)})}var T=this.files[this.root+S];return T&&!T.dir?T:null},folder:function(S){if(!S)return this;if(b(S))return this.filter(function(T,j){return j.dir&&S.test(T)});var k=this.root+S,C=x.call(this,k),A=this.clone();return A.root=C.name,A},remove:function(S){S=this.root+S;var k=this.files[S];if(k||(S.slice(-1)!=="/"&&(S+="/"),k=this.files[S]),k&&!k.dir)delete this.files[S];else for(var C=this.filter(function(T,j){return j.name.slice(0,S.length)===S}),A=0;A<C.length;A++)delete this.files[C[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")}
vendor: 22,011 bytes, line 1029
1029,generateInternalStream:function(S){var k,C={};try{if((C=o.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.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.");o.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 A=C.comment||this.comment||"";k=p.generateWorker(this,C,A)}catch(T){(k=new l("error")).error(T)}return new u(k,C.type||"string",C.mimeType)},generateAsync:function(S,k){return this.generateInternalStream(S).accumulate(k)},generateNodeStream:function(S,k){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(k)}};r.exports=E},{"./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(t,r,s){r.exports=t("stream")},{stream:void 0}],17:[function(t,r,s){var i=t("./DataReader");function a(o){i.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}t("../utils").inherits(a,i),a.prototype.byteAt=function(o){return this.data[this.zero+o]},a.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),u=o.charCodeAt(1),d=o.charCodeAt(2),h=o.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===l&&this.data[f+1]===u&&this.data[f+2]===d&&this.data[f+3]===h)return f-this.zero;return-1},a.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),u=o.charCodeAt(1),d=o.charCodeAt(2),h=o.charCodeAt(3),f=this.readData(4);return l===f[0]&&u===f[1]&&d===f[2]&&h===f[3]},a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(t,r,s){var i=t("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,u=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=o,u},readString:function(o){return i.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,s){var i=t("./Uint8ArrayReader");function a(o){i.call(this,o)}t("../utils").inherits(a,i),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,s){var i=t("./DataReader");function a(o){i.call(this,o)}t("../utils").inherits(a,i),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,r,s){var i=t("./ArrayReader");function a(o){i.call(this,o)}t("../utils").inherits(a,i),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,s){var i=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),u=t("./NodeBufferReader"),d=t("./Uint8ArrayReader");r.exports=function(h){var f=i.getTypeOf(h);return i.checkSupport(f),f!=="string"||a.uint8array?f==="nodebuffer"?new u(h):a.uint8array?new d(i.transformTo("uint8array",h)):new o(i.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,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(t,r,s){var i=t("./GenericWorker"),a=t("../utils");function o(l){i.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,i),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,s){var i=t("./GenericWorker"),a=t("../crc32");function o(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,i),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,s){var i=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(o,a),o.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,s){var i=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.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(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,s){function i(a){this.name=a||"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(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(l){o.processChunk(l)}),a.on("end",function(){o.end()}),a.on("error",function(l){o.error(l)}),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 a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},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 a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=i},{}],29:[function(t,r,s){var i=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),u=t("../support"),d=t("../external"),h=null;if(u.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(m,g){return new d.Promise(function(y,v){var x=[],b=m._internalType,E=m._outputType,S=m._mimeType;m.on("data",function(k,C){x.push(k),g&&g(C)}).on("error",function(k){x=[],v(k)}).on("end",function(){try{var k=function(C,A,T){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",A),T);case"base64":return l.encode(A);default:return i.transformTo(C,A)}}(E,function(C,A){var T,j=0,D=null,R=0;for(T=0;T<A.length;T++)R+=A[T].length;switch(C){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(D=new Uint8Array(R),T=0;T<A.length;T++)D.set(A[T],j),j+=A[T].length;return D;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,x),S);y(k)}catch(C){v(C)}x=[]}).resume()})}function p(m,g,y){var v=g;switch(g){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=g,this._mimeType=y,i.checkSupport(v),this._worker=m.pipe(new a(v)),m.lock()}catch(x){this._worker=new o("error"),this._worker.error(x)}}p.prototype={accumulate:function(m){return f(this,m)},on:function(m,g){var y=this;return m==="data"?this._worker.on(m,function(v){g.call(y,v.data,v.meta)}):this._worker.on(m,function(){i.delay(g,arguments,y)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){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"},m)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,r,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 a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(i),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,s){for(var i=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./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(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}s.utf8encode=function(p){return a.nodebuffer?o.newBufferFrom(p,"utf-8"):function(m){var g,y,v,x,b,E=m.length,S=0;for(x=0;x<E;x++)(64512&(y=m.charCodeAt(x)))==55296&&x+1<E&&(64512&(v=m.charCodeAt(x+1)))==56320&&(y=65536+(y-55296<<10)+(v-56320),x++),S+=y<128?1:y<2048?2:y<65536?3:4;for(g=a.uint8array?new Uint8Array(S):new Array(S),x=b=0;b<S;x++)(64512&(y=m.charCodeAt(x)))==55296&&x+1<E&&(64512&(v=m.charCodeAt(x+1)))==56320&&(y=65536+(y-55296<<10)+(v-56320),x++),y<128?g[b++]=y:(y<2048?g[b++]=192|y>>>6:(y<65536?g[b++]=224|y>>>12:(g[b++]=240|y>>>18,g[b++]=128|y>>>12&63),g[b++]=128|y>>>6&63),g[b++]=128|63&y);return g}(p)},s.utf8decode=function(p){return a.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(m){var g,y,v,x,b=m.length,E=new Array(2*b);for(g=y=0;g<b;)if((v=m[g++])<128)E[y++]=v;else if(4<(x=u[v]))E[y++]=65533,g+=x-1;else{for(v&=x===2?31:x===3?15:7;1<x&&g<b;)v=v<<6|63&m[g++],x--;1<x?E[y++]=65533:v<65536?E[y++]=v:(v-=65536,E[y++]=55296|v>>10&1023,E[y++]=56320|1023&v)}return E.length!==y&&(E.subarray?E=E.subarray(0,y):E.length=y),i.applyFromCharCode(E)}(p=i.transformTo(a.uint8array?"uint8array":"array",p))},i.inherits(h,l),h.prototype.processChunk=function(p){var m=i.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var y=function(x,b){var E;for((b=b||x.length)>x.length&&(b=x.length),E=b-1;0<=E&&(192&x[E])==128;)E--;return E<0||E===0?b:E+u[x[E]]>b?E:b}(m),v=m;y!==m.length&&(a.uint8array?(v=m.subarray(0,y),this.leftOver=m.subarray(y,m.length)):(v=m.slice(0,y),this.leftOver=m.slice(y,m.length))),this.push({data:s.utf8decode(v),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,l),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(t,r,s){var i=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");function u(g){return g}function d(g,y){for(var v=0;v<g.length;++v)y[v]=255&g.charCodeAt(v);return y}t("setimmediate"),s.newBlob=function(g,y){s.checkSupport("blob");try{return new Blob([g],{type:y})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(g),v.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(g,y,v){var x=[],b=0,E=g.length;if(E<=v)return String.fromCharCode.apply(null,g);for(;b<E;)y==="array"||y==="nodebuffer"?x.push(String.fromCharCode.apply(null,g.slice(b,Math.min(b+v,E)))):x.push(String.fromCharCode.apply(null,g.subarray(b,Math.min(b+v,E)))),b+=v;return x.join("")},stringifyByChar:function(g){for(var y="",v=0;v<g.length;v++)y+=String.fromCharCode(g[v]);return y},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,o.allocBuffer(1)).length===1}catch{return!1}}()}};function f(g){var y=65536,v=s.getTypeOf(g),x=!0;if(v==="uint8array"?x=h.applyCanBeUsed.uint8array:v==="nodebuffer"&&(x=h.applyCanBeUsed.nodebuffer),x)for(;1<y;)try{return h.stringifyByChunk(g,v,y)}catch{y=Math.floor(y/2)}return h.stringifyByChar(g)}function p(g,y){for(var v=0;v<g.length;v++)y[v]=g[v];return y}s.applyFromCharCode=f;var m={};m.string={string:u,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return m.string.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:function(g){return d(g,o.allocBuffer(g.length))}},m.array={string:f,array:u,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return o.newBufferFrom(g)}},m.arraybuffer={string:function(g){return f(new Uint8Array(g))},array:function(g){return p(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:u,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return o.newBufferFrom(new Uint8Array(g))}},m.uint8array={string:f,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:u,nodebuffer:function(g){return o.newBufferFrom(g)}},m.nodebuffer={string:f,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return m.nodebuffer.uint8array(g).buffer},uint8array:function(g){return p(g,new Uint8Array(g.length))},nodebuffer:u},s.transformTo=function(g,y){if(y=y||"",!g)return y;s.checkSupport(g);var v=s.getTypeOf(y);return m[v][g](y)},s.resolve=function(g){for(var y=g.split("/"),v=[],x=0;x<y.length;x++){var b=y[x];b==="."||b===""&&x!==0&&x!==y.length-1||(b===".."?v.pop():v.push(b))}return v.join("/")},s.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":i.nodebuffer&&o.isBuffer(g)?"nodebuffer":i.uint8array&&g instanceof Uint8Array?"uint8array":i.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(g){if(!i[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(g){var y,v,x="";for(v=0;v<(g||"").length;v++)x+="\\x"+((y=g.charCodeAt(v))<16?"0":"")+y.toString(16).toUpperCase();return x},s.delay=function(g,y,v){setImmediate(function(){g.apply(v||null,y||[])})},s.inherits=function(g,y){function v(){}v.prototype=y.prototype,g.prototype=new v},s.extend=function(){var g,y,v={};for(g=0;g<arguments.length;g++)for(y in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],y)&&v[y]===void 0&&(v[y]=arguments[g][y]);return v},s.prepareContent=function(g,y,v,x,b){return l.Promise.resolve(y).then(function(E){return i.blob&&(E instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(E))!==-1)&&typeof FileReader<"u"?new l.Promise(function(S,k){var C=new FileReader;C.onload=function(A){S(A.target.result)},C.onerror=function(A){k(A.target.error)},C.readAsArrayBuffer(E)}):E}).then(function(E){var S=s.getTypeOf(E);return S?(S==="arraybuffer"?E=s.transformTo("uint8array",E):S==="string"&&(b?E=a.decode(E):v&&x!==!0&&(E=function(k){return d(k,i.uint8array?new Uint8Array(k.length):new Array(k.length))}(E))),E):l.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,r,s){var i=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),l=t("./zipEntry"),u=t("./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 ("+a.pretty(f)+", expected "+a.pretty(h)+")")}},isSignature:function(h,f){var p=this.reader.index;this.reader.setIndex(h);var m=this.reader.readString(4)===f;return this.reader.setIndex(p),m},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=a.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,m=this.zip64EndOfCentralSize-44;0<m;)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(o.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(h=new l({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(o.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,o.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 f
1029ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var f=h;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var m=f-p;if(0<m)this.isSignature(f,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,r,s){var i=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),l=t("./crc32"),u=t("./utf8"),d=t("./compressions"),h=t("./support");function f(p,m){this.options=p,this.loadOptions=m}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var m,g;if(p.skip(22),this.fileNameLength=p.readInt(2),g=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(g),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((m=function(y){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===y)return d[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,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 m=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(m),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===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&
vendor: 7,719 bytes, line 1029
1029(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var m,g,y,v=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<v;)m=p.readInt(2),g=p.readInt(2),y=p.readData(g),this.extraFields[m]={id:m,length:g,value:y};p.setIndex(v)},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 m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var g=a.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var v=a.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var m=i(p.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var m=i(p.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(p.length-5))}return null}},r.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,r,s){function i(m,g,y){this.name=m,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=g,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var a=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),l=t("./utf8"),u=t("./compressedObject"),d=t("./stream/GenericWorker");i.prototype={internalStream:function(m){var g=null,y="string";try{if(!m)throw new Error("No output type specified.");var v=(y=m.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),g=this._decompressWorker();var x=!this._dataBinary;x&&!v&&(g=g.pipe(new l.Utf8EncodeWorker)),!x&&v&&(g=g.pipe(new l.Utf8DecodeWorker))}catch(b){(g=new d("error")).error(b)}return new a(g,y,"")},async:function(m,g){return this.internalStream(m).accumulate(g)},nodeStream:function(m,g){return this.internalStream(m||"nodebuffer").toNodejsStream(g)},_compressWorker:function(m,g){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(y,m,g)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new o(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;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,r,s){(function(i){var a,o,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),a=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)a="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var g=i.document.createElement("script");g.onreadystatechange=function(){m(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},i.document.documentElement.appendChild(g)}:function(){setTimeout(m,0)};else{var f=new i.MessageChannel;f.port1.onmessage=m,a=function(){f.port2.postMessage(0)}}var p=[];function m(){var g,y;o=!0;for(var v=p.length;v;){for(y=p,p=[],g=-1;++g<v;)y[g]();v=p.length}o=!1}r.exports=function(g){p.push(g)!==1||o||a()}}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,r,s){var i=t("immediate");function a(){}var o={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,v!==a&&g(this,v)}function f(v,x,b){this.promise=v,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function p(v,x,b){i(function(){var E;try{E=x(b)}catch(S){return o.reject(v,S)}E===v?o.reject(v,new TypeError("Cannot resolve promise with itself")):o.resolve(v,E)})}function m(v){var x=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof x=="function")return function(){x.apply(v,arguments)}}function g(v,x){var b=!1;function E(C){b||(b=!0,o.reject(v,C))}function S(C){b||(b=!0,o.resolve(v,C))}var k=y(function(){x(S,E)});k.status==="error"&&E(k.value)}function y(v,x){var b={};try{b.value=v(x),b.status="success"}catch(E){b.status="error",b.value=E}return b}(r.exports=h).prototype.finally=function(v){if(typeof v!="function")return this;var x=this.constructor;return this.then(function(b){return x.resolve(v()).then(function(){return b})},function(b){return x.resolve(v()).then(function(){throw b})})},h.prototype.catch=function(v){return this.then(null,v)},h.prototype.then=function(v,x){if(typeof v!="function"&&this.state===u||typeof x!="function"&&this.state===l)return this;var b=new this.constructor(a);return this.state!==d?p(b,this.state===u?v:x,this.outcome):this.queue.push(new f(b,v,x)),b},f.prototype.callFulfilled=function(v){o.resolve(this.promise,v)},f.prototype.otherCallFulfilled=function(v){p(this.promise,this.onFulfilled,v)},f.prototype.callRejected=function(v){o.reject(this.promise,v)},f.prototype.otherCallRejected=function(v){p(this.promise,this.onRejected,v)},o.resolve=function(v,x){var b=y(m,x);if(b.status==="error")return o.reject(v,b.value);var E=b.value;if(E)g(v,E);else{v.state=u,v.outcome=x;for(var S=-1,k=v.queue.length;++S<k;)v.queue[S].callFulfilled(x)}return v},o.reject=function(v,x){v.state=l,v.outcome=x;for(var b=-1,E=v.queue.length;++b<E;)v.queue[b].callRejected(x);return v},h.resolve=function(v){return v instanceof this?v:o.resolve(new this(a),v)},h.reject=function(v){var x=new this(a);return o.reject(x,v)},h.all=function(v){var x=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=v.length,E=!1;if(!b)return this.resolve([]);for(var S=new Array(b),k=0,C=-1,A=new this(a);++C<b;)T(v[C],C);return A;function T(j,D){x.resolve(j).then(function(R){S[D]=R,++k!==b||E||(E=!0,o.resolve(A,S))},function(R){E||(E=!0,o.reject(A,R))})}},h.race=function(v){var x=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=v.length,E=!1;if(!b)return this.resolve([]);for(var S=-1,k=new this(a);++S<b;)C=v[S],x.resolve(C).then(function(A){E||(E=!0,o.resolve(k,A))},function(A){E||(E=!0,o.reject(k,A))});var C;return k}},{immediate:36}],38:[function(t,r,s){var i={};(0,t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,r,s){var i=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/messages"),u=t("./zlib/zstream"),d=Object.prototype.toString,h=0,f=-1,p=0,m=8;function g(v){if(!(this instanceof g))return new g(v);this.options=a.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},v||{});var x=this.options;
vendor: 4,869 bytes, line 1029
1029x.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(l[b]);if(x.header&&i.deflateSetHeader(this.strm,x.header),x.dictionary){var E;if(E=typeof x.dictionary=="string"?o.string2buf(x.dictionary):d.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(b=i.deflateSetDictionary(this.strm,E))!==h)throw new Error(l[b]);this._dict_set=!0}}function y(v,x){var b=new g(x);if(b.push(v,!0),b.err)throw b.msg||l[b.err];return b.result}g.prototype.push=function(v,x){var b,E,S=this.strm,k=this.options.chunkSize;if(this.ended)return!1;E=x===~~x?x:x===!0?4:0,typeof v=="string"?S.input=o.string2buf(v):d.call(v)==="[object ArrayBuffer]"?S.input=new Uint8Array(v):S.input=v,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(k),S.next_out=0,S.avail_out=k),(b=i.deflate(S,E))!==1&&b!==h)return this.onEnd(b),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||E!==4&&E!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&b!==1);return E===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h):E!==2||(this.onEnd(h),!(S.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},s.Deflate=g,s.deflate=y,s.deflateRaw=function(v,x){return(x=x||{}).raw=!0,y(v,x)},s.gzip=function(v,x){return(x=x||{}).gzip=!0,y(v,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,r,s){var i=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/constants"),u=t("./zlib/messages"),d=t("./zlib/zstream"),h=t("./zlib/gzheader"),f=Object.prototype.toString;function p(g){if(!(this instanceof p))return new p(g);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},g||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||g&&g.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&!(15&y.windowBits)&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var v=i.inflateInit2(this.strm,y.windowBits);if(v!==l.Z_OK)throw new Error(u[v]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function m(g,y){var v=new p(y);if(v.push(g,!0),v.err)throw v.msg||u[v.err];return v.result}p.prototype.push=function(g,y){var v,x,b,E,S,k,C=this.strm,A=this.options.chunkSize,T=this.options.dictionary,j=!1;if(this.ended)return!1;x=y===~~y?y:y===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof g=="string"?C.input=o.binstring2buf(g):f.call(g)==="[object ArrayBuffer]"?C.input=new Uint8Array(g):C.input=g,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new a.Buf8(A),C.next_out=0,C.avail_out=A),(v=i.inflate(C,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&T&&(k=typeof T=="string"?o.string2buf(T):f.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,v=i.inflateSetDictionary(this.strm,k)),v===l.Z_BUF_ERROR&&j===!0&&(v=l.Z_OK,j=!1),v!==l.Z_STREAM_END&&v!==l.Z_OK)return this.onEnd(v),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&v!==l.Z_STREAM_END&&(C.avail_in!==0||x!==l.Z_FINISH&&x!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=o.utf8border(C.output,C.next_out),E=C.next_out-b,S=o.buf2string(C.output,b),C.next_out=E,C.avail_out=A-E,E&&a.arraySet(C.output,C.output,b,E,0),this.onData(S)):this.onData(a.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(j=!0)}while((0<C.avail_in||C.avail_out===0)&&v!==l.Z_STREAM_END);return v===l.Z_STREAM_END&&(x=l.Z_FINISH),x===l.Z_FINISH?(v=i.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===l.Z_OK):x!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(C.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Inflate=p,s.inflate=m,s.inflateRaw=function(g,y){return(y=y||{}).raw=!0,m(g,y)},s.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1
vendor: 17,774 bytes, line 1029
1029);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)&&(l[h]=d[h])}}return l},s.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var a={arraySet:function(l,u,d,h,f){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+h),f);else for(var p=0;p<h;p++)l[f+p]=u[d+p]},flattenChunks:function(l){var u,d,h,f,p,m;for(u=h=0,d=l.length;u<d;u++)h+=l[u].length;for(m=new Uint8Array(h),u=f=0,d=l.length;u<d;u++)p=l[u],m.set(p,f),f+=p.length;return m}},o={arraySet:function(l,u,d,h,f){for(var p=0;p<h;p++)l[f+p]=u[d+p]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,a)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,o))},s.setTyped(i)},{}],42:[function(t,r,s){var i=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[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&&o||!h.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(h,f));for(var p="",m=0;m<f;m++)p+=String.fromCharCode(h[m]);return p}l[254]=l[254]=1,s.string2buf=function(h){var f,p,m,g,y,v=h.length,x=0;for(g=0;g<v;g++)(64512&(p=h.charCodeAt(g)))==55296&&g+1<v&&(64512&(m=h.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),g++),x+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(x),g=y=0;y<x;g++)(64512&(p=h.charCodeAt(g)))==55296&&g+1<v&&(64512&(m=h.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(m-56320),g++),p<128?f[y++]=p:(p<2048?f[y++]=192|p>>>6:(p<65536?f[y++]=224|p>>>12:(f[y++]=240|p>>>18,f[y++]=128|p>>>12&63),f[y++]=128|p>>>6&63),f[y++]=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,m=f.length;p<m;p++)f[p]=h.charCodeAt(p);return f},s.buf2string=function(h,f){var p,m,g,y,v=f||h.length,x=new Array(2*v);for(p=m=0;p<v;)if((g=h[p++])<128)x[m++]=g;else if(4<(y=l[g]))x[m++]=65533,p+=y-1;else{for(g&=y===2?31:y===3?15:7;1<y&&p<v;)g=g<<6|63&h[p++],y--;1<y?x[m++]=65533:g<65536?x[m++]=g:(g-=65536,x[m++]=55296|g>>10&1023,x[m++]=56320|1023&g)}return d(x,m)},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+l[h[p]]>f?p:f}},{"./common":41}],43:[function(t,r,s){r.exports=function(i,a,o,l){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;o!==0;){for(o-=h=2e3<o?2e3:o;d=d+(u=u+a[l++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(t,r,s){r.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(t,r,s){var i=function(){for(var a,o=[],l=0;l<256;l++){a=l;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;o[l]=a}return o}();r.exports=function(a,o,l,u){var d=i,h=u+l;a^=-1;for(var f=u;f<h;f++)a=a>>>8^d[255&(a^o[f])];return-1^a}},{}],46:[function(t,r,s){var i,a=t("../utils/common"),o=t("./trees"),l=t("./adler32"),u=t("./crc32"),d=t("./messages"),h=0,f=4,p=0,m=-2,g=-1,y=4,v=2,x=8,b=9,E=286,S=30,k=19,C=2*E+1,A=15,T=3,j=258,D=j+T+1,R=42,M=113,N=1,U=2,q=3,I=4;function B(O,X){return O.msg=d[X],X}function $(O){return(O<<1)-(4<O?9:0)}function ie(O){for(var X=O.length;0<=--X;)O[X]=0}function ne(O){var X=O.state,ee=X.pending;ee>O.avail_out&&(ee=O.avail_out),ee!==0&&(a.arraySet(O.output,X.pending_buf,X.pending_out,ee,O.next_out),O.next_out+=ee,X.pending_out+=ee,O.total_out+=ee,O.avail_out-=ee,X.pending-=ee,X.pending===0&&(X.pending_out=0))}function L(O,X){o._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,X),O.block_start=O.strstart,ne(O.strm)}function te(O,X){O.pending_buf[O.pending++]=X}function ae(O,X){O.pending_buf[O.pending++]=X>>>8&255,O.pending_buf[O.pending++]=255&X}function de(O,X){var ee,V,H=O.max_chain_length,se=O.strstart,z=O.prev_length,Q=O.nice_match,Y=O.strstart>O.w_size-D?O.strstart-(O.w_size-D):0,ce=O.window,he=O.w_mask,ge=O.prev,Ee=O.strstart+j,Le=ce[se+z-1],qe=ce[se+z];O.prev_length>=O.good_match&&(H>>=2),Q>O.lookahead&&(Q=O.lookahead);do if(ce[(ee=X)+z]===qe&&ce[ee+z-1]===Le&&ce[ee]===ce[se]&&ce[++ee]===ce[se+1]){se+=2,ee++;do;while(ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&ce[++se]===ce[++ee]&&se<Ee);if(V=j-(Ee-se),se=Ee-j,z<V){if(O.match_start=X,Q<=(z=V))break;Le=ce[se+z-1],qe=ce[se+z]}}while((X=ge[X&he])>Y&&--H!=0);return z<=O.lookahead?z:O.lookahead}function ue(O){var X,ee,V,H,se,z,Q,Y,ce,he,ge=O.w_size;do{if(H=O.window_size-O.lookahead-O.strstart,O.strstart>=ge+(ge-D)){for(a.arraySet(O.window,O.window,ge,ge,0),O.match_start-=ge,O.strstart-=ge,O.block_start-=ge,X=ee=O.hash_size;V=O.head[--X],O.head[X]=ge<=V?V-ge:0,--ee;);for(X=ee=ge;V=O.prev[--X],O.prev[X]=ge<=V?V-ge:0,--ee;);H+=ge}if(O.strm.avail_in===0)break;if(z=O.strm,Q=O.window,Y=O.strstart+O.lookahead,ce=H,he=void 0,he=z.avail_in,ce<he&&(he=ce),ee=he===0?0:(z.avail_in-=he,a.arraySet(Q,z.input,z.next_in,he,Y),z.state.wrap===1?z.adler=l(z.adler,Q,he,Y):z.state.wrap===2&&(z.adler=u(z.adler,Q,he,Y)),z.next_in+=he,z.total_in+=he,he),O.lookahead+=ee,O.lookahead+O.insert>=T)for(se=O.strstart-O.insert,O.ins_h=O.window[se],O.ins_h=(O.ins_h<<O.hash_shift^O.window[se+1])&O.hash_mask;O.insert&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[se+T-1])&O.hash_mask,O.prev[se&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=se,se++,O.insert--,!(O.lookahead+O.insert<T)););}while(O.lookahead<D&&O.strm.avail_in!==0)}function le(O,X){for(var ee,V;;){if(O.lookahead<D){if(ue(O),O.lookahead<D&&X===h)return N;if(O.lookahead===0)break}if(ee=0,O.lookahead>=T&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+T-1])&O.hash_mask,ee=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),ee!==0&&O.strstart-ee<=O.w_size-D&&(O.match_length=de(O,ee)),O.match_length>=T)if(V=o._tr_tally(O,O.strstart-O.match_start,O.match_length-T),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=T){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+T-1])&O.hash_mask,ee=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart,--O.match_length!=0;);O.strstart++}else O.strstart+=O.match_length,O.match_length=0,O.ins_h=O.window[O.strstart],O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+1])&O.hash_mask;else V=o._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++;if(V&&(L(O,!1),O.strm.avail_out===0))return N}return O.insert=O.strstart<T-1?O.strstart:T-1,X===f?(L(O,!0),O.strm.avail_out===0?q:I):O.last_lit&&(L(O,!1),O.strm.avail_out===0)?N:U}function ve(O,X){for(var ee,V,H;;){if(O.lookahead<D){if(ue(O),O.lookahead<D&&X===h)return N;if(O.lookahead===0)break}if(ee=0,O.lookahead>=T&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+T-1])&O.hash_mask,ee=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),O.prev_length=O.match_length,O.prev_match=O.match_start,O.match_length=T-1,ee!==0&&O.prev_length<O.max_lazy_match&&O.strstart-ee<=O.w_size-D&&(O.match_length=de(O,ee),O.match_length<=5&&(O.strategy===1||O.match_length===T&&4096<O.strstart-O.match_start)&&(O.match_length=T-1)),O.prev_length>=T&&O.match_length<=O.prev_length){for(H=O.strstart+O.lookahead-T,V=o._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-T),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=H&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+T-1])&O.hash_mask,ee=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),--O.prev_length!=0;);if(O.match_available=0,O.match_length=T-1,O.strstart++,V&&(L(O,!1),O.strm.avail_out===0))return N}else if(O.match_available){if((V=o._tr_tally(O,0,O.window[O.strstart-1]))&&L(O,!1),O.strstart++,O.lookahead--,O.strm.avail_out===0)return N}else O.match_available=1,O.strstart++,O.lookahead--}return O.match_available&&(V=o._tr_tally(O,0,O.window[O.strstart-1]),O.match_available=0),O.insert=O.strstart<T-1?O.strstart:T-1,X===f?(L(O,!0),O.strm.avail_out===0?q:I):O.last_lit&&(L(O,!1),O.strm.avail_out===0)?N:U}function _e(O,X,ee,V,H){this.good_length=O,this.max_lazy=X,this.nice_length=ee,this.max_chain=V,this.func=H}function Ne(){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 a.Buf16(2*C),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*k+1)),ie(this.dyn_ltree),ie(this.dyn_dtree),ie(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(A+1),this.heap=new a.Buf16(2*E+1),ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*E+1),ie(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 Pe(O){var X;return O&&O.state?(O.total_in=O.total_out=0,O.data_type=v,(X=O.state).pending=0,X.pending_out=0,X.wrap<0&&(X.wrap=-X.wrap),X.status=X.wrap?R:M,O.adler=X.wrap===2?0:1,X.last_flush=h,o._tr_init(X),p):B(O,m)}function Se(O){var X=Pe(O);return X===p&&function(ee){ee.window_size=2*ee.w_size,ie(ee.head),ee.max_lazy_match=i[ee.level].max_lazy,ee.good_match=i[ee.level].good_length,ee.nice_match=i[ee.level].nice_length,ee.max_chain_length=i[ee.level].max_chain,ee.strstart=0,ee.block_start=0,ee.lookahead=0,ee.insert=0,ee.match_length=ee.prev_length=T-1,ee.match_available=0,ee.ins_h=0}(O.state),X}function Ce(O,X,ee,V,H,se){if(!O)return m;var z=1;if(X===g&&(X=6),V<0?(z=0,V=-V):15<V&&(z=2,V-=16),H<1||b<H||ee!==x||V<8||15<V||X<0||9<X||se<0||y<se)return B(O,m);V===8&&(V=9);var Q=new Ne;return(O.state=Q).strm=O,Q.wrap=z,Q.gzhead=null,Q.w_bits=V,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=H+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+T-1)/T),Q.window=new a.Buf8(2*Q.w_size),Q.head=new a.Buf16(Q.hash_size),Q.prev=new a.Buf16(Q.w_size),Q.lit_bufsize=1<<H+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new a.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=X,Q.strategy=se,Q.method=ee,Se(O)}i=[new _e(0,0,0,0,function(O,X){var ee=65535;for(ee>O.pending_buf_size-5&&(ee=O.pending_buf_size-5);;){if(O.lookahead<=1){if(ue(O),O.lookahead===0&&X===h)return N;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var V=O.block_start+ee;if((O.strstart===0||O.strstart>=V)&&(O.lookahead=O.strstart-V,O.strstart=V,L(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-D&&(L(O,!1),O.strm.avail_out===0))return N}return O.insert=0,X===f?(L(O,!0),O.strm.avail_out===0?q:I):(O.strstart>O.block_start&&(L(O,!1),O.strm.avail_out),N)}),new _e(4,4,8,4,le),new _e(4,5,16,8,le),new _e(4,6,32,32,le),new _e(4,4,16,16,ve),new _e(8,16,32,32,ve),new _e(8,16,128,128,ve),new _e(8,32,128,256,ve),new _e(32,128,258,1024,ve),new _e(32,258,258,4096,ve)],s.deflateInit=function(O,X){return Ce(O,X,x,15,8,0)},s.deflateInit2=Ce,s.deflateReset=Se,s.deflateResetKeep=Pe,s.deflateSetHeader=function(O,X){return O&&O.state?O.state.wrap!==2?m:(O.state.gzhead=X,p):m},s.deflate=function(O,X){var ee,V,H,se;if(!O||!O.state||5<X||X<0)return O?B(O,m):m;if(V=O.state,!O.output||!O.input&&O.avail_in!==0||V.status===666&&X!==f)return B(O,O.avail_out===0?-5:m);if(V.strm=O,ee=V.last_flush,V.last_flush=X,V.status===R)if(V.wrap===2)O.adler=0,te(V,31),te(V,139),te(V,8),V.gzhead?(te(V,(V.gzhead.text?1:0)+(V.gzhead.hcrc?2:0)+(V.gzhead.extra?4:0)+(V.gzhead.name?8:0)+(V.gzhead.comment?16:0)),te(V,255&V.gzhead.time),te(V,V.gzhead.time>>8&255),te(V,V.gzhead.time>>16&255),te(V,V.gzhead.time>>24&255),te(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),te(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(te(V,255&V.gzhead.extra.length),te(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(O.adler=u(O.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(te(V,0),te(V,0),te(V,0),te(V,0),te(V,0),te(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),te(V,3),V.status=M);else{var z=x+(V.w_bits-8<<4)<<8;z|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(z|=32),z+=31-z%31,V.status=M,ae(V,z),V.strstart!==0&&(ae(V,O.adler>>>16),ae(V,65535&O.adler)),O.adler=1}if(V.status===69)if(V.gzhead.extra){for(H=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),ne(O),H=V.pending,V.pending!==V.pending_buf_size));)te(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){H=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),ne(O),H=V.pending,V.pending===V.pending_buf_size)){se=1;break}se=V.gzindex<V.gzhead.name.length?255&V.gzhead.name.charCodeAt(V.gzindex++):0,te(V,se)}while(se!==0);V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),se===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){H=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),ne(O),H=V.pending,V.pending===V.pending_buf_size)){se=1;break}se=V.gzindex<V.gzhead.comment.length?255&V.gzhead.comment.charCodeAt(V.gzindex++):0,te(V,se)}while(se!==0);V.gzhead.hcrc&&V.pending>H&&(O.adler=u(O.adler,V.pending_buf,V.pending-H,H)),se===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&ne(O),V.pending+2<=V.pending_buf_size&&(te(V,255&O.adler),te(V,O.adler>>8&255),O.adler=0,V.status=M)):V.status=M),V.pending!==0){if(ne(O),O.avail_out===0)return V.last_flush=-1,p}else if(O.avail_in===0&&$(X)<=$(ee)&&X!==f)return B(O,-5);if(V.status===666&&O.avail_in!==0)return B(O,-5);if(O.avail_in!==0||V.lookahead!==0||X!==h&&V.status!==666){var Q=V.strategy===2?function(Y,ce){for(var he;;){if(Y.lookahead===0&&(ue(Y),Y.lookahead===0)){if(ce===h)return N;break}if(Y.match_length=0,he=o._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++,he&&(L(Y,!1),Y.strm.avail_out===0))return N}return Y.insert=0,ce===f?(L(Y,!0),Y.strm.avail_out===0?q:I):Y.last_lit&&(L(Y,!1),Y.strm.avail_out===0)?N:U}(V,X):V.strategy===3?function(Y,ce){for(var he,ge,Ee,Le,qe=Y.window;;){if(Y.lookahead<=j){if(ue(Y),Y.lookahead<=j&&ce===h)return N;if(Y.lookahead===0)break}if(Y.match_length=0,Y.lookahead>=T&&0<Y.strstart&&(ge=qe[Ee=Y.strstart-1])===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]){Le=Y.strstart+j;do;while(ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&ge===qe[++Ee]&&Ee<Le);Y.match_length=j-(Le-Ee),Y.match_length>Y.lookahead&&(Y.match_length=Y.lookahead)}if(Y.match_length>=T?(he=o._tr_tally(Y,1,Y.match_length-T),Y.lookahead-=Y.match_length,Y.strstart+=Y.match_length,Y.match_length=0):(he=o._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++),he&&(L(Y,!1),Y.strm.avail_out===0))return N}return Y.insert=0,ce===f?(L(Y,!0),Y.strm.avail_out===0?q:I):Y.last_lit&&(L(Y,!1),Y.strm.avail_out===0)?N:U}(V,X):i[V.level].func(V,X);if(Q!==q&&Q!==I||(V.status=666),Q===N||Q===q)return O.avail_out===0&&(V.last_flush=-1),p;if(Q===U&&(X===1?o._tr_align(V):X!==5&&(o._tr_stored_block(V,0,0,!1),X===3&&(ie(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),ne(O),O.avail_out===0))return V.last_flush=-1,p}return X!==f?p:V.wrap<=0?1:(V.wrap===2?(te(V,255&O.adler),te(V,O.adler>>8&255),te(V,O.adler>>16&255),te(V,O.adler>>24&255),te(V,255&O.total_in),te(V,O.total_in>>8&255),te(V,O.total_in>>16&255),te(V,O.total_in>>24&255)):(ae(V,O.adler>>>16),ae(V,65535&O.adler)),ne(O),0<V.wrap&&(V.wrap=-V.wrap),V.pending!==0?p:1)},s.deflateEnd=function(O){var X;return O&&O.state?(X=O.state.status)!==R&&X!==69&&X!==73&&X!==91&&X!==103&&X!==M&&X!==666?B(O,m):(O.state=null,X===M?B(O,-3):p):m},s.deflateSetDictionary=function(O,X){var ee,V,H,se,z,Q,Y,ce,he=X.length;if(!O||!O.state||(se=(ee=O.state).wrap)===2||se===1&&ee.status!==R||ee.lookahead)return m;for(se===1&&(O.adler=l(O.adler,X,he,0)),ee.wrap=0,he>=ee.w_size&&(se===0&&(ie(ee.head),ee.strstart=0,ee.block_start=0,ee.insert=0),ce=new a.Buf8(ee.w_size),a.arraySet(ce,X,he-ee.w_size,ee.w_size,0),X=ce,he=ee.w_size),z=O.avail_in,Q=O.next_in,Y=O.input,O.avail_in=he,O.next_in=0,O.input=X,ue(ee);ee.lookahead>=T;){for(V=ee.strstart,H=ee.lookahead-(T-1);ee.ins_h=(ee.ins_h<<ee.hash_shift^ee.window[V+T-1])&ee.hash_mask,ee.prev[V&ee.w_mask]=ee.head[ee.ins_h],ee.head[ee.ins_h]=V,V++,--H;);ee.strstart=V,ee.lookahead=T-1,ue(ee)}return ee.strstart+=ee.lookahead,ee.block_start=ee.strstart,ee.insert=ee.lookahead,ee.lookahead=0,ee.match_length=ee.prev_length=T-1,ee.match_available=0,O.next_in=Q,O.input
vendor: 16,770 bytes, line 1029
1029=Y,O.avail_in=z,ee.wrap=se,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,r,s){r.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(t,r,s){r.exports=function(i,a){var o,l,u,d,h,f,p,m,g,y,v,x,b,E,S,k,C,A,T,j,D,R,M,N,U;o=i.state,l=i.next_in,N=i.input,u=l+(i.avail_in-5),d=i.next_out,U=i.output,h=d-(a-i.avail_out),f=d+(i.avail_out-257),p=o.dmax,m=o.wsize,g=o.whave,y=o.wnext,v=o.window,x=o.hold,b=o.bits,E=o.lencode,S=o.distcode,k=(1<<o.lenbits)-1,C=(1<<o.distbits)-1;e:do{b<15&&(x+=N[l++]<<b,b+=8,x+=N[l++]<<b,b+=8),A=E[x&k];t:for(;;){if(x>>>=T=A>>>24,b-=T,(T=A>>>16&255)===0)U[d++]=65535&A;else{if(!(16&T)){if(!(64&T)){A=E[(65535&A)+(x&(1<<T)-1)];continue t}if(32&T){o.mode=12;break e}i.msg="invalid literal/length code",o.mode=30;break e}j=65535&A,(T&=15)&&(b<T&&(x+=N[l++]<<b,b+=8),j+=x&(1<<T)-1,x>>>=T,b-=T),b<15&&(x+=N[l++]<<b,b+=8,x+=N[l++]<<b,b+=8),A=S[x&C];n:for(;;){if(x>>>=T=A>>>24,b-=T,!(16&(T=A>>>16&255))){if(!(64&T)){A=S[(65535&A)+(x&(1<<T)-1)];continue n}i.msg="invalid distance code",o.mode=30;break e}if(D=65535&A,b<(T&=15)&&(x+=N[l++]<<b,(b+=8)<T&&(x+=N[l++]<<b,b+=8)),p<(D+=x&(1<<T)-1)){i.msg="invalid distance too far back",o.mode=30;break e}if(x>>>=T,b-=T,(T=d-h)<D){if(g<(T=D-T)&&o.sane){i.msg="invalid distance too far back",o.mode=30;break e}if(M=v,(R=0)===y){if(R+=m-T,T<j){for(j-=T;U[d++]=v[R++],--T;);R=d-D,M=U}}else if(y<T){if(R+=m+y-T,(T-=y)<j){for(j-=T;U[d++]=v[R++],--T;);if(R=0,y<j){for(j-=T=y;U[d++]=v[R++],--T;);R=d-D,M=U}}}else if(R+=y-T,T<j){for(j-=T;U[d++]=v[R++],--T;);R=d-D,M=U}for(;2<j;)U[d++]=M[R++],U[d++]=M[R++],U[d++]=M[R++],j-=3;j&&(U[d++]=M[R++],1<j&&(U[d++]=M[R++]))}else{for(R=d-D;U[d++]=U[R++],U[d++]=U[R++],U[d++]=U[R++],2<(j-=3););j&&(U[d++]=U[R++],1<j&&(U[d++]=U[R++]))}break}}break}}while(l<u&&d<f);l-=j=b>>3,x&=(1<<(b-=j<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<f?f-d+257:257-(d-f),o.hold=x,o.bits=b}},{}],49:[function(t,r,s){var i=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),l=t("./inffast"),u=t("./inftrees"),d=1,h=2,f=0,p=-2,m=1,g=852,y=592;function v(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<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(R){var M;return R&&R.state?(M=R.state,R.total_in=R.total_out=M.total=0,R.msg="",M.wrap&&(R.adler=1&M.wrap),M.mode=m,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new i.Buf32(g),M.distcode=M.distdyn=new i.Buf32(y),M.sane=1,M.back=-1,f):p}function E(R){var M;return R&&R.state?((M=R.state).wsize=0,M.whave=0,M.wnext=0,b(R)):p}function S(R,M){var N,U;return R&&R.state?(U=R.state,M<0?(N=0,M=-M):(N=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?p:(U.window!==null&&U.wbits!==M&&(U.window=null),U.wrap=N,U.wbits=M,E(R))):p}function k(R,M){var N,U;return R?(U=new x,(R.state=U).window=null,(N=S(R,M))!==f&&(R.state=null),N):p}var C,A,T=!0;function j(R){if(T){var M;for(C=new i.Buf32(512),A=new i.Buf32(32),M=0;M<144;)R.lens[M++]=8;for(;M<256;)R.lens[M++]=9;for(;M<280;)R.lens[M++]=7;for(;M<288;)R.lens[M++]=8;for(u(d,R.lens,0,288,C,0,R.work,{bits:9}),M=0;M<32;)R.lens[M++]=5;u(h,R.lens,0,32,A,0,R.work,{bits:5}),T=!1}R.lencode=C,R.lenbits=9,R.distcode=A,R.distbits=5}function D(R,M,N,U){var q,I=R.state;return I.window===null&&(I.wsize=1<<I.wbits,I.wnext=0,I.whave=0,I.window=new i.Buf8(I.wsize)),U>=I.wsize?(i.arraySet(I.window,M,N-I.wsize,I.wsize,0),I.wnext=0,I.whave=I.wsize):(U<(q=I.wsize-I.wnext)&&(q=U),i.arraySet(I.window,M,N-U,q,I.wnext),(U-=q)?(i.arraySet(I.window,M,N-U,U,0),I.wnext=U,I.whave=I.wsize):(I.wnext+=q,I.wnext===I.wsize&&(I.wnext=0),I.whave<I.wsize&&(I.whave+=q))),0}s.inflateReset=E,s.inflateReset2=S,s.inflateResetKeep=b,s.inflateInit=function(R){return k(R,15)},s.inflateInit2=k,s.inflate=function(R,M){var N,U,q,I,B,$,ie,ne,L,te,ae,de,ue,le,ve,_e,Ne,Pe,Se,Ce,O,X,ee,V,H=0,se=new i.Buf8(4),z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return p;(N=R.state).mode===12&&(N.mode=13),B=R.next_out,q=R.output,ie=R.avail_out,I=R.next_in,U=R.input,$=R.avail_in,ne=N.hold,L=N.bits,te=$,ae=ie,X=f;e:for(;;)switch(N.mode){case m:if(N.wrap===0){N.mode=13;break}for(;L<16;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(2&N.wrap&&ne===35615){se[N.check=0]=255&ne,se[1]=ne>>>8&255,N.check=o(N.check,se,2,0),L=ne=0,N.mode=2;break}if(N.flags=0,N.head&&(N.head.done=!1),!(1&N.wrap)||(((255&ne)<<8)+(ne>>8))%31){R.msg="incorrect header check",N.mode=30;break}if((15&ne)!=8){R.msg="unknown compression method",N.mode=30;break}if(L-=4,O=8+(15&(ne>>>=4)),N.wbits===0)N.wbits=O;else if(O>N.wbits){R.msg="invalid window size",N.mode=30;break}N.dmax=1<<O,R.adler=N.check=1,N.mode=512&ne?10:12,L=ne=0;break;case 2:for(;L<16;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(N.flags=ne,(255&N.flags)!=8){R.msg="unknown compression method",N.mode=30;break}if(57344&N.flags){R.msg="unknown header flags set",N.mode=30;break}N.head&&(N.head.text=ne>>8&1),512&N.flags&&(se[0]=255&ne,se[1]=ne>>>8&255,N.check=o(N.check,se,2,0)),L=ne=0,N.mode=3;case 3:for(;L<32;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.head&&(N.head.time=ne),512&N.flags&&(se[0]=255&ne,se[1]=ne>>>8&255,se[2]=ne>>>16&255,se[3]=ne>>>24&255,N.check=o(N.check,se,4,0)),L=ne=0,N.mode=4;case 4:for(;L<16;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.head&&(N.head.xflags=255&ne,N.head.os=ne>>8),512&N.flags&&(se[0]=255&ne,se[1]=ne>>>8&255,N.check=o(N.check,se,2,0)),L=ne=0,N.mode=5;case 5:if(1024&N.flags){for(;L<16;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.length=ne,N.head&&(N.head.extra_len=ne),512&N.flags&&(se[0]=255&ne,se[1]=ne>>>8&255,N.check=o(N.check,se,2,0)),L=ne=0}else N.head&&(N.head.extra=null);N.mode=6;case 6:if(1024&N.flags&&($<(de=N.length)&&(de=$),de&&(N.head&&(O=N.head.extra_len-N.length,N.head.extra||(N.head.extra=new Array(N.head.extra_len)),i.arraySet(N.head.extra,U,I,de,O)),512&N.flags&&(N.check=o(N.check,U,de,I)),$-=de,I+=de,N.length-=de),N.length))break e;N.length=0,N.mode=7;case 7:if(2048&N.flags){if($===0)break e;for(de=0;O=U[I+de++],N.head&&O&&N.length<65536&&(N.head.name+=String.fromCharCode(O)),O&&de<$;);if(512&N.flags&&(N.check=o(N.check,U,de,I)),$-=de,I+=de,O)break e}else N.head&&(N.head.name=null);N.length=0,N.mode=8;case 8:if(4096&N.flags){if($===0)break e;for(de=0;O=U[I+de++],N.head&&O&&N.length<65536&&(N.head.comment+=String.fromCharCode(O)),O&&de<$;);if(512&N.flags&&(N.check=o(N.check,U,de,I)),$-=de,I+=de,O)break e}else N.head&&(N.head.comment=null);N.mode=9;case 9:if(512&N.flags){for(;L<16;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(ne!==(65535&N.check)){R.msg="header crc mismatch",N.mode=30;break}L=ne=0}N.head&&(N.head.hcrc=N.flags>>9&1,N.head.done=!0),R.adler=N.check=0,N.mode=12;break;case 10:for(;L<32;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}R.adler=N.check=v(ne),L=ne=0,N.mode=11;case 11:if(N.havedict===0)return R.next_out=B,R.avail_out=ie,R.next_in=I,R.avail_in=$,N.hold=ne,N.bits=L,2;R.adler=N.check=1,N.mode=12;case 12:if(M===5||M===6)break e;case 13:if(N.last){ne>>>=7&L,L-=7&L,N.mode=27;break}for(;L<3;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}switch(N.last=1&ne,L-=1,3&(ne>>>=1)){case 0:N.mode=14;break;case 1:if(j(N),N.mode=20,M!==6)break;ne>>>=2,L-=2;break e;case 2:N.mode=17;break;case 3:R.msg="invalid block type",N.mode=30}ne>>>=2,L-=2;break;case 14:for(ne>>>=7&L,L-=7&L;L<32;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if((65535&ne)!=(ne>>>16^65535)){R.msg="invalid stored block lengths",N.mode=30;break}if(N.length=65535&ne,L=ne=0,N.mode=15,M===6)break e;case 15:N.mode=16;case 16:if(de=N.length){if($<de&&(de=$),ie<de&&(de=ie),de===0)break e;i.arraySet(q,U,I,de,B),$-=de,I+=de,ie-=de,B+=de,N.length-=de;break}N.mode=12;break;case 17:for(;L<14;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(N.nlen=257+(31&ne),ne>>>=5,L-=5,N.ndist=1+(31&ne),ne>>>=5,L-=5,N.ncode=4+(15&ne),ne>>>=4,L-=4,286<N.nlen||30<N.ndist){R.msg="too many length or distance symbols",N.mode=30;break}N.have=0,N.mode=18;case 18:for(;N.have<N.ncode;){for(;L<3;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.lens[z[N.have++]]=7&ne,ne>>>=3,L-=3}for(;N.have<19;)N.lens[z[N.have++]]=0;if(N.lencode=N.lendyn,N.lenbits=7,ee={bits:N.lenbits},X=u(0,N.lens,0,19,N.lencode,0,N.work,ee),N.lenbits=ee.bits,X){R.msg="invalid code lengths set",N.mode=30;break}N.have=0,N.mode=19;case 19:for(;N.have<N.nlen+N.ndist;){for(;_e=(H=N.lencode[ne&(1<<N.lenbits)-1])>>>16&255,Ne=65535&H,!((ve=H>>>24)<=L);){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(Ne<16)ne>>>=ve,L-=ve,N.lens[N.have++]=Ne;else{if(Ne===16){for(V=ve+2;L<V;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(ne>>>=ve,L-=ve,N.have===0){R.msg="invalid bit length repeat",N.mode=30;break}O=N.lens[N.have-1],de=3+(3&ne),ne>>>=2,L-=2}else if(Ne===17){for(V=ve+3;L<V;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}L-=ve,O=0,de=3+(7&(ne>>>=ve)),ne>>>=3,L-=3}else{for(V=ve+7;L<V;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}L-=ve,O=0,de=11+(127&(ne>>>=ve)),ne>>>=7,L-=7}if(N.have+de>N.nlen+N.ndist){R.msg="invalid bit length repeat",N.mode=30;break}for(;de--;)N.lens[N.have++]=O}}if(N.mode===30)break;if(N.lens[256]===0){R.msg="invalid code -- missing end-of-block",N.mode=30;break}if(N.lenbits=9,ee={bits:N.lenbits},X=u(d,N.lens,0,N.nlen,N.lencode,0,N.work,ee),N.lenbits=ee.bits,X){R.msg="invalid literal/lengths set",N.mode=30;break}if(N.distbits=6,N.distcode=N.distdyn,ee={bits:N.distbits},X=u(h,N.lens,N.nlen,N.ndist,N.distcode,0,N.work,ee),N.distbits=ee.bits,X){R.msg="invalid distances set",N.mode=30;break}if(N.mode=20,M===6)break e;case 20:N.mode=21;case 21:if(6<=$&&258<=ie){R.next_out=B,R.avail_out=ie,R.next_in=I,R.avail_in=$,N.hold=ne,N.bits=L,l(R,ae),B=R.next_out,q=R.output,ie=R.avail_out,I=R.next_in,U=R.input,$=R.avail_in,ne=N.hold,L=N.bits,N.mode===12&&(N.back=-1);break}for(N.back=0;_e=(H=N.lencode[ne&(1<<N.lenbits)-1])>>>16&255,Ne=65535&H,!((ve=H>>>24)<=L);){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(_e&&!(240&_e)){for(Pe=ve,Se=_e,Ce=Ne;_e=(H=N.lencode[Ce+((ne&(1<<Pe+Se)-1)>>Pe)])>>>16&255,Ne=65535&H,!(Pe+(ve=H>>>24)<=L);){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}ne>>>=Pe,L-=Pe,N.back+=Pe}if(ne>>>=ve,L-=ve,N.back+=ve,N.length=Ne,_e===0){N.mode=26;break}if(32&_e){N.back=-1,N.mode=12;break}if(64&_e){R.msg="invalid literal/length code",N.mode=30;break}N.extra=15&_e,N.mode=22;case 22:if(N.extra){for(V=N.extra;L<V;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.length+=ne&(1<<N.extra)-1,ne>>>=N.extra,L-=N.extra,N.back+=N.extra}N.was=N.length,N.mode=23;case 23:for(;_e=(H=N.distcode[ne&(1<<N.distbits)-1])>>>16&255,Ne=65535&H,!((ve=H>>>24)<=L);){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(!(240&_e)){for(Pe=ve,Se=_e,Ce=Ne;_e=(H=N.distcode[Ce+((ne&(1<<Pe+Se)-1)>>Pe)])>>>16&255,Ne=65535&H,!(Pe+(ve=H>>>24)<=L);){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}ne>>>=Pe,L-=Pe,N.back+=Pe}if(ne>>>=ve,L-=ve,N.back+=ve,64&_e){R.msg="invalid distance code",N.mode=30;break}N.offset=Ne,N.extra=15&_e,N.mode=24;case 24:if(N.extra){for(V=N.extra;L<V;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}N.offset+=ne&(1<<N.extra)-1,ne>>>=N.extra,L-=N.extra,N.back+=N.extra}if(N.offset>N.dmax){R.msg="invalid distance too far back",N.mode=30;break}N.mode=25;case 25:if(ie===0)break e;if(de=ae-ie,N.offset>de){if((de=N.offset-de)>N.whave&&N.sane){R.msg="invalid distance too far back",N.mode=30;break}ue=de>N.wnext?(de-=N.wnext,N.wsize-de):N.wnext-de,de>N.length&&(de=N.length),le=N.window}else le=q,ue=B-N.offset,de=N.length;for(ie<de&&(de=ie),ie-=de,N.length-=de;q[B++]=le[ue++],--de;);N.length===0&&(N.mode=21);break;case 26:if(ie===0)break e;q[B++]=N.length,ie--,N.mode=21;break;case 27:if(N.wrap){for(;L<32;){if($===0)break e;$--,ne|=U[I++]<<L,L+=8}if(ae-=ie,R.total_out+=ae,N.total+=ae,ae&&(R.adler=N.check=N.flags?o(N.check,q,ae,B-ae):a(N.check,q,ae,B-ae)),ae=ie,(N.flags?ne:v(ne))!==N.check){R.msg="incorrect data check",N.mode=30;break}L=ne=0}N.mode=28;case 28:if(N.wrap&&N.flags){for(;L<32;){if($===0)break e;$--,ne+=U[I++]<<L,L+=8}if(ne!==(4294967295&N.total)){R.msg="incorrect length check",N.mode=30;break}L=ne=0}N.mode=29;case 29:X=1;break e;case 30:X=-3;break e;case 31:return-4;case 32:default:return p}return R.next_out=B,R.avail_out=ie,R.next_in=I,R.avail_in=$,N.hold=ne,N.bits=L,(N.wsize||ae!==R.avail_out&&N.mode<30&&(N.mode<27||M!==4))&&D(R,R.output,R.next_out,ae-R.avail_out)?(N.mode=31,-4):(te-=R.avail_in,ae-=R.avail_out,R.total_in+=te,R.total_out+=ae,N.total+=ae,N.wrap&&ae&&(R.adler=N.check=N.flags?o(N.check,q,ae,R.next_out-ae):a(N.check,q,ae,R.next_out-ae)),R.data_type=N.bits+(N.last?64:0)+(N.mode===12?128:0)+(N.mode===20||N.mode===15?256:0),(te==0&&ae===0||M===4)&&X===f&&(X=-5),X)},s.inflateEnd=function(R){if(!R||!R.state)return p;var M=R.state;return M.window&&(M.window=null),R.state=null,f},s.inflateGetHeader=function(R,M){var N;return R&&R.state&&2&(N=R.state).wrap?((N.head=M).done=!1,f):p},s.inflateSetDictionary=function(R,M){var N,U=M.length;return R&&R.state?(N=R.state).wrap!==0&&N.mode!==11?p:N.mode===11&&a(1,M,U,0)!==N.check?-3:D(R,M,U,U)?(N.mode=31,-4):(N.havedict=1,f):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,r,s){var i=t("../utils/common"),a=[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],o=[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],l=[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];r.exports=function(d,h,f,p,m,g,y,v){var x,b,E,S,k,C,A,T,j,D=v.bits,R=0,M=0,N=0,U=0,q=0,I=0,B=0,$=0,ie=0,ne=0,L=null,te=0,ae=new i.Buf16(16),de=new i.Buf16(16),ue=null,le=0;for(R=0;R<=15;R++)ae[R]=0;for(M=0;M<p;M++)ae[h[f+M]]++;for(q=D,U=15;1<=U&&ae[U]===0;U--);if(U<q&&(q=U),U===0)return m[g++]=20971520,m[g++]=20971520,v.bits=1,0;for(N=1;N<U&&ae[N]===0;N++);for(q<N&&(q=N),R=$=1;R<=15;R++)if($<<=1,($-=ae[R])<0)return-1;if(0<$&&(d===0||U!==1))return-1;for(de[1]=0,R=1;R<15;R++)de[R+1]=de[R]+ae[R];for(M=0;M<p;M++)h[f+M]!==0&&(y[de[h[f+M]]++]=M);if(C=d===0?(L=ue=y,19):d===1?(L=a,te-=257,ue=o,le-=257,256):(L=l,ue=u,-1),R=N,k=g,B=M=ne=0,E=-1,S=(ie=1<<(I=q))-1,d===1&&852<ie||d===2&&592<ie)return 1;for(;;){for(A=R-B,j=y[M]<C?(T=0,y[M]):y[M]>C?(T=ue[le+y[M]],L[te+y[M]]):(T=96,0),x=1<<R-B,N=b=1<<I;m[k+(ne>>B)+(b-=x)]=A<<24|T<<16|j|0,b!==0;);for(x=1<<R-1;ne&x;)x>>=1;if(x!==0?(ne&=x-1,ne+=x):ne=0,M++,--ae[R]==0){if(R===U)break;R=h[f+y[M]]}if(q<R&&(ne&S)!==E){for(B===0&&(B=q),k+=N,$=1<<(I=R-B);I+B<U&&!(($-=ae[I+B])<=0);)I++,$<<=1;if(ie+=1<<I,d===1&&852<ie||d===2&&592<ie)return 1;m[E=ne&S]=q<<24|I<<16|k-g|0}}return ne!==0&&(m[k+ne]=R-B<<24|64<<16|0),v.bits=q,0}},{"../utils/common":41}],51:[function(t,r,s){r.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(t,r,s){var i=t("../utils/common"),a=0,o=1;function l(H){for(var se=H.length;0<=--se;)H[se]=0}var u=0,d=29,h=256,f=h+1+d,p=30,m=19,g=2*f+1,y=15,v=16,x=7,b=256,E=16,S=17,k=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],A=[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],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=new Array(2*(f+2));l(D);var R=new Array(2*p);l(R);var M=new Array(512);l(M);var N=new Array(256);l(N);var U=new Array(d);l(U);var q,I,B,$=new Array(p);function ie(H,se,z,Q,Y){this.static_tree=H,this.extra_bits=se,this.extra_base=z,this.elems=Q,this.max_length=Y,this.has_stree=H&&H.length}function ne(H,se){this.dyn_tree=H,this.max_code=0,this.stat_desc=se}function L(H){return H<256?M[H]:M[256+(H>>>7)]}function te(H,se){H.pending_buf[H.pending++]=255&se,H.pending_buf[H.pending++]=se>>>8&255}function ae(H,se,z){H.bi_valid>v-z?(H.bi_buf|=se<<H.bi_valid&65535,te(H,H.bi_buf),H.bi_buf=se>>v-H.bi_valid,H.bi_valid+=z-v):(H.bi_buf|=se<<H.bi_valid&65535,H.bi_valid+=z)}function de(H,se,z){ae(H,z[2*se],z[2*se+1])}function ue(H,se){for(var z=0;z|=1&H,H>>>=1,z<<=1,0<--se;);return z>>>1}
vendor: 7,502 bytes, line 1029
1029function le(H,se,z){var Q,Y,ce=new Array(y+1),he=0;for(Q=1;Q<=y;Q++)ce[Q]=he=he+z[Q-1]<<1;for(Y=0;Y<=se;Y++){var ge=H[2*Y+1];ge!==0&&(H[2*Y]=ue(ce[ge]++,ge))}}function ve(H){var se;for(se=0;se<f;se++)H.dyn_ltree[2*se]=0;for(se=0;se<p;se++)H.dyn_dtree[2*se]=0;for(se=0;se<m;se++)H.bl_tree[2*se]=0;H.dyn_ltree[2*b]=1,H.opt_len=H.static_len=0,H.last_lit=H.matches=0}function _e(H){8<H.bi_valid?te(H,H.bi_buf):0<H.bi_valid&&(H.pending_buf[H.pending++]=H.bi_buf),H.bi_buf=0,H.bi_valid=0}function Ne(H,se,z,Q){var Y=2*se,ce=2*z;return H[Y]<H[ce]||H[Y]===H[ce]&&Q[se]<=Q[z]}function Pe(H,se,z){for(var Q=H.heap[z],Y=z<<1;Y<=H.heap_len&&(Y<H.heap_len&&Ne(se,H.heap[Y+1],H.heap[Y],H.depth)&&Y++,!Ne(se,Q,H.heap[Y],H.depth));)H.heap[z]=H.heap[Y],z=Y,Y<<=1;H.heap[z]=Q}function Se(H,se,z){var Q,Y,ce,he,ge=0;if(H.last_lit!==0)for(;Q=H.pending_buf[H.d_buf+2*ge]<<8|H.pending_buf[H.d_buf+2*ge+1],Y=H.pending_buf[H.l_buf+ge],ge++,Q===0?de(H,Y,se):(de(H,(ce=N[Y])+h+1,se),(he=C[ce])!==0&&ae(H,Y-=U[ce],he),de(H,ce=L(--Q),z),(he=A[ce])!==0&&ae(H,Q-=$[ce],he)),ge<H.last_lit;);de(H,b,se)}function Ce(H,se){var z,Q,Y,ce=se.dyn_tree,he=se.stat_desc.static_tree,ge=se.stat_desc.has_stree,Ee=se.stat_desc.elems,Le=-1;for(H.heap_len=0,H.heap_max=g,z=0;z<Ee;z++)ce[2*z]!==0?(H.heap[++H.heap_len]=Le=z,H.depth[z]=0):ce[2*z+1]=0;for(;H.heap_len<2;)ce[2*(Y=H.heap[++H.heap_len]=Le<2?++Le:0)]=1,H.depth[Y]=0,H.opt_len--,ge&&(H.static_len-=he[2*Y+1]);for(se.max_code=Le,z=H.heap_len>>1;1<=z;z--)Pe(H,ce,z);for(Y=Ee;z=H.heap[1],H.heap[1]=H.heap[H.heap_len--],Pe(H,ce,1),Q=H.heap[1],H.heap[--H.heap_max]=z,H.heap[--H.heap_max]=Q,ce[2*Y]=ce[2*z]+ce[2*Q],H.depth[Y]=(H.depth[z]>=H.depth[Q]?H.depth[z]:H.depth[Q])+1,ce[2*z+1]=ce[2*Q+1]=Y,H.heap[1]=Y++,Pe(H,ce,1),2<=H.heap_len;);H.heap[--H.heap_max]=H.heap[1],function(qe,lt){var rt,Pt,en,gt,Wt,wn,J=lt.dyn_tree,Me=lt.max_code,Be=lt.stat_desc.static_tree,Qe=lt.stat_desc.has_stree,ye=lt.stat_desc.extra_bits,De=lt.stat_desc.extra_base,K=lt.stat_desc.max_length,Ie=0;for(gt=0;gt<=y;gt++)qe.bl_count[gt]=0;for(J[2*qe.heap[qe.heap_max]+1]=0,rt=qe.heap_max+1;rt<g;rt++)K<(gt=J[2*J[2*(Pt=qe.heap[rt])+1]+1]+1)&&(gt=K,Ie++),J[2*Pt+1]=gt,Me<Pt||(qe.bl_count[gt]++,Wt=0,De<=Pt&&(Wt=ye[Pt-De]),wn=J[2*Pt],qe.opt_len+=wn*(gt+Wt),Qe&&(qe.static_len+=wn*(Be[2*Pt+1]+Wt)));if(Ie!==0){do{for(gt=K-1;qe.bl_count[gt]===0;)gt--;qe.bl_count[gt]--,qe.bl_count[gt+1]+=2,qe.bl_count[K]--,Ie-=2}while(0<Ie);for(gt=K;gt!==0;gt--)for(Pt=qe.bl_count[gt];Pt!==0;)Me<(en=qe.heap[--rt])||(J[2*en+1]!==gt&&(qe.opt_len+=(gt-J[2*en+1])*J[2*en],J[2*en+1]=gt),Pt--)}}(H,se),le(ce,Le,H.bl_count)}function O(H,se,z){var Q,Y,ce=-1,he=se[1],ge=0,Ee=7,Le=4;for(he===0&&(Ee=138,Le=3),se[2*(z+1)+1]=65535,Q=0;Q<=z;Q++)Y=he,he=se[2*(Q+1)+1],++ge<Ee&&Y===he||(ge<Le?H.bl_tree[2*Y]+=ge:Y!==0?(Y!==ce&&H.bl_tree[2*Y]++,H.bl_tree[2*E]++):ge<=10?H.bl_tree[2*S]++:H.bl_tree[2*k]++,ce=Y,Le=(ge=0)===he?(Ee=138,3):Y===he?(Ee=6,3):(Ee=7,4))}function X(H,se,z){var Q,Y,ce=-1,he=se[1],ge=0,Ee=7,Le=4;for(he===0&&(Ee=138,Le=3),Q=0;Q<=z;Q++)if(Y=he,he=se[2*(Q+1)+1],!(++ge<Ee&&Y===he)){if(ge<Le)for(;de(H,Y,H.bl_tree),--ge!=0;);else Y!==0?(Y!==ce&&(de(H,Y,H.bl_tree),ge--),de(H,E,H.bl_tree),ae(H,ge-3,2)):ge<=10?(de(H,S,H.bl_tree),ae(H,ge-3,3)):(de(H,k,H.bl_tree),ae(H,ge-11,7));ce=Y,Le=(ge=0)===he?(Ee=138,3):Y===he?(Ee=6,3):(Ee=7,4)}}l($);var ee=!1;function V(H,se,z,Q){ae(H,(u<<1)+(Q?1:0),3),function(Y,ce,he,ge){_e(Y),te(Y,he),te(Y,~he),i.arraySet(Y.pending_buf,Y.window,ce,he,Y.pending),Y.pending+=he}(H,se,z)}s._tr_init=function(H){ee||(function(){var se,z,Q,Y,ce,he=new Array(y+1);for(Y=Q=0;Y<d-1;Y++)for(U[Y]=Q,se=0;se<1<<C[Y];se++)N[Q++]=Y;for(N[Q-1]=Y,Y=ce=0;Y<16;Y++)for($[Y]=ce,se=0;se<1<<A[Y];se++)M[ce++]=Y;for(ce>>=7;Y<p;Y++)for($[Y]=ce<<7,se=0;se<1<<A[Y]-7;se++)M[256+ce++]=Y;for(z=0;z<=y;z++)he[z]=0;for(se=0;se<=143;)D[2*se+1]=8,se++,he[8]++;for(;se<=255;)D[2*se+1]=9,se++,he[9]++;for(;se<=279;)D[2*se+1]=7,se++,he[7]++;for(;se<=287;)D[2*se+1]=8,se++,he[8]++;for(le(D,f+1,he),se=0;se<p;se++)R[2*se+1]=5,R[2*se]=ue(se,5);q=new ie(D,C,h+1,f,y),I=new ie(R,A,0,p,y),B=new ie(new Array(0),T,0,m,x)}(),ee=!0),H.l_desc=new ne(H.dyn_ltree,q),H.d_desc=new ne(H.dyn_dtree,I),H.bl_desc=new ne(H.bl_tree,B),H.bi_buf=0,H.bi_valid=0,ve(H)},s._tr_stored_block=V,s._tr_flush_block=function(H,se,z,Q){var Y,ce,he=0;0<H.level?(H.strm.data_type===2&&(H.strm.data_type=function(ge){var Ee,Le=4093624447;for(Ee=0;Ee<=31;Ee++,Le>>>=1)if(1&Le&&ge.dyn_ltree[2*Ee]!==0)return a;if(ge.dyn_ltree[18]!==0||ge.dyn_ltree[20]!==0||ge.dyn_ltree[26]!==0)return o;for(Ee=32;Ee<h;Ee++)if(ge.dyn_ltree[2*Ee]!==0)return o;return a}(H)),Ce(H,H.l_desc),Ce(H,H.d_desc),he=function(ge){var Ee;for(O(ge,ge.dyn_ltree,ge.l_desc.max_code),O(ge,ge.dyn_dtree,ge.d_desc.max_code),Ce(ge,ge.bl_desc),Ee=m-1;3<=Ee&&ge.bl_tree[2*j[Ee]+1]===0;Ee--);return ge.opt_len+=3*(Ee+1)+5+5+4,Ee}(H),Y=H.opt_len+3+7>>>3,(ce=H.static_len+3+7>>>3)<=Y&&(Y=ce)):Y=ce=z+5,z+4<=Y&&se!==-1?V(H,se,z,Q):H.strategy===4||ce===Y?(ae(H,2+(Q?1:0),3),Se(H,D,R)):(ae(H,4+(Q?1:0),3),function(ge,Ee,Le,qe){var lt;for(ae(ge,Ee-257,5),ae(ge,Le-1,5),ae(ge,qe-4,4),lt=0;lt<qe;lt++)ae(ge,ge.bl_tree[2*j[lt]+1],3);X(ge,ge.dyn_ltree,Ee-1),X(ge,ge.dyn_dtree,Le-1)}(H,H.l_desc.max_code+1,H.d_desc.max_code+1,he+1),Se(H,H.dyn_ltree,H.dyn_dtree)),ve(H),Q&&_e(H)},s._tr_tally=function(H,se,z){return H.pending_buf[H.d_buf+2*H.last_lit]=se>>>8&255,H.pending_buf[H.d_buf+2*H.last_lit+1]=255&se,H.pending_buf[H.l_buf+H.last_lit]=255&z,H.last_lit++,se===0?H.dyn_ltree[2*z]++:(H.matches++,se--,H.dyn_ltree[2*(N[z]+h+1)]++,H.dyn_dtree[2*L(se)]++),H.last_lit===H.lit_bufsize-1},s._tr_align=function(H){ae(H,2,3),de(H,b,D),function(se){se.bi_valid===16?(te(se,se.bi_buf),se.bi_buf=0,se.bi_valid=0):8<=se.bi_valid&&(se.pending_buf[se.pending++]=255&se.bi_buf,se.bi_buf>>=8,se.bi_valid-=8)}(H)}},{"../utils/common":41}],53:[function(t,r,s){r.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(t,r,s){(function(i){(function(a,o){if(!a.setImmediate){var l,u,d,h,f=1,p={},m=!1,g=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,l={}.toString.call(a.process)==="[object process]"?function(E){process.nextTick(function(){x(E)})}:function(){if(a.postMessage&&!a.importScripts){var E=!0,S=a.onmessage;return a.onmessage=function(){E=!1},a.postMessage("","*"),a.onmessage=S,E}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",b,!1):a.attachEvent("onmessage",b),function(E){a.postMessage(h+E,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(E){x(E.data)},function(E){d.port2.postMessage(E)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(E){var S=g.createElement("script");S.onreadystatechange=function(){x(E),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(E){setTimeout(x,0,E)},y.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var S=new Array(arguments.length-1),k=0;k<S.length;k++)S[k]=arguments[k+1];var C={callback:E,args:S};return p[f]=C,l(f),f++},y.clearImmediate=v}function v(E){delete p[E]}function x(E){if(m)setTimeout(x,0,E);else{var S=p[E];if(S){m=!0;try{(function(k){var C=k.callback,A=k.args;switch(A.length){case 0:C();break;case 1:C(A[0]);break;case 2:C(A[0],A[1]);break;case 3:C(A[0],A[1],A[2]);break;default:C.apply(o,A)}})(S)}finally{v(E),m=!1}}}}
1029function b(E){E.source===a&&typeof E.data=="string"&&E.data.indexOf(h)===0&&x(+E.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof bi<"u"?bi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bce);var wqe=bce.exports;const wce=ro(wqe);async function _qe(n,e=8e3){const t=n.size;if(t<100)return{valid:!1,error:"File too small to be a valid EPUB",fileSize:t};const r=await n.slice(0,4).arrayBuffer(),s=new Uint8Array(r),i=Array.from(s).map(o=>o.toString(16).padStart(2,"0")).join(" ");if(!(s[0]===80&&s[1]===75&&(s[2]===3||s[2]===5||s[2]===7)))return{valid:!1,error:`Not a ZIP file (magic bytes: ${i})`,magicBytes:i,fileSize:t};try{const o=await n.arrayBuffer(),l=wce.loadAsync(o),u=new Promise((y,v)=>setTimeout(()=>v(new Error("ZIP parse timeout")),e)),d=await Promise.race([l,u]),h=d.file("META-INF/container.xml");if(!h)return{valid:!1,error:"Missing META-INF/container.xml - not a valid EPUB",magicBytes:i,hasContainer:!1,fileSize:t};const p=(await h.async("text")).match(/full-path="([^"]+)"/),m=p==null?void 0:p[1];return m?d.file(m)?{valid:!0,magicBytes:i,hasContainer:!0,opfPath:m,fileSize:t}:{valid:!1,error:`OPF file not found at path: ${m}`,magicBytes:i,hasContainer:!0,opfPath:m,fileSize:t}:{valid:!1,error:"container.xml does not specify an OPF path",magicBytes:i,hasContainer:!0,fileSize:t}}catch(o){return{valid:!1,error:`ZIP parse failed: ${o instanceof Error?o.message:"Unknown error"}`,magicBytes:i,fileSize:t}}}function Sqe(n){return new Promise(async e=>{if(n.size<8){e({valid:!1,error:"File too small to be a valid PDF"});return}const t=await n.slice(0,8).arrayBuffer(),r=new Uint8Array(t),s=String.fromCharCode(...r),i=Array.from(r.slice(0,4)).map(a=>a.toString(16).padStart(2,"0")).join(" ");s.startsWith("%PDF-")?e({valid:!0,magicBytes:i}):e({valid:!1,error:`Not a PDF file (starts with: ${i})`,magicBytes:i})})}const Eqe={fontSize:16,lineSpacing:"normal",theme:"light"},Sq=3e4,kqe=1e4;function Cqe(){const{bookId:n}=Xc(),e=vr(),{user:t}=Vt(),{isOnline:r}=xJ(),[s,i]=_.useState(!1),{data:a,isLoading:o,error:l}=o$e(n),{data:u}=l$e(n),{data:d=[]}=d$e(n),h=u$e(),f=h$e(),[p,m]=_.useState(!1),[g,y]=_.useState(!1),[v,x]=_.useState(!1),[b,E]=_.useState(!1),[S,k]=_.useState(""),[C,A]=_.useState([]),[T,j]=_.useState(Eqe),[D,R]=_.useState(""),[M,N]=_.useState(""),[U,q]=_.useState(null),[I,B]=_.useState(null),[$,ie]=_.useState("init"),[ne,L]=_.useState(null),[te,ae]=_.useState(0),[de,ue]=_.useState(null),le=_.useRef(null),ve=_.useRef(null),_e=_.useRef(0),Ne=(z,Q)=>{const Y=_e.current?Date.now()-_e.current:0;console.log(`[ReaderLoad] ${z}`,{bookId:n,elapsed:`${Y}ms`,...Q}),ie(z)};_.useEffect(()=>{let z=!1;return(async()=>{var Wt,wn;if(!a)return;_e.current=Date.now(),B(null),L(null),i(!1),Ne("init");const Y=a.format,ce=await Lie(a.id);if(ce){const J=await Bie(a.id);if(J){z||(B(J),i(!0),Ne("ready",{source:"offline_storage"}));return}}if(!r&&!ce){const J=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:null,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",error:{message:"You are offline. Download this book for offline reading."}});z||L({debugInfo:J,requiresAuth:!1});return}if(a.external_url){z||(B(a.external_url),Ne("ready",{source:"external_url"}));return}const he=J1(a.file_path);if(!he){const J=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",error:{message:"No file_path configured for this book"}});z||L({debugInfo:J,requiresAuth:!1});return}if(Ne("auth_check"),!t&&!a.is_public){const J=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:null,stage:"error",error:{message:"Sign in required: this book is private"}});z||L({debugInfo:J,requiresAuth:!0});return}Ne("download_start",{normalizedPath:he,isPublic:a.is_public,hasUser:!!t});const ge=Date.now();let Ee=null,Le=null;try{const J=pe.storage.from("books").download(he),Me=new Promise((Qe,ye)=>setTimeout(()=>ye(new Error(`Download timeout after ${Sq}ms`)),Sq)),Be=await Promise.race([J,Me]);Be.error?Le=Be.error:Ee=Be.data}catch(J){Le=J instanceof Error?J:new Error(String(J))}const qe=Date.now()-ge;if(Le||!Ee){console.error("[ReaderLoad] Download failed:",Le);const J=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",error:Le,downloadMs:qe,totalMs:Date.now()-_e.current}),Me=((Wt=Le==null?void 0:Le.message)==null?void 0:Wt.includes("not authorized"))||((wn=Le
1029==null?void 0:Le.message)==null?void 0:wn.includes("sign in"))||(Le==null?void 0:Le.statusCode)==="403";z||(L({debugInfo:J,requiresAuth:Me&&!t}),Ye.error("Could not download book file"));return}Ne("download_complete",{size:Ee.size,type:Ee.type,downloadMs:qe}),Ne("validate_start");let lt=null,rt=null;try{if(Y==="epub"){const J=await _qe(Ee,kqe);if(lt=J.magicBytes??null,!J.valid){rt=J.error??"Unknown validation error",console.error("[ReaderLoad] EPUB validation failed:",rt);const Me=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",blobSize:Ee.size,blobType:Ee.type,magicBytes:lt,validationError:rt,downloadMs:qe,totalMs:Date.now()-_e.current});z||(L({debugInfo:Me,requiresAuth:!1}),Ye.error("Invalid EPUB file"));return}}else if(Y==="pdf"){const J=await Sqe(Ee);if(lt=J.magicBytes??null,!J.valid){rt=J.error??"Unknown validation error",console.error("[ReaderLoad] PDF validation failed:",rt);const Me=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",blobSize:Ee.size,blobType:Ee.type,magicBytes:lt,validationError:rt,downloadMs:qe,totalMs:Date.now()-_e.current});z||(L({debugInfo:Me,requiresAuth:!1}),Ye.error("Invalid PDF file"));return}}}catch(J){rt=J instanceof Error?J.message:"Validation exception",console.error("[ReaderLoad] Validation exception:",J);const Me=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:he,format:Y,isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",blobSize:Ee.size,blobType:Ee.type,validationError:rt,downloadMs:qe,totalMs:Date.now()-_e.current});z||(L({debugInfo:Me,requiresAuth:!1}),Ye.error("File validation failed"));return}Ne("validate_complete",{magicBytes:lt});const Pt=Y==="epub"?"application/epub+zip":"application/pdf",en=new Blob([await Ee.arrayBuffer()],{type:Pt}),gt=URL.createObjectURL(en);ve.current&&URL.revokeObjectURL(ve.current),ve.current=gt,Ne("blob_url_created"),z||(B(gt),Ne("ready",{totalMs:Date.now()-_e.current}))})(),()=>{z=!0,ve.current&&(URL.revokeObjectURL(ve.current),ve.current=null)}},[a,t,te,r]),_.useEffect(()=>{if(u!=null&&u.location&&!de){const z=u.location;(a==null?void 0:a.format)==="epub"?z.startsWith("epubcfi(")?ue(z):console.warn("[Reader] Invalid EPUB location, ignoring:",z):ue(z)}},[u,de,a==null?void 0:a.format]),_.useEffect(()=>{const z=localStorage.getItem("reader-settings");if(z)try{j(JSON.parse(z))}catch{}},[]),_.useEffect(()=>{localStorage.setItem("reader-settings",JSON.stringify(T))},[T]);const Pe=_.useRef(),Se=_.useCallback((z,Q)=>{ue(z),Pe.current&&clearTimeout(Pe.current),t&&n&&(Pe.current=setTimeout(()=>{h.mutate({bookId:n,location:z,progressPct:Q})},2e3))},[t,n,h]),Ce=_.useCallback((z,Q)=>{R(z),N(Q);const Y=window.getSelection();if(Y&&Y.rangeCount>0){const ce=Y.getRangeAt(0).getBoundingClientRect();q({x:ce.left+ce.width/2,y:ce.top-10})}},[]),O=_.useCallback((z,Q)=>{!n||!D||!M||f.mutate({bookId:n,locationRange:M,selectedText:D,color:z,note:Q},{onSuccess:()=>{Ye.success("Highlight added"),q(null),R(""),N("")}})},[n,D,M,f]),X=_.useCallback(z=>{le.current&&le.current(z),m(!1)},[]),ee=_.useCallback(z=>{ue(z),x(!1)},[]),V=_.useCallback(()=>{q(null),R(""),N("")},[]),H=_.useCallback(()=>{ue(null),ae(z=>z+1)},[]),se=_.useCallback(z=>{if(!a)return;const Q=J1(a.file_path),Y=Od({bookId:a.id,rawFilePath:a.file_path,normalizedPath:Q,format:"epub",isPublic:a.is_public,userId:(t==null?void 0:t.id)??null,stage:"error",validationError:z,totalMs:_e.current?Date.now()-_e.current:null});L({debugInfo:Y,requiresAuth:!1})},[a,t]);return o?c.jsx("div",{className:"min-h-screen flex items-center justify-center",children:c.jsx(et,{className:"w-8 h-8 animate-spin text-primary"})}):l||!a?c.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4",children:[c.jsx("h1",{className:"text-xl font-semibold",children:"Book not found"}),c.jsx(xe,{onClick:()=>e("/library"),children:"Back to Library"})]}):ne?c.jsx(bqe,{debugInfo:ne.debugInfo,requiresAuth:ne.requiresAuth,onRetry:H}):I?c.jsxs("div",{className:"h-screen flex flex-col overflow-hidden",children:[c.jsx(m$e,{title:a.title,chapterTitle:S,onBack:()=>e("/library"),onToggleToc:()=>m(!0),onToggleSettings:()=>y(!0),onToggleHighlights:()=>x(!0)}),c.jsx("div",{className:"flex-1 relative",style:{height:"calc(100vh - 56px)",overflow:"hidden",marginTop:"56px"},children:a.format==="epub"?c.jsx(DUe,{url:I,location:de,settings:T,onLocationChange:Se,onTocLoad:A,onChapterChange:k,onTextSelect:Ce,onRenderError:se}):c.jsx(hqe,{url:I,location:de,settings:T,onLocationChange:Se,onTextSelect:Ce})}),a.persona&&c.jsx(xe,{onClick:()=>E(!0),className:ke("fixed bottom-6 right-6 z-[150] rounded-full shadow-lg","w-14 h-14 p-0"),size:"icon",children:a.persona.portrait_image_url?c.jsx("img",{src:a.persona.portrait_image_url,alt:a.persona.full_name,className:"w-10 h-10 rounded-full object-cover"}):c.jsx(l1,{className:"w-6 h-6"})}),c.jsx(pqe,{open:p,onOpenChange:m,items:C,onNavigate:X}),c.jsx(fqe,{open:g,onOpenChange:y,settings:T,onSettingsChange:j}),c.jsx(mqe,{open:v,onOpenChange:x,highlights:d,bookId:n||"",onNavigate:ee}),a.persona&&c.jsx(vqe,{open:b,onOpenChange:E,bookId:n||"",bookTitle:a.title,persona:a.persona,currentLocation:de}
1029),U&&D&&t&&c.jsx(xqe,{position:U,onHighlight:O,onDismiss:V})]}):c.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-2",children:[c.jsx(et,{className:"w-8 h-8 animate-spin text-primary"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[$==="download_start"&&"Downloading...",$==="validate_start"&&"Validating...",$==="init"&&"Preparing...",$==="auth_check"&&"Checking access..."]})]})}async function Aqe(n){var v,x,b,E,S;const t=await new wce().loadAsync(n),r=await((v=t.file("META-INF/container.xml"))==null?void 0:v.async("text"));if(!r)return{format:"epub"};const s=new DOMParser,a=s.parseFromString(r,"application/xml").querySelector("rootfile"),o=a==null?void 0:a.getAttribute("full-path");if(!o)return{format:"epub"};const l=await((x=t.file(o))==null?void 0:x.async("text"));if(!l)return{format:"epub"};const u=s.parseFromString(l,"application/xml"),d=k=>{var T;const C=u.querySelector(`metadata > *|${k}, metadata ${k}`);if(C!=null&&C.textContent)return C.textContent.trim();const A=u.querySelectorAll("metadata *");for(const j of A)if((j.localName===k||j.tagName.toLowerCase().includes(k.toLowerCase()))&&(T=j.textContent)!=null&&T.trim())return j.textContent.trim()},h=d("title"),f=d("creator"),p=d("description");let m;const g=u.querySelectorAll("manifest item");let y;for(const k of g){const C=((b=k.getAttribute("id"))==null?void 0:b.toLowerCase())||"",A=((E=k.getAttribute("properties"))==null?void 0:E.toLowerCase())||"",T=k.getAttribute("media-type")||"";if((C.includes("cover")||A.includes("cover-image"))&&T.startsWith("image/")){y=k.getAttribute("href")||void 0;break}}if(!y){const k=u.querySelector('meta[name="cover"]'),C=k==null?void 0:k.getAttribute("content");if(C){const A=u.querySelector(`manifest item[id="${C}"]`);y=(A==null?void 0:A.getAttribute("href"))||void 0}}if(y){const k=o.substring(0,o.lastIndexOf("/")+1),C=y.startsWith("/")?y.slice(1):k+y,A=await((S=t.file(C))==null?void 0:S.async("blob"));A&&(m=A)}return{title:h,author:f,description:p,coverBlob:m,format:"epub"}}async function Nqe(n){return{title:n.name.replace(/\.pdf$/i,"").replace(/[-_]/g," ").replace(/\s+/g," ").trim()||void 0,format:"pdf"}}async function ZC(n){var t;const e=(t=n.name.split(".").pop())==null?void 0:t.toLowerCase();if(e==="epub")try{return await Aqe(n)}catch(r){return console.error("Error parsing EPUB:",r),{format:"epub"}}else if(e==="pdf")try{return await Nqe(n)}catch(r){return console.error("Error parsing PDF:",r),{format:"pdf"}}return{format:"epub"}}async function m4(n,e,t,r){const s=r==null?void 0:r.onProgress;let i=r==null?void 0:r.accessToken;if(!i){const{data:{session:u}}=await pe.auth.getSession();i=u==null?void 0:u.access_token}if(!i)return{error:new Error("Not authenticated")};const a="https://delgyrqdrcihvvudekdx.supabase.co",o=e.split("/").map(encodeURIComponent).join("/"),l=`${a}/storage/v1/object/${n}/${o}`;return new Promise(u=>{const d=new XMLHttpRequest;d.upload.addEventListener("progress",f=>{f.lengthComputable&&s&&s({loaded:f.loaded,total:f.total,percent:Math.round(f.loaded/f.total*100)})}),d.addEventListener("load",()=>{if(d.status>=200&&d.status<300)try{const f=JSON.parse(d.responseText),p=typeof(f==null?void 0:f.Key)=="string"?f.Key:"",m=p.startsWith(`${n}/`)?p.slice(n.length+1):p||e,g=n==="books"?J1(m):m;u({path:g})}catch{const f=J1(e);u({path:f})}else{let f="Upload failed";try{const p=JSON.parse(d.responseText);f=p.message||p.error||f}catch{f=d.statusText||f}u({error:new Error(f)})}}),d.addEventListener("error",()=>{u({error:new Error("Network error during upload")})}),d.addEventListener("abort",()=>{u({error:new Error("Upload cancelled")})}),d.open("POST",l),d.setRequestHeader("Authorization",`Bearer ${i}`),d.setRequestHeader("apikey","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRlbGd5cnFkcmNpaHZ2dWRla2R4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjcyMDQ2OTUsImV4cCI6MjA4Mjc4MDY5NX0.hN9e_rgV5h7NwFjamAmR35Blfktg2MHpAlb0ibW3FNA"),d.setRequestHeader("x-upsert","false");const h=new FormData;h.append("cacheControl","3600"),h.append("",t),d.send(h)})}function Rk(n){if(n===0)return"0 B";const e=1024,t=["B","KB","MB","GB"],r=Math.floor(Math.log(n)/Math.log(e));return`${parseFloat((n/Math.pow(e,r)).toFixed(1))} ${t[r]}`}function Tqe({open:n,onOpenChange:e,accessToken:t,personas:r,onComplete:s}){const[i,a]=_.useState(""),[o,l]=_.useState(!1),[u,d]=_.useState([]),[h,f]=_.useState(0),p=b=>b.split(`
1030`).map(E=>E.trim()).filter(E=>{if(!E)return!1;try{const S=new URL(E),k=E.toLowerCase();return k.includes(".epub")||k.includes(".pdf")}catch{return!1}}),m=async b=>{var E,S;try{const k=b.toLowerCase(),C=k.includes(".epub"),A=k.includes(".pdf"),T=await fetch(b);
1030if(!T.ok)throw new Error(`Failed to fetch: ${T.statusText}`);const j=await T.blob(),D=b.split("/").pop()||`book.${C?"epub":"pdf"}`,R=new File([j],D,{type:C?"application/epub+zip":"application/pdf"}),M=50*1024*1024;if(R.size>M)throw new Error("File too large (max 50MB)");let N;try{N=await ZC(R)}catch{N={title:D.replace(/\.(epub|pdf)$/i,""),format:A?"pdf":"epub"}}if(!t)throw new Error("No access token");const U=`${Date.now()}-${D.replace(/[^a-zA-Z0-9.-]/g,"_")}`,q=await m4("books",U,R,{accessToken:t,onProgress:()=>{}});if("error"in q)throw new Error(q.error.message);const I=q.path;let B=null;if(N.coverBlob)try{const L=`covers/${Date.now()}-cover.jpg`,{data:te,error:ae}=await pe.storage.from("books").upload(L,N.coverBlob);if(!ae&&te){const{data:de}=pe.storage.from("books").getPublicUrl(te.path);B=de.publicUrl}}catch{}if(!B&&N.title)try{const L=["leather","cloth","vintage"],te=L[Math.floor(Math.random()*L.length)],ae=await pe.functions.invoke("generate-book-cover",{body:{title:N.title,author:N.author||void 0,style:te}});if(!ae.error&&((E=ae.data)!=null&&E.image)){const{image:de,mimeType:ue}=ae.data,le=ue!=null&&ue.includes("png")?"png":"jpg",ve=`covers/${Date.now()}-generated.${le}`,_e=atob(de),Ne=new Array(_e.length);for(let X=0;X<_e.length;X++)Ne[X]=_e.charCodeAt(X);const Pe=new Uint8Array(Ne),Se=new Blob([Pe],{type:ue||"image/jpeg"}),{data:Ce,error:O}=await pe.storage.from("books").upload(ve,Se);if(!O&&Ce){const{data:X}=pe.storage.from("books").getPublicUrl(Ce.path);B=X.publicUrl}}}catch{}let $=null;if(N.author&&r){const L=N.author.toLowerCase(),te=r.find(ae=>ae.full_name.toLowerCase().includes(L)||L.includes(ae.full_name.toLowerCase().split(" ").pop()||""));te&&($=te.id)}let ie=N.description||"";if(!ie&&N.title)try{const L=await pe.functions.invoke("generate-book-description",{body:{title:N.title,author:N.author||void 0}});!L.error&&((S=L.data)!=null&&S.description)&&(ie=L.data.description)}catch{}const{error:ne}=await pe.from("books").insert({title:N.title||D.replace(/\.(epub|pdf)$/i,""),author:N.author||null,description:ie||null,format:N.format,file_path:I,cover_url:B,persona_id:$,is_public:!0});if(ne)throw new Error(ne.message);return{success:!0,title:N.title||D}}catch(k){return{success:!1,error:k.message}}},g=async()=>{const b=p(i);if(b.length===0){Ye.error("No valid EPUB/PDF URLs found");return}l(!0),d(b.map(k=>({url:k,status:"pending"}))),f(0);let E=0,S=0;for(let k=0;k<b.length;k++){f(k),d(A=>A.map((T,j)=>j===k?{...T,status:"processing"}:T));const C=await m(b[k]);d(A=>A.map((T,j)=>j===k?{...T,status:C.success?"success":"error",title:C.title,error:C.error}:T)),C.success?E++:S++}l(!1),Ye.success(`Import complete: ${E} succeeded, ${S} failed`),s()},y=()=>{o||(a(""),d([]),f(0),e(!1))},v=p(i),x=u.length>0?(h+1)/u.length*100:0;return c.jsx(ai,{open:n,onOpenChange:y,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsxs(Fs,{children:[c.jsxs(Bs,{className:"flex items-center gap-2",children:[c.jsx(S2,{className:"h-5 w-5"}),"Bulk Import Books"]}),c.jsx(Df,{children:"Paste multiple EPUB/PDF URLs (one per line) to import them all at once."})]}),!o&&u.length===0&&c.jsxs("div",{className:"space-y-4",children:[c.jsx(Ca,{placeholder:`Paste EPUB/PDF URLs here, one per line:
1031https://example.com/book1.epub
1032https://example.com/book2.pdf`,value:i,onChange:b=>a(b.target.value),rows:8,className:"font-mono text-sm"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[c.jsx(MG,{className:"inline h-4 w-4 mr-1"}),v.length," valid URL",v.length!==1?"s":""," detected"]})]}),(o||u.length>0)&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("span",{children:["Processing ",h+1," of ",u.length]}),c.jsxs("span",{children:[Math.round(x),"%"]})]}),c.jsx(yf,{value:x})]}),c.jsx(Or,{className:"h-[300px] border rounded-md p-2",children:c.jsx("div",{className:"space-y-2",children:u.map((b,E)=>c.jsxs("div",{className:`flex items-start gap-2 p-2 rounded text-sm ${b.status==="processing"?"bg-primary/10":b.status==="success"?"bg-green-500/10":b.status==="error"?"bg-destructive/10":""}`,children:[b.status==="pending"&&c.jsx("div",{className:"h-4 w-4 roun
1032ded-full border-2 border-muted-foreground/30 mt-0.5"}),b.status==="processing"&&c.jsx(et,{className:"h-4 w-4 animate-spin text-primary mt-0.5"}),b.status==="success"&&c.jsx(gF,{className:"h-4 w-4 text-green-500 mt-0.5"}),b.status==="error"&&c.jsx(sT,{className:"h-4 w-4 text-destructive mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"truncate font-medium",children:b.title||b.url.split("/").pop()}),b.error&&c.jsx("p",{className:"text-xs text-destructive",children:b.error}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.url})]})]},E))})})]}),c.jsxs(Tg,{children:[!o&&u.length===0&&c.jsxs(c.Fragment,{children:[c.jsx(xe,{variant:"outline",onClick:y,children:"Cancel"}),c.jsxs(xe,{onClick:g,disabled:v.length===0,children:[c.jsx(S2,{className:"mr-2 h-4 w-4"}),"Import ",v.length," Book",v.length!==1?"s":""]})]}),!o&&u.length>0&&c.jsx(xe,{onClick:y,children:"Done"}),o&&c.jsxs(xe,{disabled:!0,children:[c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]})]})]})})}const xb={title:"",author:"",description:"",format:"epub",external_url:"",persona_id:"",tags:"",is_public:!0,cover_url:""};function jqe(){const n=$n(),e=vr(),{session:t}=Vt(),[r,s]=_.useState(!1),[i,a]=_.useState(null),[o,l]=_.useState(xb),[u,d]=_.useState(!1),[h,f]=_.useState(!1),[p,m]=_.useState(null),[g,y]=_.useState(null),[v,x]=_.useState(!1),b=_.useRef(null);_.useRef(null);const[E,S]=_.useState(!1),[k,C]=_.useState(null),[A,T]=_.useState("leather"),[j,D]=_.useState(!1),[R,M]=_.useState(!1),[N,U]=_.useState(!1),[q,I]=_.useState(!1),B=async X=>{var se,z;if(!X||N)return;try{new URL(X)}catch{return}const ee=X.toLowerCase(),V=ee.includes(".epub"),H=ee.includes(".pdf");if(!(!V&&!H)){U(!0);try{Ye.info("Downloading book from URL...");const Q=await fetch(X);if(!Q.ok)throw new Error(`Failed to fetch: ${Q.statusText}`);const Y=await Q.blob(),ce=X.split("/").pop()||`book.${V?"epub":"pdf"}`,he=new File([Y],ce,{type:V?"application/epub+zip":"application/pdf"}),ge=50*1024*1024;if(he.size>ge){Ye.error("File too large. Maximum size is 50MB.");return}Ye.info("Extracting book metadata...");let Ee;try{Ee=await ZC(he)}catch(rt){console.error("Metadata parsing failed:",rt),Ee={title:ce.replace(/\.(epub|pdf)$/i,""),format:H?"pdf":"epub"}}if(!(t!=null&&t.access_token)){Ye.error("Your session is not available. Please refresh and try again.");return}Ye.info("Uploading book..."),C({loaded:0,total:he.size,percent:0});const Le=`${Date.now()}-${ce.replace(/[^a-zA-Z0-9.-]/g,"_")}`,qe=await m4("books",Le,he,{accessToken:t.access_token,onProgress:rt=>C(rt)});if(C(null),"error"in qe)throw new Error(qe.error.message);m(qe.path);const lt={title:Ee.title||ce.replace(/\.(epub|pdf)$/i,""),author:Ee.author||"",description:Ee.description||"",format:Ee.format,external_url:""};if(Ee.author&&te){const rt=Ee.author.toLowerCase(),Pt=te.find(en=>en.full_name.toLowerCase().includes(rt)||rt.includes(en.full_name.toLowerCase().split(" ").pop()||""));Pt&&(lt.persona_id=Pt.id)}if(Ee.coverBlob)try{const rt=`covers/${Date.now()}-cover.jpg`,{data:Pt,error:en}=await pe.storage.from("books").upload(rt,Ee.coverBlob);if(!en&&Pt){const{data:gt}=pe.storage.from("books").getPublicUrl(Pt.path);lt.cover_url=gt.publicUrl}}catch(rt){console.error("Cover upload failed:",rt)}if(!lt.cover_url&&lt.title){Ye.info("Generating AI cover...");try{const rt=["leather","cloth","vintage"],Pt=rt[Math.floor(Math.random()*rt.length)],en=await pe.functions.invoke("generate-book-cover",{body:{title:lt.title,author:lt.author||void 0,style:Pt}});if(!en.error&&((se=en.data)!=null&&se.image)){const{image:gt,mimeType:Wt}=en.data,wn=Wt!=null&&Wt.includes("png")?"png":"jpg",J=`covers/${Date.now()}-generated.${wn}`,Me=atob(gt),Be=new Array(Me.length);for(let Ie=0;Ie<Me.length;Ie++)Be[Ie]=Me.charCodeAt(Ie);const Qe=new Uint8Array(Be),ye=new Blob([Qe],{type:Wt||"image/jpeg"}),{data:De,error:K}
1032=await pe.storage.from("books").upload(J,ye);if(!K&&De){const{data:Ie}=pe.storage.from("books").getPublicUrl(De.path);lt.cover_url=Ie.publicUrl,Ye.success(`AI cover generated (${Pt} style)!`)}}}catch(rt){console.error("AI cover generation failed:",rt)}}if(l(rt=>({...rt,...lt})),!lt.description&&lt.title){Ye.info("Generating AI description..."),M(!0);try{const rt=await pe.functions.invoke("generate-book-description",{body:{title:lt.title,author:lt.author||void 0}});!rt.error&&((z=rt.data)!=null&&z.description)&&(l(Pt=>({...Pt,description:rt.data.description})),Ye.success("Description generated!"))}catch(rt){console.error("Description generation failed:",rt)}finally{M(!1)}}Ye.success("Book downloaded and metadata extracted!")}catch(Q){console.error("Fetch from URL error:",Q),Ye.error(`Failed to fetch book: ${Q.message}`)}finally{U(!1)}}},$=async()=>{if(!o.title){Ye.error("Please enter a title first");return}M(!0);try{const X=await pe.functions.invoke("generate-book-description",{body:{title:o.title,author:o.author||void 0}});if(X.error)throw new Error(X.error.message);const{description:ee}=X.data;if(ee)l(V=>({...V,description:ee})),Ye.success("Description generated!");else throw new Error("No description generated")}catch(X){console.error("Description generation error:",X),Ye.error(`Failed to generate description: ${X.message}`)}finally{M(!1)}},ie=async X=>{var V;if(!X.name.endsWith(".epub")&&!X.name.endsWith(".pdf")){Ye.error("Please drop an EPUB or PDF file");return}const ee=50*1024*1024;if(X.size>ee){Ye.error("File too large. Maximum size is 50MB.");return}S(!0),a(null),l(xb),m(null);try{Ye.info("Extracting book metadata...");let H;try{H=await ZC(X)}catch(Y){console.error("Metadata parsing failed:",Y),H={title:X.name.replace(/\.(epub|pdf)$/i,""),format:X.name.endsWith(".pdf")?"pdf":"epub"}}const se={...xb,title:H.title||X.name.replace(/\.(epub|pdf)$/i,""),author:H.author||"",description:H.description||"",format:H.format};if(H.author&&te){const Y=H.author.toLowerCase(),ce=te.find(he=>he.full_name.toLowerCase().includes(Y)||Y.includes(he.full_name.toLowerCase().split(" ").pop()||""));ce&&(se.persona_id=ce.id)}if(!(t!=null&&t.access_token)){l(se),s(!0),Ye.error("Your session is not available yet. Please refresh and try again.");return}C({loaded:0,total:X.size,percent:0});const z=`${Date.now()}-${X.name.replace(/[^a-zA-Z0-9.-]/g,"_")}`,Q=await m4("books",z,X,{accessToken:t.access_token,onProgress:Y=>C(Y)});if(C(null),"error"in Q){console.error("Upload error:",Q.error),l(se),s(!0),Ye.error(`Upload failed: ${Q.error.message}. You can try uploading the file again in the form.`);return}if(m(Q.path),H.coverBlob)try{const Y=`covers/${Date.now()}-cover.jpg`,{data:ce,error:he}=await pe.storage.from("books").upload(Y,H.coverBlob);if(!he&&ce){const{data:ge}=pe.storage.from("books").getPublicUrl(ce.path);se.cover_url=ge.publicUrl}}catch(Y){console.error("Cover upload failed:",Y)}if(!se.cover_url&&se.title){Ye.info("Generating AI cover...");try{const Y=["leather","cloth","vintage"],ce=Y[Math.floor(Math.random()*Y.length)],he=await pe.functions.invoke("generate-book-cover",{body:{title:se.title,author:se.author||void 0,style:ce}});if(!he.error&&((V=he.data)!=null&&V.image)){const{image:ge,mimeType:Ee}=he.data,Le=Ee!=null&&Ee.includes("png")?"png":"jpg",qe=`covers/${Date.now()}-generated.${Le}`,lt=atob(ge),rt=new Array(lt.length);for(let wn=0;wn<lt.length;wn++)rt[wn]=lt.charCodeAt(wn);const Pt=new Uint8Array(rt),en=new Blob([Pt],{type:Ee||"image/jpeg"}),{data:gt,error:Wt}=await pe.storage.from("books").upload(qe,en);if(!Wt&&gt){const{data:wn}=pe.storage.from("books").getPublicUrl(gt.path);se.cover_url=wn.publicUrl,Ye.success(`AI cover generated (${ce} style)!`)}}}catch(Y){console.error("AI cover generation failed:",Y)}}l(se),s(!0),Ye.success("Book uploaded! Review details and save.")}catch(H){console.error("Drop handler error:",H),Ye.error(`Error: ${H.message||"Unknown error occurred"}`)}finally{S(!1)}},{data:ne,isLoading:L}=pt({queryKey:["admin-books"],queryFn:async()=>{const{data:X,error:ee}=await pe.from("books").select(`
1033          *,
1034          persona:personas(id, full_name)
1035        `).order("created_at",{ascending:!1});if(ee)throw ee;return X}}),{data:te}=pt({queryKey:["admin-personas"],queryFn:async()=>{const{data:X,error:ee}=await pe.from("personas").select("id, full_name").order("full_name");if(ee)throw ee;return X}}),{data:ae}=pt({queryKey:["admin-book-tags"],queryFn:async()=>{const{data:X,error:ee}=await pe.from("books").select("tags");if(ee)throw ee;const V=new Set;
1035return X==null||X.forEach(H=>{var se;(se=H.tags)==null||se.forEach(z=>{V.add(z.trim().toLowerCase())})}),Array.from(V).sort()}}),de=X=>{if(!o.tags.split(",").map(V=>V.trim().toLowerCase()).filter(V=>V).includes(X.toLowerCase())){const V=o.tags.trim()?`${o.tags}, ${X}`:X;l(H=>({...H,tags:V}))}},ue=X=>o.tags.split(",").map(V=>V.trim().toLowerCase()).filter(V=>V).includes(X.toLowerCase()),le=kn({mutationFn:async X=>{const ee={title:X.title,author:X.author||null,description:X.description||null,format:X.format,external_url:X.external_url||null,file_path:X.file_path||null,persona_id:X.persona_id||null,tags:X.tags?X.tags.split(",").map(H=>H.trim()).filter(Boolean):[],is_public:X.is_public,cover_url:X.cover_url||null,...X.persona_id&&X.file_path?{extraction_status:"pending",extracted_text:null,extraction_error:null}:{}};let V=null;if(i){const{error:H}=await pe.from("books").update(ee).eq("id",i);if(H)throw H;V=i}else{const{data:H,error:se}=await pe.from("books").insert(ee).select("id").single();if(se)throw se;V=H.id}X.persona_id&&X.file_path&&V&&pe.functions.invoke("extract-book-text",{body:{bookId:V}}).then(H=>{H.error?(console.error("Text extraction failed:",H.error),Ye.error("Book saved, but text extraction failed")):(Ye.success("Text extraction started for AI knowledge base"),n.invalidateQueries({queryKey:["admin-books"]}))}).catch(H=>{console.error("Text extraction error:",H)})},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-books"]}),s(!1),a(null),l(xb),m(null),Ye.success(i?"Book updated":"Book created")},onError:X=>{Ye.error(`Error: ${X.message}`)}}),ve=kn({mutationFn:async X=>{const{error:ee}=await pe.from("books").delete().eq("id",X);if(ee)throw ee},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-books"]}),y(null),Ye.success("Book deleted")},onError:X=>{Ye.error(`Error: ${X.message}`)}}),_e=async X=>{var V;const ee=(V=X.target.files)==null?void 0:V[0];if(ee){d(!0);try{Ye.info("Extracting book metadata...");const H=await ZC(ee),se=`${Date.now()}-${ee.name}`,{data:z,error:Q}=await pe.storage.from("books").upload(se,ee);if(Q)throw Q;if(m(J1(z.path)),l(Y=>({...Y,title:H.title||Y.title||"",author:H.author||Y.author||"",description:H.description||Y.description||"",format:H.format})),H.coverBlob){Ye.info("Uploading cover image...");const Y=`covers/${Date.now()}-cover.jpg`,{data:ce,error:he}=await pe.storage.from("books").upload(Y,H.coverBlob);if(!he&&ce){const{data:ge}=pe.storage.from("books").getPublicUrl(ce.path);l(Ee=>({...Ee,cover_url:ge.publicUrl}))}}if(H.author&&te){const Y=H.author.toLowerCase(),ce=te.find(he=>he.full_name.toLowerCase().includes(Y)||Y.includes(he.full_name.toLowerCase().split(" ").pop()||""));ce&&l(he=>({...he,persona_id:ce.id}))}Ye.success("Book uploaded and metadata extracted!")}catch(H){Ye.error(`Upload failed: ${H.message}`)}finally{d(!1)}}},Ne=async X=>{var V;const ee=(V=X.target.files)==null?void 0:V[0];if(ee){f(!0);try{const H=`covers/${Date.now()}-${ee.name}`,{data:se,error:z}=await pe.storage.from("books").upload(H,ee);if(z)throw z;const{data:Q}=pe.storage.from("books").getPublicUrl(se.path);l(Y=>({...Y,cover_url:Q.publicUrl})),Ye.success("Cover uploaded")}catch(H){Ye.error(`Upload failed: ${H.message}`)}finally{f(!1)}}},Pe=async()=>{if(!o.title){Ye.error("Please enter a title first");return}D(!0);try{const X=await pe.functions.invoke("generate-book-cover",{body:{title:o.title,author:o.author||void 0,style:A}});if(X.error)throw new Error(X.error.message);const{image:ee,mimeType:V}=X.data;if(!ee)throw new Error("No image generated");const H=V!=null&&V.includes("png")?"png":"jpg",se=`covers/${Date.now()}-generated.${H}`,z=atob(ee),Q=new Array(z.length);for(let Le=0;Le<z.length;Le++)Q[Le]=z.charCodeAt(Le);const Y=new Uint8Array(Q),ce=new Blob([Y],{type:V||"image/jpeg"}),{data:he,error:ge}=await pe.storage.from("books").upload(se,ce);if(ge)throw ge;const{data:Ee}=pe.storage.from("books").getPublicUrl(he.path);l(Le=>({...Le,cover_url:Ee.publicUrl})),Ye.success("Cover generated!")}catch(X){console.error("Cover generation error:",X),Ye.error(`Failed to generate cover: ${X.message}`)}finally{D(!1)}},Se=async X=>{var ee;Ye.info("Starting text extraction for AI knowledge base...");try{await pe.from("books").update({extraction_status:"processing",extraction_error:null}).eq("id",X),n.invalidateQueries({queryKey:["admin-books"]});const V=await pe.functions.invoke("extract-book-text",{body:{bookId:X}});if(V.error)throw new Error(V.error.message);Ye.success(`Text extracted! ${((ee=V.data.characterCount)==null?void 0:ee.toLocaleStr
1035ing())||0} characters indexed.`),n.invalidateQueries({queryKey:["admin-books"]})}catch(V){console.error("Text extraction error:",V),Ye.error(`Extraction failed: ${V.message}`),n.invalidateQueries({queryKey:["admin-books"]})}},Ce=X=>{var ee;a(X.id),l({title:X.title,author:X.author||"",description:X.description||"",format:X.format,external_url:X.external_url||"",persona_id:X.persona_id||"",tags:((ee=X.tags)==null?void 0:ee.join(", "))||"",is_public:X.is_public,cover_url:X.cover_url||""}),m(X.file_path),s(!0)},O=X=>{if(X.preventDefault(),!o.title){Ye.error("Title is required");return}if(!p&&!o.external_url){Ye.error("Either upload a file or provide an external URL");return}le.mutate({...o,file_path:p})};return c.jsxs(rg,{children:[c.jsxs("div",{className:"space-y-6",onDragOver:X=>{X.preventDefault(),x(!0)},onDragLeave:X=>{X.currentTarget===X.target&&x(!1)},onDrop:X=>{X.preventDefault(),x(!1);const ee=X.dataTransfer.files[0];ee&&ie(ee)},children:[v&&c.jsx("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center pointer-events-none",children:c.jsx("div",{className:"border-4 border-dashed border-primary rounded-2xl p-16 bg-card",children:c.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[c.jsx(I$,{className:"w-16 h-16 text-primary animate-bounce"}),c.jsx("p",{className:"text-2xl font-bold",children:"Drop your EPUB or PDF"}),c.jsx("p",{className:"text-muted-foreground",children:"Metadata will be auto-extracted"})]})})}),E&&c.jsx("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:c.jsxs("div",{className:"bg-card p-8 rounded-xl shadow-lg flex flex-col items-center gap-4 min-w-[300px]",children:[c.jsx(et,{className:"w-12 h-12 animate-spin text-primary"}),k?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-lg font-medium",children:"Uploading book..."}),c.jsxs("div",{className:"w-full space-y-2",children:[c.jsx(yf,{value:k.percent,className:"h-2"}),c.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[c.jsxs("span",{children:[k.percent,"%"]}),c.jsxs("span",{children:[Rk(k.loaded)," / ",Rk(k.total)]})]})]})]}):c.jsx("p",{className:"text-lg font-medium",children:"Extracting metadata..."})]})}),N&&c.jsx("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:c.jsxs("div",{className:"bg-card p-8 rounded-xl shadow-lg flex flex-col items-center gap-4 min-w-[300px]",children:[c.jsx(et,{className:"w-12 h-12 animate-spin text-primary"}),k?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-lg font-medium",children:"Uploading book..."}),c.jsxs("div",{className:"w-full space-y-2",children:[c.jsx(yf,{value:k.percent,className:"h-2"}),c.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[c.jsxs("span",{children:[k.percent,"%"]}),c.jsxs("span",{children:[Rk(k.loaded)," / ",Rk(k.total)]})]})]})]}):c.jsx("p",{className:"text-lg font-medium",children:"Downloading and processing..."})]})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-bold",children:"Books"}),c.jsx("p",{className:"text-muted-foreground",children:"Manage the book library"})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(xe,{variant:"outline",onClick:()=>I(!0),children:[c.jsx(S2,{className:"w-4 h-4 mr-2"}),"Bulk Import"]}),c.jsxs(xe,{onClick:()=>{a(null),l(xb),m(null),s(!0)},children:[c.jsx(ka,{className:"w-4 h-4 mr-2"}),"Add Book"]})]})]}),c.jsx(Tqe,{open:q,onOpenChange:I,accessToken:t==null?void 0:t.access_token,personas:te,onComplete:()=>n.invalidateQueries({queryKey:["admin-books"]})}),L?c.jsx("div",{className:"flex justify-center py-8",children:c.jsx(et,{className:"w-6 h-6 animate-spin"})}):ne&&ne.length>0?c.jsx("div",{className:"border rounded-lg",children:c.jsxs(Of,{children:[c.jsx(Mf,{children:c.jsxs(Qs,{children:[c.jsx(gn,{children:"Title"}),c.jsx(gn,{children:"Author"}),c.jsx(gn,{children:"Persona"}),c.jsx(gn,{children:"Format"}),c.jsx(gn,{children:"Status"}),c.jsx(gn,{children:"AI"}),c.jsx(gn,{className:"w-[100px]",children:"Actions"})]})}),c.jsx(If,{children:ne.map(X=>{var ee;return c.jsxs(Qs,{children:[c.jsx(ln,{children:c.jsxs("div",{className:"flex items-center gap-2",children:[X.cover_url?c.jsx("img",{src:X.cover_url,alt:X.title,className:"w-8 h-12 object-cover rounded"}):c.jsx("div",{className:"w-8 h-12 bg-muted rounded flex items-center justify-center",children:c.jsx(Kk,{className:"w-4 h-4 text-muted-foreground"})}),c.jsx("span",{className:"font-medium",children:X.title})]})}),c.jsx(ln,{children:X.author||"-"}),c.jsx(ln,{children:((ee=X.persona)==null?void 0:ee.full_name)||"-"}),c.jsx(ln,{children:c.jsx(jt,{variant:"outline",className:"uppercase",children:X.format})}),c.jsx(ln,{children:c.jsx(jt,{variant:X.is_public?"default":"secondary",children:X.is_public?"Public":"Private"})}),c.jsx(ln,{children:X.persona_id?c.jsxs("div",{className:"flex items-center gap-1",children:[X.extraction_status==="completed"?c.jsxs(jt,{variant:"outline",className:"gap-1 text-green-600 border-green-600/30 bg-green-50",children:[c.jsx(gF,{className:"w-3 h-3"}),"Indexed"]}):X.extraction_status==="processing"?c.jsxs(jt,{variant:"outline",className:"gap-1",children:[c.jsx(et,{className:"w-3 h-3 animate-spin"}),"Processing"]}):X.extraction_status==="failed"?c.jsxs(jt,{variant:"outline",className:"gap-1 text-destructive border-destructive/30 bg-destructive/10",children:[c.jsx(o1,{className:"w-3 h-3"}),"Failed"]}):X.file_path?c.jsxs(xe,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>Se(X.id),children:[c.jsx(pw,{className:"w-3 h-3"}),"Extract"]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"No file"}),(X.extraction_status==="failed"||X.extraction_status==="completed")&&X.file_path&&c.jsx(xe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Se(X.id),title:"Re-extract text",children:c.jsx(AS,{className:"w-3 h-3"})})]}):c.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),c.jsx(ln,{children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>e(`/reader/${X.id}`),children:c.jsx(aT,{className:"w-4 h-4"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>Ce(X),children:c.jsx(rpe,{className:"w-4 h-4"})}),c.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>y(X.id),className:"text-destructive hover:text-destructive",children:c.jsx(ao,{className:"w-4 h-4"})})]})})]},X.id)})})]})}):c.jsxs("div",{className:"text-center py-12 border rounded-lg",children:[c.jsx(Kk,{className:"w-12 h-12 mx-auto text-muted-foreground
1035/30 mb-4"}),c.jsx("h3",{className:"text-lg font-medium mb-2",children:"No books yet"}),c.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload your first book to get started"}),c.jsxs(xe,{onClick:()=>s(!0),children:[c.jsx(ka,{className:"w-4 h-4 mr-2"}),"Add Book"]})]})]}),c.jsx(ai,{open:r,onOpenChange:s,children:c.jsxs(Ls,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[c.jsx(Fs,{children:c.jsx(Bs,{children:i?"Edit Book":"Add Book"})}),c.jsxs("form",{onSubmit:O,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2 p-4 bg-primary/5 border border-primary/20 rounded-lg",children:[c.jsxs(yt,{htmlFor:"external_url",className:"flex items-center gap-2 text-primary font-medium",children:[c.jsx(Wfe,{className:"w-4 h-4"}),"Paste EPUB/PDF URL"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Lt,{id:"external_url",value:o.external_url,onChange:X=>l(ee=>({...ee,external_url:X.target.value})),onPaste:X=>{const ee=X.clipboardData.getData("text");setTimeout(()=>B(ee),100)},placeholder:"https://example.com/book.epub",disabled:N,className:"bg-background"}),N&&c.jsx(et,{className:"w-5 h-5 animate-spin text-primary self-center"})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste a URL to auto-download, extract metadata, generate cover & description"})]}),c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute inset-0 flex items-center",children:c.jsx("span",{className:"w-full border-t"})}),c.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:c.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or upload a file"})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Book File (drag & drop or click)"}),c.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-4 transition-colors cursor-pointer ${v?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-primary/50"} ${u?"opacity-50 pointer-events-none":""}`,onDragOver:X=>{X.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:X=>{X.preventDefault(),x(!1);const ee=X.dataTransfer.files[0];if(ee&&(ee.name.endsWith(".epub")||ee.name.endsWith(".pdf"))){const V=b.current;if(V){const H=new DataTransfer;H.items.add(ee),V.files=H.files,V.dispatchEvent(new Event("change",{bubbles:!0}))}}else Ye.error("Please drop an EPUB or PDF file")},onClick:()=>{var X;return(X=b.current)==null?void 0:X.click()},children:[c.jsx("input",{ref:b,type:"file",accept:".epub,.pdf",onChange:_e,className:"hidden",disabled:u}),c.jsx("div",{className:"flex flex-col items-center gap-1 text-center",children:u?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"w-6 h-6 animate-spin text-primary"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Extracting metadata..."})]}):p?c.jsxs(c.Fragment,{children:[c.jsx(Kk,{className:"w-6 h-6 text-primary"}),c.jsx("p",{className:"text-sm font-medium",children:"File uploaded!"}),c.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-full",children:p})]}):c.jsxs(c.Fragment,{children:[c.jsx(I$,{className:"w-6 h-6 text-muted-foreground"}),c.jsx("p",{className:"text-sm font-medium",children:"Drop EPUB or PDF here"})]})})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"title",children:"Title *"}),c.jsx(Lt,{id:"title",value:o.title,onChange:X=>l(ee=>({...ee,title:X.target.value})),placeholder:"Book title",required:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"author",children:"Author"}),c.jsx(Lt,{id:"author",value:o.author,onChange:X=>l(ee=>({...ee,author:X.target.value})),placeholder:"Book author"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"persona",children:"Link to Persona (for AI companion)"}),c.jsxs(ki,{value:o.persona_id||"none",onValueChange:X=>l(ee=>({...ee,persona_id:X==="none"?"":X})),children:[c.jsx(ti,{children:c.jsx(Ci,{placeholder:"Select a persona"})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"none",children:"None"}),te==null?void 0:te.map(X=>c.jsx(xn,{value:X.id,children:X.full_name},X.id))]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(yt,{htmlFor:"description",children:"Description"}),c.jsxs(xe,{type:"button",variant:"ghost",size:"sm",onClick:$,disabled:R||!o.title,className:"h-7 px-2 text-xs gap-1",children:[R?c.jsx(et,{className:"w-3 h-3 animate-spin"}):c.jsx(jS,{className:"w-3 h-3"}),"Generate"]})]}),c.jsx(Ca,{id:"description",value:o.description,onChange:X=>l(ee=>({...ee,description:X.target.value})),placeholder:"Brief description of the book",rows:3})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Format"}),c.jsxs(ki,{value:o.format,onValueChange:X=>l(ee=>({...ee,format:X})),children:[c.jsx(ti,{children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"epub",children:"EPUB"}),c.jsx(xn,{value:"pdf",children:"PDF"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{children:"Cover Image"}),c.jsxs("div",{className:"flex gap-3 items-start",children:[o.cover_url?c.jsx("img",{src:o.cover_url,alt:"Cover",className:"w-20 h-28 object-cover rounded border"}):c.jsx("div",{className:"w-20 h-28 bg-muted rounded border flex items-center justify-center",children:c.jsx(OG,{className:"w-8 h-8 text-muted-foreground
1035/50"})}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Lt,{type:"file",accept:"image/*",onChange:Ne,disabled:h||j,className:"flex-1"}),h&&c.jsx(et,{className:"w-5 h-5 animate-spin"})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsxs(ki,{value:A,onValueChange:X=>T(X),disabled:j,children:[c.jsx(ti,{className:"w-28",children:c.jsx(Ci,{})}),c.jsxs(ni,{children:[c.jsx(xn,{value:"leather",children:"Leather"}),c.jsx(xn,{value:"cloth",children:"Cloth"}),c.jsx(xn,{value:"vintage",children:"Vintage"})]})]}),c.jsx(xe,{type:"button",variant:"outline",size:"sm",onClick:Pe,disabled:j||!o.title,className:"flex-1",children:j?c.jsxs(c.Fragment,{children:[c.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}),"Generating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(lpe,{className:"w-4 h-4 mr-2"}),"Generate Cover"]})})]}),c.jsx(Lt,{value:o.cover_url,onChange:X=>l(ee=>({...ee,cover_url:X.target.value})),placeholder:"Or paste image URL"})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"tags",children:"Tags (comma separated)"}),c.jsx(Lt,{id:"tags",value:o.tags,onChange:X=>l(ee=>({...ee,tags:X.target.value})),placeholder:"theology, missions, biography"}),ae&&ae.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ae.map(X=>c.jsx(jt,{variant:ue(X)?"default":"outline",className:`cursor-pointer text-xs capitalize ${ue(X)?"opacity-50":"hover:bg-primary hover:text-primary-foreground"}`,onClick:()=>!ue(X)&&de(X),children:X},X))})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(yt,{htmlFor:"is_public",children:"Make Public"}),c.jsx(w5,{id:"is_public",checked:o.is_public,onCheckedChange:X=>l(ee=>({...ee,is_public:X}))})]}),c.jsxs(Tg,{children:[c.jsx(xe,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),c.jsxs(xe,{type:"submit",disabled:le.isPending,children:[le.isPending?c.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):null,i?"Update":"Create"]})]})]})]})}),c.jsx(tE,{open:!!g,onOpenChange:()=>y(null),children:c.jsxs(j0,{children:[c.jsxs(R0,{children:[c.jsx(D0,{children:"Delete Book?"}),c.jsx(O0,{children:"This action cannot be undone. The book will be permanently deleted."})]}),c.jsxs(P0,{children:[c.jsx(I0,{children:"Cancel"}),c.jsx(M0,{onClick:()=>g&&ve.mutate(g),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Rqe(){const{pathname:n}=Ql();return _.useEffect(()=>{window.scrollTo(0,0)},[n]),null}const Pqe=bp().min(6,"Password must be at least 6 characters");function Dqe(){const{user:n,isLoading:e,session:t}=Vt(),{isPro:r,subscriptionType:s,isLoading:i}=wT(),a=vr(),{toast:o}=Jl(),[l,u]=_.useState(""),[d,h]=_.useState(""),[f,p]=_.useState(""),[m,g]=_.useState(!1),[y,v]=_.useState(!1),[x,b]=_.useState(!1),[E,S]=_.useState({});if(!e&&!n)return a("/auth"),null;const k=()=>{const j={},D=Pqe.safeParse(d);return D.success||(j.newPassword=D.error.errors[0].message),d!==f&&(j.confirmPassword="Passwords do not match"),S(j),Object.keys(j).length===0},C=async j=>{if(j.preventDefault(),!k())return;g(!0);const{error:D}=await pe.auth.updateUser({password:d});g(!1),D?o({variant:"destructive",title:"Password update failed",description:D.message}):(o({title:"Password updated",description:"Your password has been changed successfully."}),u(""),h(""),p(""))},A=async()=>{if(t!=null&&t.access_token){v(!0);try{const{data:j,error:D}=await pe.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${t.access_token}`}});if(D)throw D;j!=null&&j.url&&window.open(j.url,"_blank")}catch(j){console.error("Portal error:",j),o({title:"Error",description:"Failed to open subscription management. Please try again.",variant:"destructive"})}finally{v(!1)}}},T=()=>{if(!r)return"Free";switch(s){case"monthly":return"Pro Monthly";case"lifetime":return"Pro Lifetime";case"promo":return"Pro (Special Access)";default:return"Pro"}};return e?c.jsx(cn,{children:c.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:c.jsx(et,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):c.jsx(cn,{children:c.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-2xl",children:[c.jsxs(xe,{variant:"ghost",size:"sm",className:"mb-6",onClick:()=>a(-1),children:[c.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Back"]}),c.jsx("h1",{className:"font-serif text-3xl font-bold mb-8",children:"Account Settings"}),c.jsxs(mt,{className:"mb-6",children:[c.jsxs(Ln,{children:[c.jsxs(Wn,{className:"flex items-center gap-2",children:[c.jsx(Js,{className:"h-5 w-5"}),"Profile"]}),c.jsx(Os,{children:"Your account information"})]}),c.jsx(kt,{children:c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{className:"text-muted-foreground",children:"Email"}),c.jsx("p",{className:"font-medium",children:n==null?void 0:n.email})]})})]}),c.jsxs(mt,{className:"mb-6",children:[c.jsxs(Ln,{children:[c.jsxs(Wn,{className:"flex items-center gap-2",children:[c.jsx(TO,{className:"h-5 w-5"}),"Subscription"]}),c.jsx(Os,{children:"Manage your Pro subscription"})]}),c.jsx(kt,{children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:"Current Plan:"}),c.jsx(jt,{variant:r?"default":"secondary",children:i?"Loading...":T()})]}),r&&s==="monthly"&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage billing, cancel, or update payment method."})]}),c.jsx("div",{children:r&&s==="monthly"?c.jsxs(xe,{variant:"outline",onClick:A,disabled:y,children:[y?c.jsx(et,{className:"h-4 w-4 animate-spin mr-2"}):c.jsx(iT,{className:"h-4 w-4 mr-2"}),"Manage"]}):r?null:c.jsx(xe,{onClick:()=>b(!0),children:"Upgrade to Pro"})})]})})]}),c.jsxs(mt,{children:[c.jsxs(Ln,{children:[c.jsxs(Wn,{className:"flex items-center gap-2",children:[c.jsx(wF,{className:"h-5 w-5"}),"Change Password"]}),c.jsx(Os,{children:"Update your account password"})]}),c.jsx(kt,{children:c.jsxs("form",{onSubmit:C,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"new-password",children:"New Password"}),c.jsx(Lt,{id:"new-password",type:"password",placeholder:"••••••••",value:d,onChange:j=>h(j.target.value),required:!0}),E.newPassword&&c.jsx("p",{className:"text-sm text-destructive",children:E.newPassword})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(yt,{htmlFor:"confirm-password",children:"Confirm New Password"}),c.jsx(Lt,{id:"confirm-password",type:"password",placeholder:"••••••••",value:f,onChange:j=>p(j.target.value),required:!0}),E.confirmPassword&&c.jsx("p",{className:"text-sm text-destructive",children:E.confirmPassword})]}),c.jsxs(xe,{type:"submit",disabled:m,children:[m&&c.jsx(et,{className:"mr-2 h-4 w-4 animate-spin"}),"Update Password"]})]})})]}),c.jsx(ZQ,{open:x,onOpenChange:b})]})})}function Oqe(){const n=vr(),[e]=OS(),{checkSubscription:t}=wT(),r=e.get("session_id");return _.useEffect(()=>{r&&t()},[r,t]),c.jsx(cn,{children:c.jsx("div",{className:"container max-w-2xl py-16",children:c.jsxs(mt,{className:"text-center",children:[c.jsxs(Ln,{className:"pb-4",children:[c.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:c.jsx(gF,{className:"h-10 w-10 text-primary"})}),c.jsx(Wn,{className:"text-3xl font-serif",children:"Welcome to Pro!"}),c.jsx(Os,{className:"text-lg",children:"Your payment was successful. You now have full access to all Pro features."})]}),c.jsxs(kt,{className:"space-y-6",children:[c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs(xe,{variant:"outline",className:"h-auto flex-col gap-2 p-4",onClick:()=>n("/debate"),children:[c.jsx(Tf,{className:"h-6 w-6"}),c.jsx("span",{className:"font-medium",children:"Start a Debate"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Watch theologians discu
1035ss"})]}),c.jsxs(xe,{variant:"outline",className:"h-auto flex-col gap-2 p-4",onClick:()=>n("/study"),children:[c.jsx(En,{className:"h-6 w-6"}),c.jsx("span",{className:"font-medium",children:"Scripture Study"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"AI-powered commentary"})]})]}),c.jsxs(xe,{onClick:()=>n("/personas"),className:"gap-2",children:["Explore All Personas",c.jsx(a1,{className:"h-4 w-4"})]})]})]})})})}const Mqe=new Pve,Iqe=()=>c.jsx(Lve,{client:Mqe,children:c.jsx(Zpe,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:c.jsx(jbe,{children:c.jsx(Rbe,{children:c.jsxs(RK,{children:[c.jsx(Kpe,{}),c.jsx(Tme,{}),c.jsxs(Wye,{children:[c.jsx(Rqe,{}),c.jsxs(Lye,{children:[c.jsx(_n,{path:"/",element:c.jsx(V2e,{})}),c.jsx(_n,{path:"/auth",element:c.jsx(kAe,{})}),c.jsx(_n,{path:"/account",element:c.jsx(Dqe,{})}),c.jsx(_n,{path:"/personas",element:c.jsx(NAe,{})}),c.jsx(_n,{path:"/persona/:slug",element:c.jsx(eNe,{})}),c.jsx(_n,{path:"/explore",element:c.jsx(tNe,{})}),c.jsx(_n,{path:"/chat/:personaSlug",element:c.jsx(ETe,{})}),c.jsx(_n,{path:"/debate",element:c.jsx(YTe,{})}),c.jsx(_n,{path:"/debate/:personaAId/:personaBId",element:c.jsx(ZTe,{})}),c.jsx(_n,{path:"/debate/history/:conversationId",element:c.jsx(JTe,{})}),c.jsx(_n,{path:"/debate/share/:shareSlug",element:c.jsx(QTe,{})}),c.jsx(_n,{path:"/about",element:c.jsx(tje,{})}),c.jsx(_n,{path:"/privacy",element:c.jsx(nje,{})}),c.jsx(_n,{path:"/terms",element:c.jsx(rje,{})}),c.jsx(_n,{path:"/support",element:c.jsx(sje,{})}),c.jsx(_n,{path:"/quiz",element:c.jsx(hje,{})}),c.jsx(_n,{path:"/pro/success",element:c.jsx(Oqe,{})}),c.jsx(_n,{path:"/study",element:c.jsx(rW,{})}),c.jsx(_n,{path:"/study/notes",element:c.jsx(yT,{to:"/study?tab=notes",replace:!0})}),c.jsx(_n,{path:"/study/notes/:noteId",element:c.jsx(rW,{})}),c.jsx(_n,{path:"/study/journal",element:c.jsx(Kze,{})}),c.jsx(_n,{path:"/library",element:c.jsx(p$e,{})}),c.jsx(_n,{path:"/reader/:bookId",element:c.jsx(Cqe,{})}),c.jsx(_n,{path:"/admin",element:c.jsx(mje,{})}),c.jsx(_n,{path:"/admin/personas",element:c.jsx(Lje,{})}),c.jsx(_n,{path:"/admin/personas/:id",element:c.jsx(mPe,{})}),c.jsx(_n,{path:"/admin/labels",element:c.jsx(vPe,{})}),c.jsx(_n,{path:"/admin/library",element:c.jsx(bPe,{})}),c.jsx(_n,{path:"/admin/books",element:c.jsx(jqe,{})}),c.jsx(_n,{path:"*",element:c.jsx(fje,{})})]})]})]})})})})});K7(document.getElementById("root")).render(c.jsx(tG,{children:c.jsx(Iqe,{})}));export{Lw as I,Fw as N,T3 as W};

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